=== added 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 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/ShowDataElementGroupEditorAction.java 2011-05-30 08:58:59 +0000 @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2004-2009, 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. + */ + +package org.hisp.dhis.dd.action.dataelementgroup; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import org.hisp.dhis.dataelement.DataElement; +import org.hisp.dhis.dataelement.DataElementGroup; +import org.hisp.dhis.dataelement.DataElementService; +import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler; + +import com.opensymphony.xwork2.Action; + +/** + * @author Chau Thu Tran + * @version $ ShowDataElementGroupEditorAction.java May 30, 2011 2:05:49 PM $ + * + */ +public class ShowDataElementGroupEditorAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private DataElementService dataElementService; + + public void setDataElementService( DataElementService dataElementService ) + { + this.dataElementService = dataElementService; + } + + // ------------------------------------------------------------------------- + // Comparator + // ------------------------------------------------------------------------- + + private Comparator dataElementComparator; + + public void setDataElementComparator( Comparator dataElementComparator ) + { + this.dataElementComparator = dataElementComparator; + } + + // ------------------------------------------------------------------------- + // Input & output + // ------------------------------------------------------------------------- + + private List dataElementGroups; + + public List getDataElementGroups() + { + return dataElementGroups; + } + + private List dataElements; + + public List getDataElements() + { + return dataElements; + } + + // ------------------------------------------------------------------------- + // DisplayPropertyHandler + // ------------------------------------------------------------------------- + + private DisplayPropertyHandler displayPropertyHandler; + + public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler ) + { + this.displayPropertyHandler = displayPropertyHandler; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() + throws Exception + { + dataElementGroups = new ArrayList( dataElementService.getAllDataElementGroups() ); + + dataElements = new ArrayList( dataElementService.getAllDataElements() ); + Collections.sort( dataElements, dataElementComparator ); + displayPropertyHandler.handle( dataElements ); + + return SUCCESS; + } + +} === added 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 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/ShowUpdateDataElementGroupFormAction.java 2011-05-30 08:58:59 +0000 @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2004-2009, 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. + */ + +package org.hisp.dhis.dd.action.dataelementgroup; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import org.hisp.dhis.dataelement.DataElement; +import org.hisp.dhis.dataelement.DataElementGroup; +import org.hisp.dhis.dataelement.DataElementService; +import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler; + +import com.opensymphony.xwork2.Action; + +/** + * @author Chau Thu Tran + * @version $ ShowUpdateDataElementGroupAction.java May 30, 2011 2:26:15 PM $ + * + */ +public class ShowUpdateDataElementGroupFormAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private DataElementService dataElementService; + + public void setDataElementService( DataElementService dataElementService ) + { + this.dataElementService = dataElementService; + } + + // ------------------------------------------------------------------------- + // Comparator + // ------------------------------------------------------------------------- + + private Comparator dataElementComparator; + + public void setDataElementComparator( Comparator dataElementComparator ) + { + this.dataElementComparator = dataElementComparator; + } + + // ------------------------------------------------------------------------- + // DisplayPropertyHandler + // ------------------------------------------------------------------------- + + private DisplayPropertyHandler displayPropertyHandler; + + public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler ) + { + this.displayPropertyHandler = displayPropertyHandler; + } + + // ------------------------------------------------------------------------- + // Input + // ------------------------------------------------------------------------- + + private Integer id; + + public void setId( Integer id ) + { + this.id = id; + } + + // ------------------------------------------------------------------------- + // Output + // ------------------------------------------------------------------------- + + private DataElementGroup dataElementGroup; + + public DataElementGroup getDataElementGroup() + { + return dataElementGroup; + } + + private List groupMembers = new ArrayList(); + + public List getGroupMembers() + { + return groupMembers; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() + { + // --------------------------------------------------------------------- + // Get group members + // --------------------------------------------------------------------- + + dataElementGroup = dataElementService.getDataElementGroup( id ); + + groupMembers = new ArrayList( dataElementGroup.getMembers() ); + + Collections.sort( groupMembers, dataElementComparator ); + + displayPropertyHandler.handle( groupMembers ); + + return SUCCESS; + } +} === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowUpdateIndicatorFormAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowUpdateIndicatorFormAction.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/indicator/ShowUpdateIndicatorFormAction.java 2011-05-30 08:58:59 +0000 @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2004-2009, 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. + */ + +package org.hisp.dhis.dd.action.indicator; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.hisp.dhis.indicator.Indicator; +import org.hisp.dhis.indicator.IndicatorService; +import org.hisp.dhis.indicator.IndicatorType; +import org.hisp.dhis.indicator.comparator.IndicatorTypeNameComparator; + +import com.opensymphony.xwork2.Action; + +/** + * @author Chau Thu Tran + * @version $ ShowUpdateIndicatorFormAction.java May 30, 2011 2:34:10 PM $ + * + */ +public class ShowUpdateIndicatorFormAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private IndicatorService indicatorService; + + public void setIndicatorService( IndicatorService indicatorService ) + { + this.indicatorService = indicatorService; + } + + // ------------------------------------------------------------------------- + // Input/output + // ------------------------------------------------------------------------- + + private Integer id; + + public void setId( Integer id ) + { + this.id = id; + } + + private Indicator indicator; + + public Indicator getIndicator() + { + return indicator; + } + + private int selectedIndicatorType; + + public int getSelectedIndicatorType() + { + return selectedIndicatorType; + } + + private String indicatorTypeName; + + public String getIndicatorTypeName() + { + return indicatorTypeName; + } + + private List indicatorTypes; + + public List getIndicatorTypes() + { + return indicatorTypes; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() + { + indicator = indicatorService.getIndicator( id ); + + if ( indicator.getIndicatorType() != null ) + { + selectedIndicatorType = indicator.getIndicatorType().getId(); + + indicatorTypeName = indicator.getIndicatorType().getName(); + } + + indicatorTypes = new ArrayList( indicatorService.getAllIndicatorTypes() ); + + Collections.sort( indicatorTypes, new IndicatorTypeNameComparator() ); + + return SUCCESS; + } + +} === removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/GetIndicatorGroupMembersAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/GetIndicatorGroupMembersAction.java 2011-05-27 10:24:03 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/GetIndicatorGroupMembersAction.java 1970-01-01 00:00:00 +0000 @@ -1,126 +0,0 @@ -package org.hisp.dhis.dd.action.indicatorgroup; - -/* - * Copyright (c) 2004-2010, 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.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -import org.hisp.dhis.indicator.Indicator; -import org.hisp.dhis.indicator.IndicatorGroup; -import org.hisp.dhis.indicator.IndicatorService; -import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler; - -import com.opensymphony.xwork2.Action; - -/** - * @author Torgeir Lorange Ostby - */ -public class GetIndicatorGroupMembersAction - implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private IndicatorService indicatorService; - - public void setIndicatorService( IndicatorService indicatorService ) - { - this.indicatorService = indicatorService; - } - - // ------------------------------------------------------------------------- - // Comparator - // ------------------------------------------------------------------------- - - private Comparator indicatorComparator; - - public void setIndicatorComparator( Comparator indicatorComparator ) - { - this.indicatorComparator = indicatorComparator; - } - - // ------------------------------------------------------------------------- - // DisplayPropertyHandler - // ------------------------------------------------------------------------- - - private DisplayPropertyHandler displayPropertyHandler; - - public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler ) - { - this.displayPropertyHandler = displayPropertyHandler; - } - - // ------------------------------------------------------------------------- - // Input - // ------------------------------------------------------------------------- - - private Integer id; - - public void setId( Integer id ) - { - this.id = id; - } - - // ------------------------------------------------------------------------- - // Output - // ------------------------------------------------------------------------- - - private List groupMembers = new ArrayList(); - - public List getGroupMembers() - { - return groupMembers; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() - { - // --------------------------------------------------------------------- - // Get group members - // --------------------------------------------------------------------- - - if ( id != null ) - { - IndicatorGroup group = indicatorService.getIndicatorGroup( id.intValue() ); - - groupMembers = new ArrayList( group.getMembers() ); - - Collections.sort( groupMembers, indicatorComparator ); - - displayPropertyHandler.handle( groupMembers ); - } - - return SUCCESS; - } -} === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/ShowIndicatorGroupEditorAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/ShowIndicatorGroupEditorAction.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/indicatorgroup/ShowIndicatorGroupEditorAction.java 2011-05-30 08:58:59 +0000 @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2004-2009, 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. + */ + +package org.hisp.dhis.dd.action.indicatorgroup; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import org.hisp.dhis.indicator.Indicator; +import org.hisp.dhis.indicator.IndicatorGroup; +import org.hisp.dhis.indicator.IndicatorService; +import org.hisp.dhis.indicator.comparator.IndicatorGroupNameComparator; +import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler; + +import com.opensymphony.xwork2.Action; + +/** + * @author Chau Thu Tran + * @version $ ShowIndicatorGroupEditorAction.java May 30, 2011 2:44:20 PM $ + * + */ +public class ShowIndicatorGroupEditorAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private IndicatorService indicatorService; + + public void setIndicatorService( IndicatorService indicatorService ) + { + this.indicatorService = indicatorService; + } + + // ------------------------------------------------------------------------- + // Comparator + // ------------------------------------------------------------------------- + + private Comparator indicatorComparator; + + public void setIndicatorComparator( Comparator indicatorComparator ) + { + this.indicatorComparator = indicatorComparator; + } + + // ------------------------------------------------------------------------- + // DisplayPropertyHandler + // ------------------------------------------------------------------------- + + private DisplayPropertyHandler displayPropertyHandler; + + public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler ) + { + this.displayPropertyHandler = displayPropertyHandler; + } + + // ------------------------------------------------------------------------- + // Input & Output + // ------------------------------------------------------------------------- + + private List indicatorGroups; + + public List getIndicatorGroups() + { + return indicatorGroups; + } + + private List indicators; + + public List getIndicators() + { + return indicators; + } + + // ------------------------------------------------------------------------- + + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() + { + indicatorGroups = new ArrayList( indicatorService.getAllIndicatorGroups() ); + + Collections.sort( indicatorGroups, new IndicatorGroupNameComparator() ); + + + indicators = new ArrayList( indicatorService.getAllIndicators() ); + + Collections.sort( indicators, indicatorComparator ); + + displayPropertyHandler.handle( indicators ); + + return SUCCESS; + } +} === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/ShowUpdateIndicatorGroupFormAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/ShowUpdateIndicatorGroupFormAction.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/indicatorgroup/ShowUpdateIndicatorGroupFormAction.java 2011-05-30 08:58:59 +0000 @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2004-2009, 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. + */ + +package org.hisp.dhis.dd.action.indicatorgroup; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import org.hisp.dhis.indicator.Indicator; +import org.hisp.dhis.indicator.IndicatorGroup; +import org.hisp.dhis.indicator.IndicatorService; +import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler; + +import com.opensymphony.xwork2.Action; + +/** + * @author Chau Thu Tran + * @version $ ShowUpdateIndicatorGroupFormAction.java May 30, 2011 3:01:41 PM $ + * + */ +public class ShowUpdateIndicatorGroupFormAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private IndicatorService indicatorService; + + public void setIndicatorService( IndicatorService indicatorService ) + { + this.indicatorService = indicatorService; + } + + // ------------------------------------------------------------------------- + // Comparator + // ------------------------------------------------------------------------- + + private Comparator indicatorComparator; + + public void setIndicatorComparator( Comparator indicatorComparator ) + { + this.indicatorComparator = indicatorComparator; + } + + // ------------------------------------------------------------------------- + // DisplayPropertyHandler + // ------------------------------------------------------------------------- + + private DisplayPropertyHandler displayPropertyHandler; + + public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler ) + { + this.displayPropertyHandler = displayPropertyHandler; + } + + // ------------------------------------------------------------------------- + // Input/output + // ------------------------------------------------------------------------- + + private Integer id; + + public void setId( Integer id ) + { + this.id = id; + } + + private IndicatorGroup indicatorGroup; + + public IndicatorGroup getIndicatorGroup() + { + return indicatorGroup; + } + + private List groupMembers = new ArrayList(); + + public List getGroupMembers() + { + return groupMembers; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() + { + indicatorGroup = indicatorService.getIndicatorGroup( id ); + + groupMembers = new ArrayList( indicatorGroup.getMembers() ); + + Collections.sort( groupMembers, indicatorComparator ); + + displayPropertyHandler.handle( groupMembers ); + + return SUCCESS; + } +} \ No newline at end of file === 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 2011-05-27 10:24:03 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml 2011-05-30 08:58:59 +0000 @@ -39,6 +39,15 @@ + + + + + + @@ -125,12 +134,21 @@ scope="prototype"> - + - + + + + + + + @@ -138,7 +156,7 @@ - + - + - + - + + + + + + + @@ -314,6 +341,15 @@ + + + + + + @@ -332,15 +368,6 @@ - - - - - - @@ -348,7 +375,7 @@ - + - + - + + + + + + + @@ -542,7 +577,7 @@ - + @@ -711,7 +746,7 @@ - + - @@ -791,59 +825,49 @@ - + - - - + - - - + - + - + class="org.hisp.dhis.dd.action.concept.UpdateConceptAction" scope="prototype"> + - + - - - - - - - + class="org.hisp.dhis.dd.action.concept.RemoveConceptAction" scope="prototype"> + + + + + + + - + class="org.hisp.dhis.dd.action.concept.GetConceptListAction" scope="prototype"> + - + - + - + === 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 2011-05-27 10:24:03 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2011-05-30 08:58:59 +0000 @@ -97,17 +97,7 @@ - dataElementGroupEditorChain1 - - - - dataElementGroupEditorChain2 - - - + class="org.hisp.dhis.dd.action.dataelementgroup.ShowDataElementGroupEditorAction"> /main.vm /dhis-web-maintenance-datadictionary/dataElementGroupEditorView.vm /dhis-web-maintenance-datadictionary/menu.vm @@ -185,14 +175,7 @@ - - getGroupMembersAndAvailableElements - F_DATAELEMENTGROUP_UPDATE - - - + class="org.hisp.dhis.dd.action.dataelementgroup.ShowUpdateDataElementGroupFormAction"> /main.vm /dhis-web-maintenance-datadictionary/updateDataElementGroupForm.vm javascript/dataElementGroup.js @@ -326,13 +309,7 @@ - getIndicatorTypeList - F_INDICATOR_UPDATE - - - + class="org.hisp.dhis.dd.action.indicator.ShowUpdateIndicatorFormAction"> /main.vm /dhis-web-maintenance-datadictionary/updateIndicatorForm.vm javascript/shortName.js,javascript/indicator.js,javascript/denum.js @@ -358,17 +335,7 @@ - indicatorGroupEditorChain1 - - - - indicatorGroupEditorChain2 - - - + class="org.hisp.dhis.dd.action.indicatorgroup.ShowIndicatorGroupEditorAction"> /main.vm /dhis-web-maintenance-datadictionary/indicatorGroupEditorView.vm /dhis-web-maintenance-datadictionary/menu.vm @@ -446,14 +413,7 @@ - - getGroupMembersAndAvailableIndicators - F_INDICATORGROUP_UPDATE - - - + class="org.hisp.dhis.dd.action.indicatorgroup.ShowUpdateIndicatorGroupFormAction"> /main.vm /dhis-web-maintenance-datadictionary/updateIndicatorGroupForm.vm javascript/indicatorGroup.js