=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/PivotDataSetAssociationTable.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/PivotDataSetAssociationTable.java 2010-08-27 07:07:57 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/PivotDataSetAssociationTable.java 1970-01-01 00:00:00 +0000 @@ -1,101 +0,0 @@ -/* - * 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. - */ -package org.hisp.dhis.dataset; - -import java.util.ArrayList; -import java.util.List; - -import org.hisp.dhis.aggregation.AggregatedDataSetAssociation; -import org.hisp.dhis.organisationunit.OrganisationUnit; - -/** - * @author Chau Thu Tran - * @version $ID : DataSetAssociationTable.java 10:17:51 AM Jul 9, 2010 - */ -public class PivotDataSetAssociationTable -{ - private List dataSets = new ArrayList(); - -// private List periodTypes = new ArrayList(); - - private List organisationUnits = new ArrayList(); - - private List associations = new ArrayList(); - - // ------------------------------------------------------------------------- - // Constructor - // ------------------------------------------------------------------------- - - public PivotDataSetAssociationTable() - { - } - - // ------------------------------------------------------------------------- - // Getters and setters - // ------------------------------------------------------------------------- - - public List getDataSets() - { - return dataSets; - } - - public void setDataSets( List dataSets ) - { - this.dataSets = dataSets; - } - -// public List getPeriodTypes() -// { -// return periodTypes; -// } -// -// public void setPeriodTypes( List periodTypes ) -// { -// this.periodTypes = periodTypes; -// } - - public List getOrganisationUnits() - { - return organisationUnits; - } - - public void setOrganisationUnits( List organisationUnits ) - { - this.organisationUnits = organisationUnits; - } - - public List getAssociations() - { - return associations; - } - - public void setAssociations( List associations ) - { - this.associations = associations; - } - -} === removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/PivotDataSetAssociationTableService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/PivotDataSetAssociationTableService.java 2010-08-20 07:54:16 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/PivotDataSetAssociationTableService.java 1970-01-01 00:00:00 +0000 @@ -1,45 +0,0 @@ -/* - * 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. - */ -package org.hisp.dhis.dataset; - - - -/** - * @author Chau Thu Tran - * @version $ID : PivotDataSetAssociationTableService.java 10:22:40 AM Jul 9, - * 2010 - */ -public interface PivotDataSetAssociationTableService -{ - /** - * Returns a PivotDataSetAssociationTable object. - * - * @param level the OrganisationUnit level. - * @return a PivotDataSetAssociationTable object. - */ - PivotDataSetAssociationTable getPivotDataSetAssociationTable( int level, String periodTypeName ); -} === removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultPivotDataSetAssociationTableService.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultPivotDataSetAssociationTableService.java 2010-08-20 08:03:31 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultPivotDataSetAssociationTableService.java 1970-01-01 00:00:00 +0000 @@ -1,141 +0,0 @@ -/* - * 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. - */ -package org.hisp.dhis.dataset; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.hisp.dhis.aggregation.AggregatedDataSetAssociation; -import org.hisp.dhis.dataset.comparator.DataSetNameComparator; -import org.hisp.dhis.organisationunit.OrganisationUnit; -import org.hisp.dhis.organisationunit.OrganisationUnitService; -import org.hisp.dhis.period.PeriodService; -import org.hisp.dhis.period.PeriodType; - -/** - * @author Lars Helge Overland - * @version $ID : DefaultPivotDataSetAssociationTableService.java 10:28:18 AM - * Jul 30, 2010 - */ -public class DefaultPivotDataSetAssociationTableService - implements PivotDataSetAssociationTableService -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private DataSetService dataSetService; - - public void setDataSetService( DataSetService dataSetService ) - { - this.dataSetService = dataSetService; - } - - private OrganisationUnitService organisationUnitService; - - public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) - { - this.organisationUnitService = organisationUnitService; - } - - private PeriodService periodService; - - public void setPeriodService( PeriodService periodService ) - { - this.periodService = periodService; - } - - // ------------------------------------------------------------------------- - // Implementation methods - // ------------------------------------------------------------------------- - - @Override - public PivotDataSetAssociationTable getPivotDataSetAssociationTable( int level, String periodTypeName ) - { - PeriodType periodType = periodService.getPeriodTypeByName( periodTypeName ); - - List organisationUnits = new ArrayList( organisationUnitService - .getOrganisationUnitsAtLevel( level ) ); - - List associations = new ArrayList(); - - Map> dataSetMap = getDataSetMap( organisationUnits ); - - List dataSetsByPeriodType = new ArrayList( dataSetService - .getDataSetsByPeriodType( periodType ) ); - - if ( dataSetsByPeriodType.size() > 0 ) - { - Collections.sort( dataSetsByPeriodType, new DataSetNameComparator() ); - - for ( OrganisationUnit orgunit : organisationUnits ) - { - Collection dataSetCollection = dataSetMap.get( orgunit.getId() ); - - for ( DataSet dataSet : dataSetsByPeriodType ) - { - boolean assigned = dataSetCollection.contains( dataSet ); - - AggregatedDataSetAssociation assoc = new AggregatedDataSetAssociation(); - assoc.setOrganisationUnitId( orgunit.getId() ); - assoc.setDataSetId( dataSet.getId() ); - assoc.setLevel( level ); - assoc.setAssigned( assigned ); - - associations.add( assoc ); - } - } - } - - PivotDataSetAssociationTable table = new PivotDataSetAssociationTable(); - table.setOrganisationUnits( organisationUnits ); - table.setDataSets( dataSetsByPeriodType ); - table.setAssociations( associations ); - - return table; - } - - // ------------------------------------------------------------------------- - // Private methods - // ------------------------------------------------------------------------- - - private Map> getDataSetMap( Collection organisationUnits ) - { - Map> dataSetMap = new HashMap>(); - - for ( OrganisationUnit unit : organisationUnits ) - { - dataSetMap.put( unit.getId(), dataSetService.getDataSetsBySource( unit ) ); - } - - return dataSetMap; - } -} === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2011-01-07 11:38:55 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2011-01-11 17:04:20 +0000 @@ -440,14 +440,6 @@ - - - - - - === removed directory 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/pivotassociation' === removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/pivotassociation/DefineAssociationAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/pivotassociation/DefineAssociationAction.java 2010-08-20 07:54:16 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/pivotassociation/DefineAssociationAction.java 1970-01-01 00:00:00 +0000 @@ -1,117 +0,0 @@ -/* - * 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. - */ -package org.hisp.dhis.dataset.action.pivotassociation; - -import org.hisp.dhis.dataset.DataSet; -import org.hisp.dhis.dataset.DataSetService; -import org.hisp.dhis.organisationunit.OrganisationUnit; -import org.hisp.dhis.organisationunit.OrganisationUnitService; - -import com.opensymphony.xwork2.Action; - -/** - * @author Chau Thu Tran - * @version $ID : DefineAssociationAction.java 4:49:05 PM Jul 30, 2010 - */ -public class DefineAssociationAction - implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private DataSetService dataSetService; - - private OrganisationUnitService organisationUnitService; - - // ------------------------------------------------------------------------- - // Output - // ------------------------------------------------------------------------- - - private Integer dataSetId; - - private Integer organisationId; - - private boolean assigned; - - // ------------------------------------------------------------------------- - // Getters && Setters - // ------------------------------------------------------------------------- - - public void setDataSetService( DataSetService dataSetService ) - { - this.dataSetService = dataSetService; - } - - public void setDataSetId( Integer dataSetId ) - { - this.dataSetId = dataSetId; - } - - public void setOrganisationId( Integer organisationId ) - { - this.organisationId = organisationId; - } - - public void setAssigned( boolean assigned ) - { - this.assigned = assigned; - } - - public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) - { - this.organisationUnitService = organisationUnitService; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - @Override - public String execute() - throws Exception - { - DataSet dataSet = dataSetService.getDataSet( dataSetId ); - OrganisationUnit orgunit = organisationUnitService.getOrganisationUnit( organisationId ); - - if ( assigned ) - { - dataSet.getSources().add( orgunit ); - orgunit.getDataSets().add( dataSet ); - } - else - { - dataSet.getSources().remove( orgunit ); - orgunit.getDataSets().remove( dataSet ); - } - - dataSetService.updateDataSet( dataSet ); - - return SUCCESS; - } - -} === removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/pivotassociation/GetOrganisationUnitLevelsAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/pivotassociation/GetOrganisationUnitLevelsAction.java 2010-08-20 07:54:16 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/pivotassociation/GetOrganisationUnitLevelsAction.java 1970-01-01 00:00:00 +0000 @@ -1,76 +0,0 @@ -package org.hisp.dhis.dataset.action.pivotassociation; - -/* - * 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.List; - -import org.hisp.dhis.organisationunit.OrganisationUnitLevel; -import org.hisp.dhis.organisationunit.OrganisationUnitService; - -import com.opensymphony.xwork2.Action; - -/** - * @author Lars Helge Overland - * @version $Id$ - */ -public class GetOrganisationUnitLevelsAction - implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private OrganisationUnitService organisationUnitService; - - public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) - { - this.organisationUnitService = organisationUnitService; - } - - // ------------------------------------------------------------------------- - // Output - // ------------------------------------------------------------------------- - - private List levels; - - public List getLevels() - { - return levels; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() - { - levels = organisationUnitService.getOrganisationUnitLevels(); - - return SUCCESS; - } -} === removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/pivotassociation/GetPeriodTypesAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/pivotassociation/GetPeriodTypesAction.java 2010-08-20 07:54:16 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/pivotassociation/GetPeriodTypesAction.java 1970-01-01 00:00:00 +0000 @@ -1,76 +0,0 @@ -package org.hisp.dhis.dataset.action.pivotassociation; - -/* - * 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.List; - -import org.hisp.dhis.period.PeriodService; -import org.hisp.dhis.period.PeriodType; - -import com.opensymphony.xwork2.Action; - -/** - * @author Lars Helge Overland - * @version $Id$ - */ -public class GetPeriodTypesAction - implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private PeriodService periodService; - - public void setPeriodService( PeriodService periodService ) - { - this.periodService = periodService; - } - - // ------------------------------------------------------------------------- - // Input - // ------------------------------------------------------------------------- - - private List periodTypes; - - public List getPeriodTypes() - { - return periodTypes; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() - { - periodTypes = periodService.getAllPeriodTypes(); - - return SUCCESS; - } -} === removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/pivotassociation/GetPivotDataSetAssocicationTableAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/pivotassociation/GetPivotDataSetAssocicationTableAction.java 2010-08-31 05:47:11 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/pivotassociation/GetPivotDataSetAssocicationTableAction.java 1970-01-01 00:00:00 +0000 @@ -1,98 +0,0 @@ -/* - * 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. - */ -package org.hisp.dhis.dataset.action.pivotassociation; - -import org.hisp.dhis.dataset.PivotDataSetAssociationTable; -import org.hisp.dhis.dataset.PivotDataSetAssociationTableService; - -import com.opensymphony.xwork2.Action; - -/** - * @author Chau Thu Tran - * @version $ID : GetPivotDataSetAssocicationTable.java 11:09:50 AM Jul 30, 2010 - */ -public class GetPivotDataSetAssocicationTableAction - implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private PivotDataSetAssociationTableService associationTableService; - - // ------------------------------------------------------------------------- - // Input - // ------------------------------------------------------------------------- - - private Integer level; - - private String periodTypeName; - - // ------------------------------------------------------------------------- - // Output - // ------------------------------------------------------------------------- - - private PivotDataSetAssociationTable associationtable; - - // ------------------------------------------------------------------------- - // Getters && Setters - // ------------------------------------------------------------------------- - - public PivotDataSetAssociationTable getAssociationtable() - { - return associationtable; - } - - public void setPeriodTypeName( String periodTypeName ) - { - this.periodTypeName = periodTypeName; - } - - public void setAssociationTableService( PivotDataSetAssociationTableService associationTableService ) - { - this.associationTableService = associationTableService; - } - - public void setLevel( Integer level ) - { - this.level = level; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - @Override - public String execute() - throws Exception - { - - associationtable = associationTableService.getPivotDataSetAssociationTable( level, periodTypeName ); - - return SUCCESS; - } -} === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml 2010-12-30 09:13:41 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml 2011-01-11 17:04:20 +0000 @@ -179,37 +179,6 @@ - - - - - - - - - - - - - - - - - - - plainTextError - - - - /main.vm - /dhis-web-maintenance-dataset/viewPivotAssociationTableForm.vm - /dhis-web-maintenance-dataset/menu.vm - javascript/pivotAssociationTable.js,javascript/criteria.js - css/pivot.css - - - - /dhis-web-maintenance-dataset/responsePivotAssociationTable.vm - plainTextError - - - - /dhis-web-maintenance-dataset/responseOrganisationUnitLevel.vm - plainTextError - - - - /dhis-web-maintenance-dataset/responsePeriodType.vm - plainTextError - - - - /dhis-web-commons/ajax/jsonResponseSuccess.vm - plainTextError - - === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/index.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/index.vm 2011-01-11 16:52:46 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/index.vm 2011-01-11 17:04:20 +0000 @@ -5,5 +5,4 @@ #introListImgItem( "dataSet.action" "dataset" "dataset" ) #introListImgItem( "section.action" "dataset_section" "dataset" ) #introListImgItem( "showAssignMultiDataSetForOrgunitForm.action" "assign_multidataset" "dataset" ) - #introListImgItem( "displayAssociationTableForm.action" "dataset_association_management" "dataset" ) \ No newline at end of file === removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/pivotAssociationTable.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/pivotAssociationTable.js 2010-08-20 07:54:16 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/pivotAssociationTable.js 1970-01-01 00:00:00 +0000 @@ -1,412 +0,0 @@ - -// ----------------------------------------------------------------------------- -// Global variables -// ----------------------------------------------------------------------------- - -var dataSets = []; // Array->associative array (id,name) -var orgunits = []; // Array->associative array (id,name) -var data = []; // Associative array [(dataset-periodType-orgunit), (association)] - -var sizes = []; // Associative array (dimension, size) - -var pivotDataSet = true; // Should correspond to init value in form -var pivotOrgunit = false; - -var currentDataSet = 0; -var currentOrgunit = 0; - -// ----------------------------------------------------------------------------- -// Public methods -// ----------------------------------------------------------------------------- - -/** - * This method is called from the UI and is responsible for retrieving data from - * the server and setting the global variables. - */ -function getData() -{ - clearGlobalVariables(); - - var levelList = byId( "level" ); - var periodTypeList = byId("periodType"); - - var level = levelList.options[ levelList.selectedIndex ].value; - var periodTypeName = periodTypeList.options[ periodTypeList.selectedIndex ].value; - - document.getElementById( "dataLabel" ).innerHTML = i18n_organisation_unit_level + ": " + level + ", " + i18n_period_type + ": " + periodTypeName; - - hideDivs(); - - showLoader(); - - $.getJSON( - "getPivotAssociationTable.action", - { - "level": level, - "periodTypeName": periodTypeName - }, - function( json ) - { - var pivot = json.pivottable; - - dataSets = pivot.dataSets; - orgunits = pivot.organisationUnits; - - sizes["dataSet"] = pivot.sizeDataSets; - sizes["orgunit"] = pivot.sizeOrganisationUnits; - - data = pivot.associations[0]; - - hideLoader(); - - generateTable(); - } - ); -} - -/** - * This method is called from the UI and is responsible for pivoting the table. - */ -function pivotData() -{ - pivotDataSet = document.getElementById( "dataSetBox" ).checked; - pivotOrgunit = document.getElementById( "orgunitBox" ).checked; - - hideDivs(); - - generateTable(); -} - - -/** - * This method is called from the UI and assigns a dataset for orgunit. - */ -function assignDataSet( dataSetId, organisationId, assigned, imgElement ) -{ - $.getJSON( - "defineAssociation.action", - { - "dataSetId": dataSetId, - "organisationId": organisationId, - "assigned": assigned - }, - function( json ) - { - if ( json.response == "success" ) - { - data[dataSetId + '-' + organisationId] = assigned; - - var action = 'assignDataSet( ' + - dataSetId + ',' + - organisationId + ',' + - !assigned + ', this)'; - - if(assigned == true){ - imgElement.src = "../images/check.png"; - imgElement.title = "Unassign"; - imgElement.setAttribute('onclick', action); - }else{ - imgElement.src = "../images/cross.png"; - imgElement.title = "Assign"; - imgElement.setAttribute('onclick', action); - } - } - } - ); -} - -// ----------------------------------------------------------------------------- -// Supportive methods -// ----------------------------------------------------------------------------- - -/** - * This method is responsible for generating the pivot table. - */ -function generateTable() -{ - var columnDataSets = pivotDataSet ? dataSets : [null]; - var columnOrgunits = pivotOrgunit ? orgunits : [null]; - - var rowDataSets = pivotDataSet ? [null] : dataSets; - var rowOrgunits = pivotOrgunit ? [null] : orgunits; - - var table = document.getElementById( "pivotTable" ); - - clearTable( table ); - - var columns = getColumns( columnDataSets, columnOrgunits ); - var rows = getRows( rowDataSets, rowOrgunits ); - - var columnDimensions = getColumnDimensions(); - var rowDimensions = getRowDimensions(); - - var colSpans = getSpans( columnDimensions ); - var rowSpans = getSpans( rowDimensions ); - - var html = ""; - - // --------------------------------------------------------------------------- - // Column headers - // --------------------------------------------------------------------------- - - for ( d in columnDimensions ) - { - for ( rowDimension in rowDimensions ) // Make space for row header - { - html += ""; - } - - var dimension = columnDimensions[d]; - var colSpan = colSpans[dimension]; - - for ( c in columns ) - { - var modulus = c % colSpan; - - if ( modulus == 0 ) - { - html += "" + columns[c][dimension] + ""; - } - } - - html += ""; - } - - // --------------------------------------------------------------------------- - // Rows - // --------------------------------------------------------------------------- - - for ( r in rows ) - { - html += ""; - - for ( d in rowDimensions ) // Row headers - { - var dimension = rowDimensions[d]; - var rowSpan = rowSpans[dimension]; - var modulus = r % rowSpan; - - if ( modulus == 0 ) - { - html += "" + rows[r][dimension] + ""; - } - } - - for ( c in columns ) // Values - { - var value = getValue( columns[c], rows[r] ); - - var ids = mergeArrays( columns[c], rows[r] ); - - html += ""; - } - - html += ""; - } - - table.innerHTML = html; - - hidePivot(); -} - -/** -* @param dimensions array -> dimensions -* -* @return associative array ( dimension, span ) -*/ -function getSpans( dimensions ) -{ - var spans = []; - - var lastIndex = ( dimensions.length - 1 ); - - var span = 1; - - for ( var i=lastIndex; i>=0; i-- ) - { - var dimension = dimensions[i]; - - spans[dimension] = span; - - var dimensionSize = sizes[dimension]; - - span = ( span * dimensionSize ); - } - - return spans; -} - -/** -* @param columnDataSets array -> associative array ( DataSetId, DataSetName ) -* @param columnOrgunits array -> associative array ( orgunitId, orgunitName ) -* -* @return array -> associative array ( dataSetId, dataSet, periodTypeId, periodType, orgunitId, orgunit ) -*/ -function getColumns( columnDataSets, columnOrgunits ) -{ - var columns = []; - var columnsIndex = 0; - - for ( var i=0; i associative array ( dataSetId, dataSetName ) -* @param rowOrgunits array -> associative array ( orgunitId, orgunitName ) -* -* @return array -> associative array ( dataSetId, dataSet, orgunitId, orgunit ) -*/ -function getRows( rowDataSets, rowOrgunits ) -{ - var rows = []; - var rowsIndex = 0; - - for ( var i=0; i dimension -*/ -function getColumnDimensions() -{ - var dimensions = []; - - if ( pivotDataSet ) - { - dimensions[dimensions.length] = "dataSet"; - } - - if ( pivotOrgunit ) - { - dimensions[dimensions.length] = "orgunit"; - } - - return dimensions; -} - -/** -* @return array -> dimension -*/ -function getRowDimensions() -{ - var dimensions = []; - - if ( !pivotDataSet ) - { - dimensions[dimensions.length] = "dataSet"; - } - - if ( !pivotOrgunit ) - { - dimensions[dimensions.length] = "orgunit"; - } - - return dimensions; -} - -/** - * @param array1 the first associative array. - * @param array2 the second associative array. - * - * @return an associative array with the merged contents of the input arrays. - */ -function mergeArrays( array1, array2 ) -{ - for ( a2 in array2 ) - { - array1[a2] = array2[a2]; - } - - return array1; -} - -/** - * @param column associative array ( columnId, columnName ) - * @param row associative array ( rowId, rowName ) - * - * @return the value for the given combination of dimension identifiers. - */ -function getValue( column, row ) -{ - var key = mergeArrays( column, row ); - - var keyString = key.dataSetId + "-" + key.orgunitId; - - var value = data[keyString]; - - value = ( value!= null) ? eval(value) : false; - - if(value==true){ - value = ''; - }else{ - value = ''; - } - - return value; -} - -/** - * Clears the table. - */ -function clearTable( table ) -{ - while ( table.rows.length > 0 ) - { - table.deleteRow( 0 ); - } -} - -/** - * Clears the global variables. - */ -function clearGlobalVariables() -{ - dataSets.length = 0; - orgunits.length = 0; - data.length = 0; - sizes.length = 0; -} === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/menu.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/menu.vm 2010-08-20 07:54:16 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/menu.vm 2011-01-11 17:04:20 +0000 @@ -4,5 +4,4 @@
  • $i18n.getString( "dataset" ) 
  • $i18n.getString( "dataset_section" ) 
  • $i18n.getString( "dataset_assignment_editor" ) 
  • -
  • $i18n.getString( "dataset_association_management" ) 
  • \ No newline at end of file === removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewPivotAssociationTableForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewPivotAssociationTableForm.vm 2010-09-21 06:16:05 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewPivotAssociationTableForm.vm 1970-01-01 00:00:00 +0000 @@ -1,74 +0,0 @@ - - - - -  - -
    - - - - - - - - - - - -#parse( "dhis-web-commons/loader/loader.vm" ) - -
    -
    -
    - - - - \ No newline at end of file