dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38530
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19636: Removed setAutoFields() in default constructors, should be set directly in HibernateGenericStore, ...
------------------------------------------------------------
revno: 19636
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-07-13 19:34:39 +0700
message:
Removed setAutoFields() in default constructors, should be set directly in HibernateGenericStore, updated tests
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItem.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupSet.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorType.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/Option.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstance.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSection.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidation.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRule.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleAction.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleVariable.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipType.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntity.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceReminder.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/Translation.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserAuthorityGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserCredentials.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRule.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleGroup.java
dhis-2/dhis-api/src/test/java/org/hisp/dhis/common/BaseAnalyticalObjectTest.java
dhis-2/dhis-api/src/test/java/org/hisp/dhis/dataelement/CategoryComboMapTest.java
dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/event/data/EventAnalyticsServiceTest.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/dashboard/DashboardServiceTest.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/chart/Chart.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2015-02-26 15:21:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2015-07-13 12:34:39 +0000
@@ -69,7 +69,7 @@
public Chart()
{
- setAutoFields();
+
}
public Chart( String name )
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java 2015-06-07 12:42:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java 2015-07-13 12:34:39 +0000
@@ -42,6 +42,7 @@
import org.hisp.dhis.common.view.DetailedView;
import org.hisp.dhis.common.view.DimensionalView;
import org.hisp.dhis.common.view.ExportView;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.schema.PropertyType;
import org.hisp.dhis.schema.annotation.Property;
import org.hisp.dhis.schema.annotation.PropertyRange;
@@ -54,6 +55,7 @@
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import java.util.UUID;
/**
* @author Bob Jolliffe
@@ -378,8 +380,8 @@
public int hashCode()
{
int result = getUid() != null ? getUid().hashCode() : 0;
- result = 31 * result + ( getCode() != null ? getCode().hashCode() : 0 );
- result = 31 * result + ( getName() != null ? getName().hashCode() : 0 );
+ result = 31 * result + (getCode() != null ? getCode().hashCode() : 0);
+ result = 31 * result + (getName() != null ? getName().hashCode() : 0);
return result;
}
@@ -463,7 +465,7 @@
publicAccess = AccessStringHelper.DEFAULT;
externalAccess = false;
-
+
if ( userGroupAccesses != null )
{
userGroupAccesses.clear();
@@ -500,7 +502,7 @@
public static Map<String, Integer> getCodeMap( Collection<? extends BaseIdentifiableObject> objects )
{
Map<String, Integer> map = new HashMap<>();
-
+
for ( BaseIdentifiableObject object : objects )
{
String code = object.getCode();
@@ -508,7 +510,7 @@
map.put( code, internalId );
}
-
+
return map;
}
@@ -521,7 +523,7 @@
public static Map<String, Integer> getNameMap( Collection<? extends BaseIdentifiableObject> objects )
{
Map<String, Integer> map = new HashMap<>();
-
+
for ( BaseIdentifiableObject object : objects )
{
String name = object.getName();
@@ -529,7 +531,7 @@
map.put( name, internalId );
}
-
+
return map;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItem.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItem.java 2015-02-26 15:21:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/DashboardItem.java 2015-07-13 12:34:39 +0000
@@ -110,7 +110,7 @@
public DashboardItem()
{
- super.setAutoFields();
+ setAutoFields();
}
public DashboardItem( String uid )
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroup.java 2015-02-26 15:21:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroup.java 2015-07-13 12:34:39 +0000
@@ -64,7 +64,7 @@
public CategoryOptionGroup()
{
- setAutoFields();
+
}
public CategoryOptionGroup( String name )
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupSet.java 2015-03-08 10:23:09 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupSet.java 2015-07-13 12:34:39 +0000
@@ -66,12 +66,11 @@
public CategoryOptionGroupSet()
{
- setAutoFields();
+
}
public CategoryOptionGroupSet( String name )
{
- this();
this.name = name;
}
=== 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 2015-07-08 05:02:25 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2015-07-13 12:34:39 +0000
@@ -205,7 +205,7 @@
public DataElement()
{
- setAutoFields();
+
}
public DataElement( String name )
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java 2015-03-08 10:23:09 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java 2015-07-13 12:34:39 +0000
@@ -78,12 +78,11 @@
public DataElementCategory()
{
- setAutoFields();
+
}
public DataElementCategory( String name )
{
- this();
this.name = name;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java 2015-04-03 15:22:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java 2015-07-13 12:34:39 +0000
@@ -88,12 +88,11 @@
public DataElementCategoryCombo()
{
- setAutoFields();
+
}
public DataElementCategoryCombo( String name )
{
- this();
this.name = name;
}
@@ -111,7 +110,7 @@
{
return name.equals( DEFAULT_CATEGORY_COMBO_NAME );
}
-
+
/**
* Indicates whether this category combo has at least one category, has at
* least one category option combo and that all categories have at least one
@@ -123,7 +122,7 @@
{
return false;
}
-
+
for ( DataElementCategory category : categories )
{
if ( category == null || category.getCategoryOptions() == null || category.getCategoryOptions().isEmpty() )
@@ -131,7 +130,7 @@
return false;
}
}
-
+
return true;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java 2015-02-26 15:21:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java 2015-07-13 12:34:39 +0000
@@ -82,12 +82,11 @@
public DataElementCategoryOption()
{
- setAutoFields();
+
}
public DataElementCategoryOption( String name )
{
- this();
this.name = name;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java 2015-04-07 10:51:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java 2015-07-13 12:34:39 +0000
@@ -95,7 +95,7 @@
public DataElementCategoryOptionCombo()
{
- setAutoFields();
+
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java 2015-02-26 15:21:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java 2015-07-13 12:34:39 +0000
@@ -76,12 +76,11 @@
public DataElementGroup()
{
- setAutoFields();
+
}
public DataElementGroup( String name )
{
- this();
this.name = name;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java 2015-03-08 10:23:09 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java 2015-07-13 12:34:39 +0000
@@ -78,12 +78,11 @@
public DataElementGroupSet()
{
- setAutoFields();
+
}
public DataElementGroupSet( String name )
{
- this();
this.name = name;
this.compulsory = false;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2015-06-10 20:22:17 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2015-07-13 12:34:39 +0000
@@ -240,12 +240,11 @@
public DataSet()
{
- setAutoFields();
+
}
public DataSet( String name )
{
- this();
this.name = name;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java 2015-02-26 15:21:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java 2015-07-13 12:34:39 +0000
@@ -103,7 +103,7 @@
public Indicator()
{
- setAutoFields();
+
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java 2015-02-26 15:21:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java 2015-07-13 12:34:39 +0000
@@ -74,12 +74,11 @@
public IndicatorGroup()
{
- setAutoFields();
+
}
public IndicatorGroup( String name )
{
- this();
this.name = name;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java 2015-02-26 15:21:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java 2015-07-13 12:34:39 +0000
@@ -78,12 +78,11 @@
public IndicatorGroupSet()
{
- setAutoFields();
+
}
public IndicatorGroupSet( String name )
{
- this();
this.name = name;
this.compulsory = false;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorType.java 2015-02-05 06:53:38 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorType.java 2015-07-13 12:34:39 +0000
@@ -62,12 +62,11 @@
public IndicatorType()
{
- setAutoFields();
+
}
public IndicatorType( String name, int factor, Boolean number )
{
- this();
this.name = name;
this.factor = factor;
this.number = number;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/Option.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/Option.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/Option.java 2015-07-13 12:34:39 +0000
@@ -45,12 +45,11 @@
{
public Option()
{
- setAutoFields();
+
}
public Option( String name, String code )
{
- setAutoFields();
this.name = name;
this.code = code;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2015-07-08 09:40:04 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2015-07-13 12:34:39 +0000
@@ -168,13 +168,11 @@
public OrganisationUnit()
{
- this.uuid = UUID.randomUUID().toString();
- setAutoFields();
+
}
public OrganisationUnit( String name )
{
- this();
this.name = name;
}
@@ -216,6 +214,17 @@
this.comment = comment;
}
+ @Override
+ public void setAutoFields()
+ {
+ if ( uuid == null )
+ {
+ uuid = UUID.randomUUID().toString();
+ }
+
+ super.setAutoFields();
+ }
+
// -------------------------------------------------------------------------
// Logic
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java 2015-02-26 15:21:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java 2015-07-13 12:34:39 +0000
@@ -78,12 +78,11 @@
public OrganisationUnitGroup()
{
- setAutoFields();
+
}
public OrganisationUnitGroup( String name )
{
- this();
this.name = name;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java 2015-03-08 10:23:09 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java 2015-07-13 12:34:39 +0000
@@ -83,12 +83,11 @@
public OrganisationUnitGroupSet()
{
- setAutoFields();
+
}
public OrganisationUnitGroupSet( String name, String description, boolean compulsory )
{
- this();
this.name = name;
this.description = description;
this.compulsory = compulsory;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2015-07-02 07:05:55 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2015-07-13 12:34:39 +0000
@@ -134,12 +134,11 @@
public Program()
{
- setAutoFields();
+
}
public Program( String name, String description )
{
- setAutoFields();
this.name = name;
this.description = description;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java 2015-06-02 22:11:37 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java 2015-07-13 12:34:39 +0000
@@ -96,7 +96,7 @@
public ProgramIndicator()
{
- setAutoFields();
+
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java 2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStage.java 2015-07-13 12:34:39 +0000
@@ -138,12 +138,11 @@
public ProgramStage()
{
- setAutoFields();
+
}
public ProgramStage( String name, Program program )
{
- setAutoFields();
this.name = name;
this.program = program;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstance.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstance.java 2015-01-26 22:26:24 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstance.java 2015-07-13 12:34:39 +0000
@@ -83,7 +83,7 @@
public ProgramStageInstance()
{
- setAutoFields();
+
}
public ProgramStageInstance( ProgramInstance programInstance, ProgramStage programStage )
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSection.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSection.java 2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageSection.java 2015-07-13 12:34:39 +0000
@@ -70,21 +70,18 @@
public ProgramStageSection()
{
- setAutoFields();
+
}
public ProgramStageSection( String name, List<ProgramStageDataElement> programStageDataElements )
{
- setAutoFields();
this.name = name;
this.programStageDataElements = programStageDataElements;
}
public ProgramStageSection( String name, List<ProgramStageDataElement> programStageDataElements, Integer sortOrder )
{
- setAutoFields();
- this.name = name;
- this.programStageDataElements = programStageDataElements;
+ this( name, programStageDataElements );
this.sortOrder = sortOrder;
}
@@ -96,7 +93,7 @@
{
return programStage != null;
}
-
+
// -------------------------------------------------------------------------
// Getters and setters
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidation.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidation.java 2015-02-26 15:21:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramValidation.java 2015-07-13 12:34:39 +0000
@@ -74,13 +74,12 @@
public ProgramValidation()
{
- setAutoFields();
+
}
public ProgramValidation( String name, ProgramExpression leftSide, ProgramExpression rightSide,
Program program )
{
- this();
this.name = name;
this.leftSide = leftSide;
this.rightSide = rightSide;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRule.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRule.java 2015-05-13 02:28:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRule.java 2015-07-13 12:34:39 +0000
@@ -73,7 +73,7 @@
* The collection of actions that will be triggered if the the rule is triggered.
*/
@Scanned
- private Set<ProgramRuleAction> programRuleActions;
+ private Set<ProgramRuleAction> programRuleActions = new HashSet<>();
/**
* The condition expression, if this expression is evaluated to true, the actions is triggered.
@@ -92,13 +92,11 @@
public ProgramRule()
{
- this.setAutoFields();
- this.programRuleActions = new HashSet<ProgramRuleAction>();
+
}
public ProgramRule( String name, String description, Program program, ProgramStage programStage, Set<ProgramRuleAction> programRuleActions, String condition, Integer priority )
{
- this();
this.name = name;
this.description = description;
this.program = program;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleAction.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleAction.java 2015-05-13 02:28:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleAction.java 2015-07-13 12:34:39 +0000
@@ -130,12 +130,11 @@
public ProgramRuleAction()
{
- setAutoFields();
+
}
public ProgramRuleAction( String name, ProgramRule programRule, ProgramRuleActionType programRuleActionType, DataElement dataElement, String location, String content, String data )
{
- this();
this.name = name;
this.programRule = programRule;
this.programRuleActionType = programRuleActionType;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleVariable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleVariable.java 2015-06-23 09:02:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/programrule/ProgramRuleVariable.java 2015-07-13 12:34:39 +0000
@@ -106,7 +106,7 @@
public ProgramRuleVariable()
{
- setAutoFields();
+
}
public ProgramRuleVariable( String name,
@@ -116,7 +116,6 @@
DataElement dataElement,
ProgramStage programStage )
{
- this();
this.name = name;
this.program = program;
this.sourceType = sourceType;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipType.java 2015-02-26 15:21:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipType.java 2015-07-13 12:34:39 +0000
@@ -62,12 +62,11 @@
public RelationshipType()
{
- setAutoFields();
+
}
public RelationshipType( String aIsToB, String bIsToA )
{
- this();
this.aIsToB = aIsToB;
this.bIsToA = bIsToA;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntity.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntity.java 2015-03-18 13:03:25 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntity.java 2015-07-13 12:34:39 +0000
@@ -64,12 +64,11 @@
public TrackedEntity()
{
- setAutoFields();
+
}
public TrackedEntity( String name, String description )
{
- this();
this.name = name;
this.description = description;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java 2015-06-19 10:06:15 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java 2015-07-13 12:34:39 +0000
@@ -111,7 +111,7 @@
public TrackedEntityAttribute()
{
- setAutoFields();
+
}
public TrackedEntityAttribute( String name, String description, String valueType, Boolean inherit,
@@ -122,8 +122,6 @@
this.valueType = valueType;
this.inherit = inherit;
this.displayOnVisitSchedule = displayOnVisitSchedule;
-
- setAutoFields();
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceReminder.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceReminder.java 2015-03-31 03:17:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceReminder.java 2015-07-13 12:34:39 +0000
@@ -122,12 +122,11 @@
public TrackedEntityInstanceReminder()
{
- setAutoFields();
+
}
public TrackedEntityInstanceReminder( String name, Integer daysAllowedSendMessage, String templateMessage )
{
- setAutoFields();
this.name = name;
this.daysAllowedSendMessage = daysAllowedSendMessage;
this.templateMessage = templateMessage;
@@ -136,7 +135,6 @@
public TrackedEntityInstanceReminder( String name, Integer daysAllowedSendMessage, String templateMessage, String dateToCompare,
Integer sendTo, Integer whenToSend, Integer messageType )
{
- setAutoFields();
this.name = name;
this.daysAllowedSendMessage = daysAllowedSendMessage;
this.templateMessage = templateMessage;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/Translation.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/Translation.java 2015-02-13 07:14:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/Translation.java 2015-07-13 12:34:39 +0000
@@ -60,12 +60,11 @@
public Translation()
{
- setAutoFields();
+
}
public Translation( String className, String locale, String property, String value, String objectUid )
{
- this();
this.className = className;
this.locale = locale;
this.property = property;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserAuthorityGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserAuthorityGroup.java 2015-02-26 15:21:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserAuthorityGroup.java 2015-07-13 12:34:39 +0000
@@ -82,7 +82,7 @@
public UserAuthorityGroup()
{
- setAutoFields();
+
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserCredentials.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserCredentials.java 2015-02-26 15:21:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserCredentials.java 2015-07-13 12:34:39 +0000
@@ -155,8 +155,6 @@
public UserCredentials()
{
- setAutoFields();
- this.name = this.getClass().getSimpleName(); // Used to avoid JSR-303 issues
this.lastLogin = new Date();
this.passwordLastUpdated = new Date();
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserGroup.java 2015-02-05 06:53:38 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserGroup.java 2015-07-13 12:34:39 +0000
@@ -95,12 +95,11 @@
public UserGroup()
{
- setAutoFields();
+
}
public UserGroup( String name )
{
- this();
this.name = name;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRule.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRule.java 2015-02-26 15:21:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRule.java 2015-07-13 12:34:39 +0000
@@ -152,13 +152,12 @@
public ValidationRule()
{
- setAutoFields();
+
}
public ValidationRule( String name, String description,
Operator operator, Expression leftSide, Expression rightSide )
{
- this();
this.name = name;
this.description = description;
this.operator = operator;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleGroup.java 2015-02-26 15:21:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleGroup.java 2015-07-13 12:34:39 +0000
@@ -75,12 +75,11 @@
public ValidationRuleGroup()
{
- setAutoFields();
+
}
public ValidationRuleGroup( String name, String description, Set<ValidationRule> members )
{
- this();
this.name = name;
this.description = description;
this.members = members;
=== modified file 'dhis-2/dhis-api/src/test/java/org/hisp/dhis/common/BaseAnalyticalObjectTest.java'
--- dhis-2/dhis-api/src/test/java/org/hisp/dhis/common/BaseAnalyticalObjectTest.java 2015-06-18 14:35:18 +0000
+++ dhis-2/dhis-api/src/test/java/org/hisp/dhis/common/BaseAnalyticalObjectTest.java 2015-07-13 12:34:39 +0000
@@ -110,18 +110,20 @@
public void testPopulateAnalyticalProperties()
{
TrackedEntityAttribute tea = new TrackedEntityAttribute();
+ tea.setAutoFields();
TrackedEntityAttributeDimension tead = new TrackedEntityAttributeDimension( tea, null, "EQ:10" );
-
- EventChart chart = new EventChart();
- chart.getColumnDimensions().add( tea.getUid() );
- chart.getAttributeDimensions().add( tead );
-
- chart.populateAnalyticalProperties();
-
- assertEquals( 1, chart.getColumns().size() );
-
- DimensionalObject dim = chart.getColumns().get( 0 );
+
+ EventChart eventChart = new EventChart();
+ eventChart.setAutoFields();
+ eventChart.getColumnDimensions().add( tea.getUid() );
+ eventChart.getAttributeDimensions().add( tead );
+
+ eventChart.populateAnalyticalProperties();
+
+ assertEquals( 1, eventChart.getColumns().size() );
+
+ DimensionalObject dim = eventChart.getColumns().get( 0 );
assertNotNull( dim );
assertEquals( tea.getDimension(), dim.getDimension() );
=== modified file 'dhis-2/dhis-api/src/test/java/org/hisp/dhis/dataelement/CategoryComboMapTest.java'
--- dhis-2/dhis-api/src/test/java/org/hisp/dhis/dataelement/CategoryComboMapTest.java 2015-02-12 15:19:27 +0000
+++ dhis-2/dhis-api/src/test/java/org/hisp/dhis/dataelement/CategoryComboMapTest.java 2015-07-13 12:34:39 +0000
@@ -28,17 +28,17 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.hisp.dhis.common.IdentifiableProperty;
+import org.junit.Before;
+import org.junit.Test;
+
import java.util.LinkedList;
-import static org.junit.Assert.assertNotNull;
-
import java.util.List;
-import org.hisp.dhis.common.IdentifiableProperty;
+
import static org.hisp.dhis.common.IdentifiableProperty.NAME;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import org.junit.Before;
-import org.junit.Test;
-
/**
* @author bobj
*/
@@ -78,10 +78,21 @@
categoryOptionE = new DataElementCategoryOption( "OptionE" );
categoryOptionF = new DataElementCategoryOption( "OptionF" );
+ categoryOptionA.setAutoFields();
+ categoryOptionB.setAutoFields();
+ categoryOptionC.setAutoFields();
+ categoryOptionD.setAutoFields();
+ categoryOptionE.setAutoFields();
+ categoryOptionF.setAutoFields();
+
categoryA = new DataElementCategory( "CategoryA" );
categoryB = new DataElementCategory( "CategoryB" );
categoryC = new DataElementCategory( "CategoryC" );
+ categoryA.setAutoFields();
+ categoryB.setAutoFields();
+ categoryC.setAutoFields();
+
categoryA.getCategoryOptions().add( categoryOptionA );
categoryA.getCategoryOptions().add( categoryOptionB );
categoryB.getCategoryOptions().add( categoryOptionC );
@@ -90,6 +101,7 @@
categoryC.getCategoryOptions().add( categoryOptionF );
categoryCombo = new DataElementCategoryCombo( "CategoryCombo" );
+ categoryCombo.setAutoFields();
categoryCombo.addDataElementCategory( categoryA );
categoryCombo.addDataElementCategory( categoryB );
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/event/data/EventAnalyticsServiceTest.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/event/data/EventAnalyticsServiceTest.java 2015-06-18 14:35:18 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/event/data/EventAnalyticsServiceTest.java 2015-07-13 12:34:39 +0000
@@ -28,13 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
+import com.google.common.collect.Sets;
import org.hisp.dhis.DhisSpringTest;
import org.hisp.dhis.analytics.AggregationType;
import org.hisp.dhis.analytics.event.EventAnalyticsService;
@@ -70,7 +64,12 @@
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import com.google.common.collect.Sets;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
/**
* @author Lars Helge Overland
@@ -83,18 +82,18 @@
private Period peA;
private Period peB;
-
+
private OrganisationUnit ouA;
private OrganisationUnit ouB;
-
+
private DataElement deA;
private DataElement deB;
-
+
private TrackedEntityAttribute atA;
private TrackedEntityAttribute atB;
-
+
private LegendSet legendSetA;
-
+
private Legend legendA;
private Legend legendB;
@@ -106,68 +105,68 @@
@Autowired
private ProgramStageService programStageService;
-
+
@Autowired
private ProgramStageDataElementService programStageDataElementService;
-
+
@Autowired
private DataElementService dataElementService;
@Autowired
private OrganisationUnitService organisationUnitService;
-
+
@Autowired
private TrackedEntityAttributeService attributeService;
-
+
@Autowired
private LegendService legendService;
-
+
@Override
public void setUpTest()
{
peA = PeriodType.getPeriodFromIsoString( "201401" );
peB = PeriodType.getPeriodFromIsoString( "201402" );
-
+
ouA = createOrganisationUnit( 'A' );
ouB = createOrganisationUnit( 'B' );
organisationUnitService.addOrganisationUnit( ouA );
organisationUnitService.addOrganisationUnit( ouB );
-
+
deA = createDataElement( 'A' );
deB = createDataElement( 'B' );
dataElementService.addDataElement( deA );
dataElementService.addDataElement( deB );
-
+
atA = createTrackedEntityAttribute( 'A' );
atB = createTrackedEntityAttribute( 'B' );
-
+
attributeService.addTrackedEntityAttribute( atA );
attributeService.addTrackedEntityAttribute( atB );
-
+
prA = createProgram( 'A', new HashSet<ProgramStage>(), Sets.newHashSet( atA, atB ), Sets.newHashSet( ouA, ouB ) );
programService.addProgram( prA );
-
+
psA = createProgramStage( 'A', 0 );
prA.getProgramStages().add( psA );
-
+
programStageService.saveProgramStage( psA );
-
+
programStageDataElementService.addProgramStageDataElement( new ProgramStageDataElement( psA, deA, false ) );
programStageDataElementService.addProgramStageDataElement( new ProgramStageDataElement( psA, deB, false ) );
-
+
legendA = createLegend( 'A', 0d, 10d );
legendB = createLegend( 'B', 10d, 20d );
legendService.addLegend( legendA );
legendService.addLegend( legendB );
-
+
legendSetA = createLegendSet( 'A' );
-
+
legendSetA.getLegends().add( legendA );
legendSetA.getLegends().add( legendB );
-
+
legendService.addLegendSet( legendSetA );
}
@@ -177,13 +176,13 @@
Set<String> dimensionParams = new HashSet<>();
dimensionParams.add( "ou:" + ouA.getUid() + ";" + ouB.getId() );
dimensionParams.add( atA.getUid() + ":LE:5" );
-
+
Set<String> filterParams = new HashSet<>();
filterParams.add( "pe:201401;201402" );
-
- EventQueryParams params = analyticsService.getFromUrl( prA.getUid(), null,
+
+ EventQueryParams params = analyticsService.getFromUrl( prA.getUid(), null,
null, null, dimensionParams, filterParams, null, null, false, false, false, false, null, null, null, false, false, null, null );
-
+
assertEquals( prA, params.getProgram() );
assertEquals( 1, params.getOrganisationUnits().size() );
assertEquals( 1, params.getItems().size() );
@@ -196,13 +195,13 @@
Set<String> dimensionParams = new HashSet<>();
dimensionParams.add( "ou:" + ouA.getUid() + ";" + ouB.getId() );
dimensionParams.add( atA.getUid() + ":LE:5" );
-
+
Set<String> filterParams = new HashSet<>();
filterParams.add( "pe:201401" );
-
- EventQueryParams params = analyticsService.getFromUrl( prA.getUid(), null,
+
+ EventQueryParams params = analyticsService.getFromUrl( prA.getUid(), null,
null, null, dimensionParams, filterParams, deA.getUid(), AggregationType.AVERAGE, false, false, false, false, null, null, null, false, false, null, null );
-
+
assertEquals( prA, params.getProgram() );
assertEquals( 1, params.getOrganisationUnits().size() );
assertEquals( 1, params.getItems().size() );
@@ -210,51 +209,53 @@
assertEquals( deA, params.getValue() );
assertEquals( AggregationType.AVERAGE, params.getAggregationType() );
}
-
+
@Test
public void testGetFromAnalyticalObjectA()
{
- EventChart chart = new EventChart();
- chart.setProgram( prA );
-
- chart.getColumnDimensions().add( atA.getUid() );
- chart.getRowDimensions().add( DimensionalObject.ORGUNIT_DIM_ID );
- chart.getFilterDimensions().add( DimensionalObject.PERIOD_DIM_ID );
-
- chart.getAttributeDimensions().add( new TrackedEntityAttributeDimension( atA, null, "LE:5" ) );
- chart.getPeriods().add( peA );
- chart.getPeriods().add( peB );
- chart.getOrganisationUnits().add( ouA );
- chart.getOrganisationUnits().add( ouB );
-
- EventQueryParams params = analyticsService.getFromAnalyticalObject( chart, null );
-
+ EventChart eventChart = new EventChart();
+ eventChart.setAutoFields();
+ eventChart.setProgram( prA );
+
+ eventChart.getColumnDimensions().add( atA.getUid() );
+ eventChart.getRowDimensions().add( DimensionalObject.ORGUNIT_DIM_ID );
+ eventChart.getFilterDimensions().add( DimensionalObject.PERIOD_DIM_ID );
+
+ eventChart.getAttributeDimensions().add( new TrackedEntityAttributeDimension( atA, null, "LE:5" ) );
+ eventChart.getPeriods().add( peA );
+ eventChart.getPeriods().add( peB );
+ eventChart.getOrganisationUnits().add( ouA );
+ eventChart.getOrganisationUnits().add( ouB );
+
+ EventQueryParams params = analyticsService.getFromAnalyticalObject( eventChart, null );
+
assertNotNull( params );
assertEquals( 1, params.getItems().size() );
assertEquals( 2, params.getOrganisationUnits().size() );
assertEquals( 2, params.getFilterPeriods().size() );
}
-
+
@Test
public void testGetFromAnalyticalObjectB()
{
- EventChart chart = new EventChart();
- chart.setProgram( prA );
-
- chart.getColumnDimensions().add( atA.getUid() );
- chart.getColumnDimensions().add( deA.getUid() );
- chart.getRowDimensions().add( DimensionalObject.PERIOD_DIM_ID );
- chart.getFilterDimensions().add( DimensionalObject.ORGUNIT_DIM_ID );
-
- chart.getAttributeDimensions().add( new TrackedEntityAttributeDimension( atA, null, "LE:5" ) );
- chart.getDataElementDimensions().add( new TrackedEntityDataElementDimension( deA, null, "GE:100" ) );
- chart.getPeriods().add( peA );
- chart.getPeriods().add( peB );
- chart.getOrganisationUnits().add( ouA );
- chart.getOrganisationUnits().add( ouB );
-
- EventQueryParams params = analyticsService.getFromAnalyticalObject( chart, null );
-
+ EventChart eventChart = new EventChart();
+ eventChart.setAutoFields();
+ eventChart.setProgram( prA );
+
+ eventChart.getColumnDimensions().add( atA.getUid() );
+ eventChart.getColumnDimensions().add( deA.getUid() );
+ eventChart.getRowDimensions().add( DimensionalObject.PERIOD_DIM_ID );
+ eventChart.getFilterDimensions().add( DimensionalObject.ORGUNIT_DIM_ID );
+
+ eventChart.getAttributeDimensions().add( new TrackedEntityAttributeDimension( atA, null, "LE:5" ) );
+ eventChart.getDataElementDimensions().add( new TrackedEntityDataElementDimension( deA, null, "GE:100" ) );
+ eventChart.getPeriods().add( peA );
+ eventChart.getPeriods().add( peB );
+ eventChart.getOrganisationUnits().add( ouA );
+ eventChart.getOrganisationUnits().add( ouB );
+
+ EventQueryParams params = analyticsService.getFromAnalyticalObject( eventChart, null );
+
assertNotNull( params );
assertEquals( 2, params.getItems().size() );
assertEquals( 2, params.getPeriods().size() );
@@ -264,58 +265,61 @@
@Test
public void testGetFromAnalyticalObjectC()
{
- EventChart chart = new EventChart();
- chart.setProgram( prA );
-
- chart.getColumnDimensions().add( deA.getUid() );
- chart.getColumnDimensions().add( atA.getUid() );
- chart.getRowDimensions().add( DimensionalObject.ORGUNIT_DIM_ID );
- chart.getFilterDimensions().add( DimensionalObject.PERIOD_DIM_ID );
-
- chart.getDataElementDimensions().add( new TrackedEntityDataElementDimension( deA, null, "GT:2000" ) );
- chart.getAttributeDimensions().add( new TrackedEntityAttributeDimension( atA, null, "LE:5" ) );
- chart.getPeriods().add( peA );
- chart.getPeriods().add( peB );
- chart.getOrganisationUnits().add( ouA );
-
- EventQueryParams params = analyticsService.getFromAnalyticalObject( chart, null );
-
+ EventChart eventChart = new EventChart();
+ eventChart.setAutoFields();
+ eventChart.setProgram( prA );
+
+ eventChart.getColumnDimensions().add( deA.getUid() );
+ eventChart.getColumnDimensions().add( atA.getUid() );
+ eventChart.getRowDimensions().add( DimensionalObject.ORGUNIT_DIM_ID );
+ eventChart.getFilterDimensions().add( DimensionalObject.PERIOD_DIM_ID );
+
+ eventChart.getDataElementDimensions().add( new TrackedEntityDataElementDimension( deA, null, "GT:2000" ) );
+ eventChart.getAttributeDimensions().add( new TrackedEntityAttributeDimension( atA, null, "LE:5" ) );
+ eventChart.getPeriods().add( peA );
+ eventChart.getPeriods().add( peB );
+ eventChart.getOrganisationUnits().add( ouA );
+
+ EventQueryParams params = analyticsService.getFromAnalyticalObject( eventChart, null );
+
assertNotNull( params );
assertEquals( 2, params.getItems().size() );
assertEquals( 1, params.getOrganisationUnits().size() );
assertEquals( 2, params.getFilterPeriods().size() );
}
-
+
@Test
public void testSetItemsForDimensionFilters()
{
TrackedEntityAttribute tea = new TrackedEntityAttribute();
+ tea.setAutoFields();
TrackedEntityAttributeDimension tead = new TrackedEntityAttributeDimension( tea, null, "EQ:2" );
-
- EventChart chart = new EventChart();
- chart.getColumnDimensions().add( tea.getUid() );
- chart.getAttributeDimensions().add( tead );
-
+
+ EventChart eventChart = new EventChart();
+ eventChart.setAutoFields();
+ eventChart.getColumnDimensions().add( tea.getUid() );
+ eventChart.getAttributeDimensions().add( tead );
+
Grid grid = new ListGrid();
grid.addHeader( new GridHeader( tea.getUid(), tea.getName() ) );
grid.addRow().addValue( "1" );
grid.addRow().addValue( "2" );
grid.addRow().addValue( "3" );
grid.addRow().addValue( null );
-
- chart.populateAnalyticalProperties();
-
- DimensionalObject dim = chart.getColumns().get( 0 );
-
+
+ eventChart.populateAnalyticalProperties();
+
+ DimensionalObject dim = eventChart.getColumns().get( 0 );
+
DimensionalObjectUtils.setDimensionItemsForFilters( dim, grid, true );
-
+
assertNotNull( dim );
assertEquals( tea.getDimension(), dim.getDimension() );
assertEquals( DimensionType.PROGRAM_ATTRIBUTE, dim.getDimensionType() );
assertEquals( AnalyticsType.EVENT, dim.getAnalyticsType() );
assertEquals( tead.getFilter(), dim.getFilter() );
-
+
List<NameableObject> items = dim.getItems();
assertEquals( 4, items.size() );
assertNotNull( items.get( 0 ).getUid() );
@@ -329,14 +333,14 @@
{
Set<String> dimensionParams = new HashSet<>();
dimensionParams.add( deA.getUid() + "-" + legendSetA.getUid() + ":IN:" + legendA.getUid() + ";" + legendB.getUid() );
-
+
Set<String> filterParams = new HashSet<>();
filterParams.add( "pe:201401;201402" );
filterParams.add( atA.getUid() + ":LE:5" );
-
- EventQueryParams params = analyticsService.getFromUrl( prA.getUid(), null,
+
+ EventQueryParams params = analyticsService.getFromUrl( prA.getUid(), null,
null, null, dimensionParams, filterParams, null, null, false, false, false, false, null, null, null, false, false, null, null );
-
+
assertEquals( prA, params.getProgram() );
assertEquals( 1, params.getItems().size() );
assertEquals( legendSetA, params.getItems().get( 0 ).getLegendSet() );
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.java 2015-06-15 13:44:20 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/dashboard/impl/DefaultDashboardService.java 2015-07-13 12:34:39 +0000
@@ -28,9 +28,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import com.google.common.collect.Sets;
import org.hisp.dhis.chart.Chart;
import org.hisp.dhis.common.IdentifiableObjectManager;
import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
+import org.hisp.dhis.commons.util.TextUtils;
import org.hisp.dhis.dashboard.Dashboard;
import org.hisp.dhis.dashboard.DashboardItem;
import org.hisp.dhis.dashboard.DashboardItemStore;
@@ -42,14 +44,11 @@
import org.hisp.dhis.mapping.Map;
import org.hisp.dhis.report.Report;
import org.hisp.dhis.reporttable.ReportTable;
-import org.hisp.dhis.commons.util.TextUtils;
import org.hisp.dhis.user.User;
import org.hisp.dhis.user.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
-import com.google.common.collect.Sets;
-
import java.util.HashSet;
import java.util.Set;
@@ -81,7 +80,7 @@
@Autowired
private IdentifiableObjectManager objectManager;
-
+
@Autowired
private UserService userService;
@@ -106,7 +105,7 @@
public DashboardSearchResult search( String query, Set<String> maxTypes )
{
Set<String> words = Sets.newHashSet( query.split( TextUtils.SPACE ) );
-
+
DashboardSearchResult result = new DashboardSearchResult();
result.setUsers( userService.getAllUsersBetweenByName( query, 0, getMax( TYPE_USERS, maxTypes ) ) );
@@ -130,11 +129,11 @@
{
return null;
}
-
+
DashboardItem item = new DashboardItem();
-
+
if ( TYPE_CHART.equals( type ) )
- {
+ {
item.setChart( objectManager.get( Chart.class, contentUid ) );
dashboard.getItems().add( 0, item );
}
@@ -232,7 +231,7 @@
{
item.setReportTable( objectManager.get( ReportTable.class, item.getReportTable().getUid() ) );
}
-
+
if ( item.getEventReport() != null )
{
item.setEventReport( objectManager.get( EventReport.class, item.getEventReport().getUid() ) );
@@ -298,7 +297,7 @@
{
dashboardItemStore.update( item );
}
-
+
@Override
public DashboardItem getDashboardItem( String uid )
{
@@ -310,7 +309,7 @@
{
dashboardItemStore.delete( item );
}
-
+
@Override
public int countMapDashboardItems( Map map )
{
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/dashboard/DashboardServiceTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/dashboard/DashboardServiceTest.java 2015-01-21 09:30:45 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/dashboard/DashboardServiceTest.java 2015-07-13 12:34:39 +0000
@@ -43,75 +43,81 @@
{
@Autowired
private DashboardService dashboardService;
-
+
@Autowired
private ChartService chartService;
-
+
@Autowired
private DocumentService documentService;
-
+
private Dashboard dA;
private Dashboard dB;
-
+
private DashboardItem diA;
private DashboardItem diB;
private DashboardItem diC;
private DashboardItem diD;
-
+
private Chart chartA;
private Chart chartB;
-
+
@Override
public void setUpTest()
{
chartA = new Chart( "A" );
chartB = new Chart( "B" );
-
+
chartService.addChart( chartA );
chartService.addChart( chartB );
-
+
Document docA = new Document( "A", "url", false, null );
Document docB = new Document( "B", "url", false, null );
Document docC = new Document( "C", "url", false, null );
Document docD = new Document( "D", "url", false, null );
-
+
documentService.saveDocument( docA );
documentService.saveDocument( docB );
documentService.saveDocument( docC );
documentService.saveDocument( docD );
-
+
diA = new DashboardItem();
+ diA.setAutoFields();
diA.setChart( chartA );
-
+
diB = new DashboardItem();
+ diB.setAutoFields();
diB.setChart( chartB );
-
+
diC = new DashboardItem();
+ diC.setAutoFields();
diC.getResources().add( docA );
diC.getResources().add( docB );
diD = new DashboardItem();
+ diD.setAutoFields();
diD.getResources().add( docC );
diD.getResources().add( docD );
-
+
dA = new Dashboard( "A" );
+ dA.setAutoFields();
dA.getItems().add( diA );
dA.getItems().add( diB );
dA.getItems().add( diC );
-
+
dB = new Dashboard( "B" );
+ dB.setAutoFields();
dB.getItems().add( diD );
}
-
+
@Test
public void testAddGet()
- {
+ {
int dAId = dashboardService.saveDashboard( dA );
int dBId = dashboardService.saveDashboard( dB );
-
+
assertEquals( dA, dashboardService.getDashboard( dAId ) );
assertEquals( dB, dashboardService.getDashboard( dBId ) );
-
+
assertEquals( 3, dashboardService.getDashboard( dAId ).getItems().size() );
assertEquals( 1, dashboardService.getDashboard( dBId ).getItems().size() );
}
@@ -120,11 +126,11 @@
public void testUpdate()
{
int dAId = dashboardService.saveDashboard( dA );
-
+
assertEquals( "A", dashboardService.getDashboard( dAId ).getName() );
-
+
dA.setName( "B" );
-
+
dashboardService.updateDashboard( dA );
assertEquals( "B", dashboardService.getDashboard( dAId ).getName() );
@@ -132,13 +138,13 @@
@Test
public void testDelete()
- {
+ {
int dAId = dashboardService.saveDashboard( dA );
int dBId = dashboardService.saveDashboard( dB );
-
+
assertNotNull( dashboardService.getDashboard( dAId ) );
assertNotNull( dashboardService.getDashboard( dBId ) );
-
+
dashboardService.deleteDashboard( dA );
assertNull( dashboardService.getDashboard( dAId ) );
@@ -147,17 +153,17 @@
dashboardService.deleteDashboard( dB );
assertNull( dashboardService.getDashboard( dAId ) );
- assertNull( dashboardService.getDashboard( dBId ) );
+ assertNull( dashboardService.getDashboard( dBId ) );
}
-
+
@Test
public void testAddItemContent()
{
dashboardService.saveDashboard( dA );
dashboardService.saveDashboard( dB );
-
+
DashboardItem itemA = dashboardService.addItemContent( dA.getUid(), DashboardItem.TYPE_CHART, chartA.getUid() );
-
+
assertNotNull( itemA );
assertNotNull( itemA.getUid() );
}