dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33546
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17137: Added property optionSet to grid headers / in analytics
------------------------------------------------------------
revno: 17137
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-10-16 14:28:42 +0200
message:
Added property optionSet to grid headers / in analytics
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GridHeader.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryItem.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java
dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.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/GridHeader.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GridHeader.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GridHeader.java 2014-10-16 12:28:42 +0000
@@ -52,6 +52,12 @@
private boolean hidden;
private boolean meta;
+
+ private boolean optionSet;
+
+ // -------------------------------------------------------------------------
+ // Constructors
+ // -------------------------------------------------------------------------
public GridHeader()
{
@@ -114,11 +120,37 @@
this.meta = meta;
}
+ /**
+ * @param name name
+ * @param column column
+ * @param type type
+ * @param hidden hidden
+ * @param meta meta
+ * @param optionSet optionSet
+ */
+ public GridHeader( String name, String column, String type, boolean hidden, boolean meta, boolean optionSet )
+ {
+ this.name = name;
+ this.column = column;
+ this.type = type;
+ this.hidden = hidden;
+ this.meta = meta;
+ this.optionSet = optionSet;
+ }
+
+ // -------------------------------------------------------------------------
+ // Logic
+ // -------------------------------------------------------------------------
+
public boolean isNumeric()
{
return type != null && NUMERIC_TYPES.contains( type );
}
+ // -------------------------------------------------------------------------
+ // Getters and setters
+ // -------------------------------------------------------------------------
+
@JsonProperty
@JsonView( {DetailedView.class} )
public String getName()
@@ -179,12 +211,22 @@
this.meta = meta;
}
- @Override
- public String toString()
- {
- return "[Name: " + name + ", column: " + column + ", type: " + type + "]";
- }
-
+ @JsonProperty
+ @JsonView( {DetailedView.class} )
+ public boolean isOptionSet()
+ {
+ return optionSet;
+ }
+
+ public void setOptionSet( boolean optionSet )
+ {
+ this.optionSet = optionSet;
+ }
+
+ // -------------------------------------------------------------------------
+ // hashCode, equals, toString
+ // -------------------------------------------------------------------------
+
@Override
public int hashCode()
{
@@ -213,4 +255,10 @@
return name.equals( other.name );
}
+
+ @Override
+ public String toString()
+ {
+ return "[Name: " + name + ", column: " + column + ", type: " + type + "]";
+ }
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryItem.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryItem.java 2014-10-15 17:31:32 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryItem.java 2014-10-16 12:28:42 +0000
@@ -45,6 +45,8 @@
private List<QueryFilter> filters = new ArrayList<>();
private boolean numeric;
+
+ private boolean optionSet;
// -------------------------------------------------------------------------
// Constructors
@@ -55,16 +57,18 @@
this.item = item;
}
- public QueryItem( NameableObject item, boolean numeric )
+ public QueryItem( NameableObject item, boolean numeric, boolean optionSet )
{
this.item = item;
this.numeric = numeric;
+ this.optionSet = optionSet;
}
- public QueryItem( NameableObject item, QueryOperator operator, String filter, boolean numeric )
+ public QueryItem( NameableObject item, QueryOperator operator, String filter, boolean numeric, boolean optionSet )
{
this.item = item;
this.numeric = numeric;
+ this.optionSet = optionSet;
if ( operator != null && filter != null )
{
@@ -72,11 +76,12 @@
}
}
- public QueryItem( NameableObject item, List<QueryFilter> filters, boolean numeric )
+ public QueryItem( NameableObject item, List<QueryFilter> filters, boolean numeric, boolean optionSet )
{
this.item = item;
this.filters = filters;
this.numeric = numeric;
+ this.optionSet = optionSet;
}
// -------------------------------------------------------------------------
@@ -104,7 +109,7 @@
for ( NameableObject object : objects )
{
- queryItems.add( new QueryItem( object, false ) );
+ queryItems.add( new QueryItem( object, false, false ) );
}
return queryItems;
@@ -146,7 +151,7 @@
@Override
public String toString()
{
- return "[Item: " + item + ", filters: " + filters + "]";
+ return "[Item: " + item + ", filters: " + filters + ", numeric: " + numeric + ", optionSet: " + optionSet + "]";
}
// -------------------------------------------------------------------------
@@ -182,4 +187,14 @@
{
this.numeric = numeric;
}
+
+ public boolean isOptionSet()
+ {
+ return optionSet;
+ }
+
+ public void setOptionSet( boolean optionSet )
+ {
+ this.optionSet = optionSet;
+ }
}
=== 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 2014-10-16 06:17:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java 2014-10-16 12:28:42 +0000
@@ -141,6 +141,14 @@
return TYPE_NUMBER.equals( valueType );
}
+ /**
+ * Indicates whether this attribute has an option set.
+ */
+ public boolean hasOptionSet()
+ {
+ return optionSet != null;
+ }
+
// -------------------------------------------------------------------------
// Getters and setters
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java 2014-10-16 06:17:19 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java 2014-10-16 12:28:42 +0000
@@ -274,7 +274,7 @@
for ( QueryItem item : params.getItems() )
{
- grid.addHeader( new GridHeader( item.getItem().getUid(), item.getItem().getName(), item.getTypeAsString() ) );
+ grid.addHeader( new GridHeader( item.getItem().getUid(), item.getItem().getName(), item.getTypeAsString(), false, true, item.isOptionSet() ) );
}
// ---------------------------------------------------------------------
@@ -647,14 +647,14 @@
if ( de != null ) //TODO check if part of program
{
- return new QueryItem( de, de.isNumericType() );
+ return new QueryItem( de, de.isNumericType(), de.hasOptionSet() );
}
TrackedEntityAttribute at = attributeService.getTrackedEntityAttribute( item );
if ( at != null )
{
- return new QueryItem( at, at.isNumericType() );
+ return new QueryItem( at, at.isNumericType(), at.hasOptionSet() );
}
throw new IllegalQueryException( "Item identifier does not reference any item part of the program: " + item );
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java 2014-10-16 09:11:20 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java 2014-10-16 12:28:42 +0000
@@ -574,7 +574,7 @@
TrackedEntityInstanceQueryParams params = new TrackedEntityInstanceQueryParams();
- QueryItem queryItem = new QueryItem( attribute, QueryOperator.EQ, value, false );
+ QueryItem queryItem = new QueryItem( attribute, QueryOperator.EQ, value, attribute.isNumericType(), attribute.hasOptionSet() );
params.addAttribute( queryItem );
if ( attribute.getOrgunitScope() && attribute.getProgramScope() )
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java 2014-09-17 14:51:26 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java 2014-10-16 12:28:42 +0000
@@ -352,7 +352,7 @@
TrackedEntityInstanceQueryParams params = new TrackedEntityInstanceQueryParams();
- QueryItem queryItem = new QueryItem( attribute, QueryOperator.EQ, value, false );
+ QueryItem queryItem = new QueryItem( attribute, QueryOperator.EQ, value, attribute.isNumericType(), attribute.hasOptionSet() );
params.addAttribute( queryItem );
if ( attribute.getOrgunitScope() )
=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2014-10-16 06:17:19 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2014-10-16 12:28:42 +0000
@@ -1576,7 +1576,7 @@
else
{
TrackedEntityAttribute at = attributeService.getTrackedEntityAttributeByName( split[0] );
- QueryItem queryItem = new QueryItem( at, at.isNumericType() );
+ QueryItem queryItem = new QueryItem( at, at.isNumericType(), at.hasOptionSet() );
QueryOperator operator = QueryOperator.fromString( split[1] );
queryItem.getFilters().add( new QueryFilter( operator, split[2] ) );
param.getFilters().add( queryItem );
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java 2014-10-16 06:17:19 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java 2014-10-16 12:28:42 +0000
@@ -492,7 +492,7 @@
throw new IllegalQueryException( "Attribute does not exist: " + item );
}
- return new QueryItem( at, at.isNumericType() );
+ return new QueryItem( at, at.isNumericType(), at.hasOptionSet() );
}
/**