=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetDataSets.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetDataSets.java 2012-02-08 12:04:46 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetDataSets.java 1970-01-01 00:00:00 +0000 @@ -1,119 +0,0 @@ -package org.hisp.dhis.dataadmin.action.lockexception; - -/* - * 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.dataset.DataSet; -import org.hisp.dhis.organisationunit.OrganisationUnit; -import org.hisp.dhis.organisationunit.OrganisationUnitService; -import org.hisp.dhis.user.CurrentUserService; -import org.hisp.dhis.user.UserCredentials; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Morten Olav Hansen - */ -public class GetDataSets - implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private CurrentUserService currentUserService; - - public void setCurrentUserService( CurrentUserService currentUserService ) - { - this.currentUserService = currentUserService; - } - - private OrganisationUnitService organisationUnitService; - - public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) - { - this.organisationUnitService = organisationUnitService; - } - - // ------------------------------------------------------------------------- - // Input & Output - // ------------------------------------------------------------------------- - - private int id; - - public void setId( int id ) - { - this.id = id; - } - - private List dataSets; - - public List getDataSets() - { - return dataSets; - } - - // ------------------------------------------------------------------------- - // Action Implementation - // ------------------------------------------------------------------------- - - @Override - public String execute() throws Exception - { - dataSets = getDataSetsForCurrentUser( id ); - - return SUCCESS; - } - - public List getDataSetsForCurrentUser( int id ) - { - OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( id ); - - if ( organisationUnit == null ) - { - return new ArrayList(); - } - - List dataSets = new ArrayList(); - - if ( organisationUnit.getDataSets() != null ) - { - dataSets.addAll( organisationUnit.getDataSets() ); - } - - UserCredentials userCredentials = currentUserService.getCurrentUser().getUserCredentials(); - - if ( !userCredentials.isSuper() ) - { - dataSets.retainAll( userCredentials.getAllDataSets() ); - } - - return dataSets; - } -} === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetDataSetsAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetDataSetsAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetDataSetsAction.java 2012-02-08 13:38:13 +0000 @@ -0,0 +1,119 @@ +package org.hisp.dhis.dataadmin.action.lockexception; + +/* + * 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.dataset.DataSet; +import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.organisationunit.OrganisationUnitService; +import org.hisp.dhis.user.CurrentUserService; +import org.hisp.dhis.user.UserCredentials; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Morten Olav Hansen + */ +public class GetDataSetsAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private CurrentUserService currentUserService; + + public void setCurrentUserService( CurrentUserService currentUserService ) + { + this.currentUserService = currentUserService; + } + + private OrganisationUnitService organisationUnitService; + + public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) + { + this.organisationUnitService = organisationUnitService; + } + + // ------------------------------------------------------------------------- + // Input & Output + // ------------------------------------------------------------------------- + + private int id; + + public void setId( int id ) + { + this.id = id; + } + + private List dataSets; + + public List getDataSets() + { + return dataSets; + } + + // ------------------------------------------------------------------------- + // Action Implementation + // ------------------------------------------------------------------------- + + @Override + public String execute() throws Exception + { + dataSets = getDataSetsForCurrentUser( id ); + + return SUCCESS; + } + + private List getDataSetsForCurrentUser( int id ) + { + OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( id ); + + if ( organisationUnit == null ) + { + return new ArrayList(); + } + + List dataSets = new ArrayList(); + + if ( organisationUnit.getDataSets() != null ) + { + dataSets.addAll( organisationUnit.getDataSets() ); + } + + UserCredentials userCredentials = currentUserService.getCurrentUser().getUserCredentials(); + + if ( !userCredentials.isSuper() ) + { + dataSets.retainAll( userCredentials.getAllDataSets() ); + } + + return dataSets; + } +} === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetLockExceptionFormAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetLockExceptionFormAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetLockExceptionFormAction.java 2012-02-08 13:38:13 +0000 @@ -0,0 +1,203 @@ +package org.hisp.dhis.dataadmin.action.lockexception; + +/* + * 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.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; +import org.hisp.dhis.dataset.LockException; +import org.hisp.dhis.i18n.I18nFormat; +import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.organisationunit.OrganisationUnitService; +import org.hisp.dhis.oust.manager.SelectionTreeManager; +import org.hisp.dhis.period.CalendarPeriodType; +import org.hisp.dhis.period.Period; +import org.hisp.dhis.system.filter.PastAndCurrentPeriodFilter; +import org.hisp.dhis.system.util.FilterUtils; +import org.hisp.dhis.user.CurrentUserService; +import org.hisp.dhis.user.UserCredentials; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; + +/** + * @author Morten Olav Hansen + */ +public class GetLockExceptionFormAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private CurrentUserService currentUserService; + + public void setCurrentUserService( CurrentUserService currentUserService ) + { + this.currentUserService = currentUserService; + } + + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } + + private OrganisationUnitService organisationUnitService; + + public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) + { + this.organisationUnitService = organisationUnitService; + } + + private SelectionTreeManager selectionTreeManager; + + public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager ) + { + this.selectionTreeManager = selectionTreeManager; + } + + private I18nFormat format; + + public void setFormat( I18nFormat format ) + { + this.format = format; + } + + // ------------------------------------------------------------------------- + // Input & Output + // ------------------------------------------------------------------------- + + private Integer id; + + public void setId( Integer id ) + { + this.id = id; + } + + private LockException lockException; + + public LockException getLockException() + { + return lockException; + } + + private List dataSets; + + public List getDataSets() + { + return dataSets; + } + + private List periods; + + public List getPeriods() + { + return periods; + } + + // ------------------------------------------------------------------------- + // Action Implementation + // ------------------------------------------------------------------------- + + @Override + public String execute() throws Exception + { + if ( id != null ) + { + lockException = dataSetService.getLockException( id ); + + if ( lockException == null ) + { + return INPUT; + } + + selectionTreeManager.setSelectedOrganisationUnit( lockException.getOrganisationUnit() ); + dataSets = getDataSetsForCurrentUser( lockException.getOrganisationUnit().getId() ); + periods = getPeriodsForDataSet( lockException.getDataSet().getId() ); + + for ( Period period : periods ) + { + period.setName( format.formatPeriod( period ) ); + } + } + + return SUCCESS; + } + + private List getPeriodsForDataSet( int id ) + { + DataSet dataSet = dataSetService.getDataSet( id ); + + if ( dataSet == null ) + { + return new ArrayList(); + } + + CalendarPeriodType periodType = (CalendarPeriodType) dataSet.getPeriodType(); + List periods = periodType.generateLast5Years( new Date() ); + FilterUtils.filter( periods, new PastAndCurrentPeriodFilter() ); + Collections.reverse( periods ); + + if ( periods.size() > 10 ) + { + periods = periods.subList( 0, 10 ); + } + + return periods; + } + + private List getDataSetsForCurrentUser( int id ) + { + OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( id ); + + if ( organisationUnit == null ) + { + return new ArrayList(); + } + + List dataSets = new ArrayList(); + + if ( organisationUnit.getDataSets() != null ) + { + dataSets.addAll( organisationUnit.getDataSets() ); + } + + UserCredentials userCredentials = currentUserService.getCurrentUser().getUserCredentials(); + + if ( !userCredentials.isSuper() ) + { + dataSets.retainAll( userCredentials.getAllDataSets() ); + } + + return dataSets; + } +} === removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetPeriods.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetPeriods.java 2012-02-08 12:04:46 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetPeriods.java 1970-01-01 00:00:00 +0000 @@ -1,125 +0,0 @@ -package org.hisp.dhis.dataadmin.action.lockexception; - -/* - * 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.dataset.CompleteDataSetRegistration; -import org.hisp.dhis.dataset.DataSet; -import org.hisp.dhis.dataset.DataSetService; -import org.hisp.dhis.i18n.I18nFormat; -import org.hisp.dhis.period.CalendarPeriodType; -import org.hisp.dhis.period.Period; -import org.hisp.dhis.system.filter.PastAndCurrentPeriodFilter; -import org.hisp.dhis.system.util.FilterUtils; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.List; - -/** - * @author Morten Olav Hansen - */ -public class GetPeriods - implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private DataSetService dataSetService; - - public void setDataSetService( DataSetService dataSetService ) - { - this.dataSetService = dataSetService; - } - - private I18nFormat format; - - public void setFormat( I18nFormat format ) - { - this.format = format; - } - - // ------------------------------------------------------------------------- - // Input & Output - // ------------------------------------------------------------------------- - - private int id; - - public void setId( int id ) - { - this.id = id; - } - - private List periods; - - public List getPeriods() - { - return periods; - } - - // ------------------------------------------------------------------------- - // Action Implementation - // ------------------------------------------------------------------------- - - @Override - public String execute() throws Exception - { - periods = getPeriodsForDataSet( id ); - - for ( Period period : periods ) - { - period.setName( format.formatPeriod( period ) ); - } - - return SUCCESS; - } - - public List getPeriodsForDataSet( int id ) - { - DataSet dataSet = dataSetService.getDataSet( id ); - - if ( dataSet == null ) - { - return new ArrayList(); - } - - CalendarPeriodType periodType = (CalendarPeriodType) dataSet.getPeriodType(); - List periods = periodType.generateLast5Years( new Date() ); - FilterUtils.filter( periods, new PastAndCurrentPeriodFilter() ); - Collections.reverse( periods ); - - if ( periods.size() > 10 ) - { - periods = periods.subList( 0, 10 ); - } - - return periods; - } -} === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetPeriodsAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetPeriodsAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetPeriodsAction.java 2012-02-08 13:38:13 +0000 @@ -0,0 +1,125 @@ +package org.hisp.dhis.dataadmin.action.lockexception; + +/* + * 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.dataset.CompleteDataSetRegistration; +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; +import org.hisp.dhis.i18n.I18nFormat; +import org.hisp.dhis.period.CalendarPeriodType; +import org.hisp.dhis.period.Period; +import org.hisp.dhis.system.filter.PastAndCurrentPeriodFilter; +import org.hisp.dhis.system.util.FilterUtils; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; + +/** + * @author Morten Olav Hansen + */ +public class GetPeriodsAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } + + private I18nFormat format; + + public void setFormat( I18nFormat format ) + { + this.format = format; + } + + // ------------------------------------------------------------------------- + // Input & Output + // ------------------------------------------------------------------------- + + private int id; + + public void setId( int id ) + { + this.id = id; + } + + private List periods; + + public List getPeriods() + { + return periods; + } + + // ------------------------------------------------------------------------- + // Action Implementation + // ------------------------------------------------------------------------- + + @Override + public String execute() throws Exception + { + periods = getPeriodsForDataSet( id ); + + for ( Period period : periods ) + { + period.setName( format.formatPeriod( period ) ); + } + + return SUCCESS; + } + + private List getPeriodsForDataSet( int id ) + { + DataSet dataSet = dataSetService.getDataSet( id ); + + if ( dataSet == null ) + { + return new ArrayList(); + } + + CalendarPeriodType periodType = (CalendarPeriodType) dataSet.getPeriodType(); + List periods = periodType.generateLast5Years( new Date() ); + FilterUtils.filter( periods, new PastAndCurrentPeriodFilter() ); + Collections.reverse( periods ); + + if ( periods.size() > 10 ) + { + periods = periods.subList( 0, 10 ); + } + + return periods; + } +} === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2012-02-08 12:04:46 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2012-02-08 13:38:13 +0000 @@ -301,6 +301,14 @@ + + + + + + + @@ -313,13 +321,13 @@ - - === 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-02-08 12:39:22 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2012-02-08 13:38:13 +0000 @@ -107,6 +107,7 @@ organisation_unit_pruning=Organisation Unit Pruning min_max_value_generation=Min-Max Value Generation intro_data_locking=Deny data to be entered or imported for data sets for certain combinations of organisation unit and period. +intro_lock_exception=Add or remove exceptions to the auto-locking feature of datasets intro_data_browser=Browse the database and get an overview of where data exists. View and export counts of data elements as well as raw data. intro_data_integrity=Run data integrity checks and unveil anomalies and problems in the meta data setup. intro_data_archive=Archive data which is not currently relevant to your system in order to improve performance. Data can also be unarchived. === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2012-02-08 12:04:46 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2012-02-08 13:38:13 +0000 @@ -493,7 +493,7 @@ F_DATASET_ADD - + /main.vm /dhis-web-maintenance-dataadmin/menu.vm /dhis-web-maintenance-dataadmin/updateLockExceptionForm.vm @@ -520,12 +520,12 @@ F_DATASET_DELETE - + jsonDataSets.vm plainTextError - + jsonPeriods.vm plainTextError === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addLockExceptionForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addLockExceptionForm.vm 2012-02-08 12:04:46 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addLockExceptionForm.vm 2012-02-08 13:38:13 +0000 @@ -1,83 +1,4 @@ - +

