dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38788
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19695: Tracked entity attribute, added aggregation type property
------------------------------------------------------------
revno: 19695
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2015-08-02 14:27:56 +0200
message:
Tracked entity attribute, added aggregation type property
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttribute.hbm.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.vm
--
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/trackedentity/TrackedEntityAttribute.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java 2015-07-15 09:45:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java 2015-08-02 12:27:56 +0000
@@ -34,6 +34,8 @@
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+
+import org.hisp.dhis.analytics.AggregationType;
import org.hisp.dhis.attribute.AttributeValue;
import org.hisp.dhis.common.BaseDimensionalObject;
import org.hisp.dhis.common.BaseIdentifiableObject;
@@ -71,6 +73,8 @@
private String description;
private String valueType;
+
+ private AggregationType aggregationType;
private Boolean inherit = false;
@@ -229,6 +233,19 @@
this.valueType = valueType;
}
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public AggregationType getAggregationType()
+ {
+ return aggregationType;
+ }
+
+ public void setAggregationType( AggregationType aggregationType )
+ {
+ this.aggregationType = aggregationType;
+ }
+
@JsonProperty( "trackedEntityAttributeGroup" )
@JsonView( { DetailedView.class } )
@JsonSerialize( as = BaseIdentifiableObject.class )
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java 2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/startup/TableAlteror.java 2015-08-02 12:27:56 +0000
@@ -266,10 +266,10 @@
+ "ON pa.trackedentityattributeid=trackedentityattribute.trackedentityattributeid "
+ "where trackedentityattribute.mandatory is not null" );
executeSql( "ALTER TABLE trackedentityattribute DROP COLUMN mandatory" );
-
executeSql( "ALTER TABLE trackedentityattribute DROP COLUMN groupBy" );
executeSql( "update trackedentityattribute set valuetype='string' where valuetype='combo' and optionsetid is null" );
+ executeSql( "update trackedentityattribute set aggregationype='AVERAGE' where aggregationtype is null" );
executeSql( "UPDATE trackedentityattribute SET valuetype='string' WHERE valuetype='localId';" );
executeSql( "UPDATE trackedentityattribute SET valuetype='number' WHERE valuetype='age'" );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttribute.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttribute.hbm.xml 2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttribute.hbm.xml 2015-08-02 12:27:56 +0000
@@ -20,7 +20,14 @@
<property name="description" type="text"/>
<property name="valueType" column="valuetype" not-null="true" />
-
+
+ <property name="aggregationType" length="40">
+ <type name="org.hibernate.type.EnumType">
+ <param name="enumClass">org.hisp.dhis.analytics.AggregationType</param>
+ <param name="type">12</param>
+ </type>
+ </property>
+
<many-to-one name="attributeGroup" class="org.hisp.dhis.trackedentity.TrackedEntityAttributeGroup"
column="trackedentityattributegroupid" foreign-key="fk_trackedentityattribute_attributegroupid" />
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java 2015-06-10 10:20:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java 2015-08-02 12:27:56 +0000
@@ -29,7 +29,9 @@
*/
import com.opensymphony.xwork2.Action;
+
import org.apache.commons.lang3.StringUtils;
+import org.hisp.dhis.analytics.AggregationType;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.legend.LegendService;
import org.hisp.dhis.option.OptionService;
@@ -119,6 +121,13 @@
{
this.valueType = valueType;
}
+
+ private String aggregationType;
+
+ public void setAggregationType( String aggregationType )
+ {
+ this.aggregationType = aggregationType;
+ }
private Boolean inherit;
@@ -198,6 +207,7 @@
trackedEntityAttribute.setCode( StringUtils.trimToNull( code ) );
trackedEntityAttribute.setDescription( StringUtils.trimToNull( description ) );
trackedEntityAttribute.setValueType( valueType );
+ trackedEntityAttribute.setAggregationType( AggregationType.fromValue( aggregationType ) );
trackedEntityAttribute.setExpression( expression );
trackedEntityAttribute.setDisplayOnVisitSchedule( false );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java 2015-06-19 06:20:43 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java 2015-08-02 12:27:56 +0000
@@ -29,7 +29,9 @@
*/
import com.opensymphony.xwork2.Action;
+
import org.apache.commons.lang3.StringUtils;
+import org.hisp.dhis.analytics.AggregationType;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.legend.LegendService;
import org.hisp.dhis.option.OptionService;
@@ -127,6 +129,13 @@
this.valueType = valueType;
}
+ private String aggregationType;
+
+ public void setAggregationType( String aggregationType )
+ {
+ this.aggregationType = aggregationType;
+ }
+
private Boolean unique;
public void setUnique( Boolean unique )
@@ -205,6 +214,7 @@
trackedEntityAttribute.setCode( StringUtils.trimToNull( code ) );
trackedEntityAttribute.setDescription( StringUtils.trimToNull( description ) );
trackedEntityAttribute.setValueType( valueType );
+ trackedEntityAttribute.setAggregationType( AggregationType.fromValue( aggregationType ) );
trackedEntityAttribute.setExpression( expression );
trackedEntityAttribute.setDisplayOnVisitSchedule( false );
trackedEntityAttribute.setOptionSet( null );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties 2015-07-19 19:20:06 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties 2015-08-02 12:27:56 +0000
@@ -550,4 +550,5 @@
select_program_stage=Select program stage
tei_attribute = Tracked entity attribute
design_custom_registration_form=Design custom registration form
-program_registration_form=Program registration form
\ No newline at end of file
+program_registration_form=Program registration form
+aggregation_type=Aggregation type
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeForm.vm 2015-04-08 23:26:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeForm.vm 2015-08-02 12:27:56 +0000
@@ -91,7 +91,7 @@
<option value="string">$i18n.getString( "text" )</option>
<option value="letter">$i18n.getString( "letter_only" )</option>
<option value="bool">$i18n.getString( "yes_no" )</option>
- <option value="trueOnly">$i18n.getString( "yes_only" )</option>
+ <option value="trueOnly">$i18n.getString( "yes_only" )</option>
<option value="date">$i18n.getString( "date" )</option>
<option value="phoneNumber">$i18n.getString( "phone_number" )</option>
<option value="phoneNumber">$i18n.getString( "email" )</option>
@@ -101,7 +101,22 @@
</select>
</td>
<td></td>
- </tr>
+ </tr>
+
+ <tr>
+ <td><label for="aggregationType">$i18n.getString( "aggregation_type" )</label></td>
+ <td>
+ <select id="aggregationType" name="aggregationType">
+ <option value="AVERAGE">$i18n.getString( "average" )</option>
+ <option value="SUM">$i18n.getString( "sum" )</option>
+ <option value="COUNT">$i18n.getString( "count" )</option>
+ <option value="STDDEV">$i18n.getString( "stddev" )</option>
+ <option value="VARIANCE">$i18n.getString( "variance" )</option>
+ <option value="MIN">$i18n.getString( "min" )</option>
+ <option value="MAX">$i18n.getString( "max" )</option>
+ </select>
+ </td>
+ </tr>
<tr id="optionSetRow" class="hidden">
<td><label for="optionSetId">$i18n.getString( "option_set" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.vm 2015-04-08 23:26:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.vm 2015-08-02 12:27:56 +0000
@@ -87,14 +87,29 @@
<option value="number" #if( $attribute.valueType == 'number' ) selected="selected" #end>$i18n.getString( "number" )</option>
<option value="string" #if( $attribute.valueType == 'string' ) selected="selected" #end>$i18n.getString( "text" )</option>
<option value="letter" #if( $attribute.valueType == 'letter' ) selected="selected" #end>$i18n.getString( "letter_only" )</option>
- <option value="bool" #if( $attribute.unique=='true' ) style='display:none' #end #if( $attribute.valueType == 'bool' ) selected="selected" #end>$i18n.getString( "yes_no" )</option>
+ <option value="bool" #if( $attribute.unique=='true' ) style='display:none' #end #if( $attribute.valueType == 'bool' ) selected="selected" #end>$i18n.getString( "yes_no" )</option>
<option value="trueOnly" #if( $attribute.unique=='true' ) style='display:none' #end #if( $attribute.valueType == 'trueOnly' ) selected="selected" #end >$i18n.getString( "yes_only" )</option>
- <option value="date" #if( $attribute.unique=='true' ) style='display:none' #end #if( $attribute.valueType == 'date' ) selected="selected" #end>$i18n.getString( "date" )</option>
+ <option value="date" #if( $attribute.unique=='true' ) style='display:none' #end #if( $attribute.valueType == 'date' ) selected="selected" #end>$i18n.getString( "date" )</option>
<option value="phoneNumber" #if( $attribute.valueType == 'phoneNumber' ) selected="selected" #end>$i18n.getString( "phone_number" )</option>
<option value="email" #if( $attribute.valueType == 'email' ) selected="selected" #end>$i18n.getString( "email" )</option>
- <option value="trackerAssociate" #if( $attribute.unique=='true' ) style='display:none' #end #if( $attribute.valueType == 'trackerAssociate' ) selected="selected" #end>$i18n.getString( "tracker_associate" )</option>
- <option value="users" #if( $attribute.unique=='true' ) style='display:none' #end #if( $attribute.valueType == 'users' ) selected="selected" #end>$i18n.getString( "users" )</option>
- <option value="optionSet" #if( $attribute.unique=='true' ) style='display:none' #end #if( $attribute.valueType == 'optionSet' ) selected="selected" #end>$i18n.getString( "option_set" )</option>
+ <option value="trackerAssociate" #if( $attribute.unique=='true' ) style='display:none' #end #if( $attribute.valueType == 'trackerAssociate' ) selected="selected" #end>$i18n.getString( "tracker_associate" )</option>
+ <option value="users" #if( $attribute.unique=='true' ) style='display:none' #end #if( $attribute.valueType == 'users' ) selected="selected" #end>$i18n.getString( "users" )</option>
+ <option value="optionSet" #if( $attribute.unique=='true' ) style='display:none' #end #if( $attribute.valueType == 'optionSet' ) selected="selected" #end>$i18n.getString( "option_set" )</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td><label for="aggregationType">$i18n.getString( "aggregation_type" )</label></td>
+ <td>
+ <select id="aggregationType" name="aggregationType">
+ <option value="AVERAGE"#if( $attribute.aggregationType == 'AVERAGE' ) selected="selected"#end>$i18n.getString( "average" )</option>
+ <option value="SUM"#if( $attribute.aggregationType == 'SUM' ) selected="selected"#end>$i18n.getString( "sum" )</option>
+ <option value="COUNT"#if( $attribute.aggregationType == 'COUNT' ) selected="selected"#end>$i18n.getString( "count" )</option>
+ <option value="STDDEV"#if( $attribute.aggregationType == 'STDDEV' ) selected="selected"#end>$i18n.getString( "stddev" )</option>
+ <option value="VARIANCE"#if( $attribute.aggregationType == 'VARIANCE' ) selected="selected"#end>$i18n.getString( "variance" )</option>
+ <option value="MIN"#if( $attribute.aggregationType == 'MIN' ) selected="selected"#end>$i18n.getString( "min" )</option>
+ <option value="MAX"#if( $attribute.aggregationType == 'MAX' ) selected="selected"#end>$i18n.getString( "max" )</option>
</select>
</td>
</tr>