dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #29380
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14830: Approval, using equals instead of id comparison
------------------------------------------------------------
revno: 14830
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-04-14 09:02:03 +0200
message:
Approval, using equals instead of id comparison
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalService.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-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-04-10 21:20:39 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalService.java 2014-04-14 07:02:03 +0000
@@ -136,9 +136,10 @@
for ( OrganisationUnit ancestor : dataApproval.getOrganisationUnit().getAncestors() )
{
DataApproval ancestorApproval = dataApprovalStore.getDataApproval(
- dataApproval.getDataSet(), dataApproval.getPeriod(), ancestor, dataApproval.getCategoryOptionGroup() );
+ dataApproval.getDataSet(), dataApproval.getPeriod(), ancestor, dataApproval.getCategoryOptionGroup() );
- if ( ancestorApproval != null ) {
+ if ( ancestorApproval != null )
+ {
dataApprovalStore.deleteDataApproval ( ancestorApproval );
}
}
@@ -151,9 +152,11 @@
public DataApprovalStatus getDataApprovalStatus( DataSet dataSet, Period period, OrganisationUnit organisationUnit, DataElementCategoryOptionCombo attributeOptionCombo )
{
- return getDataApprovalStatus( dataSet, period, organisationUnit, null,
- ( attributeOptionCombo == null || attributeOptionCombo.getId() == categoryService.getDefaultDataElementCategoryOptionCombo().getId() )
- ? null : attributeOptionCombo.getCategoryOptions() );
+ Set<DataElementCategoryOption> categoryOptions =
+ attributeOptionCombo == null || attributeOptionCombo.equals( categoryService.getDefaultDataElementCategoryOptionCombo() ) ?
+ null : attributeOptionCombo.getCategoryOptions();
+
+ return getDataApprovalStatus( dataSet, period, organisationUnit, null, categoryOptions );
}
public DataApprovalStatus getDataApprovalStatus( DataSet dataSet, Period period, OrganisationUnit organisationUnit,
@@ -170,9 +173,11 @@
public DataApprovalPermissions getDataApprovalPermissions( DataSet dataSet, Period period,
OrganisationUnit organisationUnit, DataElementCategoryOptionCombo attributeOptionCombo )
{
- return getDataApprovalPermissions( dataSet, period, organisationUnit, null,
- ( attributeOptionCombo == null || attributeOptionCombo.getId() == categoryService.getDefaultDataElementCategoryOptionCombo().getId() )
- ? null : attributeOptionCombo.getCategoryOptions() );
+ Set<DataElementCategoryOption> categoryOptions =
+ attributeOptionCombo == null || attributeOptionCombo.equals( categoryService.getDefaultDataElementCategoryOptionCombo() ) ?
+ null : attributeOptionCombo.getCategoryOptions();
+
+ return getDataApprovalPermissions( dataSet, period, organisationUnit, null, categoryOptions );
}
public DataApprovalPermissions getDataApprovalPermissions( DataSet dataSet, Period period,
@@ -254,7 +259,7 @@
warnNotPermitted( dataApproval, "unaccept", mayAcceptOrUnaccept( dataApproval.getOrganisationUnit() ) );
}
}
-
+
// -------------------------------------------------------------------------
// Supportive methods
// -------------------------------------------------------------------------