package es.icane.metadatos.model;

import es.icane.metadatos.adapters.DateAdapter;
import java.io.Serializable;
import java.util.Date;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

@XmlType
public class Measure implements Serializable {

    private Integer id;
    private String code;
    private String title;
    private String unit;
    private boolean defaultMeasure = false;
    private Date created;
    private Date lastUpdated;

    @XmlAttribute(required = true)
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @XmlElement(name = "dateCreated")
    @XmlJavaTypeAdapter(value = DateAdapter.class)
    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    @XmlJavaTypeAdapter(value = DateAdapter.class)
    public Date getLastUpdated() {
        return lastUpdated;
    }

    public void setLastUpdated(Date lastUpdated) {
        this.lastUpdated = lastUpdated;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public boolean isDefaultMeasure() {
        return defaultMeasure;
    }

    public void setDefaultMeasure(boolean defaultMeasure) {
        this.defaultMeasure = defaultMeasure;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 37 * hash + (this.id != null ? this.id.hashCode() : 0);
        hash = 37 * hash + (this.code != null ? this.code.hashCode() : 0);
        hash = 37 * hash + (this.title != null ? this.title.hashCode() : 0);
        hash = 37 * hash + (this.unit != null ? this.unit.hashCode() : 0);
        hash = 37 * hash + (this.defaultMeasure ? 1 : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Measure other = (Measure) obj;
        if (this.id != other.id &&
                (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        if ((this.code == null) ? (other.code != null)
                : !this.code.equals(other.code)) {
            return false;
        }
        if ((this.title == null) ? (other.title != null)
                : !this.title.equals(other.title)) {
            return false;
        }
        if ((this.unit == null) ? (other.unit != null)
                : !this.unit.equals(other.unit)) {
            return false;
        }
        if (this.defaultMeasure != other.defaultMeasure) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return title;
    }


}

@@ -542,50 +542,175 @@
 ate 
-Date created;%0A    private Date lastUpdated
+String mapType = MAP_TYPE_CHOROPLETH;%0A    private Date created;%0A    private Date lastUpdated;%0A    //%0A    private final static String MAP_TYPE_CHOROPLETH = %22choropleth%22
 ;%0A%0A 
@@ -3356,11 +3356,393 @@
 %0A    %7D%0A%0A
+    public String getMapType() %7B%0A        if (mapType == null %7C%7C mapType.isEmpty()) %7B%0A            mapType = MAP_TYPE_CHOROPLETH;%0A        %7D%0A        return mapType;%0A    %7D%0A%0A    public void setMapType(String mapType) %7B%0A        if (mapType == null %7C%7C mapType.isEmpty()) %7B%0A            this.mapType = MAP_TYPE_CHOROPLETH;%0A        %7D else %7B%0A            this.mapType = mapType;%0A        %7D%0A    %7D
 %0A%7D%0A

Add mapType property for Measure.