=== 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-10-31 15:23:23 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalService.java 2014-10-31 15:32:24 +0000 @@ -38,18 +38,11 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.hisp.dhis.dataapproval.exceptions.DataApprovalException; -import org.hisp.dhis.dataapproval.exceptions.DataMayNotBeAcceptedException; import org.hisp.dhis.dataapproval.exceptions.DataMayNotBeApprovedException; -import org.hisp.dhis.dataapproval.exceptions.DataMayNotBeUnacceptedException; -import org.hisp.dhis.dataapproval.exceptions.DataMayNotBeUnapprovedException; import org.hisp.dhis.dataapproval.exceptions.DataSetNotMarkedForApprovalException; import org.hisp.dhis.dataapproval.exceptions.PeriodShorterThanDataSetPeriodException; import org.hisp.dhis.dataapproval.exceptions.UserCannotAccessApprovalLevelException; import org.hisp.dhis.dataapproval.exceptions.UserCannotApproveAttributeComboException; -import org.hisp.dhis.dataapproval.exceptions.UserMayNotAcceptDataException; -import org.hisp.dhis.dataapproval.exceptions.UserMayNotApproveDataException; -import org.hisp.dhis.dataapproval.exceptions.UserMayNotUnacceptDataException; -import org.hisp.dhis.dataapproval.exceptions.UserMayNotUnapproveDataException; import org.hisp.dhis.dataelement.CategoryOptionGroup; import org.hisp.dhis.dataelement.DataElementCategoryOption; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; === 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-10-31 15:23:23 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/hibernate/HibernateDataApprovalStore.java 2014-10-31 15:32:24 +0000 @@ -28,6 +28,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import static org.hisp.dhis.dataapproval.DataApprovalState.ACCEPTED_HERE; +import static org.hisp.dhis.dataapproval.DataApprovalState.APPROVED_ELSEWHERE; +import static org.hisp.dhis.dataapproval.DataApprovalState.APPROVED_HERE; +import static org.hisp.dhis.dataapproval.DataApprovalState.UNAPPROVED_READY; +import static org.hisp.dhis.dataapproval.DataApprovalState.UNAPPROVED_WAITING; +import static org.hisp.dhis.setting.SystemSettingManager.KEY_ACCEPTANCE_REQUIRED_FOR_APPROVAL; +import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers; +import static org.hisp.dhis.system.util.TextUtils.getCommaDelimitedString; + import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; @@ -63,18 +72,12 @@ import org.hisp.dhis.system.util.TextUtils; import org.hisp.dhis.user.CurrentUserService; import org.hisp.dhis.user.User; -import org.hisp.dhis.user.UserService; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.support.rowset.SqlRowSet; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; -import static org.hisp.dhis.dataapproval.DataApprovalState.*; -import static org.hisp.dhis.setting.SystemSettingManager.KEY_ACCEPTANCE_REQUIRED_FOR_APPROVAL; -import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers; -import static org.hisp.dhis.system.util.TextUtils.getCommaDelimitedString; - /** * @author Jim Grace */ @@ -113,13 +116,6 @@ this.currentUserService = currentUserService; } - private UserService userService; - - public void setUserService( UserService userService ) - { - this.userService = userService; - } - private OrganisationUnitService organisationUnitService; public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) @@ -364,39 +360,4 @@ return statusList; } - - // ------------------------------------------------------------------------- - // Supportive methods - // ------------------------------------------------------------------------- - - private Set getUserOrgsAtLevel( int desiredLevel ) - { - Set orgUnits = new HashSet<>(); - - for ( OrganisationUnit orgUnit : currentUserService.getCurrentUser().getOrganisationUnits() ) - { - orgUnits.addAll( getOrgsAtLevel( orgUnit, desiredLevel, organisationUnitService.getLevelOfOrganisationUnit( orgUnit ) ) ); - } - - return orgUnits; - } - - private Set getOrgsAtLevel( OrganisationUnit orgUnit, int desiredLevel, int thisLevel ) - { - Set orgUnits = new HashSet<>(); - - if ( thisLevel < desiredLevel ) - { - for ( OrganisationUnit child : orgUnit.getChildren() ) - { - orgUnits.addAll( getOrgsAtLevel( child, desiredLevel, thisLevel + 1 ) ); - } - } - else if ( thisLevel == desiredLevel ) - { - orgUnits.add( orgUnit ); - } - - return orgUnits; - } } === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2014-10-31 15:23:23 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2014-10-31 15:32:24 +0000 @@ -75,7 +75,6 @@ -