dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33096
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16854: Analytics. Display property for org unit hierarchy.
------------------------------------------------------------
revno: 16854
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-09-29 18:28:57 +0200
message:
Analytics. Display property for org unit hierarchy.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/NameableObjectUtils.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/CompleteDataSetRegistrationServiceTest.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/common/DimensionalObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.java 2014-09-29 16:10:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.java 2014-09-29 16:28:57 +0000
@@ -100,13 +100,7 @@
* tables.
*/
String getDimensionName();
-
- /**
- * Gets the dimension display name, which is a readable name describing the
- * dimension.
- */
- String getDisplayName();
-
+
/**
* Dimension items.
*/
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/NameableObjectUtils.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/NameableObjectUtils.java 2014-09-25 15:46:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/NameableObjectUtils.java 2014-09-29 16:28:57 +0000
@@ -186,4 +186,26 @@
return map;
}
+
+ /**
+ * Returns a mapping between the uid and the short name of the given nameable
+ * objects.
+ *
+ * @param objects the v objects.
+ * @return mapping between the uid and the short name of the given objects.
+ */
+ public static Map<String, String> getUidShortNameMap( Collection<? extends NameableObject> objects )
+ {
+ Map<String, String> map = new HashMap<>();
+
+ if ( objects != null )
+ {
+ for ( NameableObject object : objects )
+ {
+ map.put( object.getUid(), object.getDisplayShortName() );
+ }
+ }
+
+ return map;
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2014-09-29 16:10:58 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2014-09-29 16:28:57 +0000
@@ -1235,7 +1235,7 @@
{
map.put( idObject.getUid(), idObject.getDisplayShortName() );
}
- else // NAME is default
+ else // NAME
{
map.put( idObject.getUid(), idObject.getDisplayName() );
}
@@ -1245,11 +1245,22 @@
{
OrganisationUnit unit = (OrganisationUnit) idObject;
- map.putAll( IdentifiableObjectUtils.getUidNameMap( unit.getAncestors() ) );
+ if ( DisplayProperty.SHORTNAME.equals( displayProperty ) )
+ {
+ map.putAll( NameableObjectUtils.getUidShortNameMap( unit.getAncestors() ) );
+ }
+ else // NAME
+ {
+ map.putAll( IdentifiableObjectUtils.getUidNameMap( unit.getAncestors() ) );
+ }
}
}
- if ( dimension.getDisplayName() != null )
+ if ( dimension.getDisplayShortName() != null && DisplayProperty.SHORTNAME.equals( displayProperty ) )
+ {
+ map.put( dimension.getDimension(), dimension.getDisplayShortName() );
+ }
+ else if ( dimension.getDisplayName() != null ) // NAME
{
map.put( dimension.getDimension(), dimension.getDisplayName() );
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/CompleteDataSetRegistrationServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/CompleteDataSetRegistrationServiceTest.java 2014-08-24 13:57:12 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/CompleteDataSetRegistrationServiceTest.java 2014-09-29 16:28:57 +0000
@@ -87,16 +87,6 @@
private Date onTimeA;
- private Date onTimeB;
-
- private Date deadlineA;
-
- private Date deadlineB;
-
- private Date tooLateA;
-
- private Date tooLateB;
-
private DataElementCategoryOptionCombo optionCombo;
// -------------------------------------------------------------------------
@@ -148,11 +138,6 @@
optionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
onTimeA = getDate( 2000, 1, 10 );
- onTimeB = getDate( 2000, 2, 10 );
- deadlineA = getDate( 2000, 1, 15 );
- deadlineB = getDate( 2000, 2, 15 );
- tooLateA = getDate( 2000, 1, 25 );
- tooLateB = getDate( 2000, 2, 25 );
}
// -------------------------------------------------------------------------