dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38991
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19792: Added DataDimensionType properties to CategoryOptionGroup and CategoryOptionGroupSet
------------------------------------------------------------
revno: 19792
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-08-19 07:13:46 -0400
message:
Added DataDimensionType properties to CategoryOptionGroup and CategoryOptionGroupSet
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupSet.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/CategoryOptionGroup.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/CategoryOptionGroupSet.hbm.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/AddCategoryOptionGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/AddCategoryOptionGroupSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupSetForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupSetForm.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/dataelement/CategoryOptionGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroup.java 2015-08-19 10:39:53 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroup.java 2015-08-19 11:13:46 +0000
@@ -34,9 +34,11 @@
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.attribute.AttributeValue;
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseNameableObject;
+import org.hisp.dhis.common.DataDimensionType;
import org.hisp.dhis.common.DxfNamespaces;
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.common.MergeStrategy;
@@ -59,6 +61,8 @@
private CategoryOptionGroupSet groupSet;
+ private DataDimensionType dataDimensionType;
+
/**
* Set of the dynamic attributes values that belong to this data element.
*/
@@ -128,6 +132,19 @@
this.groupSet = groupSet;
}
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public DataDimensionType getDataDimensionType()
+ {
+ return dataDimensionType;
+ }
+
+ public void setDataDimensionType( DataDimensionType dataDimensionType )
+ {
+ this.dataDimensionType = dataDimensionType;
+ }
+
@JsonProperty( "attributeValues" )
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlElementWrapper( localName = "attributeValues", namespace = DxfNamespaces.DXF_2_0 )
@@ -154,10 +171,12 @@
if ( strategy.isReplace() )
{
groupSet = categoryOptionGroup.getGroupSet();
+ dataDimensionType = categoryOptionGroup.getDataDimensionType();
}
else if ( strategy.isMerge() )
{
groupSet = categoryOptionGroup.getGroupSet() == null ? groupSet : categoryOptionGroup.getGroupSet();
+ dataDimensionType = categoryOptionGroup.getDataDimensionType() == null ? dataDimensionType : categoryOptionGroup.getDataDimensionType();
}
members.clear();
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupSet.java 2015-07-15 16:04:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupSet.java 2015-08-19 11:13:46 +0000
@@ -38,6 +38,7 @@
import org.apache.commons.collections.CollectionUtils;
import org.hisp.dhis.common.BaseDimensionalObject;
import org.hisp.dhis.common.BaseIdentifiableObject;
+import org.hisp.dhis.common.DataDimensionType;
import org.hisp.dhis.common.DimensionType;
import org.hisp.dhis.common.DxfNamespaces;
import org.hisp.dhis.common.IdentifiableObject;
@@ -62,13 +63,14 @@
@Scanned
private List<CategoryOptionGroup> members = new ArrayList<>();
+ private DataDimensionType dataDimensionType;
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
public CategoryOptionGroupSet()
{
-
}
public CategoryOptionGroupSet( String name )
@@ -138,6 +140,19 @@
this.members = members;
}
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public DataDimensionType getDataDimensionType()
+ {
+ return dataDimensionType;
+ }
+
+ public void setDataDimensionType( DataDimensionType dataDimensionType )
+ {
+ this.dataDimensionType = dataDimensionType;
+ }
+
// -------------------------------------------------------------------------
// Logic
// -------------------------------------------------------------------------
@@ -163,6 +178,15 @@
{
CategoryOptionGroupSet categoryOptionGroupSet = (CategoryOptionGroupSet) other;
+ if ( strategy.isReplace() )
+ {
+ dataDimensionType = categoryOptionGroupSet.getDataDimensionType();
+ }
+ else if ( strategy.isMerge() )
+ {
+ dataDimensionType = categoryOptionGroupSet.getDataDimensionType() == null ? dataDimensionType : categoryOptionGroupSet.getDataDimensionType();
+ }
+
members.clear();
for ( CategoryOptionGroup categoryOptionGroup : categoryOptionGroupSet.getMembers() )
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/CategoryOptionGroup.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/CategoryOptionGroup.hbm.xml 2015-08-19 03:02:24 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/CategoryOptionGroup.hbm.xml 2015-08-19 11:13:46 +0000
@@ -26,6 +26,8 @@
foreign-key="fk_categoryoptiongroupmembers_categoryoptiongroupid" />
</set>
+ <property name="dataDimensionType" column="datadimensiontype" type="org.hisp.dhis.common.DataDimensionTypeUserType" />
+
<!-- Dynamic attribute values -->
<set name="attributeValues" table="categoryoptiongroupattributevalues">
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/CategoryOptionGroupSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/CategoryOptionGroupSet.hbm.xml 2014-02-12 10:52:22 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/CategoryOptionGroupSet.hbm.xml 2015-08-19 11:13:46 +0000
@@ -29,6 +29,8 @@
foreign-key="fk_categoryoptiongroupsetmembers_categoryoptiongroupid" />
</list>
+ <property name="dataDimensionType" column="datadimensiontype" type="org.hisp.dhis.common.DataDimensionTypeUserType" />
+
<!-- Access properties -->
<many-to-one name="user" class="org.hisp.dhis.user.User" column="userid" foreign-key="fk_categoryoptiongroupset_userid" />
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/AddCategoryOptionGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/AddCategoryOptionGroupAction.java 2015-08-19 05:26:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/AddCategoryOptionGroupAction.java 2015-08-19 11:13:46 +0000
@@ -32,6 +32,7 @@
import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.common.DataDimensionType;
import org.hisp.dhis.dataelement.CategoryOptionGroup;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.system.util.AttributeUtils;
@@ -82,6 +83,13 @@
this.code = code;
}
+ private String dataDimensionType;
+
+ public void setDataDimensionType( String dataDimensionType )
+ {
+ this.dataDimensionType = dataDimensionType;
+ }
+
private Set<String> coSelected = new HashSet<>();
public void setCoSelected( Set<String> coSelected )
@@ -107,6 +115,7 @@
CategoryOptionGroup categoryOptionGroup = new CategoryOptionGroup( StringUtils.trimToNull( name ) );
categoryOptionGroup.setShortName( StringUtils.trimToNull( shortName ) );
categoryOptionGroup.setCode( StringUtils.trimToNull( code ) );
+ categoryOptionGroup.setDataDimensionType( DataDimensionType.valueOf( dataDimensionType ) );
for ( String id : coSelected )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/AddCategoryOptionGroupSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/AddCategoryOptionGroupSetAction.java 2015-03-11 11:01:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/AddCategoryOptionGroupSetAction.java 2015-08-19 11:13:46 +0000
@@ -31,6 +31,7 @@
import com.opensymphony.xwork2.Action;
import org.apache.commons.lang3.StringUtils;
+import org.hisp.dhis.common.DataDimensionType;
import org.hisp.dhis.dataelement.CategoryOptionGroup;
import org.hisp.dhis.dataelement.CategoryOptionGroupSet;
import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -78,6 +79,13 @@
{
this.dataDimension = dataDimension;
}
+
+ private String dataDimensionType;
+
+ public void setDataDimensionType( String dataDimensionType )
+ {
+ this.dataDimensionType = dataDimensionType;
+ }
private Set<String> cogSelected = new HashSet<>();
@@ -97,6 +105,7 @@
CategoryOptionGroupSet categoryOptionGroupSet = new CategoryOptionGroupSet( StringUtils.trimToNull( name ) );
categoryOptionGroupSet.setDescription( StringUtils.trimToNull( description ) );
categoryOptionGroupSet.setDataDimension( dataDimension );
+ categoryOptionGroupSet.setDataDimensionType( DataDimensionType.valueOf( dataDimensionType ) );
List<CategoryOptionGroup> members = new ArrayList<>();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupForm.vm 2015-08-19 05:26:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupForm.vm 2015-08-19 11:13:46 +0000
@@ -44,6 +44,15 @@
<td><label for="code">$i18n.getString( "code" )</label></td>
<td><input type="text" id="code" name="code" /></td>
</tr>
+ <tr>
+ <td><label>$i18n.getString( "data_dimension_type" )</td>
+ <td>
+ <select id="dataDimensionType" name="dataDimensionType">
+ <option value="DISAGGREGATION" selected="selected">$i18n.getString( "disaggregation" )</option>
+ <option value="ATTRIBUTE">$i18n.getString( "attribute" )</option>
+ </select>
+ </td>
+ </tr>
</table>
#tblDynamicAttributes( { "attributes": $attributes, "attributeValues": $attributeValues } )
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupSetForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupSetForm.vm 2014-09-26 06:23:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addCategoryOptionGroupSetForm.vm 2015-08-19 11:13:46 +0000
@@ -46,6 +46,15 @@
</select>
</td>
</tr>
+ <tr>
+ <td><label>$i18n.getString( "data_dimension_type" )</td>
+ <td>
+ <select id="dataDimensionType" name="dataDimensionType">
+ <option value="DISAGGREGATION" selected="selected">$i18n.getString( "disaggregation" )</option>
+ <option value="ATTRIBUTE">$i18n.getString( "attribute" )</option>
+ </select>
+ </td>
+ </tr>
</table>
#jqSelected({
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupForm.vm 2015-08-19 05:26:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupForm.vm 2015-08-19 11:13:46 +0000
@@ -57,6 +57,15 @@
<td><label for="code">$i18n.getString( "code" )</label></td>
<td><input type="text" id="code" name="code" value="$!encoder.htmlEncode( $categoryOptionGroup.code )"></td>
</tr>
+ <tr>
+ <td><label>$i18n.getString( "data_dimension_type" )</td>
+ <td>
+ <select id="dataDmensionType" name="dataDimensionType" disabled="disabled">
+ <option value="DISAGGREGATION"#if( "DISAGGREGATION" == $categoryOptionGroup.dataDimensionType ) selected="selected"#end>$i18n.getString( "disaggregation" )</option>
+ <option value="ATTRIBUTE"#if( "ATTRIBUTE" == $categoryOptionGroup.dataDimensionType ) selected="selected"#end>$i18n.getString( "attribute" )</option>
+ </select>
+ </td>
+ </tr>
</table>
#tblDynamicAttributes( { "attributes": $attributes, "attributeValues": $attributeValues } )
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupSetForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupSetForm.vm 2014-11-14 12:22:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateCategoryOptionGroupSetForm.vm 2015-08-19 11:13:46 +0000
@@ -54,6 +54,15 @@
</select>
</td>
</tr>
+ <tr>
+ <td><label>$i18n.getString( "data_dimension_type" )</td>
+ <td>
+ <select id="dataDmensionType" name="dataDimensionType" disabled="disabled">
+ <option value="DISAGGREGATION"#if( "DISAGGREGATION" == $categoryOptionGroupSet.dataDimensionType ) selected="selected"#end>$i18n.getString( "disaggregation" )</option>
+ <option value="ATTRIBUTE"#if( "ATTRIBUTE" == $categoryOptionGroupSet.dataDimensionType ) selected="selected"#end>$i18n.getString( "attribute" )</option>
+ </select>
+ </td>
+ </tr>
</table>
#jqSelected({