dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #02338
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 792: Codestyle fix.
------------------------------------------------------------
revno: 792
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Mon 2009-09-28 19:11:58 +0200
message:
Codestyle fix.
modified:
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/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/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-23 00:55:01 +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-28 17:11:58 +0000
@@ -46,7 +46,7 @@
* @author Brajesh Murari
* @version $Id$
*/
-public class SelectLevelAction
+public class SelectLevelAction
implements Action
{
private static final int FIRST_LEVEL = 1;
@@ -61,28 +61,28 @@
{
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;
}
-
+
private OrganisationUnitService organisationUnitService;
public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
@@ -105,14 +105,14 @@
{
this.level = level;
}
-
+
public Integer getLevel()
{
return level;
}
-
+
private Integer selectedLockedDataSetId;
-
+
public void setSelectedLockedDataSetId( Integer selectedLockedDataSetId )
{
this.selectedLockedDataSetId = selectedLockedDataSetId;
@@ -122,19 +122,19 @@
{
return selectedLockedDataSetId;
}
-
+
private Integer periodId;
-
+
public void setPeriodId( Integer periodId )
{
this.periodId = periodId;
}
-
+
public Integer getPeriodId()
{
return periodId;
}
-
+
// -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
@@ -150,78 +150,77 @@
// Action
// -------------------------------------------------------------------------
- @SuppressWarnings("unchecked")
- public String execute()
- throws Exception
+ public String execute()
+ throws Exception
{
selectionTreeManager.clearSelectedOrganisationUnits();
- selectionTreeManager.clearLockOnSelectedOrganisationUnits();
-
- Period period = new Period();
- period = periodService.getPeriod(periodId.intValue());
-
- DataSet dataSet = new DataSet();
- dataSet = dataSetService.getDataSet(selectedLockedDataSetId.intValue());
-
+ selectionTreeManager.clearLockOnSelectedOrganisationUnits();
+
+ Period period = new Period();
+ period = periodService.getPeriod( periodId.intValue() );
+
+ DataSet dataSet = new DataSet();
+ dataSet = dataSetService.getDataSet( selectedLockedDataSetId.intValue() );
+
Collection<OrganisationUnit> rootUnits = selectionTreeManager.getRootOrganisationUnits();
selectionTreeManager.setSelectedOrganisationUnits( convert( dataSet.getSources() ) );
DataSetLock dataSetLock = dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period );
- Set<OrganisationUnit> selectedUnits = new HashSet<OrganisationUnit>(selectionTreeManager.getSelectedOrganisationUnits().size());
-
+ Set<OrganisationUnit> selectedUnits = new HashSet<OrganisationUnit>( selectionTreeManager
+ .getSelectedOrganisationUnits().size() );
+
for ( OrganisationUnit rootUnit : rootUnits )
- {
- selectLevel( rootUnit, FIRST_LEVEL, selectedUnits );
+ {
+ selectLevel( rootUnit, FIRST_LEVEL, selectedUnits );
}
-
+
selectionTreeManager.clearLockOnSelectedOrganisationUnits();
-
- if( dataSetLock.getSources() == null )
- {
+
+ if ( dataSetLock.getSources() == null )
+ {
selectionTreeManager.setLockOnSelectedOrganisationUnits( selectedUnits );
}
else
- {
- selectedUnits.addAll(( convert( dataSetLock.getSources() )));
- selectionTreeManager.setLockOnSelectedOrganisationUnits( selectedUnits ) ;
+ {
+ selectedUnits.addAll( (convert( dataSetLock.getSources() )) );
+ selectionTreeManager.setLockOnSelectedOrganisationUnits( selectedUnits );
}
-
+
selectLevel = level;
-
+
return SUCCESS;
}
-
- // -------------------------------------------------------------------------
- // Supportive methods
- // -------------------------------------------------------------------------
-
- private Set<OrganisationUnit> convert( Collection<Source> sources )
- {
- Set<OrganisationUnit> organisationUnits = new HashSet<OrganisationUnit>();
-
- for ( Source source : sources )
- {
- organisationUnits.add( (OrganisationUnit) source );
- }
-
- return organisationUnits;
- }
-
- private void selectLevel( OrganisationUnit orgUnit, int currentLevel, Collection<OrganisationUnit> selectedUnits )
- {
- if ( currentLevel == level )
- {
- if( selectionTreeManager.getSelectedOrganisationUnits().contains( orgUnit ))
- {
- selectedUnits.add( orgUnit );
- }
- }
- else
- {
- for ( OrganisationUnit child : orgUnit.getChildren() )
- {
- selectLevel( child, currentLevel + 1, selectedUnits );
- }
- }
- }
+ // -------------------------------------------------------------------------
+ // Supportive methods
+ // -------------------------------------------------------------------------
+
+ private Set<OrganisationUnit> convert( Collection<Source> sources )
+ {
+ Set<OrganisationUnit> organisationUnits = new HashSet<OrganisationUnit>();
+
+ for ( Source source : sources )
+ {
+ organisationUnits.add( (OrganisationUnit) source );
+ }
+
+ return organisationUnits;
+ }
+
+ private void selectLevel( OrganisationUnit orgUnit, int currentLevel, Collection<OrganisationUnit> selectedUnits )
+ {
+ if ( currentLevel == level )
+ {
+ if ( selectionTreeManager.getSelectedOrganisationUnits().contains( orgUnit ) )
+ {
+ selectedUnits.add( orgUnit );
+ }
+ }
+ else
+ {
+ for ( OrganisationUnit child : orgUnit.getChildren() )
+ {
+ selectLevel( child, currentLevel + 1, selectedUnits );
+ }
+ }
+ }
}
=== 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-23 00:55:01 +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-28 17:11:58 +0000
@@ -50,9 +50,7 @@
*/
public class UnselectLevelAction
implements Action
-{
- private static final int FIRST_LEVEL = 1;
-
+{
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------