dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20193
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9117: removed old audit logging from datasetservice and orgunitservice
------------------------------------------------------------
revno: 9117
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-11-25 20:22:52 +0100
message:
removed old audit logging from datasetservice and orgunitservice
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.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/dataset/DefaultDataSetService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java 2012-11-25 18:27:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java 2012-11-25 19:22:52 +0000
@@ -27,21 +27,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.i18n.I18nUtils.getCountByName;
-import static org.hisp.dhis.i18n.I18nUtils.getObjectsBetween;
-import static org.hisp.dhis.i18n.I18nUtils.getObjectsBetweenByName;
-import static org.hisp.dhis.i18n.I18nUtils.i18n;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataentryform.DataEntryForm;
import org.hisp.dhis.i18n.I18nService;
@@ -54,6 +39,10 @@
import org.joda.time.DateTime;
import org.springframework.transaction.annotation.Transactional;
+import java.util.*;
+
+import static org.hisp.dhis.i18n.I18nUtils.*;
+
/**
* @author Lars Helge Overland
* @version $Id: DefaultDataSetService.java 6255 2008-11-10 16:01:24Z larshelg $
@@ -62,8 +51,6 @@
public class DefaultDataSetService
implements DataSetService
{
- private static final Log log = LogFactory.getLog( DefaultDataSetService.class );
-
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -102,25 +89,16 @@
public int addDataSet( DataSet dataSet )
{
- //log.info( AuditLogUtil.logMessage( currentUserService.getCurrentUsername(),
- // AuditLogUtil.ACTION_CREATE, DataSet.class.getSimpleName(), dataSet.getName() ) );
-
return dataSetStore.save( dataSet );
}
public void updateDataSet( DataSet dataSet )
{
dataSetStore.update( dataSet );
-
- //log.info( AuditLogUtil.logMessage( currentUserService.getCurrentUsername(),
- // AuditLogUtil.ACTION_UPDATE, DataSet.class.getSimpleName(), dataSet.getName() ) );
}
public void deleteDataSet( DataSet dataSet )
{
- //log.info( AuditLogUtil.logMessage( currentUserService.getCurrentUsername(),
- // AuditLogUtil.ACTION_DELETE, DataSet.class.getSimpleName(), dataSet.getName() ) );
-
dataSetStore.delete( dataSet );
}
@@ -295,7 +273,7 @@
return dataElements;
}
-
+
public List<DataSet> getDataSetsByUid( Collection<String> uids )
{
return dataSetStore.getByUid( uids );
@@ -402,21 +380,21 @@
public boolean isLocked( DataSet dataSet, Period period, OrganisationUnit organisationUnit, Date now )
{
now = now != null ? now : new Date();
-
+
boolean expired = dataSet.getExpiryDays() != DataSet.NO_EXPIRY && new DateTime( period.getEndDate() ).plusDays( dataSet.getExpiryDays() ).isBefore( new DateTime( now ) );
-
+
return expired && lockExceptionStore.getCount( dataSet, period, organisationUnit ) == 0l;
}
-
+
@Override
public boolean isLocked( DataElement dataElement, Period period, OrganisationUnit organisationUnit, Date now )
{
now = now != null ? now : new Date();
-
+
int expiryDays = dataElement.getExpiryDays();
-
+
boolean expired = expiryDays != DataSet.NO_EXPIRY && new DateTime( period.getEndDate() ).plusDays( expiryDays ).isBefore( new DateTime( now ) );
-
+
return expired && lockExceptionStore.getCount( dataElement, period, organisationUnit ) == 0l;
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2012-11-25 18:27:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2012-11-25 19:22:52 +0000
@@ -28,8 +28,6 @@
*/
import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.hierarchy.HierarchyViolationException;
import org.hisp.dhis.organisationunit.comparator.OrganisationUnitLevelComparator;
@@ -54,8 +52,6 @@
{
private static final String LEVEL_PREFIX = "Level ";
- private static final Log log = LogFactory.getLog( DefaultOrganisationUnitService.class );
-
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -100,13 +96,10 @@
if ( organisationUnit.getParent() == null && currentUserService.getCurrentUser() != null )
{
// Adding a new root node, add this node to the current user
-
+
currentUserService.getCurrentUser().getOrganisationUnits().add( organisationUnit );
}
- //log.info( AuditLogUtil.logMessage( currentUserService.getCurrentUsername(), AuditLogUtil.ACTION_CREATE,
- // OrganisationUnit.class.getSimpleName(), organisationUnit.getName() ) );
-
updateVersion();
return id;
@@ -116,9 +109,6 @@
{
organisationUnitStore.update( organisationUnit );
- //log.info( AuditLogUtil.logMessage( currentUserService.getCurrentUsername(), AuditLogUtil.ACTION_UPDATE,
- // OrganisationUnit.class.getSimpleName(), organisationUnit.getName() ) );
-
updateVersion();
}
@@ -131,7 +121,7 @@
throws HierarchyViolationException
{
organisationUnit = getOrganisationUnit( organisationUnit.getId() );
-
+
if ( !organisationUnit.getChildren().isEmpty() )
{
throw new HierarchyViolationException( "Cannot delete an OrganisationUnit with children" );
@@ -146,9 +136,6 @@
organisationUnitStore.update( parent );
}
- //log.info( AuditLogUtil.logMessage( currentUserService.getCurrentUsername(), AuditLogUtil.ACTION_DELETE,
- // OrganisationUnit.class.getSimpleName(), organisationUnit.getName() ) );
-
organisationUnitStore.delete( organisationUnit );
updateVersion();
@@ -539,7 +526,7 @@
{
return organisationUnitStore.getBetweenByName( name, first, max );
}
-
+
// -------------------------------------------------------------------------
// OrganisationUnitHierarchy
// -------------------------------------------------------------------------