dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33954
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17394: Codestyle
------------------------------------------------------------
revno: 17394
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-11-10 12:08:53 +0100
message:
Codestyle
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DataApprovalPermissionsEvaluator.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/hibernate/HibernateDataApprovalStore.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-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelService.java 2014-11-02 13:30:47 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataapproval/DataApprovalLevelService.java 2014-11-10 11:08:53 +0000
@@ -178,10 +178,10 @@
* position possible (to facilitate the use case where users add the
* approval levels from low to high.)
*
- * @param newLevel the new level to add.
+ * @param level the new level to add.
* @return the identifier of the added level, or -1 if not well formed or duplicate.
*/
- int addDataApprovalLevel( DataApprovalLevel newLevel );
+ int addDataApprovalLevel( DataApprovalLevel level );
/**
* Adds a new data approval level. Sets the level epxlicitl.
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DataApprovalPermissionsEvaluator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DataApprovalPermissionsEvaluator.java 2014-11-10 10:28:05 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DataApprovalPermissionsEvaluator.java 2014-11-10 11:08:53 +0000
@@ -59,7 +59,7 @@
private boolean authorizedToAcceptAtLowerLevels;
private boolean authorizedToViewUnapprovedData;
- int maxApprovalLevel;
+ private int maxApprovalLevel;
private DataApprovalPermissionsEvaluator()
{
@@ -129,8 +129,7 @@
if ( userApprovalLevel == null )
{
- tracePrint( "getPermissions userApprovalLevel is null for user " + ( user == null ? "(null)" : user.getUsername() )
- + " orgUnit " + da.getOrganisationUnit().getName() );
+ tracePrint( "getPermissions userApprovalLevel null for user " + ( user == null ? "(null)" : user.getUsername() ) + " orgUnit " + da.getOrganisationUnit().getName() );
return permissions; // Can't find user approval level, so no permissions are set.
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java 2014-11-07 01:55:41 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java 2014-11-10 11:08:53 +0000
@@ -277,9 +277,9 @@
( cogs == null && canSeeAllDimensions ) ||
( cogs != null && securityService.canRead( cogs ) && !CollectionUtils.isEmpty( categoryService.getCategoryOptionGroups( cogs ) ) ) ) );
- //
+
// Test using assignedAtLevel and approvableAtLevel values from the previous (higher) level.
- //
+
Boolean addBecauseOfPreviousLevel = false;
if ( canReadThisLevel && ( approvableAtLevel // Approve at previous higher level implies unapprove at current level.
@@ -292,17 +292,15 @@
{
approvableAtAllLowerLevels = true;
}
-
- //
+
// Get new values of assignedAtLevel and approvableAtLevel for the current approval level.
- //
+
assignedAtLevel = canReadThisLevel && userOrgUnitLevels.contains( approvalLevel.getOrgUnitLevel() );
approvableAtLevel = canReadThisLevel && ( ( mayApprove && assignedAtLevel ) || approvableAtAllLowerLevels );
-
- //
+
// Test using assignedAtLevel and approvableAtLevel values from the current level.
- //
+
if ( approvableAtLevel || addBecauseOfPreviousLevel )
{
userDataApprovalLevels.add( approvalLevel );
@@ -412,18 +410,18 @@
}
@Override
- public int addDataApprovalLevel( DataApprovalLevel newLevel )
+ public int addDataApprovalLevel( DataApprovalLevel level )
{
List<DataApprovalLevel> dataApprovalLevels = getAllDataApprovalLevels();
- int index = getInsertIndex( dataApprovalLevels, newLevel );
+ int index = getInsertIndex( dataApprovalLevels, level );
if ( index < 0 )
{
return -1;
}
- dataApprovalLevels.add( index, newLevel );
+ dataApprovalLevels.add( index, level );
// Move down from end to here, to avoid duplicate level in database.
@@ -432,9 +430,9 @@
update( dataApprovalLevels.get( i ), i );
}
- newLevel.setLevel( index + 1 );
+ level.setLevel( index + 1 );
- return dataApprovalLevelStore.save( newLevel );
+ return dataApprovalLevelStore.save( level );
}
@Override
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalService.java 2014-11-10 10:28:05 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalService.java 2014-11-10 11:08:53 +0000
@@ -309,7 +309,7 @@
@Override
public DataApprovalStatus getDataApprovalStatus( DataSet dataSet, Period period, OrganisationUnit organisationUnit,
- DataElementCategoryOptionCombo attributeOptionCombo )
+ DataElementCategoryOptionCombo attributeOptionCombo )
{
log.debug( "getDataApprovalStatus( " + dataSet.getName() + ", "
+ period.getPeriodType().getName() + " " + period.getName() + " " + period + ", "
@@ -342,7 +342,7 @@
@Override
public DataApprovalStatus getDataApprovalStatusAndPermissions( DataSet dataSet, Period period, OrganisationUnit organisationUnit,
- DataElementCategoryOptionCombo attributeOptionCombo )
+ DataElementCategoryOptionCombo attributeOptionCombo )
{
DataApprovalStatus status = getDataApprovalStatus( dataSet, period, organisationUnit, attributeOptionCombo );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/hibernate/HibernateDataApprovalStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/hibernate/HibernateDataApprovalStore.java 2014-11-07 17:22:17 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/hibernate/HibernateDataApprovalStore.java 2014-11-10 11:08:53 +0000
@@ -279,6 +279,7 @@
{
orgUnitLevel = dal.getOrgUnitLevel(); // Get lowest (last level -> greatest number) level.
}
+
orgUnitJoinOn = "o.level = " + orgUnitLevel;
}