dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #35925
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18398: Added LegendSet assocation to TrackedEntityAttribute
------------------------------------------------------------
revno: 18398
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-02-24 22:48:22 +0100
message:
Added LegendSet assocation to TrackedEntityAttribute
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java
dhis-2/dhis-services/dhis-service-tracker/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/ShowAddAttributeFormAction.java
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/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-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 @@
<many-to-one name="optionSet" class="org.hisp.dhis.option.OptionSet"
column="optionsetid" foreign-key="fk_trackedentityattribute_optionsetid" />
+ <many-to-one name="legendSet" class="org.hisp.dhis.legend.LegendSet" column="legendsetid"
+ foreign-key="fk_dataelement_legendset" />
+
<property name="inherit" column="inherit" />
<property name="expression" column="expression" />
=== 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<LegendSet> legendSets;
+
+ public List<LegendSet> 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<LegendSet> legendSets;
+
+ public List<LegendSet> 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 @@
</td>
</tr>
+ <tr>
+ <td><label for="legendSetId">$i18n.getString( 'legend_set' )</label></td>
+ <td>
+ <select id="legendSetId" name="legendSetId">
+ <option>[$i18n.getString('please_select')]</option>
+ #foreach ( $legendSet in $legendSets )
+ <option value="$legendSet.id">$encoder.htmlEncode( $legendSet.name )</option>
+ #end
+ </select>
+ </td>
+ </tr>
</tbody>
<tr>
=== 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 @@
<td><label for="optionSetId">$i18n.getString( "option_set" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td><select id="optionSetId" name="optionSetId" class="{validate:{required:true}}">
#foreach($optionSet in $optionSets)
- <option value="$optionSet.id" #if($attribute.optionSet.id==$optionSet.id) selected #end>$encoder.htmlEncode($optionSet.name)</option>
+ <option value="$optionSet.id" #if($attribute.optionSet.id==$optionSet.id) selected#end>$encoder.htmlEncode($optionSet.name)</option>
#end
</select>
</td>
</tr>
+ <tr>
+ <td><label for="legendSetId">$i18n.getString( 'legend_set' )</label></td>
+ <td>
+ <select id="legendSetId" name="legendSetId">
+ <option>[$i18n.getString('please_select')]</option>
+ #foreach ( $legendSet in $legendSets )
+ <option value="$legendSet.id" #if($attribute.legendSet.id==$legendSet.id) selected#end>$encoder.htmlEncode( $legendSet.name )</option>
+ #end
+ </select>
+ </td>
+ </tr>
</tbody>
<tr>