dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #06521
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2084: Minor fix
------------------------------------------------------------
revno: 2084
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Mon 2010-07-05 03:22:16 +0200
message:
Minor fix
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/DailyPeriodType.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/MonthlyPeriodType.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/QuarterlyPeriodType.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/SixMonthlyPeriodType.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/TwoYearlyPeriodType.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/WeeklyPeriodType.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/YearlyPeriodType.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2010-07-04 10:48:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2010-07-05 01:22:16 +0000
@@ -42,6 +42,7 @@
import org.hisp.dhis.dimension.DimensionOptionElement;
import org.hisp.dhis.dimension.DimensionType;
import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.period.TwoYearlyPeriodType;
/**
* A DataElement is a definition (meta-information about) of the entities that
@@ -323,7 +324,7 @@
{
PeriodType periodType = getPeriodType();
- return periodType != null ? periodType.getFrequencyOrder() : 0;
+ return periodType != null ? periodType.getFrequencyOrder() : TwoYearlyPeriodType.FREQUENCY_ORDER;
}
/**
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/DailyPeriodType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/DailyPeriodType.java 2010-06-14 15:51:12 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/DailyPeriodType.java 2010-07-05 01:22:16 +0000
@@ -47,6 +47,8 @@
*/
public static final String NAME = "Daily";
+ public static final int FREQUENCY_ORDER = 1;
+
// -------------------------------------------------------------------------
// PeriodType functionality
// -------------------------------------------------------------------------
@@ -76,7 +78,7 @@
@Override
public int getFrequencyOrder()
{
- return 1;
+ return FREQUENCY_ORDER;
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/MonthlyPeriodType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/MonthlyPeriodType.java 2010-07-04 10:48:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/MonthlyPeriodType.java 2010-07-05 01:22:16 +0000
@@ -48,6 +48,8 @@
*/
public static final String NAME = "Monthly";
+ public static final int FREQUENCY_ORDER = 31;
+
// -------------------------------------------------------------------------
// PeriodType functionality
// -------------------------------------------------------------------------
@@ -84,7 +86,7 @@
@Override
public int getFrequencyOrder()
{
- return 31;
+ return FREQUENCY_ORDER;
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/QuarterlyPeriodType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/QuarterlyPeriodType.java 2010-07-04 10:48:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/QuarterlyPeriodType.java 2010-07-05 01:22:16 +0000
@@ -48,6 +48,8 @@
*/
public static final String NAME = "Quarterly";
+ public static final int FREQUENCY_ORDER = 92;
+
// -------------------------------------------------------------------------
// PeriodType functionality
// -------------------------------------------------------------------------
@@ -86,7 +88,7 @@
@Override
public int getFrequencyOrder()
{
- return 92;
+ return FREQUENCY_ORDER;
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/SixMonthlyPeriodType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/SixMonthlyPeriodType.java 2010-07-04 10:48:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/SixMonthlyPeriodType.java 2010-07-05 01:22:16 +0000
@@ -47,6 +47,8 @@
* The name of the SixMonthlyPeriodType, which is "SixMonthly".
*/
public static final String NAME = "SixMonthly";
+
+ public static final int FREQUENCY_ORDER = 182;
// -------------------------------------------------------------------------
// PeriodType functionality
@@ -86,7 +88,7 @@
@Override
public int getFrequencyOrder()
{
- return 182;
+ return FREQUENCY_ORDER;
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/TwoYearlyPeriodType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/TwoYearlyPeriodType.java 2010-07-04 10:48:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/TwoYearlyPeriodType.java 2010-07-05 01:22:16 +0000
@@ -48,6 +48,8 @@
*/
public static final String NAME = "TwoYearly";
+ public static final int FREQUENCY_ORDER = 730;
+
// -------------------------------------------------------------------------
// PeriodType functionality
// -------------------------------------------------------------------------
@@ -86,7 +88,7 @@
@Override
public int getFrequencyOrder()
{
- return 730;
+ return FREQUENCY_ORDER;
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/WeeklyPeriodType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/WeeklyPeriodType.java 2010-07-04 10:48:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/WeeklyPeriodType.java 2010-07-05 01:22:16 +0000
@@ -48,6 +48,8 @@
*/
public static final String NAME = "Weekly";
+ public static final int FREQUENCY_ORDER = 7;
+
// -------------------------------------------------------------------------
// PeriodType functionality
// -------------------------------------------------------------------------
@@ -84,7 +86,7 @@
@Override
public int getFrequencyOrder()
{
- return 7;
+ return FREQUENCY_ORDER;
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/YearlyPeriodType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/YearlyPeriodType.java 2010-07-04 10:48:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/YearlyPeriodType.java 2010-07-05 01:22:16 +0000
@@ -47,6 +47,8 @@
*/
public static final String NAME = "Yearly";
+ public static final int FREQUENCY_ORDER = 365;
+
// -------------------------------------------------------------------------
// PeriodType functionality
// -------------------------------------------------------------------------
@@ -83,7 +85,7 @@
@Override
public int getFrequencyOrder()
{
- return 365;
+ return FREQUENCY_ORDER;
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2010-06-17 21:08:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2010-07-05 01:22:16 +0000
@@ -396,7 +396,7 @@
Set<DataElementCategoryOptionCombo> categoryOptionCombos = dataElement.getCategoryCombo()
.getOptionCombos();
- int frequencyOrder = dataElement.getPeriodType() != null ? dataElement.getPeriodType().getFrequencyOrder() : new TwoYearlyPeriodType().getFrequencyOrder(); // Assume lowest frequency if no PeriodType
+ int frequencyOrder = dataElement.getPeriodType() != null ? dataElement.getPeriodType().getFrequencyOrder() : TwoYearlyPeriodType.FREQUENCY_ORDER; // Assume lowest frequency if no PeriodType
if ( categoryOptionCombos.size() > 1 && !(dataElement instanceof CalculatedDataElement) )
{