=== added directory 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/comparator' === added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/comparator/IdentifiableObjectNameComparator.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/comparator/IdentifiableObjectNameComparator.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/comparator/IdentifiableObjectNameComparator.java 2009-11-06 14:08:10 +0000 @@ -0,0 +1,44 @@ +package org.hisp.dhis.common.comparator; + +/* + * Copyright (c) 2004-2007, 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 java.util.Comparator; + +import org.hisp.dhis.common.IdentifiableObject; + +/** + * @author Lars Helge Overland + */ +public class IdentifiableObjectNameComparator + implements Comparator +{ + public int compare( IdentifiableObject object0, IdentifiableObject object1 ) + { + return object0.getName().compareTo( object1.getName() ); + } +} === 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 2009-11-06 11:58:30 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2009-11-06 14:08:10 +0000 @@ -151,15 +151,15 @@ private Set dataSets = new HashSet(); /** + * A Set of DataElementGroupSets. + */ + private List groupSets = new ArrayList(); + + /** * The lower organisation unit levels for aggregation. */ private List aggregationLevels = new ArrayList(); - /** - * A Set of DataElementGroupSets. - */ - private List groupSets = new ArrayList(); - // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- @@ -260,6 +260,11 @@ return DIMENSION; } + public String getDimensionSetType() + { + return DataElement.class.getSimpleName().toUpperCase(); + } + public boolean isDimensionSet() { return groupSets != null && groupSets.size() > 0; @@ -507,6 +512,16 @@ this.dataSets = dataSets; } + public List getGroupSets() + { + return groupSets; + } + + public void setGroupSets( List groupSets ) + { + this.groupSets = groupSets; + } + public List getAggregationLevels() { return aggregationLevels; @@ -516,14 +531,4 @@ { this.aggregationLevels = aggregationLevels; } - - public List getGroupSets() - { - return groupSets; - } - - public void setGroupSets( List groupSets ) - { - this.groupSets = groupSets; - } } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java 2009-11-06 11:58:30 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java 2009-11-06 14:08:10 +0000 @@ -80,6 +80,11 @@ return new ArrayList( optionCombos ); } + public String getDimensionSetType() + { + return DataElementCategoryCombo.class.getSimpleName().toUpperCase(); + } + // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionSet.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionSet.java 2009-11-06 11:58:30 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dimension/DimensionSet.java 2009-11-06 14:08:10 +0000 @@ -29,14 +29,24 @@ import java.util.List; +import org.hisp.dhis.dataelement.DataElement; +import org.hisp.dhis.dataelement.DataElementCategoryCombo; +import org.hisp.dhis.indicator.Indicator; + /** * @author Lars Helge Overland */ public interface DimensionSet { + final String TYPE_DATAELEMENT = DataElement.class.getSimpleName().toUpperCase(); + final String TYPE_INDICATOR = Indicator.class.getSimpleName().toUpperCase(); + final String TYPE_CATEGORY_COMBO = DataElementCategoryCombo.class.getSimpleName().toUpperCase(); + String getName(); List getDimensions(); List getDimensionOptionElements(); + + String getDimensionSetType(); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java 2009-11-06 11:58:30 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java 2009-11-06 14:08:10 +0000 @@ -130,7 +130,12 @@ return dimensionOptionElements; } - + + public String getDimensionSetType() + { + return Indicator.class.getSimpleName().toUpperCase(); + } + public boolean isDimensionSet() { return groupSets != null && groupSets.size() > 0; === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml' --- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml 2009-11-06 10:50:01 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml 2009-11-06 14:08:10 +0000 @@ -63,6 +63,13 @@ + + + + + + === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroupSet.hbm.xml' --- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroupSet.hbm.xml 2009-11-06 10:43:00 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroupSet.hbm.xml 2009-11-06 14:08:10 +0000 @@ -22,7 +22,7 @@ + column="dataelementgroupid" unique="true" foreign-key="fk_dataelementgroupset_dataelementgroupid"/> === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java 2009-11-06 10:50:01 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java 2009-11-06 14:08:10 +0000 @@ -146,6 +146,13 @@ { this.url = url; } + + private Collection dataElementGroupSets = new ArrayList(); + + public void setDataElementGroupSets( Collection dataElementGroupSets ) + { + this.dataElementGroupSets = dataElementGroupSets; + } private Collection aggregationLevels; @@ -267,6 +274,11 @@ { dataElement = new DataElement(); } + + for ( String id : dataElementGroupSets ) + { + dataElement.getGroupSets().add( dataElementService.getDataElementGroupSet( Integer.parseInt( id ) ) ); + } dataElement.setName( name ); dataElement.setAlternativeName( alternativeName ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowAddDataElementForm.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowAddDataElementForm.java 2009-10-18 22:44:41 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowAddDataElementForm.java 2009-11-06 14:08:10 +0000 @@ -31,15 +31,20 @@ import java.util.Collection; import java.util.List; +import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator; import org.hisp.dhis.dataelement.DataElementCategoryCombo; import org.hisp.dhis.dataelement.DataElementCategoryService; import org.hisp.dhis.dataelement.DataElementGroup; +import org.hisp.dhis.dataelement.DataElementGroupSet; import org.hisp.dhis.dataelement.DataElementService; +import org.hisp.dhis.dataelement.comparator.DataElementCategoryComboNameComparator; import org.hisp.dhis.organisationunit.OrganisationUnitLevel; import org.hisp.dhis.organisationunit.OrganisationUnitService; import com.opensymphony.xwork2.Action; +import edu.emory.mathcs.backport.java.util.Collections; + /** * @author Hans S. Toemmerholt * @version $Id: GetDataElementAction.java 2869 2007-02-20 14:26:09Z andegje $ @@ -104,6 +109,13 @@ return defaultCategoryCombo; } + private List dataElementGroupSets; + + public List getDataElementGroupSets() + { + return dataElementGroupSets; + } + private List organisationUnitLevels; public List getOrganisationUnitLevels() @@ -120,9 +132,15 @@ defaultCategoryCombo = dataElementCategoryService.getDataElementCategoryComboByName( DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME ); dataElementGroups = dataElementService.getAllDataElementGroups(); - + dataElementCategoryCombos = new ArrayList( dataElementCategoryService.getAllDataElementCategoryCombos() ); + Collections.sort( dataElementCategoryCombos, new DataElementCategoryComboNameComparator() ); + + dataElementGroupSets = new ArrayList( dataElementService.getAllDataElementGroupSets() ); + + Collections.sort( dataElementGroupSets, new IdentifiableObjectNameComparator() ); + organisationUnitLevels = organisationUnitService.getOrganisationUnitLevels(); return SUCCESS; === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowUpdateDataElementFormAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowUpdateDataElementFormAction.java 2009-10-18 22:44:41 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowUpdateDataElementFormAction.java 2009-11-06 14:08:10 +0000 @@ -34,12 +34,14 @@ import java.util.List; import java.util.Map; +import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator; import org.hisp.dhis.dataelement.CalculatedDataElement; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategoryCombo; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; import org.hisp.dhis.dataelement.DataElementCategoryService; import org.hisp.dhis.dataelement.DataElementGroup; +import org.hisp.dhis.dataelement.DataElementGroupSet; import org.hisp.dhis.dataelement.DataElementService; import org.hisp.dhis.dataelement.Operand; import org.hisp.dhis.organisationunit.OrganisationUnitLevel; @@ -47,6 +49,8 @@ import com.opensymphony.xwork2.ActionSupport; +import edu.emory.mathcs.backport.java.util.Collections; + /** * @author Hans S. Toemmerholt * @version $Id: GetDataElementAction.java 2869 2007-02-20 14:26:09Z andegje $ @@ -139,6 +143,13 @@ return dataElementCategoryCombos; } + private List dataElementGroupSets; + + public List getDataElementGroupSets() + { + return dataElementGroupSets; + } + private List organisationUnitLevels; public List getOrganisationUnitLevels() @@ -196,6 +207,12 @@ } } + dataElementGroupSets = new ArrayList( dataElementService.getAllDataElementGroupSets() ); + + dataElementGroupSets.removeAll( dataElement.getGroupSets() ); + + Collections.sort( dataElementGroupSets, 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/dataelement/UpdateDataElementAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2009-11-06 10:50:01 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2009-11-06 14:08:10 +0000 @@ -150,6 +150,13 @@ this.url = url; } + private Collection dataElementGroupSets = new ArrayList(); + + public void setDataElementGroupSets( Collection dataElementGroupSets ) + { + this.dataElementGroupSets = dataElementGroupSets; + } + private Collection aggregationLevels; public void setAggregationLevels( Collection aggregationLevels ) @@ -275,7 +282,14 @@ calculatedDataElement.setSaved( saved != null ); } + + dataElement.getGroupSets().clear(); + for ( String id : dataElementGroupSets ) + { + dataElement.getGroupSets().add( dataElementService.getDataElementGroupSet( Integer.parseInt( id ) ) ); + } + dataElementService.updateDataElement( dataElement ); return SUCCESS; === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties 2009-11-06 10:50:01 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties 2009-11-06 14:08:10 +0000 @@ -375,3 +375,6 @@ intro_indicator_group_editor = Easily add or remove indicators to and from indicator groups. intro_indicator_group_set = Create, modify, view and delete indicator group sets. intro_data_dictionary = Create, modify, view and delete data dictionaries. +data_element_group_sets = Data element group sets +available_data_element_group_sets = Available data element group sets +selected_data_element_group_sets = Selected data element group sets === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm 2009-11-06 10:50:01 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm 2009-11-06 14:08:10 +0000 @@ -138,6 +138,50 @@ + + + + + + + +
$i18n.getString( "data_element_group_sets" )
+ + + + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js 2009-11-06 10:50:01 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js 2009-11-06 14:08:10 +0000 @@ -508,6 +508,7 @@ function submitAddDataElement() { selectAllById( "aggregationLevels" ); + selectAllById( "dataElementGroupSets" ); document.getElementById( "addDataElementForm" ).submit(); } @@ -515,6 +516,7 @@ function submitUpdateDataElement() { selectAllById( "aggregationLevels" ); + selectAllById( "dataElementGroupSets" ); document.getElementById( "updateDataElementForm" ).submit(); } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm 2009-11-06 10:50:01 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm 2009-11-06 14:08:10 +0000 @@ -159,6 +159,53 @@ + + + +
$i18n.getString( "data_element_group_sets" )
+ + + + + + + +
$i18n.getString( "aggregation_levels" )