dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #02085
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 703: Added licenses.
------------------------------------------------------------
revno: 703
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Mon 2009-09-14 18:13:49 +0200
message:
Added licenses.
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/databrowser/SearchAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/DefineLockOnDataSetOrgunitAndPeriod.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetDataSetsForLockAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetNumberOfLevelsAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetPeriodTypesAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/OrgunitwiseGetDataSetsAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/SelectAllAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/SelectLevelAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/SetupAssociationsTreeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/UnselectAllAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/UnselectLevelAction.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription.
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/databrowser/SearchAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/databrowser/SearchAction.java 2009-09-03 17:43:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/databrowser/SearchAction.java 2009-09-14 16:13:49 +0000
@@ -65,11 +65,14 @@
{
private static final String KEY_PERIODTYPEID = "periodTypeId";
- // Session variables for PDF export
private static final String KEY_DATABROWSERTITLENAME = "dataBrowserTitleName";
+
private static final String KEY_DATABROWSERFROMDATE = "dataBrowserFromDate";
+
private static final String KEY_DATABROWSERTODATE = "dataBrowserToDate";
+
private static final String KEY_DATABROWSERPERIODTYPE = "dataBrowserPeriodType";
+
private static final String KEY_DATABROWSERTABLE = "dataBrowserTableResults";
// -------------------------------------------------------------------------
@@ -105,7 +108,7 @@
}
private OrganisationUnitGroupService organisationUnitGroupService;
-
+
public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
{
this.organisationUnitGroupService = organisationUnitGroupService;
@@ -287,9 +290,9 @@
if ( searchOption.equals( "OrganisationUnitGroup" ) )
{
- return organisationUnitGroupService.getOrganisationUnitGroup( Integer.parseInt ( parent )).getName();
+ return organisationUnitGroupService.getOrganisationUnitGroup( Integer.parseInt( parent ) ).getName();
}
-
+
if ( searchOption.equals( "DataElementGroup" ) )
{
return dataElementService.getDataElementGroup( Integer.parseInt( parent ) ).getName();
@@ -384,7 +387,8 @@
parent = selectionManager.getSelectedOrganisationUnit().getId() + "";
}
- // Check if the second selected date is later than the first selected date
+ // Check if the second selected date is later than the first selected
+ // date
if ( fromDate.length() == 0 && toDate.length() == 0 )
{
if ( checkDates( fromDate, toDate ) )
@@ -402,7 +406,8 @@
// Show DataElement for a given DataSet
Integer parentInt = Integer.parseInt( parent );
- dataBrowserTable = dataBrowserService.getCountDataElementsForDataSetInPeriod( parentInt, fromDate, toDate, periodType );
+ dataBrowserTable = dataBrowserService.getCountDataElementsForDataSetInPeriod( parentInt, fromDate,
+ toDate, periodType );
}
else
@@ -413,15 +418,16 @@
}
else if ( searchOption.equals( "OrganisationUnitGroup" ) )
{
- if( parent != null)
+ if ( parent != null )
{
- // Show DataElementGroups
+ // Show DataElementGroups
Integer parentInt = Integer.parseInt( parent );
- dataBrowserTable = dataBrowserService.getCountDataElementGroupsForOrgUnitGroupInPeriod(parentInt, fromDate, toDate, periodType );
+ dataBrowserTable = dataBrowserService.getCountDataElementGroupsForOrgUnitGroupInPeriod( parentInt,
+ fromDate, toDate, periodType );
}
else
{
- dataBrowserTable = dataBrowserService.getOrgUnitGroupsInPeriod( fromDate, toDate, periodType);
+ dataBrowserTable = dataBrowserService.getOrgUnitGroupsInPeriod( fromDate, toDate, periodType );
}
}
else if ( searchOption.equals( "DataElementGroup" ) )
@@ -448,11 +454,13 @@
{
Integer parentInt = Integer.parseInt( parent );
// Show DataElement values only for specified organization unit
- dataBrowserTable = dataBrowserService.getCountDataElementsForOrgUnitInPeriod( parentInt, fromDate, toDate, periodType );
+ dataBrowserTable = dataBrowserService.getCountDataElementsForOrgUnitInPeriod( parentInt, fromDate,
+ toDate, periodType );
}
else if ( selectedUnit != null )
{
- dataBrowserTable = dataBrowserService.getOrgUnitsInPeriod( selectedUnit.getId(), fromDate, toDate, periodType );
+ dataBrowserTable = dataBrowserService.getOrgUnitsInPeriod( selectedUnit.getId(), fromDate, toDate,
+ periodType );
}
else
@@ -469,10 +477,10 @@
SessionUtils.setSessionVar( KEY_DATABROWSERTABLE, dataBrowserTable );
requestTime = System.currentTimeMillis() - before;
-
+
// Convert column date names
convertColumnNames( dataBrowserTable );
-
+
// Set DataBrowserTable variable for PDF export
setExportPDFVariables();
@@ -539,6 +547,7 @@
private void convertColumnNames( DataBrowserTable dataBrowserTable )
{
allColumnsConverted = dataBrowserTable.getColumns();
+
for ( MetaValue col : allColumnsConverted )
{
col.setName( DateUtils.convertDate( col.getName() ) );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/DefineLockOnDataSetOrgunitAndPeriod.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/DefineLockOnDataSetOrgunitAndPeriod.java 2009-09-10 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/DefineLockOnDataSetOrgunitAndPeriod.java 2009-09-14 16:13:49 +0000
@@ -48,9 +48,8 @@
* @author Brajesh Murari
* @version $Id$
*/
-
public class DefineLockOnDataSetOrgunitAndPeriod
-implements Action
+ implements Action
{
// -------------------------------------------------------------------------
// Dependencies
@@ -62,24 +61,24 @@
{
this.selectionTreeManager = selectionTreeManager;
}
-
+
private DataSetService dataSetService;
public void setDataSetService( DataSetService dataSetService )
{
this.dataSetService = dataSetService;
}
-
+
private PeriodService periodService;
-
+
public void setPeriodService( PeriodService periodService )
{
this.periodService = periodService;
}
-
+
private DataSetLockService dataSetLockService;
-
- public void setDataSetLockService( DataSetLockService dataSetLockService)
+
+ public void setDataSetLockService( DataSetLockService dataSetLockService )
{
this.dataSetLockService = dataSetLockService;
}
@@ -90,7 +89,7 @@
{
this.currentUserService = currentUserService;
}
-
+
// -------------------------------------------------------------------------
// Input/output
// -------------------------------------------------------------------------
@@ -101,7 +100,7 @@
{
this.lockedDataSets = lockedDataSets;
}
-
+
public Integer getLockedDataSets()
{
return lockedDataSets;
@@ -113,14 +112,14 @@
{
this.unlockedDataSets = unlockedDataSets;
}
-
+
public Collection<String> getUnlockedDataSets()
{
return unlockedDataSets;
}
-
+
private Integer selectedLockedDataSetId;
-
+
public void setSelectedLockedDataSetId( Integer selectedLockedDataSetId )
{
this.selectedLockedDataSetId = selectedLockedDataSetId;
@@ -130,19 +129,19 @@
{
return selectedLockedDataSetId;
}
-
+
private Integer periodId;
-
+
public void setPeriodId( Integer periodId )
{
this.periodId = periodId;
}
-
+
public Integer getPeriodId()
{
return periodId;
}
-
+
private Date timestamp;
public Date getTimestamp()
@@ -156,69 +155,70 @@
{
return storedBy;
}
-
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
- public String execute()
+ public String execute()
throws Exception
{
-
Period period = new Period();
- period = periodService.getPeriod(periodId.intValue());
+ period = periodService.getPeriod( periodId.intValue() );
storedBy = currentUserService.getCurrentUsername();
-
+
// -------------------------------------------------------------------------------
- // For data set movement from locked to unlocked data set list box and vice versa
+ // For data set movement from locked to unlocked data set list box and
+ // vice versa
// according to lock status
// -------------------------------------------------------------------------------
-
+
for ( String id : unlockedDataSets )
{
DataSet dataSet = dataSetService.getDataSet( Integer.parseInt( id ) );
- DataSetLock dataSetLock = dataSetLockService.getDataSetLockByDataSetAndPeriod ( dataSet, period );
-
- if ( dataSetLock != null )
+ DataSetLock dataSetLock = dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period );
+
+ if ( dataSetLock != null )
{
- if( dataSet.getLocked()== true )
- {
- dataSet.setLocked( false );
- dataSetService.updateDataSet( dataSet);
- }
- dataSetLock.getSources().removeAll( dataSetLock.getSources() );
- dataSetLockService.deleteDataSetLock( dataSetLock );
- }
- }
-
- // ----------------------------------------------------------------------------------------
- // Data sets lock for specific selected period, and selected organization unit ( or units )
- // ----------------------------------------------------------------------------------------
-
- if( lockedDataSets != null )
+ if ( dataSet.getLocked() == true )
+ {
+ dataSet.setLocked( false );
+ dataSetService.updateDataSet( dataSet );
+ }
+
+ dataSetLock.getSources().removeAll( dataSetLock.getSources() );
+ dataSetLockService.deleteDataSetLock( dataSetLock );
+ }
+ }
+
+ // ----------------------------------------------------------------------------------------
+ // Data sets lock for specific selected period, and selected
+ // organization unit ( or units )
+ // ----------------------------------------------------------------------------------------
+
+ if ( lockedDataSets != null )
{
- DataSet dataSet = dataSetService.getDataSet( lockedDataSets.intValue() );
- Set<Source> organisationUnitsSelectedForLocking = new HashSet<Source>( selectionTreeManager.getLockOnSelectedOrganisationUnits());
- DataSetLock dataSetLock = dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period );
-
- //System.out.println("locked orgunit size :" + organisationUnitsSelectedForLocking.size());
-
- if( organisationUnitsSelectedForLocking.size() < 1 )
- {
- dataSet.setLocked( false );
- dataSetService.updateDataSet( dataSet );
+ DataSet dataSet = dataSetService.getDataSet( lockedDataSets );
+ Set<Source> organisationUnitsSelectedForLocking = new HashSet<Source>( selectionTreeManager
+ .getLockOnSelectedOrganisationUnits() );
+ DataSetLock dataSetLock = dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period );
+
+ if ( organisationUnitsSelectedForLocking.size() < 1 )
+ {
+ dataSet.setLocked( false );
+ dataSetService.updateDataSet( dataSet );
dataSetLock.getSources().removeAll( dataSetLock.getSources() );
dataSetLockService.deleteDataSetLock( dataSetLock );
return SUCCESS;
- }
-
- dataSetLock.getSources().removeAll( dataSetLock.getSources() );
- dataSetLock.getSources().addAll( organisationUnitsSelectedForLocking );
- dataSetLock.setTimestamp( new Date() );
- dataSetLock.setStoredBy(storedBy);
- dataSetLockService.updateDataSetLock(dataSetLock);
- }
-
+ }
+
+ dataSetLock.getSources().removeAll( dataSetLock.getSources() );
+ dataSetLock.getSources().addAll( organisationUnitsSelectedForLocking );
+ dataSetLock.setTimestamp( new Date() );
+ dataSetLock.setStoredBy( storedBy );
+ dataSetLockService.updateDataSetLock( dataSetLock );
+ }
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetDataSetsForLockAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetDataSetsForLockAction.java 2009-09-10 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetDataSetsForLockAction.java 2009-09-14 16:13:49 +0000
@@ -1,5 +1,7 @@
+package org.hisp.dhis.dataadmin.action.lock;
+
/*
- * Copyright (c) 2004-2009, University of Oslo
+ * Copyright (c) 2004-2007, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -24,7 +26,6 @@
* (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.dataadmin.action.lock;
import java.util.ArrayList;
import java.util.Collection;
@@ -54,17 +55,17 @@
{
this.dataSetService = dataSetService;
}
-
+
private PeriodService periodService;
-
+
public void setPeriodService( PeriodService periodService )
{
this.periodService = periodService;
}
-
+
private DataSetLockService dataSetLockService;
-
- public void setDataSetLockService( DataSetLockService dataSetLockService)
+
+ public void setDataSetLockService( DataSetLockService dataSetLockService )
{
this.dataSetLockService = dataSetLockService;
}
@@ -72,21 +73,21 @@
// -------------------------------------------------------------------------
// Input/output
// -------------------------------------------------------------------------
-
+
private Integer periodId;
-
+
public void setPeriodId( Integer periodId )
{
this.periodId = periodId;
}
-
+
private Collection<DataSet> dataSets = new ArrayList<DataSet>();
public Collection<DataSet> getDataSets()
{
return dataSets;
}
-
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -97,20 +98,20 @@
{
Period period = new Period();
period = periodService.getPeriod( periodId.intValue() );
-
+
for ( DataSet dataSet : dataSetService.getAssignedDataSetsByPeriodType( period.getPeriodType() ) )
{
- if(dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period ) != null)
+ if ( dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period ) != null )
{
- dataSet.setLocked( true );
- dataSetService.updateDataSet( dataSet);
+ dataSet.setLocked( true );
+ dataSetService.updateDataSet( dataSet );
dataSets.add( dataSet );
}
else
{
- dataSet.setLocked( false );
- dataSetService.updateDataSet( dataSet);
- dataSets.add( dataSet );
+ dataSet.setLocked( false );
+ dataSetService.updateDataSet( dataSet );
+ dataSets.add( dataSet );
}
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetNumberOfLevelsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetNumberOfLevelsAction.java 2009-09-10 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetNumberOfLevelsAction.java 2009-09-14 16:13:49 +0000
@@ -1,8 +1,32 @@
-/**
- *
- */
package org.hisp.dhis.dataadmin.action.lock;
+/*
+ * Copyright (c) 2004-2007, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
import java.util.List;
import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
@@ -14,7 +38,8 @@
* @author Brajesh Murari
* @version $Id$
*/
-public class GetNumberOfLevelsAction extends ActionSupport
+public class GetNumberOfLevelsAction
+ extends ActionSupport
{
// -------------------------------------------------------------------------
// Dependencies
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetPeriodTypesAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetPeriodTypesAction.java 2009-09-10 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetPeriodTypesAction.java 2009-09-14 16:13:49 +0000
@@ -38,7 +38,7 @@
* @version $Id$
*/
public class GetPeriodTypesAction
-implements Action
+ implements Action
{
// -------------------------------------------------------------------------
// Dependencies
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/OrgunitwiseGetDataSetsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/OrgunitwiseGetDataSetsAction.java 2009-09-10 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/OrgunitwiseGetDataSetsAction.java 2009-09-14 16:13:49 +0000
@@ -41,7 +41,7 @@
* @version $Id$
*/
public class OrgunitwiseGetDataSetsAction
-implements Action
+ implements Action
{
// -------------------------------------------------------------------------
// Dependencies
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/SelectAllAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/SelectAllAction.java 2009-09-10 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/SelectAllAction.java 2009-09-14 16:13:49 +0000
@@ -40,7 +40,8 @@
* @author Brajesh Murari
* @version $Id$
*/
-public class SelectAllAction implements Action
+public class SelectAllAction
+ implements Action
{
// -------------------------------------------------------------------------
// Dependencies
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/SelectLevelAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/SelectLevelAction.java 2009-09-10 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/SelectLevelAction.java 2009-09-14 16:13:49 +0000
@@ -1,8 +1,32 @@
-/**
- *
- */
package org.hisp.dhis.dataadmin.action.lock;
+/*
+ * Copyright (c) 2004-2007, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@@ -22,7 +46,8 @@
* @author Brajesh Murari
* @version $Id$
*/
-public class SelectLevelAction implements Action
+public class SelectLevelAction
+ implements Action
{
private static final int FIRST_LEVEL = 1;
@@ -126,7 +151,7 @@
// -------------------------------------------------------------------------
public String execute()
- throws Exception
+ throws Exception
{
selectionTreeManager.clearSelectedOrganisationUnits();
selectionTreeManager.clearLockOnSelectedOrganisationUnits();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/SetupAssociationsTreeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/SetupAssociationsTreeAction.java 2009-09-10 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/SetupAssociationsTreeAction.java 2009-09-14 16:13:49 +0000
@@ -50,7 +50,7 @@
* @version $Id$
*/
public class SetupAssociationsTreeAction
-implements Action
+ implements Action
{
// -------------------------------------------------------------------------
// Dependencies
@@ -69,21 +69,21 @@
{
this.dataSetService = dataSetService;
}
-
+
private PeriodService periodService;
-
+
public void setPeriodService( PeriodService periodService )
{
this.periodService = periodService;
}
-
+
private DataSetLockService dataSetLockService;
-
- public void setDataSetLockService( DataSetLockService dataSetLockService)
+
+ public void setDataSetLockService( DataSetLockService dataSetLockService )
{
this.dataSetLockService = dataSetLockService;
}
-
+
private CurrentUserService currentUserService;
public void setCurrentUserService( CurrentUserService currentUserService )
@@ -96,7 +96,7 @@
// -------------------------------------------------------------------------
private Integer selectedLockedDataSetId;
-
+
public void setSelectedLockedDataSetId( Integer selectedLockedDataSetId )
{
this.selectedLockedDataSetId = selectedLockedDataSetId;
@@ -106,26 +106,26 @@
{
return selectedLockedDataSetId;
}
-
+
private Integer periodId;
-
+
public void setPeriodId( Integer periodId )
{
this.periodId = periodId;
}
-
+
public Integer getPeriodId()
{
return periodId;
}
-
+
private Collection<String> lockedDataSets = new ArrayList<String>();
public void setLockedDataSets( Collection<String> lockedDataSets )
{
this.lockedDataSets = lockedDataSets;
}
-
+
public Collection<String> getLockedDataSets()
{
return lockedDataSets;
@@ -137,11 +137,11 @@
{
this.unlockedDataSets = unlockedDataSets;
}
-
+
public Collection<String> getUnlockedDataSets()
{
return unlockedDataSets;
- }
+ }
private DataSet dataSet;
@@ -149,19 +149,19 @@
{
return dataSet;
}
-
+
public void setDataSet( DataSet dataSet )
{
this.dataSet = dataSet;
}
-
+
private Collection<DataSet> dataSets = new ArrayList<DataSet>();
public Collection<DataSet> getDataSets()
{
return dataSets;
}
-
+
private Date timestamp;
public Date getTimestamp()
@@ -179,40 +179,41 @@
// -------------------------------------------------------------------------
// Execute
// -------------------------------------------------------------------------
-
+
public String execute()
throws Exception
- {
- Period period = new Period();
- period = periodService.getPeriod(periodId.intValue());
-
- DataSet dataSet = new DataSet();
- dataSet = dataSetService.getDataSet(selectedLockedDataSetId.intValue());
+ {
+ Period period = new Period();
+ period = periodService.getPeriod( periodId.intValue() );
+
+ DataSet dataSet = new DataSet();
+ dataSet = dataSetService.getDataSet( selectedLockedDataSetId.intValue() );
storedBy = currentUserService.getCurrentUsername();
-
- if (dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period )!=null)
- {
+
+ if ( dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period ) != null )
+ {
selectionTreeManager.clearSelectedOrganisationUnits();
selectionTreeManager.clearLockOnSelectedOrganisationUnits();
selectionTreeManager.setSelectedOrganisationUnits( convert( dataSet.getSources() ) );
- if(dataSetLockService.getDataSetLockByDataSetAndPeriod(dataSet, period).getSources() != null)
+ if ( dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period ).getSources() != null )
{
- selectionTreeManager.setLockOnSelectedOrganisationUnits( convert( dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period ).getSources() ) );
+ selectionTreeManager.setLockOnSelectedOrganisationUnits( convert( dataSetLockService
+ .getDataSetLockByDataSetAndPeriod( dataSet, period ).getSources() ) );
}
}
else
{
selectionTreeManager.clearSelectedOrganisationUnits();
selectionTreeManager.clearLockOnSelectedOrganisationUnits();
- selectionTreeManager.setSelectedOrganisationUnits( convert( dataSet.getSources() ) );
- DataSetLock dataSLock = new DataSetLock( dataSet, period );
+ selectionTreeManager.setSelectedOrganisationUnits( convert( dataSet.getSources() ) );
+ DataSetLock dataSLock = new DataSetLock( dataSet, period );
dataSLock.setTimestamp( new Date() );
- dataSLock.setStoredBy(storedBy);
- dataSetLockService.addDataSetLock( dataSLock );
- dataSet.setLocked(true);
+ dataSLock.setStoredBy( storedBy );
+ dataSetLockService.addDataSetLock( dataSLock );
+ dataSet.setLocked( true );
dataSetService.updateDataSet( dataSet );
}
-
+
return SUCCESS;
}
@@ -223,12 +224,12 @@
private Set<OrganisationUnit> convert( Collection<Source> sources )
{
Set<OrganisationUnit> organisationUnits = new HashSet<OrganisationUnit>();
-
+
for ( Source source : sources )
- {
+ {
organisationUnits.add( (OrganisationUnit) source );
- }
-
+ }
+
return organisationUnits;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/UnselectAllAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/UnselectAllAction.java 2009-09-10 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/UnselectAllAction.java 2009-09-14 16:13:49 +0000
@@ -1,8 +1,32 @@
-/**
- *
- */
package org.hisp.dhis.dataadmin.action.lock;
+/*
+ * Copyright (c) 2004-2007, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@@ -22,7 +46,8 @@
* @author Brajesh Murari
* @version $Id$
*/
-public class UnselectAllAction implements Action
+public class UnselectAllAction
+ implements Action
{
// -------------------------------------------------------------------------
// Dependencies
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/UnselectLevelAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/UnselectLevelAction.java 2009-09-10 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/UnselectLevelAction.java 2009-09-14 16:13:49 +0000
@@ -1,8 +1,32 @@
-/**
- *
- */
package org.hisp.dhis.dataadmin.action.lock;
+/*
+ * Copyright (c) 2004-2007, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@@ -24,7 +48,8 @@
* @author Brajesh Murari
* @version $Id$
*/
-public class UnselectLevelAction implements Action
+public class UnselectLevelAction
+ implements Action
{
// -------------------------------------------------------------------------
// Dependencies
@@ -49,8 +74,7 @@
public void setPeriodService( PeriodService periodService )
{
this.periodService = periodService;
- }
-
+ }
private DataSetLockService dataSetLockService;
@@ -151,7 +175,8 @@
selectionTreeManager.setSelectedOrganisationUnits( convert( dataSet.getSources() ) );
temp.removeAll( tt );
selectionTreeManager.setLockOnSelectedOrganisationUnits( temp ) ;
- }
+ }
+
return SUCCESS;
}