=== 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-02-12 15:16:32 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java 2015-02-24 21:48:22 +0000 @@ -33,6 +33,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + import org.hisp.dhis.common.BaseDimensionalObject; import org.hisp.dhis.common.BaseIdentifiableObject; import org.hisp.dhis.common.DxfNamespaces; @@ -41,6 +42,7 @@ import org.hisp.dhis.common.view.DetailedView; import org.hisp.dhis.common.view.ExportView; import org.hisp.dhis.common.view.WithoutOrganisationUnitsView; +import org.hisp.dhis.legend.LegendSet; import org.hisp.dhis.option.Option; import org.hisp.dhis.option.OptionSet; import org.hisp.dhis.schema.annotation.PropertyRange; @@ -73,6 +75,8 @@ private TrackedEntityAttributeGroup attributeGroup; private OptionSet optionSet; + + private LegendSet legendSet; private String expression; @@ -331,6 +335,20 @@ } @JsonProperty + @JsonSerialize( as = BaseIdentifiableObject.class ) + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public LegendSet getLegendSet() + { + return legendSet; + } + + public void setLegendSet( LegendSet legendSet ) + { + this.legendSet = legendSet; + } + + @JsonProperty @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public Boolean getConfidential() === modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttribute.hbm.xml' --- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttribute.hbm.xml 2014-07-02 12:11:16 +0000 +++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttribute.hbm.xml 2015-02-24 21:48:22 +0000 @@ -27,6 +27,9 @@ + + === 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-02-19 09:18:17 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java 2015-02-24 21:48:22 +0000 @@ -29,6 +29,7 @@ */ import org.apache.commons.lang3.StringUtils; +import org.hisp.dhis.legend.LegendService; import org.hisp.dhis.option.OptionService; import org.hisp.dhis.period.PeriodService; import org.hisp.dhis.trackedentity.TrackedEntityAttribute; @@ -66,6 +67,9 @@ @Autowired private PeriodService periodService; + + @Autowired + private LegendService legendService; // ------------------------------------------------------------------------- // Input/Output @@ -133,6 +137,13 @@ { this.optionSetId = optionSetId; } + + private Integer legendSetId; + + public void setLegendSetId( Integer legendSetId ) + { + this.legendSetId = legendSetId; + } private Integer scope; @@ -196,6 +207,11 @@ { attribute.setOptionSet( optionService.getOptionSet( optionSetId ) ); } + + if ( legendSetId != null ) + { + attribute.setLegendSet( legendService.getLegendSet( legendSetId ) ); + } attributeService.addTrackedEntityAttribute( attribute ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/ShowAddAttributeFormAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/ShowAddAttributeFormAction.java 2015-01-17 07:41:26 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/ShowAddAttributeFormAction.java 2015-02-24 21:48:22 +0000 @@ -31,6 +31,8 @@ import java.util.ArrayList; import java.util.List; +import org.hisp.dhis.legend.LegendService; +import org.hisp.dhis.legend.LegendSet; import org.hisp.dhis.option.OptionService; import org.hisp.dhis.option.OptionSet; import org.hisp.dhis.period.PeriodService; @@ -61,6 +63,9 @@ @Autowired private OptionService optionService; + @Autowired + private LegendService legendService; + // ------------------------------------------------------------------------- // Output // ------------------------------------------------------------------------- @@ -79,6 +84,13 @@ return optionSets; } + private List legendSets; + + public List getLegendSets() + { + return legendSets; + } + // ------------------------------------------------------------------------- // Getters && Setters // ------------------------------------------------------------------------- @@ -88,7 +100,10 @@ throws Exception { periodTypes = periodService.getAllPeriodTypes(); - optionSets = new ArrayList<>(optionService.getAllOptionSets()); + + optionSets = new ArrayList<>( optionService.getAllOptionSets() ); + + legendSets = legendService.getAllLegendSets(); return SUCCESS; } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/ShowUpdateAttributeAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/ShowUpdateAttributeAction.java 2015-01-17 07:41:26 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/ShowUpdateAttributeAction.java 2015-02-24 21:48:22 +0000 @@ -32,6 +32,8 @@ import java.util.Collection; import java.util.List; +import org.hisp.dhis.legend.LegendService; +import org.hisp.dhis.legend.LegendSet; import org.hisp.dhis.option.OptionService; import org.hisp.dhis.option.OptionSet; import org.hisp.dhis.period.PeriodService; @@ -77,6 +79,9 @@ @Autowired private OptionService optionService; + + @Autowired + private LegendService legendService; // ------------------------------------------------------------------------- // Input/Output @@ -117,6 +122,13 @@ return optionSets; } + private List legendSets; + + public List getLegendSets() + { + return legendSets; + } + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -135,6 +147,8 @@ optionSets = new ArrayList<>( optionService.getAllOptionSets() ); + legendSets = legendService.getAllLegendSets(); + return SUCCESS; } } === 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-02-19 09:18:17 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java 2015-02-24 21:48:22 +0000 @@ -29,6 +29,7 @@ */ import org.apache.commons.lang3.StringUtils; +import org.hisp.dhis.legend.LegendService; import org.hisp.dhis.option.OptionService; import org.hisp.dhis.period.PeriodService; import org.hisp.dhis.trackedentity.TrackedEntityAttribute; @@ -67,6 +68,9 @@ @Autowired private PeriodService periodService; + @Autowired + private LegendService legendService; + // ------------------------------------------------------------------------- // Input/Output // ------------------------------------------------------------------------- @@ -127,6 +131,13 @@ this.optionSetId = optionSetId; } + private Integer legendSetId; + + public void setLegendSetId( Integer legendSetId ) + { + this.legendSetId = legendSetId; + } + private Boolean inherit; public void setInherit( Boolean inherit ) @@ -204,6 +215,11 @@ attribute.setOptionSet( optionService.getOptionSet( optionSetId ) ); } + if ( legendSetId != null ) + { + attribute.setLegendSet( legendService.getLegendSet( legendSetId ) ); + } + attributeService.updateTrackedEntityAttribute( attribute ); return SUCCESS; === 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-02-16 17:57:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties 2015-02-24 21:48:22 +0000 @@ -27,6 +27,7 @@ edit_tracked_entity_attribute=Edit tracked entity attribute attribute=Attribute value_type=Value type +legend_set=Legend set create_new_tracked_entity_attribute=Create new tracked entity attribute confirm_delete_tracked_entity_attribute=Are you sure you want to delete this tracked entity attribute? tracked_entity_attribute_management=Tracked entity attribute management === 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 2014-09-08 10:02:47 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeForm.vm 2015-02-24 21:48:22 +0000 @@ -97,6 +97,17 @@ + + + + + + === 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 2014-11-03 13:35:42 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.vm 2015-02-24 21:48:22 +0000 @@ -88,12 +88,23 @@ + + + + + +