dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17686
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7133: Addded attributeValues for dataElementGroup, indicatorGroup, organisationUnitGroup and userGroup ...
------------------------------------------------------------
revno: 7133
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-06-01 13:35:55 +0200
message:
Addded attributeValues for dataElementGroup, indicatorGroup, organisationUnitGroup and userGroup (and updated stores/services) on the service layer. On the web layer only dataElementGroups are supported for now (rest is coming)
removed:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementGroupForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementGroupForm.js
added:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/ShowAddDataElementGroupForm.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserGroup.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeStore.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/dataelement/hibernate/DataElementGroup.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroup.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroup.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserGroup.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
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/AddDataElementGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/GetDataElementGroupListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/ShowDataElementGroupEditorAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/ShowUpdateDataElementGroupFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/UpdateDataElementGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/AddIndicatorGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/UpdateIndicatorGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementGroupForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementGroupForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/AddOrganisationUnitGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/UpdateOrganisationUnitGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/META-INF/dhis/beans.xml
--
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 2012-05-17 09:11:30 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java 2012-06-01 11:35:55 +0000
@@ -56,12 +56,20 @@
private boolean dataElementAttribute;
+ private Boolean dataElementGroupAttribute = false;
+
private boolean indicatorAttribute;
+ private Boolean indicatorGroupAttribute = false;
+
private boolean organisationUnitAttribute;
+ private Boolean organisationUnitGroupAttribute = false;
+
private boolean userAttribute;
+ private Boolean userGroupAttribute = false;
+
private boolean mandatory;
private Integer sortOrder;
@@ -80,7 +88,7 @@
}
@JsonProperty
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public String getValueType()
{
@@ -93,7 +101,7 @@
}
@JsonProperty
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public boolean isMandatory()
{
@@ -106,7 +114,7 @@
}
@JsonProperty
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public boolean isDataElementAttribute()
{
@@ -119,7 +127,20 @@
}
@JsonProperty
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
+ public boolean isDataElementGroupAttribute()
+ {
+ return dataElementGroupAttribute == null ? false : dataElementGroupAttribute;
+ }
+
+ public void setDataElementGroupAttribute( Boolean dataElementGroupAttribute )
+ {
+ this.dataElementGroupAttribute = dataElementGroupAttribute;
+ }
+
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public boolean isIndicatorAttribute()
{
@@ -132,7 +153,20 @@
}
@JsonProperty
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
+ public boolean isIndicatorGroupAttribute()
+ {
+ return indicatorGroupAttribute == null ? false : indicatorGroupAttribute;
+ }
+
+ public void setIndicatorGroupAttribute( Boolean indicatorGroupAttribute )
+ {
+ this.indicatorGroupAttribute = indicatorGroupAttribute;
+ }
+
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public boolean isOrganisationUnitAttribute()
{
@@ -145,7 +179,20 @@
}
@JsonProperty
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
+ public boolean isOrganisationUnitGroupAttribute()
+ {
+ return organisationUnitGroupAttribute == null ? false : organisationUnitGroupAttribute;
+ }
+
+ public void setOrganisationUnitGroupAttribute( Boolean organisationUnitGroupAttribute )
+ {
+ this.organisationUnitGroupAttribute = organisationUnitGroupAttribute;
+ }
+
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public boolean isUserAttribute()
{
@@ -157,6 +204,19 @@
this.userAttribute = userAttribute;
}
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
+ public boolean isUserGroupAttribute()
+ {
+ return userGroupAttribute == null ? false : userGroupAttribute;
+ }
+
+ public void setUserGroupAttribute( Boolean userGroupAttribute )
+ {
+ this.userGroupAttribute = userGroupAttribute;
+ }
+
public Set<AttributeValue> getAttributeValues()
{
return attributeValues;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java 2012-06-01 11:35:55 +0000
@@ -56,12 +56,20 @@
Set<Attribute> getDataElementAttributes();
+ Set<Attribute> getDataElementGroupAttributes();
+
Set<Attribute> getIndicatorAttributes();
+ Set<Attribute> getIndicatorGroupAttributes();
+
Set<Attribute> getOrganisationUnitAttributes();
+ Set<Attribute> getOrganisationUnitGroupAttributes();
+
Set<Attribute> getUserAttributes();
+ Set<Attribute> getUserGroupAttributes();
+
int getAttributeCount();
int getAttributeCountByName( String name );
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java 2012-06-01 11:35:55 +0000
@@ -47,6 +47,13 @@
Set<Attribute> getDataElementAttributes();
/**
+ * Get all attributes that are enabled for data element groups.
+ *
+ * @return All attributes with attribute.dataElementGroup = true
+ */
+ Set<Attribute> getDataElementGroupAttributes();
+
+ /**
* Get all attributes that are enabled for indicators.
*
* @return All attributes with attribute.indicator = true
@@ -54,6 +61,13 @@
Set<Attribute> getIndicatorAttributes();
/**
+ * Get all attributes that are enabled for indicator groups.
+ *
+ * @return All attributes with attribute.indicatorGroup = true
+ */
+ Set<Attribute> getIndicatorGroupAttributes();
+
+ /**
* Get all attributes that are enabled for organisation units.
*
* @return All attributes with attribute.organisationUnit = true
@@ -61,9 +75,23 @@
Set<Attribute> getOrganisationUnitAttributes();
/**
+ * Get all attributes that are enabled for organisation unit groups.
+ *
+ * @return All attributes with attribute.organisationUnitGroup = true
+ */
+ Set<Attribute> getOrganisationUnitGroupAttributes();
+
+ /**
* Get all attributes that are enabled for users.
*
* @return All attributes with attribute.organisationUnit = true
*/
Set<Attribute> getUserAttributes();
+
+ /**
+ * Get all attributes that are enabled for user group.
+ *
+ * @return All attributes with attribute.organisationUnitGroup = true
+ */
+ Set<Attribute> getUserGroupAttributes();
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2012-05-28 21:23:50 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2012-06-01 11:35:55 +0000
@@ -27,13 +27,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.dataset.DataSet.NO_EXPIRY;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonView;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+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;
@@ -46,12 +45,12 @@
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.period.YearlyPeriodType;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonView;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-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 java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.hisp.dhis.dataset.DataSet.NO_EXPIRY;
/**
* A DataElement is a definition (meta-information about) of the entities that
@@ -236,16 +235,6 @@
// Logic
// -------------------------------------------------------------------------
- public void removeAllAttributeValues()
- {
- attributeValues.clear();
- }
-
- public void removeAllCategoryLevels()
- {
- aggregationLevels.clear();
- }
-
public void addDataElementGroup( DataElementGroup group )
{
groups.add( group );
@@ -412,7 +401,7 @@
// -------------------------------------------------------------------------
@JsonProperty
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public String getFormName()
{
@@ -425,7 +414,7 @@
}
@JsonProperty
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public boolean isActive()
{
@@ -438,7 +427,7 @@
}
@JsonProperty
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public String getDomainType()
{
@@ -451,7 +440,7 @@
}
@JsonProperty
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public String getType()
{
@@ -464,7 +453,7 @@
}
@JsonProperty
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public String getAggregationOperator()
{
@@ -478,7 +467,7 @@
@JsonProperty
@JsonSerialize( as = BaseIdentifiableObject.class )
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public DataElementCategoryCombo getCategoryCombo()
{
@@ -501,7 +490,7 @@
}
@JsonProperty
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public String getUrl()
{
@@ -515,7 +504,7 @@
@JsonProperty( value = "dataElementGroups" )
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
- @JsonView( {DetailedView.class} )
+ @JsonView( { DetailedView.class } )
@JacksonXmlElementWrapper( localName = "dataElementGroups", namespace = Dxf2Namespace.NAMESPACE )
@JacksonXmlProperty( localName = "dataElementGroup", namespace = Dxf2Namespace.NAMESPACE )
public Set<DataElementGroup> getGroups()
@@ -530,7 +519,7 @@
@JsonProperty
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
- @JsonView( {DetailedView.class} )
+ @JsonView( { DetailedView.class } )
@JacksonXmlElementWrapper( localName = "dataSets", namespace = Dxf2Namespace.NAMESPACE )
@JacksonXmlProperty( localName = "dataSet", namespace = Dxf2Namespace.NAMESPACE )
public Set<DataSet> getDataSets()
@@ -544,7 +533,7 @@
}
@JsonProperty
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public List<Integer> getAggregationLevels()
{
@@ -557,7 +546,7 @@
}
@JsonProperty
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public boolean isZeroIsSignificant()
{
@@ -570,7 +559,7 @@
}
@JsonProperty
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public String getNumberType()
{
@@ -583,7 +572,7 @@
}
@JsonProperty( value = "attributes" )
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlElementWrapper( localName = "attributes", namespace = Dxf2Namespace.NAMESPACE )
@JacksonXmlProperty( localName = "attribute", namespace = Dxf2Namespace.NAMESPACE )
public Set<AttributeValue> getAttributeValues()
@@ -598,7 +587,7 @@
@JsonProperty
@JsonSerialize( as = BaseIdentifiableObject.class )
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public OptionSet getOptionSet()
{
@@ -634,10 +623,10 @@
groups.clear();
dataSets.clear();
- removeAllCategoryLevels();
+ aggregationLevels.clear();
aggregationLevels.addAll( dataElement.getAggregationLevels() );
- removeAllAttributeValues();
+ attributeValues.clear();
attributeValues.addAll( dataElement.getAttributeValues() );
}
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java 2012-05-08 17:24:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroup.java 2012-06-01 11:35:55 +0000
@@ -33,6 +33,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.Dxf2Namespace;
import org.hisp.dhis.common.IdentifiableObject;
@@ -60,6 +61,11 @@
private DataElementGroupSet groupSet;
+ /**
+ * Set of the dynamic attributes values that belong to this dataElement group.
+ */
+ private Set<AttributeValue> attributeValues = new HashSet<AttributeValue>();
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -160,7 +166,7 @@
@JsonProperty( value = "dataElements" )
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlElementWrapper( localName = "dataElements", namespace = Dxf2Namespace.NAMESPACE )
@JacksonXmlProperty( localName = "dataElement", namespace = Dxf2Namespace.NAMESPACE )
public Set<DataElement> getMembers()
@@ -175,7 +181,7 @@
@JsonProperty( value = "dataElementGroupSet" )
@JsonSerialize( as = BaseIdentifiableObject.class )
- @JsonView( {DetailedView.class} )
+ @JsonView( { DetailedView.class } )
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public DataElementGroupSet getGroupSet()
{
@@ -187,6 +193,20 @@
this.groupSet = groupSet;
}
+ @JsonProperty( value = "attributes" )
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlElementWrapper( localName = "attributes", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "attribute", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<AttributeValue> getAttributeValues()
+ {
+ return attributeValues;
+ }
+
+ public void setAttributeValues( Set<AttributeValue> attributeValues )
+ {
+ this.attributeValues = attributeValues;
+ }
+
@Override
public void mergeWith( IdentifiableObject other )
{
@@ -204,6 +224,9 @@
{
addDataElement( dataElement );
}
+
+ attributeValues.clear();
+ attributeValues.addAll( dataElementGroup.getAttributeValues() );
}
}
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java 2012-05-08 17:24:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroup.java 2012-06-01 11:35:55 +0000
@@ -33,6 +33,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.Dxf2Namespace;
import org.hisp.dhis.common.IdentifiableObject;
@@ -60,6 +61,11 @@
private IndicatorGroupSet groupSet;
+ /**
+ * Set of the dynamic attributes values that belong to this indicator group.
+ */
+ private Set<AttributeValue> attributeValues = new HashSet<AttributeValue>();
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -159,7 +165,7 @@
@JsonProperty( value = "indicators" )
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlElementWrapper( localName = "indicators", namespace = Dxf2Namespace.NAMESPACE )
@JacksonXmlProperty( localName = "indicator", namespace = Dxf2Namespace.NAMESPACE )
public Set<Indicator> getMembers()
@@ -174,7 +180,7 @@
@JsonProperty( value = "indicatorGroupSet" )
@JsonSerialize( as = BaseIdentifiableObject.class )
- @JsonView( {DetailedView.class} )
+ @JsonView( { DetailedView.class } )
@JacksonXmlProperty( localName = "indicatorGroupSet", namespace = Dxf2Namespace.NAMESPACE )
public IndicatorGroupSet getGroupSet()
{
@@ -186,6 +192,20 @@
this.groupSet = groupSet;
}
+ @JsonProperty( value = "attributes" )
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlElementWrapper( localName = "attributes", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "attribute", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<AttributeValue> getAttributeValues()
+ {
+ return attributeValues;
+ }
+
+ public void setAttributeValues( Set<AttributeValue> attributeValues )
+ {
+ this.attributeValues = attributeValues;
+ }
+
@Override
public void mergeWith( IdentifiableObject other )
{
@@ -203,6 +223,9 @@
{
addIndicator( indicator );
}
+
+ attributeValues.clear();
+ attributeValues.addAll( indicatorGroup.getAttributeValues() );
}
}
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java 2012-05-08 17:24:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java 2012-06-01 11:35:55 +0000
@@ -33,6 +33,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.Dxf2Namespace;
@@ -61,6 +62,11 @@
private OrganisationUnitGroupSet groupSet;
+ /**
+ * Set of the dynamic attributes values that belong to this organisationUnit group.
+ */
+ private Set<AttributeValue> attributeValues = new HashSet<AttributeValue>();
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -172,7 +178,7 @@
@JsonProperty( value = "organisationUnits" )
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlElementWrapper( localName = "organisationUnits", namespace = Dxf2Namespace.NAMESPACE )
@JacksonXmlProperty( localName = "organisationUnit", namespace = Dxf2Namespace.NAMESPACE )
public Set<OrganisationUnit> getMembers()
@@ -187,7 +193,7 @@
@JsonProperty( value = "organisationUnitGroupSet" )
@JsonSerialize( as = BaseIdentifiableObject.class )
- @JsonView( {DetailedView.class} )
+ @JsonView( { DetailedView.class } )
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
public OrganisationUnitGroupSet getGroupSet()
{
@@ -199,6 +205,20 @@
this.groupSet = groupSet;
}
+ @JsonProperty( value = "attributes" )
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlElementWrapper( localName = "attributes", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "attribute", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<AttributeValue> getAttributeValues()
+ {
+ return attributeValues;
+ }
+
+ public void setAttributeValues( Set<AttributeValue> attributeValues )
+ {
+ this.attributeValues = attributeValues;
+ }
+
@Override
public void mergeWith( IdentifiableObject other )
{
@@ -216,6 +236,9 @@
{
addOrganisationUnit( organisationUnit );
}
+
+ attributeValues.clear();
+ attributeValues.addAll( organisationUnitGroup.getAttributeValues() );
}
}
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserGroup.java 2012-04-20 18:31:48 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserGroup.java 2012-06-01 11:35:55 +0000
@@ -33,6 +33,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.Dxf2Namespace;
import org.hisp.dhis.common.IdentifiableObject;
@@ -58,6 +59,11 @@
@Scanned
private Set<User> members = new HashSet<User>();
+ /**
+ * Set of the dynamic attributes values that belong to this user group.
+ */
+ private Set<AttributeValue> attributeValues = new HashSet<AttributeValue>();
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -122,7 +128,7 @@
@JsonProperty( value = "users" )
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
- @JsonView( {DetailedView.class, ExportView.class} )
+ @JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlElementWrapper( localName = "users", namespace = Dxf2Namespace.NAMESPACE )
@JacksonXmlProperty( localName = "user", namespace = Dxf2Namespace.NAMESPACE )
public Set<User> getMembers()
@@ -135,6 +141,20 @@
this.members = members;
}
+ @JsonProperty( value = "attributes" )
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlElementWrapper( localName = "attributes", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "attribute", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<AttributeValue> getAttributeValues()
+ {
+ return attributeValues;
+ }
+
+ public void setAttributeValues( Set<AttributeValue> attributeValues )
+ {
+ this.attributeValues = attributeValues;
+ }
+
@Override
public void mergeWith( IdentifiableObject other )
{
@@ -146,6 +166,9 @@
removeAllUsers();
members.addAll( userGroup.getMembers() );
+
+ attributeValues.clear();
+ attributeValues.addAll( userGroup.getAttributeValues() );
}
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java 2012-06-01 11:35:55 +0000
@@ -23,12 +23,12 @@
package org.hisp.dhis.attribute;
+import org.hisp.dhis.common.GenericStore;
+import org.springframework.transaction.annotation.Transactional;
+
import java.util.HashSet;
import java.util.Set;
-import org.hisp.dhis.common.GenericStore;
-import org.springframework.transaction.annotation.Transactional;
-
/**
* @author mortenoh
*/
@@ -87,7 +87,7 @@
{
return attributeStore.getByUid( uid );
}
-
+
@Override
public Attribute getAttributeByName( String name )
{
@@ -107,24 +107,48 @@
}
@Override
+ public Set<Attribute> getDataElementGroupAttributes()
+ {
+ return attributeStore.getDataElementGroupAttributes();
+ }
+
+ @Override
public Set<Attribute> getIndicatorAttributes()
{
return attributeStore.getIndicatorAttributes();
}
@Override
+ public Set<Attribute> getIndicatorGroupAttributes()
+ {
+ return attributeStore.getIndicatorGroupAttributes();
+ }
+
+ @Override
public Set<Attribute> getOrganisationUnitAttributes()
{
return attributeStore.getOrganisationUnitAttributes();
}
@Override
+ public Set<Attribute> getOrganisationUnitGroupAttributes()
+ {
+ return attributeStore.getOrganisationUnitGroupAttributes();
+ }
+
+ @Override
public Set<Attribute> getUserAttributes()
{
return attributeStore.getUserAttributes();
}
@Override
+ public Set<Attribute> getUserGroupAttributes()
+ {
+ return attributeStore.getUserGroupAttributes();
+ }
+
+ @Override
public int getAttributeCount()
{
return attributeStore.getCount();
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeStore.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeStore.java 2012-06-01 11:35:55 +0000
@@ -38,27 +38,59 @@
extends HibernateIdentifiableObjectStore<Attribute>
implements AttributeStore
{
+ @Override
@SuppressWarnings( "unchecked" )
public Set<Attribute> getDataElementAttributes()
{
return new HashSet<Attribute>( getCriteria( Restrictions.eq( "dataElementAttribute", true ) ).list() );
}
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public Set<Attribute> getDataElementGroupAttributes()
+ {
+ return new HashSet<Attribute>( getCriteria( Restrictions.eq( "dataElementGroupAttribute", true ) ).list() );
+ }
+
+ @Override
@SuppressWarnings( "unchecked" )
public Set<Attribute> getIndicatorAttributes()
{
return new HashSet<Attribute>( getCriteria( Restrictions.eq( "indicatorAttribute", true ) ).list() );
}
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public Set<Attribute> getIndicatorGroupAttributes()
+ {
+ return new HashSet<Attribute>( getCriteria( Restrictions.eq( "indicatorGroupAttribute", true ) ).list() );
+ }
+
+ @Override
@SuppressWarnings( "unchecked" )
public Set<Attribute> getOrganisationUnitAttributes()
{
return new HashSet<Attribute>( getCriteria( Restrictions.eq( "organisationUnitAttribute", true ) ).list() );
}
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public Set<Attribute> getOrganisationUnitGroupAttributes()
+ {
+ return new HashSet<Attribute>( getCriteria( Restrictions.eq( "organisationUnitGroupAttribute", true ) ).list() );
+ }
+
+ @Override
@SuppressWarnings( "unchecked" )
public Set<Attribute> getUserAttributes()
{
return new HashSet<Attribute>( getCriteria( Restrictions.eq( "userAttribute", true ) ).list() );
}
+
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public Set<Attribute> getUserGroupAttributes()
+ {
+ return new HashSet<Attribute>( getCriteria( Restrictions.eq( "userGroupAttribute", true ) ).list() );
+ }
}
=== 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 2011-11-23 18:07:35 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/Attribute.hbm.xml 2012-06-01 11:35:55 +0000
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"
- [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
->
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"
+ [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
+ >
<hibernate-mapping package="org.hisp.dhis.attribute">
<class name="Attribute" table="attribute">
@@ -14,19 +14,27 @@
<generator class="native" />
</id>
&identifiableProperties;
-
+
<property name="valueType" not-null="true" />
<property name="mandatory" not-null="true" />
<property name="dataElementAttribute" not-null="true" />
+ <property name="dataElementGroupAttribute" not-null="false" />
+
<property name="indicatorAttribute" not-null="true" />
+ <property name="indicatorGroupAttribute" not-null="false" />
+
<property name="organisationUnitAttribute" not-null="true" />
+ <property name="organisationUnitGroupAttribute" not-null="false" />
+
<property name="userAttribute" not-null="true" />
+ <property name="userGroupAttribute" not-null="false" />
+
<property name="sortOrder" />
<set name="attributeValues" inverse="true" lazy="true">
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroup.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroup.hbm.xml 2011-11-03 01:02:13 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroup.hbm.xml 2012-06-01 11:35:55 +0000
@@ -22,6 +22,14 @@
foreign-key="fk_dataelementgroup_dataelementid" />
</set>
+ <!-- Dynamic attribute values -->
+
+ <set name="attributeValues" table="dataelementgroupattributevalues">
+ <cache usage="read-write" />
+ <key column="dataelementgroupid" />
+ <many-to-many class="org.hisp.dhis.attribute.AttributeValue" column="attributevalueid" unique="true" />
+ </set>
+
<join table="dataelementgroupsetmembers" inverse="true">
<key column="dataelementgroupid" />
<many-to-one column="dataelementgroupsetid" name="groupSet" />
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroup.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroup.hbm.xml 2011-11-03 01:02:13 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroup.hbm.xml 2012-06-01 11:35:55 +0000
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"
- [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
->
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"
+ [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
+ >
<hibernate-mapping>
<class name="org.hisp.dhis.indicator.IndicatorGroup" table="indicatorgroup">
@@ -14,11 +14,20 @@
<generator class="native" />
</id>
&identifiableProperties;
-
+
<set name="members" table="indicatorgroupmembers">
<cache usage="read-write" />
<key column="indicatorgroupid" foreign-key="fk_indicatorgroupmembers_indicatorgroupid" />
- <many-to-many class="org.hisp.dhis.indicator.Indicator" column="indicatorid" foreign-key="fk_indicatorgroup_indicatorid" />
+ <many-to-many class="org.hisp.dhis.indicator.Indicator" column="indicatorid"
+ foreign-key="fk_indicatorgroup_indicatorid" />
+ </set>
+
+ <!-- Dynamic attribute values -->
+
+ <set name="attributeValues" table="indicatorgroupattributevalues">
+ <cache usage="read-write" />
+ <key column="indicatorgroupid" />
+ <many-to-many class="org.hisp.dhis.attribute.AttributeValue" column="attributevalueid" unique="true" />
</set>
<join table="indicatorgroupsetmembers" inverse="true">
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroup.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroup.hbm.xml 2011-11-03 01:02:13 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroup.hbm.xml 2012-06-01 11:35:55 +0000
@@ -22,6 +22,14 @@
foreign-key="fk_orgunitgroup_organisationunitid" />
</set>
+ <!-- Dynamic attribute values -->
+
+ <set name="attributeValues" table="orgunitgroupattributevalues">
+ <cache usage="read-write" />
+ <key column="orgunitgroupid" />
+ <many-to-many class="org.hisp.dhis.attribute.AttributeValue" column="attributevalueid" unique="true" />
+ </set>
+
<join table="orgunitgroupsetmembers" inverse="true">
<key column="orgunitgroupid" />
<many-to-one column="orgunitgroupsetid" name="groupSet" />
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserGroup.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserGroup.hbm.xml 2011-12-21 11:37:17 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/user/hibernate/UserGroup.hbm.xml 2012-06-01 11:35:55 +0000
@@ -18,5 +18,13 @@
<many-to-many column="userid" class="org.hisp.dhis.user.User" foreign-key="fk_usergroup_userid" />
</set>
+ <!-- Dynamic attribute values -->
+
+ <set name="attributeValues" table="usergroupattributevalues">
+ <cache usage="read-write" />
+ <key column="usergroupid" />
+ <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 2011-10-03 09:23:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/AddAttributeAction.java 2012-06-01 11:35:55 +0000
@@ -27,11 +27,10 @@
package org.hisp.dhis.dataadmin.action.attribute;
+import com.opensymphony.xwork2.Action;
import org.hisp.dhis.attribute.Attribute;
import org.hisp.dhis.attribute.AttributeService;
-import com.opensymphony.xwork2.Action;
-
/**
* @author mortenoh
*/
@@ -81,6 +80,13 @@
this.dataElementAttribute = dataElementAttribute;
}
+ private Boolean dataElementGroupAttribute = false;
+
+ public void setDataElementGroupAttribute( Boolean dataElementGroupAttribute )
+ {
+ this.dataElementGroupAttribute = dataElementGroupAttribute;
+ }
+
private Boolean indicatorAttribute = false;
public void setIndicatorAttribute( Boolean indicatorAttribute )
@@ -88,6 +94,13 @@
this.indicatorAttribute = indicatorAttribute;
}
+ private Boolean indicatorGroupAttribute = false;
+
+ public void setIndicatorGroupAttribute( Boolean indicatorGroupAttribute )
+ {
+ this.indicatorGroupAttribute = indicatorGroupAttribute;
+ }
+
private Boolean organisationUnitAttribute = false;
public void setOrganisationUnitAttribute( Boolean organisationUnitAttribute )
@@ -95,6 +108,13 @@
this.organisationUnitAttribute = organisationUnitAttribute;
}
+ private Boolean organisationUnitGroupAttribute = false;
+
+ public void setOrganisationUnitGroupAttribute( Boolean organisationUnitGroupAttribute )
+ {
+ this.organisationUnitGroupAttribute = organisationUnitGroupAttribute;
+ }
+
private Boolean userAttribute = false;
public void setUserAttribute( Boolean userAttribute )
@@ -102,6 +122,13 @@
this.userAttribute = userAttribute;
}
+ private Boolean userGroupAttribute = false;
+
+ public void setUserGroupAttribute( Boolean userGroupAttribute )
+ {
+ this.userGroupAttribute = userGroupAttribute;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -112,9 +139,13 @@
Attribute attribute = new Attribute( name, valueType );
attribute.setMandatory( mandatory );
attribute.setDataElementAttribute( dataElementAttribute );
+ attribute.setDataElementGroupAttribute( dataElementGroupAttribute );
attribute.setIndicatorAttribute( indicatorAttribute );
+ attribute.setIndicatorGroupAttribute( indicatorGroupAttribute );
attribute.setOrganisationUnitAttribute( organisationUnitAttribute );
+ attribute.setOrganisationUnitGroupAttribute( organisationUnitGroupAttribute );
attribute.setUserAttribute( userAttribute );
+ attribute.setUserGroupAttribute( userGroupAttribute );
attributeService.addAttribute( attribute );
=== 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 2011-10-03 09:23:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/UpdateAttributeAction.java 2012-06-01 11:35:55 +0000
@@ -88,6 +88,13 @@
this.dataElementAttribute = dataElementAttribute;
}
+ private Boolean dataElementGroupAttribute = false;
+
+ public void setDataElementGroupAttribute( Boolean dataElementGroupAttribute )
+ {
+ this.dataElementGroupAttribute = dataElementGroupAttribute;
+ }
+
private Boolean indicatorAttribute = false;
public void setIndicatorAttribute( Boolean indicatorAttribute )
@@ -95,6 +102,13 @@
this.indicatorAttribute = indicatorAttribute;
}
+ private Boolean indicatorGroupAttribute = false;
+
+ public void setIndicatorGroupAttribute( Boolean indicatorGroupAttribute )
+ {
+ this.indicatorGroupAttribute = indicatorGroupAttribute;
+ }
+
private Boolean organisationUnitAttribute = false;
public void setOrganisationUnitAttribute( Boolean organisationUnitAttribute )
@@ -102,12 +116,26 @@
this.organisationUnitAttribute = organisationUnitAttribute;
}
+ private Boolean organisationUnitGroupAttribute = false;
+
+ public void setOrganisationUnitGroupAttribute( Boolean organisationUnitGroupAttribute )
+ {
+ this.organisationUnitGroupAttribute = organisationUnitGroupAttribute;
+ }
+
private Boolean userAttribute = false;
public void setUserAttribute( Boolean userAttribute )
{
this.userAttribute = userAttribute;
}
+
+ private Boolean userGroupAttribute = false;
+
+ public void setUserGroupAttribute( Boolean userGroupAttribute )
+ {
+ this.userGroupAttribute = userGroupAttribute;
+ }
// -------------------------------------------------------------------------
// Action implementation
@@ -124,9 +152,13 @@
attribute.setValueType( valueType );
attribute.setMandatory( mandatory );
attribute.setDataElementAttribute( dataElementAttribute );
+ attribute.setDataElementGroupAttribute( dataElementGroupAttribute );
attribute.setIndicatorAttribute( indicatorAttribute );
+ attribute.setIndicatorGroupAttribute( indicatorGroupAttribute );
attribute.setOrganisationUnitAttribute( organisationUnitAttribute );
+ attribute.setOrganisationUnitGroupAttribute( organisationUnitGroupAttribute );
attribute.setUserAttribute( userAttribute );
+ attribute.setUserGroupAttribute( userGroupAttribute );
attributeService.updateAttribute( attribute );
=== 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 2012-05-30 07:22:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2012-06-01 11:35:55 +0000
@@ -77,6 +77,7 @@
found=Found
values=values
data_element=Data element
+data_element_group=Data element Group
validation_rules_without_groups=Validation rules without groups
aggregated_data_values=Aggregated data values
aggregated_indicator_values=Aggregated indicator values
@@ -244,8 +245,11 @@
value_type=Value Type
mandatory=Mandatory
indicator=Indicator
+indicator_group=Indicator Group
organisation_unit=Organisation Unit
+organisation_unit_group=Organisation Unit Group
user=User
+user_group=User Group
integer=Integer
positive_integer=Positive Integer
negative_integer=Negative Integer
=== 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 2011-10-03 09:23:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addAttributeForm.vm 2012-06-01 11:35:55 +0000
@@ -43,10 +43,14 @@
<tr>
<td style="vertical-align: text-top;">$i18n.getString( "assigned_to" )</td>
<td>
- <input type="checkbox" id="dataElementAttribute" name="dataElementAttribute" value="true" /><label for="dataElementAttribute">$i18n.getString( 'data_element' )</label> <br />
- <input type="checkbox" id="indicatorAttribute" name="indicatorAttribute" value="true" /><label for="indicatorAttribute">$i18n.getString( 'indicator' )</label> <br />
- <input type="checkbox" id="organisationUnitAttribute" name="organisationUnitAttribute" value="true" /><label for="organisationUnitAttribute">$i18n.getString( 'organisation_unit' )</label> <br />
- <input type="checkbox" id="userAttribute" name="userAttribute" value="true" /><label for="userAttribute">$i18n.getString( 'user' )</label> <br />
+ <input type="checkbox" id="dataElementAttribute" name="dataElementAttribute" value="true" /><label for="dataElementAttribute">$i18n.getString( 'data_element' )</label> <br />
+ <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="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="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>
</tr>
=== 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 2011-10-03 09:23:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateAttributeForm.vm 2012-06-01 11:35:55 +0000
@@ -44,10 +44,14 @@
<tr>
<td style="vertical-align: text-top;">$i18n.getString( "assigned_to" )</td>
<td>
- <input type="checkbox" id="dataElementAttribute" name="dataElementAttribute" value="true" #if( $attribute.dataElementAttribute ) checked="checked" #end /><label for="dataElementAttribute">$i18n.getString( 'data_element' )</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="organisationUnitAttribute" name="organisationUnitAttribute" value="true" #if( $attribute.organisationUnitAttribute ) checked="checked" #end /><label for="organisationUnitAttribute">$i18n.getString( 'organisation_unit' )</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="dataElementAttribute" name="dataElementAttribute" value="true" #if( $attribute.dataElementAttribute ) checked="checked" #end /><label for="dataElementAttribute">$i18n.getString( 'data_element' )</label> <br />
+ <input type="checkbox" id="dataElementGroupAttribute" name="dataElementGroupAttribute" value="true" #if( $attribute.dataElementAttribute ) 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.indicatorAttribute ) checked="checked" #end /><label for="indicatorGroupAttribute">$i18n.getString( 'indicator_group' )</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.organisationUnitAttribute ) checked="checked" #end /><label for="organisationUnitGroupAttribute">$i18n.getString( 'organisation_unit_group' )</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.userAttribute ) checked="checked" #end /><label for="userGroupAttribute">$i18n.getString( 'user_group' )</label> <br />
</td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/AddDataElementGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/AddDataElementGroupAction.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/AddDataElementGroupAction.java 2012-06-01 11:35:55 +0000
@@ -28,12 +28,15 @@
*/
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
+import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataelement.DataElementService;
import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.system.util.AttributeUtils;
/**
* @author Torgeir Lorange Ostby
@@ -54,6 +57,13 @@
this.dataElementService = dataElementService;
}
+ private AttributeService attributeService;
+
+ public void setAttributeService( AttributeService attributeService )
+ {
+ this.attributeService = attributeService;
+ }
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -72,6 +82,13 @@
this.groupMembers = groupMembers;
}
+ private List<String> jsonAttributeValues;
+
+ public void setJsonAttributeValues( List<String> jsonAttributeValues )
+ {
+ this.jsonAttributeValues = jsonAttributeValues;
+ }
+
// -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
@@ -95,7 +112,13 @@
{
dataElementGroup.addDataElement( dataElementService.getDataElement( Integer.parseInt( id ) ) );
}
-
+
+ if ( jsonAttributeValues != null )
+ {
+ AttributeUtils.updateAttributeValuesFromJson( dataElementGroup.getAttributeValues(), jsonAttributeValues,
+ attributeService );
+ }
+
dataElementService.addDataElementGroup( dataElementGroup );
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/GetDataElementGroupListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/GetDataElementGroupListAction.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/GetDataElementGroupListAction.java 2012-06-01 11:35:55 +0000
@@ -59,7 +59,7 @@
// -------------------------------------------------------------------------
private String key;
-
+
public String getKey()
{
return key;
@@ -80,7 +80,7 @@
{
return dataElementGroups;
}
-
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -90,7 +90,7 @@
if ( isNotBlank( key ) )
{
this.paging = createPaging( dataElementService.getDataElementGroupCountByName( key ) );
-
+
dataElementGroups = new ArrayList<DataElementGroup>( dataElementService.getDataElementGroupsBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) );
}
else
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/ShowAddDataElementGroupForm.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/ShowAddDataElementGroupForm.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/ShowAddDataElementGroupForm.java 2012-06-01 11:35:55 +0000
@@ -0,0 +1,75 @@
+package org.hisp.dhis.dd.action.dataelementgroup;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.attribute.Attribute;
+import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class ShowAddDataElementGroupForm
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private AttributeService attributeService;
+
+ public void setAttributeService( AttributeService attributeService )
+ {
+ this.attributeService = attributeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/output
+ // -------------------------------------------------------------------------
+
+ private List<Attribute> attributes;
+
+ public List<Attribute> getAttributes()
+ {
+ return attributes;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ attributes = new ArrayList<Attribute>( attributeService.getDataElementGroupAttributes() );
+ Collections.sort( attributes, new AttributeSortOrderComparator() );
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/ShowDataElementGroupEditorAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/ShowDataElementGroupEditorAction.java 2012-02-02 10:34:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/ShowDataElementGroupEditorAction.java 2012-06-01 11:35:55 +0000
@@ -85,7 +85,7 @@
dataElementGroups = new ArrayList<DataElementGroup>( dataElementService.getAllDataElementGroups() );
dataElements = new ArrayList<DataElement>( dataElementService.getAllDataElements() );
-
+
Collections.sort( dataElements, new IdentifiableObjectNameComparator() );
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/ShowUpdateDataElementGroupFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/ShowUpdateDataElementGroupFormAction.java 2012-02-01 10:50:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/ShowUpdateDataElementGroupFormAction.java 2012-06-01 11:35:55 +0000
@@ -27,21 +27,21 @@
package org.hisp.dhis.dd.action.dataelementgroup;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
+import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.attribute.Attribute;
+import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.system.util.AttributeUtils;
-import com.opensymphony.xwork2.Action;
+import java.util.*;
/**
* @author Chau Thu Tran
* @version $ ShowUpdateDataElementGroupAction.java May 30, 2011 2:26:15 PM $
- *
*/
public class ShowUpdateDataElementGroupFormAction
implements Action
@@ -57,6 +57,13 @@
this.dataElementService = dataElementService;
}
+ private AttributeService attributeService;
+
+ public void setAttributeService( AttributeService attributeService )
+ {
+ this.attributeService = attributeService;
+ }
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -68,6 +75,20 @@
this.id = id;
}
+ private List<Attribute> attributes;
+
+ public List<Attribute> getAttributes()
+ {
+ return attributes;
+ }
+
+ public Map<Integer, String> attributeValues = new HashMap<Integer, String>();
+
+ public Map<Integer, String> getAttributeValues()
+ {
+ return attributeValues;
+ }
+
// -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
@@ -100,7 +121,12 @@
groupMembers = new ArrayList<DataElement>( dataElementGroup.getMembers() );
+ attributes = new ArrayList<Attribute>( attributeService.getDataElementGroupAttributes() );
+
+ attributeValues = AttributeUtils.getAttributeValueMap( dataElementGroup.getAttributeValues() );
+
Collections.sort( groupMembers, new IdentifiableObjectNameComparator() );
+ Collections.sort( attributes, new AttributeSortOrderComparator() );
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/UpdateDataElementGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/UpdateDataElementGroupAction.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/UpdateDataElementGroupAction.java 2012-06-01 11:35:55 +0000
@@ -28,13 +28,16 @@
*/
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
+import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataelement.DataElementService;
import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.system.util.AttributeUtils;
/**
* @author Torgeir Lorange Ostby
@@ -55,6 +58,13 @@
this.dataElementService = dataElementService;
}
+ private AttributeService attributeService;
+
+ public void setAttributeService( AttributeService attributeService )
+ {
+ this.attributeService = attributeService;
+ }
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -80,6 +90,13 @@
this.groupMembers = groupMembers;
}
+ private List<String> jsonAttributeValues;
+
+ public void setJsonAttributeValues( List<String> jsonAttributeValues )
+ {
+ this.jsonAttributeValues = jsonAttributeValues;
+ }
+
// -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
@@ -111,6 +128,12 @@
members.add( dataElementService.getDataElement( Integer.parseInt( id ) ) );
}
+ if ( jsonAttributeValues != null )
+ {
+ AttributeUtils.updateAttributeValuesFromJson( dataElementGroup.getAttributeValues(), jsonAttributeValues,
+ attributeService );
+ }
+
dataElementGroup.updateDataElements( members );
dataElementService.updateDataElementGroup( dataElementGroup );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/AddIndicatorGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/AddIndicatorGroupAction.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/AddIndicatorGroupAction.java 2012-06-01 11:35:55 +0000
@@ -28,12 +28,15 @@
*/
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
+import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.indicator.IndicatorGroup;
import org.hisp.dhis.indicator.IndicatorService;
import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.system.util.AttributeUtils;
/**
* @author Torgeir Lorange Ostby
@@ -52,7 +55,14 @@
{
this.indicatorService = indicatorService;
}
-
+
+ private AttributeService attributeService;
+
+ public void setAttributeService( AttributeService attributeService )
+ {
+ this.attributeService = attributeService;
+ }
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -78,6 +88,13 @@
return indicatorGroup;
}
+ private List<String> jsonAttributeValues;
+
+ public void setJsonAttributeValues( List<String> jsonAttributeValues )
+ {
+ this.jsonAttributeValues = jsonAttributeValues;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -91,6 +108,12 @@
indicatorGroup.addIndicator( indicatorService.getIndicator( Integer.parseInt( id ) ) );
}
+ if ( jsonAttributeValues != null )
+ {
+ AttributeUtils.updateAttributeValuesFromJson( indicatorGroup.getAttributeValues(), jsonAttributeValues,
+ attributeService );
+ }
+
indicatorService.addIndicatorGroup( indicatorGroup );
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/UpdateIndicatorGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/UpdateIndicatorGroupAction.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/UpdateIndicatorGroupAction.java 2012-06-01 11:35:55 +0000
@@ -28,13 +28,16 @@
*/
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
+import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorGroup;
import org.hisp.dhis.indicator.IndicatorService;
import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.system.util.AttributeUtils;
/**
* @author Torgeir Lorange Ostby
@@ -55,6 +58,13 @@
this.indicatorService = indicatorService;
}
+ private AttributeService attributeService;
+
+ public void setAttributeService( AttributeService attributeService )
+ {
+ this.attributeService = attributeService;
+ }
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -87,6 +97,13 @@
return indicatorGroup;
}
+ private List<String> jsonAttributeValues;
+
+ public void setJsonAttributeValues( List<String> jsonAttributeValues )
+ {
+ this.jsonAttributeValues = jsonAttributeValues;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -107,6 +124,12 @@
members.add( indicatorService.getIndicator( Integer.parseInt( memberId ) ) );
}
+ if ( jsonAttributeValues != null )
+ {
+ AttributeUtils.updateAttributeValuesFromJson( indicatorGroup.getAttributeValues(), jsonAttributeValues,
+ attributeService );
+ }
+
indicatorGroup.updateIndicators( members );
indicatorService.updateIndicatorGroup( indicatorGroup );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml 2012-02-08 03:37:11 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml 2012-06-01 11:35:55 +0000
@@ -37,6 +37,7 @@
<property name="dataElementService">
<ref bean="org.hisp.dhis.dataelement.DataElementService" />
</property>
+ <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
</bean>
<bean id="org.hisp.dhis.dd.action.dataelement.GetDataElementGroupMembersAction" class="org.hisp.dhis.dd.action.dataelement.GetDataElementGroupMembersAction"
@@ -129,6 +130,10 @@
<!-- Data Element Group -->
+ <bean id="org.hisp.dhis.dd.action.dataelementgroup.ShowAddDataElementGroupForm" class="org.hisp.dhis.dd.action.dataelementgroup.ShowAddDataElementGroupForm">
+ <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+ </bean>
+
<bean id="org.hisp.dhis.dd.action.dataelementgroup.ShowDataElementGroupEditorAction" class="org.hisp.dhis.dd.action.dataelementgroup.ShowDataElementGroupEditorAction"
scope="prototype">
<property name="dataElementService">
@@ -179,6 +184,7 @@
<property name="dataElementService">
<ref bean="org.hisp.dhis.dataelement.DataElementService" />
</property>
+ <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
</bean>
<bean id="org.hisp.dhis.dd.action.dataelementgroup.UpdateDataElementGroupAction" class="org.hisp.dhis.dd.action.dataelementgroup.UpdateDataElementGroupAction"
@@ -186,6 +192,7 @@
<property name="dataElementService">
<ref bean="org.hisp.dhis.dataelement.DataElementService" />
</property>
+ <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
</bean>
<bean id="org.hisp.dhis.dd.action.dataelementgroup.ValidateDataElementGroupAction" class="org.hisp.dhis.dd.action.dataelementgroup.ValidateDataElementGroupAction"
@@ -289,6 +296,7 @@
<property name="indicatorService">
<ref bean="org.hisp.dhis.indicator.IndicatorService" />
</property>
+ <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
</bean>
<bean id="org.hisp.dhis.dd.action.indicatorgroup.ShowUpdateIndicatorGroupFormAction" class="org.hisp.dhis.dd.action.indicatorgroup.ShowUpdateIndicatorGroupFormAction"
@@ -303,6 +311,7 @@
<property name="indicatorService">
<ref bean="org.hisp.dhis.indicator.IndicatorService" />
</property>
+ <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
</bean>
<bean id="org.hisp.dhis.dd.action.indicatorgroup.RenameIndicatorGroupNameEditorAction" class="org.hisp.dhis.dd.action.indicatorgroup.RenameIndicatorGroupNameEditorAction"
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2012-02-13 20:04:18 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2012-06-01 11:35:55 +0000
@@ -140,7 +140,7 @@
<param name="requiredAuthorities">F_DATAELEMENTGROUP_DELETE</param>
</action>
- <action name="showAddDataElementGroupForm" class="org.hisp.dhis.dd.action.NoAction">
+ <action name="showAddDataElementGroupForm" class="org.hisp.dhis.dd.action.dataelementgroup.ShowAddDataElementGroupForm">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-datadictionary/addDataElementGroupForm.vm</param>
<param name="javascripts">javascript/dataElementGroup.js</param>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementGroupForm.vm 2011-10-06 07:29:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementGroupForm.vm 2012-06-01 11:35:55 +0000
@@ -1,6 +1,17 @@
-<script type="text/javascript" src="javascript/addDataElementGroupForm.js"></script>
<script type="text/javascript">
jQuery(function() {
+ validation2('addDataElementGroupForm', function ( form ) {
+ form.submit();
+ }, {
+ 'beforeValidateHandler' : function () {
+ beforeSubmit();
+ #tblDynamicAttributesJavascript()
+ },
+ 'rules' : getValidationRules("dataElementGroup")
+ });
+
+ checkValueIsExist("name", "validateDataElementGroup.action");
+
jQuery("#availableDataElementsList").dhisAjaxSelect({
source: "../dhis-web-commons-ajax-json/getDataElements.action",
iterator: "dataElements",
@@ -21,18 +32,20 @@
<form id="addDataElementGroupForm" action="addDataElementGroup.action" method="post" >
<table>
+ <col width="200px" />
+ <col width="240px" />
+
<tr>
<th colspan="2">$i18n.getString( "details" )</th>
</tr>
<tr>
<td><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td><input type="text" id="name" name="name" style="width:20em"/></td>
- </tr>
- <tr>
- <td colspan="2" height="15px"></td>
- </tr>
+ <td><input type="text" id="name" name="name" style="width:240px" /></td>
+ </tr>
</table>
+#tblDynamicAttributes( { "attributes": $attributes } )
+
<table>
<col style="width: 450px"/>
<col/>
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementGroupForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementGroupForm.js 2011-08-19 21:33:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementGroupForm.js 1970-01-01 00:00:00 +0000
@@ -1,12 +0,0 @@
-jQuery( document ).ready( function()
-{
- validation2( 'addDataElementGroupForm', function( form )
- {
- form.submit();
- }, {
- 'beforeValidateHandler' : beforeSubmit,
- 'rules' : getValidationRules( "dataElementGroup" )
- } );
-
- checkValueIsExist( "name", "validateDataElementGroup.action" );
-} );
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementGroupForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementGroupForm.js 2011-08-19 21:33:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementGroupForm.js 1970-01-01 00:00:00 +0000
@@ -1,14 +0,0 @@
-jQuery( document ).ready( function()
-{
- validation2( 'updateDataElementGroupForm', function( form )
- {
- form.submit();
- }, {
- 'beforeValidateHandler' : beforeSubmit,
- 'rules' : getValidationRules( "dataElementGroup" )
- } );
-
- checkValueIsExist( "name", "validateDataElementGroup.action", {
- id : getFieldValue( 'id' )
- } );
-} );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementGroupForm.vm 2012-02-01 10:50:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementGroupForm.vm 2012-06-01 11:35:55 +0000
@@ -1,6 +1,20 @@
-<script type="text/javascript" src="javascript/updateDataElementGroupForm.js"></script>
<script type="text/javascript">
jQuery(function() {
+ validation2( 'updateDataElementGroupForm', function( form )
+ {
+ form.submit();
+ }, {
+ 'beforeValidateHandler' : function() {
+ beforeSubmit();
+ #tblDynamicAttributesJavascript()
+ },
+ 'rules' : getValidationRules( "dataElementGroup" )
+ } );
+
+ checkValueIsExist( "name", "validateDataElementGroup.action", {
+ id : getFieldValue( 'id' )
+ } );
+
jQuery("#availableDataElementsList").dhisAjaxSelect({
source: "../dhis-web-commons-ajax-json/getDataElements.action",
iterator: "dataElements",
@@ -25,19 +39,21 @@
</div>
<table>
+ <col width="200px" />
+ <col width="240px" />
+
<tr>
<th colspan="2">$i18n.getString( "details" )</th>
</tr>
<tr>
<td><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td><input type="text" id="name" name="name" value="$encoder.htmlEncode( $dataElementGroup.name )" style="width:20em"/>
+ <td><input type="text" id="name" name="name" value="$encoder.htmlEncode( $dataElementGroup.name )" style="width:240px"/>
</td>
</tr>
- <tr>
- <td colspan="2" height="15px"></td>
- </tr>
</table>
+#tblDynamicAttributes( { "attributes": $attributes, "attributeValues": $attributeValues } )
+
<table>
<col style="width: 450px"/>
<col/>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/AddOrganisationUnitGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/AddOrganisationUnitGroupAction.java 2012-04-03 10:52:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/AddOrganisationUnitGroupAction.java 2012-06-01 11:35:55 +0000
@@ -27,14 +27,16 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Collection;
-
+import com.opensymphony.xwork2.ActionSupport;
+import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
import org.hisp.dhis.oust.manager.SelectionTreeManager;
+import org.hisp.dhis.system.util.AttributeUtils;
-import com.opensymphony.xwork2.ActionSupport;
+import java.util.Collection;
+import java.util.List;
/**
* @author Torgeir Lorange Ostby
@@ -61,6 +63,13 @@
this.selectionTreeManager = selectionTreeManager;
}
+ private AttributeService attributeService;
+
+ public void setAttributeService( AttributeService attributeService )
+ {
+ this.attributeService = attributeService;
+ }
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -72,6 +81,14 @@
this.name = name;
}
+
+ private List<String> jsonAttributeValues;
+
+ public void setJsonAttributeValues( List<String> jsonAttributeValues )
+ {
+ this.jsonAttributeValues = jsonAttributeValues;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -80,7 +97,7 @@
throws Exception
{
OrganisationUnitGroup organisationUnitGroup = new OrganisationUnitGroup( name );
-
+
Collection<OrganisationUnit> selectedOrganisationUnits = selectionTreeManager
.getReloadedSelectedOrganisationUnits();
@@ -89,6 +106,12 @@
organisationUnitGroup.addOrganisationUnit( unit );
}
+ if ( jsonAttributeValues != null )
+ {
+ AttributeUtils.updateAttributeValuesFromJson( organisationUnitGroup.getAttributeValues(), jsonAttributeValues,
+ attributeService );
+ }
+
organisationUnitGroupService.addOrganisationUnitGroup( organisationUnitGroup );
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/UpdateOrganisationUnitGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/UpdateOrganisationUnitGroupAction.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/UpdateOrganisationUnitGroupAction.java 2012-06-01 11:35:55 +0000
@@ -27,20 +27,22 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Collection;
-import java.util.HashSet;
-
+import com.opensymphony.xwork2.ActionSupport;
+import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
import org.hisp.dhis.oust.manager.SelectionTreeManager;
+import org.hisp.dhis.system.util.AttributeUtils;
-import com.opensymphony.xwork2.ActionSupport;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
/**
* @author Torgeir Lorange Ostby
*/
-@SuppressWarnings("serial")
+@SuppressWarnings( "serial" )
public class UpdateOrganisationUnitGroupAction
extends ActionSupport
{
@@ -62,6 +64,13 @@
this.organisationUnitGroupService = organisationUnitGroupService;
}
+ private AttributeService attributeService;
+
+ public void setAttributeService( AttributeService attributeService )
+ {
+ this.attributeService = attributeService;
+ }
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -80,6 +89,13 @@
this.name = name;
}
+ private List<String> jsonAttributeValues;
+
+ public void setJsonAttributeValues( List<String> jsonAttributeValues )
+ {
+ this.jsonAttributeValues = jsonAttributeValues;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -95,6 +111,12 @@
organisationUnitGroup.updateOrganisationUnits( new HashSet<OrganisationUnit>( selectedOrganisationUnits ) );
+ if ( jsonAttributeValues != null )
+ {
+ AttributeUtils.updateAttributeValuesFromJson( organisationUnitGroup.getAttributeValues(), jsonAttributeValues,
+ attributeService );
+ }
+
organisationUnitGroupService.updateOrganisationUnitGroup( organisationUnitGroup );
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml 2012-01-05 20:39:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml 2012-06-01 11:35:55 +0000
@@ -166,6 +166,7 @@
<property name="organisationUnitGroupService">
<ref bean="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
</property>
+ <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
</bean>
<bean id="org.hisp.dhis.oum.action.organisationunitgroup.UpdateOrganisationUnitGroupAction" class="org.hisp.dhis.oum.action.organisationunitgroup.UpdateOrganisationUnitGroupAction"
@@ -176,6 +177,7 @@
<property name="organisationUnitGroupService">
<ref bean="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
</property>
+ <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
</bean>
<bean id="org.hisp.dhis.oum.action.organisationunitgroup.RemoveOrganisationUnitGroupAction" class="org.hisp.dhis.oum.action.organisationunitgroup.RemoveOrganisationUnitGroupAction"
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserGroupAction.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserGroupAction.java 2012-06-01 11:35:55 +0000
@@ -31,6 +31,8 @@
import java.util.List;
import java.util.Set;
+import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.system.util.AttributeUtils;
import org.hisp.dhis.user.User;
import org.hisp.dhis.user.UserGroup;
import org.hisp.dhis.user.UserGroupService;
@@ -59,6 +61,13 @@
this.userGroupService = userGroupService;
}
+ private AttributeService attributeService;
+
+ public void setAttributeService( AttributeService attributeService )
+ {
+ this.attributeService = attributeService;
+ }
+
// -------------------------------------------------------------------------
// Parameters
// -------------------------------------------------------------------------
@@ -77,6 +86,13 @@
this.name = name;
}
+ private List<String> jsonAttributeValues;
+
+ public void setJsonAttributeValues( List<String> jsonAttributeValues )
+ {
+ this.jsonAttributeValues = jsonAttributeValues;
+ }
+
// -------------------------------------------------------------------------
// Action Implementation
// -------------------------------------------------------------------------
@@ -94,6 +110,12 @@
UserGroup userGroup = new UserGroup( name, userList );
+ if ( jsonAttributeValues != null )
+ {
+ AttributeUtils.updateAttributeValuesFromJson( userGroup.getAttributeValues(), jsonAttributeValues,
+ attributeService );
+ }
+
userGroupService.addUserGroup( userGroup );
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserAction.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserAction.java 2012-06-01 11:35:55 +0000
@@ -27,25 +27,16 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
+import com.opensymphony.xwork2.Action;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.oust.manager.SelectionTreeManager;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
import org.hisp.dhis.security.PasswordManager;
import org.hisp.dhis.system.util.AttributeUtils;
-import org.hisp.dhis.user.CurrentUserService;
-import org.hisp.dhis.user.User;
-import org.hisp.dhis.user.UserAuthorityGroup;
-import org.hisp.dhis.user.UserCredentials;
-import org.hisp.dhis.user.UserService;
+import org.hisp.dhis.user.*;
-import com.opensymphony.xwork2.Action;
+import java.util.*;
/**
* @author Torgeir Lorange Ostby
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserGroupAction.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserGroupAction.java 2012-06-01 11:35:55 +0000
@@ -27,19 +27,21 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
+import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.system.util.AttributeUtils;
import org.hisp.dhis.user.User;
import org.hisp.dhis.user.UserGroup;
import org.hisp.dhis.user.UserGroupService;
import org.hisp.dhis.user.UserService;
-import com.opensymphony.xwork2.Action;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
-public class UpdateUserGroupAction implements Action
-{
+public class UpdateUserGroupAction
+ implements Action
+{
private UserService userService;
public void setUserService( UserService userService )
@@ -54,6 +56,13 @@
this.userGroupService = userGroupService;
}
+ private AttributeService attributeService;
+
+ public void setAttributeService( AttributeService attributeService )
+ {
+ this.attributeService = attributeService;
+ }
+
// -------------------------------------------------------------------------
// Parameters
// -------------------------------------------------------------------------
@@ -73,12 +82,19 @@
}
private Integer userGroupId;
-
+
public void setUserGroupId( Integer userGroupId )
{
this.userGroupId = userGroupId;
}
-
+
+ private List<String> jsonAttributeValues;
+
+ public void setJsonAttributeValues( List<String> jsonAttributeValues )
+ {
+ this.jsonAttributeValues = jsonAttributeValues;
+ }
+
// -------------------------------------------------------------------------
// Action Implementation
// -------------------------------------------------------------------------
@@ -95,12 +111,18 @@
}
UserGroup userGroup = userGroupService.getUserGroup( userGroupId );
-
+
userGroup.setName( name );
userGroup.setMembers( userList );
- userGroupService.updateUserGroup( userGroup);
-
+ if ( jsonAttributeValues != null )
+ {
+ AttributeUtils.updateAttributeValuesFromJson( userGroup.getAttributeValues(), jsonAttributeValues,
+ attributeService );
+ }
+
+ userGroupService.updateUserGroup( userGroup );
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/META-INF/dhis/beans.xml 2012-01-05 20:39:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/META-INF/dhis/beans.xml 2012-06-01 11:35:55 +0000
@@ -218,6 +218,7 @@
scope="prototype">
<property name="userService" ref="org.hisp.dhis.user.UserService" />
<property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
+ <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
</bean>
<bean id="org.hisp.dhis.user.action.EditUserGroupFormAction" class="org.hisp.dhis.user.action.EditUserGroupFormAction"
@@ -229,6 +230,7 @@
scope="prototype">
<property name="userService" ref="org.hisp.dhis.user.UserService" />
<property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
+ <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
</bean>
<bean id="org.hisp.dhis.user.action.RemoveUserGroupAction" class="org.hisp.dhis.user.action.RemoveUserGroupAction"