~dhis2-devs-core/dhis2/nelushi

« back to all changes in this revision

Viewing changes to dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeValue.java

  • Committer: Mike Nelushi
  • Date: 2014-08-04 14:21:11 UTC
  • Revision ID: mikeevolution@gmail.com-20140804142111-o00z0v3jrd1ta73k
Added the convertion module

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
37
37
import org.hisp.dhis.common.BaseIdentifiableObject;
38
38
import org.hisp.dhis.common.DxfNamespaces;
 
39
import org.hisp.dhis.common.ImportableObject;
39
40
import org.hisp.dhis.common.view.DetailedView;
40
41
import org.hisp.dhis.common.view.ExportView;
41
42
 
44
45
/**
45
46
 * @author Morten Olav Hansen <mortenoh@gmail.com>
46
47
 */
47
 
@JacksonXmlRootElement( localName = "attributeValue", namespace = DxfNamespaces.DXF_2_0)
 
48
@JacksonXmlRootElement( localName = "attributeValue", namespace = DxfNamespaces.DXF_2_0 )
48
49
public class AttributeValue
49
 
    implements Serializable
 
50
    implements Serializable, ImportableObject
50
51
{
51
52
    /**
52
53
     * Determines if a de-serialized file is compatible with this class.
59
60
 
60
61
    private String value;
61
62
 
 
63
    private int dataElementId;
 
64
    
 
65
    private int indicatorId;
 
66
    
 
67
    private int organisationUnitId;
 
68
 
62
69
    public AttributeValue()
63
70
    {
64
71
 
72
79
    @Override
73
80
    public boolean equals( Object o )
74
81
    {
75
 
        if ( this == o ) return true;
76
 
        if ( o == null || getClass() != o.getClass() ) return false;
 
82
        if ( this == o )
 
83
            return true;
 
84
        if ( o == null || getClass() != o.getClass() )
 
85
            return false;
77
86
 
78
87
        AttributeValue that = (AttributeValue) o;
79
88
 
80
 
        if ( id != that.id ) return false;
81
 
        if ( attribute != null ? !attribute.equals( that.attribute ) : that.attribute != null ) return false;
82
 
        if ( value != null ? !value.equals( that.value ) : that.value != null ) return false;
 
89
        if ( id != that.id )
 
90
            return false;
 
91
        if ( attribute != null ? !attribute.equals( that.attribute ) : that.attribute != null )
 
92
            return false;
 
93
        if ( value != null ? !value.equals( that.value ) : that.value != null )
 
94
            return false;
83
95
 
84
96
        return true;
85
97
    }
96
108
    @Override
97
109
    public String toString()
98
110
    {
99
 
        return "AttributeValue{" +
100
 
            "id=" + id +
101
 
            ", attribute=" + attribute +
102
 
            ", value='" + value + '\'' +
103
 
            '}';
 
111
        return "AttributeValue{" + "id=" + id + ", attribute=" + attribute + ", value='" + value + '\'' + '}';
104
112
    }
105
113
 
106
114
    @JsonIgnore
116
124
 
117
125
    @JsonProperty
118
126
    @JsonSerialize( as = BaseIdentifiableObject.class )
119
 
    @JsonView( {DetailedView.class, ExportView.class} )
120
 
    @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
 
127
    @JsonView( { DetailedView.class, ExportView.class } )
 
128
    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
121
129
    public Attribute getAttribute()
122
130
    {
123
131
        return attribute;
129
137
    }
130
138
 
131
139
    @JsonProperty
132
 
    @JsonView( {DetailedView.class, ExportView.class} )
133
 
    @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
 
140
    @JsonView( { DetailedView.class, ExportView.class } )
 
141
    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
134
142
    public String getValue()
135
143
    {
136
144
        return value;
140
148
    {
141
149
        this.value = value;
142
150
    }
 
151
 
 
152
    public int getDataElementId()
 
153
    {
 
154
        return dataElementId;
 
155
    }
 
156
 
 
157
    public void setDataElementId( int dataElementId )
 
158
    {
 
159
        this.dataElementId = dataElementId;
 
160
    }
 
161
    
 
162
    public int getIndicatorId()
 
163
    {
 
164
        return indicatorId;
 
165
    }
 
166
 
 
167
    public void setIndicatorId( int indicatorId )
 
168
    {
 
169
        this.indicatorId = indicatorId;
 
170
    }
 
171
 
 
172
    public int getOrganisationUnitId()
 
173
    {
 
174
        return organisationUnitId;
 
175
    }
 
176
 
 
177
    public void setOrganisationUnitId( int organisationUnitId )
 
178
    {
 
179
        this.organisationUnitId = organisationUnitId;
 
180
    }
 
181
 
 
182
    @Override
 
183
    public String getName()
 
184
    {
 
185
        throw new UnsupportedOperationException();
 
186
    }
143
187
}