$i18n.getString( "create_new_lock_exception" )

@@ -103,7 +24,7 @@ === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/index.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/index.vm 2012-02-08 12:04:46 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/index.vm 2012-02-08 13:38:13 +0000 @@ -19,7 +19,7 @@ #introListImgItem( "displayDuplicateDataEliminationForm.action" "duplicate_data_elimination" "duplicatedataelimination" ) #introListImgItem( "viewStatistics.action" "data_statistics" "datastatistics" ) #introListImgItem( "displayLockingForm.action" "data_locking" "datalocking" ) - #introListImgItem( "lockException.action" "lock_exception" "lockexception" ) + #introListImgItem( "lockException.action" "lock_exception" "datalocking" ) #introListImgItem( "zeroValueStorageManagement.action" "zero_storage_management" "zerovaluestorage" ) #introListImgItem( "displayPruneOrganisationUnitForm.action" "organisation_unit_pruning" "organisationunitpruning" ) #introListImgItem( "getMinMaxValidationParams.action" "min_max_value_generation" "minmaxvaluegeneration" ) === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/lockException.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/lockException.js 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/lockException.js 2012-02-08 13:38:13 +0000 @@ -0,0 +1,73 @@ +jQuery(document).ready(function () { + jQuery("body").bind("oust.selected", ouChanged); + jQuery("#dataSets").bind("change", dataSetChanged); + jQuery("#periods").bind("change", periodChanged); +}); + +function ouChanged( e, ou ) { + jQuery("#organisationUnitId").val(ou); + + jQuery.getJSON('getDataSets.action?id=' + ou, function ( data ) { + jQuery("#dataSets").children().remove(); + + if ( data.dataSets.length == 0 ) { + resetDataSets(); + } else { + for ( var n in data.dataSets ) { + var option = jQuery(""); + jQuery("#dataSets").append(option); + jQuery("#dataSets").attr("disabled", true); +} + +function resetPeriods() { + var option = jQuery(""); + jQuery("#periods").append(option); + jQuery("#periods").attr("disabled", true); +} === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateLockExceptionForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateLockExceptionForm.vm 2012-02-08 12:39:22 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateLockExceptionForm.vm 2012-02-08 13:38:13 +0000 @@ -1,34 +1,43 @@ - +

$i18n.getString( "edit_lock_exception" )

+ + - +
#organisationUnitSelectionTree( true, false, true )#organisationUnitSelectionTree( false, false, true )
- + #foreach( $dataSet in $dataSets ) + #if( $dataSet.id == $lockException.dataSet.id ) + + #else + + #end + #end)
- + #foreach( $period in $periods ) + #if( $period.externalId == $lockException.period.externalId ) + + #else + + #end + #end)