1
package org.hisp.dhis.aggregation;
4
* Copyright (c) 2004-2007, University of Oslo
7
* Redistribution and use in source and binary forms, with or without
8
* modification, are permitted provided that the following conditions are met:
9
* * Redistributions of source code must retain the above copyright notice, this
10
* list of conditions and the following disclaimer.
11
* * Redistributions in binary form must reproduce the above copyright notice,
12
* this list of conditions and the following disclaimer in the documentation
13
* and/or other materials provided with the distribution.
14
* * Neither the name of the HISP project nor the names of its contributors may
15
* be used to endorse or promote products derived from this software without
16
* specific prior written permission.
18
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
22
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
import java.io.Serializable;
33
* @author Lars Helge Overland
34
* @version $Id: AggregatedDataValue.java 2694 2007-01-12 19:19:46Z torgeilo $
36
public class AggregatedDataValue
37
implements Serializable
39
private int dataElementId;
41
private int categoryOptionComboId;
45
private int periodTypeId;
47
private int organisationUnitId;
53
// ----------------------------------------------------------------------
55
// ----------------------------------------------------------------------
57
public AggregatedDataValue()
62
* @param dataElementId data element id
63
* @param categoryOptionComboId category option combo id
64
* @param periodId period id
65
* @param periodTypeId period type id
66
* @param organisationUnitId organisation unit id
70
public AggregatedDataValue( int dataElementId, int categoryOptionComboId, int periodId, int periodTypeId, int organisationUnitId, int level, double value )
72
this.dataElementId = dataElementId;
73
this.categoryOptionComboId = categoryOptionComboId;
74
this.periodId = periodId;
75
this.periodTypeId = periodTypeId;
76
this.organisationUnitId = organisationUnitId;
81
// ----------------------------------------------------------------------
83
// ----------------------------------------------------------------------
87
this.dataElementId = 0;
88
this.categoryOptionComboId = 0;
90
this.periodTypeId = 0;
91
this.organisationUnitId = 0;
96
// ----------------------------------------------------------------------
97
// Getters and setters
98
// ----------------------------------------------------------------------
100
public int getDataElementId()
102
return dataElementId;
105
public void setDataElementId( int dataElementId )
107
this.dataElementId = dataElementId;
110
public int getCategoryOptionComboId()
112
return categoryOptionComboId;
115
public void setCategoryOptionComboId( int categoryOptionComboId )
117
this.categoryOptionComboId = categoryOptionComboId;
120
public int getLevel()
125
public void setLevel( int level )
130
public int getOrganisationUnitId()
132
return organisationUnitId;
135
public void setOrganisationUnitId( int organisationUnitId )
137
this.organisationUnitId = organisationUnitId;
140
public int getPeriodId()
145
public void setPeriodId( int periodId )
147
this.periodId = periodId;
150
public int getPeriodTypeId()
155
public void setPeriodTypeId( int periodTypeId )
157
this.periodTypeId = periodTypeId;
160
public double getValue()
165
public void setValue( double value )
170
// ----------------------------------------------------------------------
171
// hashCode and equals
172
// ----------------------------------------------------------------------
174
public int hashCode()
176
return dataElementId * periodId * organisationUnitId * 17;
179
public boolean equals( Object object )
181
if ( this == object )
186
if ( object == null || !( object instanceof AggregatedDataValue ) )
191
AggregatedDataValue that = (AggregatedDataValue) object;
193
return this.dataElementId == that.getDataElementId() &&
194
this.periodId == that.getPeriodId() &&
195
this.organisationUnitId == that.getOrganisationUnitId();