dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27665
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13773: wip, attributes for dataSets and orgUnitGroupSets
------------------------------------------------------------
revno: 13773
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-01-19 12:14:19 +0700
message:
wip, attributes for dataSets and orgUnitGroupSets
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/Attribute.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroupSet.hbm.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/AddAttributeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/UpdateAttributeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addAttributeForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateAttributeForm.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/attribute/Attribute.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java 2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java 2014-01-19 05:14:19 +0000
@@ -42,7 +42,7 @@
import java.util.Set;
/**
- * @author mortenoh
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@JacksonXmlRootElement( localName = "attributeType", namespace = DxfNamespaces.DXF_2_0 )
public class Attribute
@@ -63,10 +63,14 @@
private Boolean indicatorGroupAttribute = false;
+ private Boolean dataSetAttribute = false;
+
private boolean organisationUnitAttribute;
private Boolean organisationUnitGroupAttribute = false;
+ private Boolean organisationUnitGroupSetAttribute = false;
+
private boolean userAttribute;
private Boolean userGroupAttribute = false;
@@ -169,6 +173,19 @@
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public boolean isDataSetAttribute()
+ {
+ return dataSetAttribute == null ? false : dataSetAttribute;
+ }
+
+ public void setDataSetAttribute( Boolean dataSetAttribute )
+ {
+ this.dataSetAttribute = dataSetAttribute;
+ }
+
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public boolean isOrganisationUnitAttribute()
{
return organisationUnitAttribute;
@@ -195,6 +212,19 @@
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public boolean isOrganisationUnitGroupSetAttribute()
+ {
+ return organisationUnitGroupSetAttribute == null ? false : organisationUnitGroupSetAttribute;
+ }
+
+ public void setOrganisationUnitGroupSetAttribute( Boolean organisationUnitGroupSetAttribute )
+ {
+ this.organisationUnitGroupSetAttribute = organisationUnitGroupSetAttribute;
+ }
+
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public boolean isUserAttribute()
{
return userAttribute;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2014-01-09 10:09:43 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2014-01-19 05:14:19 +0000
@@ -35,6 +35,7 @@
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.DxfNamespaces;
@@ -179,6 +180,11 @@
*/
private boolean approveData;
+ /**
+ * Set of the dynamic attributes values that belong to this data element.
+ */
+ private Set<AttributeValue> attributeValues = new HashSet<AttributeValue>();
+
// -------------------------------------------------------------------------
// Form properties
// -------------------------------------------------------------------------
@@ -706,6 +712,20 @@
this.approveData = approveData;
}
+ @JsonProperty( value = "attributes" )
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlElementWrapper( localName = "attributes", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty( localName = "attribute", namespace = DxfNamespaces.DXF_2_0)
+ public Set<AttributeValue> getAttributeValues()
+ {
+ return attributeValues;
+ }
+
+ public void setAttributeValues( Set<AttributeValue> attributeValues )
+ {
+ this.attributeValues = attributeValues;
+ }
+
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
@@ -865,6 +885,9 @@
{
addOrganisationUnit( organisationUnit );
}
+
+ attributeValues.clear();
+ attributeValues.addAll( dataSet.getAttributeValues() );
}
}
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java 2013-12-30 09:44:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java 2014-01-19 05:14:19 +0000
@@ -34,6 +34,7 @@
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.BaseDimensionalObject;
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.DxfNamespaces;
@@ -76,6 +77,11 @@
private boolean dataDimension = true;
+ /**
+ * Set of the dynamic attributes values that belong to this data element.
+ */
+ private Set<AttributeValue> attributeValues = new HashSet<AttributeValue>();
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -267,6 +273,20 @@
this.dataDimension = dataDimension;
}
+ @JsonProperty( value = "attributes" )
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlElementWrapper( localName = "attributes", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty( localName = "attribute", namespace = DxfNamespaces.DXF_2_0)
+ public Set<AttributeValue> getAttributeValues()
+ {
+ return attributeValues;
+ }
+
+ public void setAttributeValues( Set<AttributeValue> attributeValues )
+ {
+ this.attributeValues = attributeValues;
+ }
+
@Override
public void mergeWith( IdentifiableObject other )
{
@@ -286,6 +306,9 @@
{
addOrganisationUnitGroup( organisationUnitGroup );
}
+
+ attributeValues.clear();
+ attributeValues.addAll( organisationUnitGroupSet.getAttributeValues() );
}
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/Attribute.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/Attribute.hbm.xml 2013-02-07 10:25:34 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/Attribute.hbm.xml 2014-01-19 05:14:19 +0000
@@ -29,10 +29,14 @@
<property name="indicatorGroupAttribute" not-null="false" />
+ <property name="dataSetAttribute" not-null="false" />
+
<property name="organisationUnitAttribute" not-null="true" />
<property name="organisationUnitGroupAttribute" not-null="false" />
+ <property name="organisationUnitGroupSetAttribute" not-null="false" />
+
<property name="userAttribute" not-null="true" />
<property name="userGroupAttribute" not-null="false" />
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml 2013-12-22 21:08:30 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml 2014-01-19 05:14:19 +0000
@@ -117,5 +117,13 @@
<many-to-one name="legendSet" class="org.hisp.dhis.mapping.MapLegendSet" column="legendsetid"
foreign-key="fk_indicator_legendset" />
+ <!-- Dynamic attribute values -->
+
+ <set name="attributeValues" table="datasetattributevalues">
+ <cache usage="read-write" />
+ <key column="datasetid" />
+ <many-to-many class="org.hisp.dhis.attribute.AttributeValue" column="attributevalueid" unique="true" />
+ </set>
+
</class>
</hibernate-mapping>
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroupSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroupSet.hbm.xml 2013-12-30 09:28:55 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroupSet.hbm.xml 2014-01-19 05:14:19 +0000
@@ -30,5 +30,13 @@
foreign-key="fk_orgunitgroupset_orgunitgroupid" />
</set>
+ <!-- Dynamic attribute values -->
+
+ <set name="attributeValues" table="orgunitgroupsetattributevalues">
+ <cache usage="read-write" />
+ <key column="orgunitgroupsetid" />
+ <many-to-many class="org.hisp.dhis.attribute.AttributeValue" column="attributevalueid" unique="true" />
+ </set>
+
</class>
</hibernate-mapping>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/AddAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/AddAttributeAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/AddAttributeAction.java 2014-01-19 05:14:19 +0000
@@ -33,7 +33,7 @@
import org.hisp.dhis.attribute.AttributeService;
/**
- * @author mortenoh
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
public class AddAttributeAction
implements Action
@@ -102,6 +102,13 @@
this.indicatorGroupAttribute = indicatorGroupAttribute;
}
+ private Boolean dataSetAttribute = false;
+
+ public void setDataSetAttribute( Boolean dataSetAttribute )
+ {
+ this.dataSetAttribute = dataSetAttribute;
+ }
+
private Boolean organisationUnitAttribute = false;
public void setOrganisationUnitAttribute( Boolean organisationUnitAttribute )
@@ -116,6 +123,13 @@
this.organisationUnitGroupAttribute = organisationUnitGroupAttribute;
}
+ private Boolean organisationUnitGroupSetAttribute = false;
+
+ public void setOrganisationUnitGroupSetAttribute( Boolean organisationUnitGroupSetAttribute )
+ {
+ this.organisationUnitGroupSetAttribute = organisationUnitGroupSetAttribute;
+ }
+
private Boolean userAttribute = false;
public void setUserAttribute( Boolean userAttribute )
@@ -143,8 +157,10 @@
attribute.setDataElementGroupAttribute( dataElementGroupAttribute );
attribute.setIndicatorAttribute( indicatorAttribute );
attribute.setIndicatorGroupAttribute( indicatorGroupAttribute );
+ attribute.setDataSetAttribute( dataSetAttribute );
attribute.setOrganisationUnitAttribute( organisationUnitAttribute );
attribute.setOrganisationUnitGroupAttribute( organisationUnitGroupAttribute );
+ attribute.setOrganisationUnitGroupSetAttribute( organisationUnitGroupSetAttribute );
attribute.setUserAttribute( userAttribute );
attribute.setUserGroupAttribute( userGroupAttribute );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/UpdateAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/UpdateAttributeAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/UpdateAttributeAction.java 2014-01-19 05:14:19 +0000
@@ -34,7 +34,7 @@
import com.opensymphony.xwork2.Action;
/**
- * @author mortenoh
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
public class UpdateAttributeAction
implements Action
@@ -110,6 +110,13 @@
this.indicatorGroupAttribute = indicatorGroupAttribute;
}
+ private Boolean dataSetAttribute = false;
+
+ public void setDataSetAttribute( Boolean dataSetAttribute )
+ {
+ this.dataSetAttribute = dataSetAttribute;
+ }
+
private Boolean organisationUnitAttribute = false;
public void setOrganisationUnitAttribute( Boolean organisationUnitAttribute )
@@ -124,6 +131,13 @@
this.organisationUnitGroupAttribute = organisationUnitGroupAttribute;
}
+ private Boolean organisationUnitGroupSetAttribute = false;
+
+ public void setOrganisationUnitGroupSetAttribute( Boolean organisationUnitGroupSetAttribute )
+ {
+ this.organisationUnitGroupSetAttribute = organisationUnitGroupSetAttribute;
+ }
+
private Boolean userAttribute = false;
public void setUserAttribute( Boolean userAttribute )
@@ -156,8 +170,10 @@
attribute.setDataElementGroupAttribute( dataElementGroupAttribute );
attribute.setIndicatorAttribute( indicatorAttribute );
attribute.setIndicatorGroupAttribute( indicatorGroupAttribute );
+ attribute.setDataSetAttribute( dataSetAttribute );
attribute.setOrganisationUnitAttribute( organisationUnitAttribute );
attribute.setOrganisationUnitGroupAttribute( organisationUnitGroupAttribute );
+ attribute.setOrganisationUnitGroupSetAttribute( organisationUnitGroupSetAttribute );
attribute.setUserAttribute( userAttribute );
attribute.setUserGroupAttribute( userGroupAttribute );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2013-10-21 17:17:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2014-01-19 05:14:19 +0000
@@ -252,6 +252,7 @@
indicator_group=Indicator Group
organisation_unit=Organisation Unit
organisation_unit_group=Organisation Unit Group
+organisation_unit_group_set=Organisation Unit Group Set
user=User
user_group=User Group
integer=Integer
@@ -337,4 +338,5 @@
locale_country_no_translation=Please select a country
data_monitoring=Data monitoring
data_monitoring_strategy=Data monitoring strategy
-last_hour=Last hour
\ No newline at end of file
+last_hour=Last hour
+data_set=Data Set
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addAttributeForm.vm 2012-10-18 13:27:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addAttributeForm.vm 2014-01-19 05:14:19 +0000
@@ -47,8 +47,10 @@
<input type="checkbox" id="dataElementGroupAttribute" name="dataElementGroupAttribute" value="true" /><label for="dataElementGroupAttribute">$i18n.getString( 'data_element_group' )</label> <br />
<input type="checkbox" id="indicatorAttribute" name="indicatorAttribute" value="true" /><label for="indicatorAttribute">$i18n.getString( 'indicator' )</label> <br />
<input type="checkbox" id="indicatorGroupAttribute" name="indicatorGroupAttribute" value="true" /><label for="indicatorGroupAttribute">$i18n.getString( 'indicator_group' )</label> <br />
+ <input type="checkbox" id="dataSetAttribute" name="dataSetAttribute" value="true" /><label for="dataSetAttribute">$i18n.getString( 'data_set' )</label> <br />
<input type="checkbox" id="organisationUnitAttribute" name="organisationUnitAttribute" value="true" /><label for="organisationUnitAttribute">$i18n.getString( 'organisation_unit' )</label> <br />
<input type="checkbox" id="organisationUnitGroupAttribute" name="organisationUnitGroupAttribute" value="true" /><label for="organisationUnitGroupAttribute">$i18n.getString( 'organisation_unit_group' )</label> <br />
+ <input type="checkbox" id="organisationUnitGroupSetAttribute" name="organisationUnitGroupSetAttribute" value="true" /><label for="organisationUnitGroupSetAttribute">$i18n.getString( 'organisation_unit_group_set' )</label> <br />
<input type="checkbox" id="userAttribute" name="userAttribute" value="true" /><label for="userAttribute">$i18n.getString( 'user' )</label> <br />
<input type="checkbox" id="userGroupAttribute" name="userGroupAttribute" value="true" /><label for="userGroupAttribute">$i18n.getString( 'user_group' )</label> <br />
</td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateAttributeForm.vm 2012-10-18 13:27:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateAttributeForm.vm 2014-01-19 05:14:19 +0000
@@ -48,8 +48,10 @@
<input type="checkbox" id="dataElementGroupAttribute" name="dataElementGroupAttribute" value="true" #if( $attribute.dataElementGroupAttribute ) checked="checked" #end /><label for="dataElementGroupAttribute">$i18n.getString( 'data_element_group' )</label> <br />
<input type="checkbox" id="indicatorAttribute" name="indicatorAttribute" value="true" #if( $attribute.indicatorAttribute ) checked="checked" #end /><label for="indicatorAttribute">$i18n.getString( 'indicator' )</label> <br />
<input type="checkbox" id="indicatorGroupAttribute" name="indicatorGroupAttribute" value="true" #if( $attribute.indicatorGroupAttribute ) checked="checked" #end /><label for="indicatorGroupAttribute">$i18n.getString( 'indicator_group' )</label> <br />
+ <input type="checkbox" id="dataSetAttribute" name="dataSetAttribute" value="true" #if( $attribute.dataSetAttribute ) checked="checked" #end /><label for="dataSetAttribute">$i18n.getString( 'data_set' )</label> <br />
<input type="checkbox" id="organisationUnitAttribute" name="organisationUnitAttribute" value="true" #if( $attribute.organisationUnitAttribute ) checked="checked" #end /><label for="organisationUnitAttribute">$i18n.getString( 'organisation_unit' )</label> <br />
<input type="checkbox" id="organisationUnitGroupAttribute" name="organisationUnitGroupAttribute" value="true" #if( $attribute.organisationUnitGroupAttribute ) checked="checked" #end /><label for="organisationUnitGroupAttribute">$i18n.getString( 'organisation_unit_group' )</label> <br />
+ <input type="checkbox" id="organisationUnitGroupSetAttribute" name="organisationUnitGroupSetAttribute" value="true" #if( $attribute.organisationUnitGroupSetAttribute ) checked="checked" #end /><label for="organisationUnitGroupSetAttribute">$i18n.getString( 'organisation_unit_group_set' )</label> <br />
<input type="checkbox" id="userAttribute" name="userAttribute" value="true" #if( $attribute.userAttribute ) checked="checked" #end /><label for="userAttribute">$i18n.getString( 'user' )</label> <br />
<input type="checkbox" id="userGroupAttribute" name="userGroupAttribute" value="true" #if( $attribute.userGroupAttribute ) checked="checked" #end /><label for="userGroupAttribute">$i18n.getString( 'user_group' )</label> <br />
</td>