RM: Compilation warnings cleaned

* including deprecations caused by recent refactoring
  * all other supurious warnings



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@44873 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2012-12-20 03:23:15 +00:00
parent e4ea0fe02d
commit 2cb5a0aa16
47 changed files with 1004 additions and 1091 deletions

View File

@@ -30,7 +30,6 @@ import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.model.RenditionModel;
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService;
@@ -98,9 +97,6 @@ public class RecordsManagementServiceImpl implements RecordsManagementService,
/** Policy component */
private PolicyComponent policyComponent;
/** Records management action service */
private RecordsManagementActionService rmActionService;
/** Well-known location of the scripts folder. */
private NodeRef scriptsFolderNodeRef = new NodeRef("workspace", "SpacesStore", "rm_scripts");
@@ -150,16 +146,6 @@ public class RecordsManagementServiceImpl implements RecordsManagementService,
this.nodeDAO = nodeDAO;
}
/**
* Set records management action service
*
* @param rmActionService records management action service
*/
public void setRmActionService(RecordsManagementActionService rmActionService)
{
this.rmActionService = rmActionService;
}
/**
* Sets the default RM store reference
* @param defaultStoreRef store reference

View File

@@ -24,9 +24,11 @@ import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService;
import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService;
import org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService;
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService;
import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService;
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService;
import org.alfresco.service.NotAuditable;
import org.alfresco.service.ServiceRegistry;
@@ -38,6 +40,7 @@ import org.alfresco.service.namespace.QName;
*
* @author Roy Wetherall
*/
@SuppressWarnings("deprecation")
public interface RecordsManagementServiceRegistry extends ServiceRegistry
{
/** Service QName constants */
@@ -46,13 +49,16 @@ public interface RecordsManagementServiceRegistry extends ServiceRegistry
static final QName RECORDS_MANAGEMENT_ADMIN_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementAdminService");
static final QName RECORDS_MANAGEMENT_ACTION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementActionService");
static final QName RECORDS_MANAGEMENT_EVENT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementEventService");
static final QName RECORDS_MANAGEMENT_SECURITY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementSecurityService");
static final QName RECORDS_MANAGEMENT_AUDIT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementAuditService");
static final QName CAPABILITY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "CapabilityService");
static final QName RECORD_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordService");
static final QName FREEZE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FreezeService");
static final QName EXTENDED_SECURITY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "ExtendedSecurityService");
static final QName FILE_PLAN_ROLE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FilePlanRoleService");
static final QName FILE_PLAN_PERMISSION_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FilePlanPermissionService");
@Deprecated
static final QName RECORDS_MANAGEMENT_SECURITY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementSecurityService");
/**
* @return records management service
@@ -92,7 +98,10 @@ public interface RecordsManagementServiceRegistry extends ServiceRegistry
/**
* @return records management security service
*
* @deprecated As of release 2.1, replaced with {@link FilePlanRoleService}, {@link FilePlanPermissionService} and {@link ModelSecurityService}
*/
@Deprecated
@NotAuditable
RecordsManagementSecurityService getRecordsManagementSecurityService();
@@ -104,25 +113,36 @@ public interface RecordsManagementServiceRegistry extends ServiceRegistry
/**
* @return capability service
* @since 2.0
*/
@NotAuditable
CapabilityService getCapabilityService();
/**
* @return freeze service
* @since 2.1
*/
@NotAuditable
FreezeService getFreezeService();
/**
* @return extended security service
* @since 2.1
*/
@NotAuditable
ExtendedSecurityService getExtendedSecurityService();
/**
* @return file plan role service
* @since 2.1
*/
@NotAuditable
FilePlanRoleService getFilePlanRoleService();
/**
* @return file plan permission service
* @since 2.1
*/
@NotAuditable
FilePlanPermissionService getFilePlanPermissionService();
}

View File

@@ -27,6 +27,7 @@ import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService;
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService;
import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService;
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService;
import org.alfresco.repo.service.ServiceDescriptorRegistry;
@@ -35,6 +36,7 @@ import org.alfresco.repo.service.ServiceDescriptorRegistry;
*
* @author Roy Wetherall
*/
@SuppressWarnings("deprecation")
public class RecordsManagementServiceRegistryImpl extends ServiceDescriptorRegistry
implements RecordsManagementServiceRegistry
{
@@ -86,6 +88,7 @@ public class RecordsManagementServiceRegistryImpl extends ServiceDescriptorRegis
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordsManagementSecurityService()
*/
@Override
@Deprecated
public RecordsManagementSecurityService getRecordsManagementSecurityService()
{
return (RecordsManagementSecurityService) getService(RECORDS_MANAGEMENT_SECURITY_SERVICE);
@@ -144,4 +147,13 @@ public class RecordsManagementServiceRegistryImpl extends ServiceDescriptorRegis
{
return (FilePlanRoleService) getService(FILE_PLAN_ROLE_SERVICE);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getFilePlanPermissionService()
*/
@Override
public FilePlanPermissionService getFilePlanPermissionService()
{
return (FilePlanPermissionService) getService(FILE_PLAN_PERMISSION_SERVICE);
}
}

View File

@@ -23,8 +23,8 @@ import java.util.Set;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService;
import org.alfresco.module.org_alfresco_module_rm.security.Role;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
import org.alfresco.module.org_alfresco_module_rm.role.Role;
import org.alfresco.repo.audit.extractor.AbstractDataExtractor;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -42,7 +42,7 @@ public final class AuthenticatedUserRolesDataExtractor extends AbstractDataExtra
{
private NodeService nodeService;
private RecordsManagementService rmService;
private RecordsManagementSecurityService rmSecurityService;
private FilePlanRoleService filePlanRoleService;
/**
* Used to check that the node in the context is a fileplan component
@@ -61,11 +61,11 @@ public final class AuthenticatedUserRolesDataExtractor extends AbstractDataExtra
}
/**
* Used to get roles
* @param filePlanRoleService file plan role service
*/
public void setRmSecurityService(RecordsManagementSecurityService rmSecurityService)
public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService)
{
this.rmSecurityService = rmSecurityService;
this.filePlanRoleService = filePlanRoleService;
}
/**
@@ -94,7 +94,7 @@ public final class AuthenticatedUserRolesDataExtractor extends AbstractDataExtra
// Get the rm root
NodeRef rmRootNodeRef = rmService.getFilePlan(nodeRef);
Set<Role> roles = rmSecurityService.getRolesByUser(rmRootNodeRef, user);
Set<Role> roles = filePlanRoleService.getRolesByUser(rmRootNodeRef, user);
StringBuilder sb = new StringBuilder(100);
for (Role role : roles)
{

View File

@@ -100,14 +100,12 @@ public class RecordsManagementAuditServiceImpl
private static final String MSG_DELETE_OBJECT = "rm.audit.delte-object";
private static final String MSG_LOGIN_SUCCEEDED = "rm.audit.login-succeeded";
private static final String MSG_LOGIN_FAILED = "rm.audit.login-failed";
private static final String MSG_FILED_RECORD = "rm.audit.filed-record";
private static final String MSG_REVIEWED = "rm.audit.reviewed";
private static final String MSG_CUT_OFF = "rm.audit.cut-off";
private static final String MSG_REVERSED_CUT_OFF = "rm.audit.reversed-cut-off";
private static final String MSG_DESTROYED_ITEM = "rm.audit.destroyed-item";
private static final String MSG_OPENED_RECORD_FOLDER = "rm.audit.opened-record-folder";
private static final String MSG_CLOSED_RECORD_FOLDER = "rm.audit.closed-record-folder";
private static final String MSG_SETUP_RECORD_FOLDER = "rm.audit.setup-recorder-folder";
private static final String MSG_DECLARED_RECORD = "rm.audit.declared-record";
private static final String MSG_UNDECLARED_RECORD = "rm.audit.undeclared-record";
private static final String MSG_FROZE_ITEM = "rm.audit.froze-item";
@@ -920,8 +918,6 @@ public class RecordsManagementAuditServiceImpl
Long fromTime = (params.getDateFrom() == null ? null : new Long(params.getDateFrom().getTime()));
Long toTime = (params.getDateTo() == null ? null : new Long(params.getDateTo().getTime()));
NodeRef nodeRef = params.getNodeRef();
String eventName = params.getEvent();
QName propertyQName = params.getProperty();
int maxEntries = params.getMaxEntries();
boolean forward = maxEntries > 0 ? false : true; // Reverse order if the results are limited

View File

@@ -64,6 +64,7 @@ import org.springframework.beans.factory.InitializingBean;
/**
* RM After Invocation Provider
*/
@SuppressWarnings("unused")
public class RMAfterInvocationProvider extends RMSecurityCommon
implements AfterInvocationProvider, InitializingBean
{

View File

@@ -42,7 +42,7 @@ public class ClosedCapabilityCondition extends AbstractCapabilityCondition
{
result = rmService.isRecordFolderClosed(nodeRef);
}
else if (rmService.isRecord(nodeRef) == true)
else if (recordService.isRecord(nodeRef) == true)
{
List<ChildAssociationRef> assocs = nodeService.getParentAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef assoc : assocs)

View File

@@ -91,7 +91,7 @@ public class MayBeScheduledCapabilityCondition extends AbstractCapabilityConditi
{
boolean result = false;
boolean isRecordLevelDisposition = dispositionSchedule.isRecordLevelDisposition();
if (rmService.isRecord(nodeRef) == true && isRecordLevelDisposition == true)
if (recordService.isRecord(nodeRef) == true && isRecordLevelDisposition == true)
{
result = true;
}

View File

@@ -32,7 +32,7 @@ public class VitalRecordOrFolderCapabilityCondition extends AbstractCapabilityCo
{
boolean result = false;
if (rmService.isRecord(nodeRef) == true)
if (recordService.isRecord(nodeRef) == true)
{
// Check the record for the vital record aspect
result = nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_VITAL_RECORD);

View File

@@ -22,7 +22,6 @@ import java.io.File;
import java.io.InputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -511,7 +510,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
if (! (AuthenticationUtil.isMtEnabled() && AuthenticationUtil.isRunAsUserTheSystemUser()))
{
// note: userName and userGroupNames must not be null
Map<String, List<String>> caveatConstraintDef = caveatConfig.get(constraintName);
caveatConfig.get(constraintName);
Set<String> userGroupFullNames = authorityService.getAuthoritiesForUser(userName);
allowedValues = getRMAllowedValues(userName, userGroupFullNames, constraintName);
}

View File

@@ -15,15 +15,14 @@ import java.util.Map.Entry;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService;
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule;
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour;
import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderServiceImpl;
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService;
import org.alfresco.module.org_alfresco_module_rm.security.Role;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
import org.alfresco.module.org_alfresco_module_rm.role.Role;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
@@ -67,17 +66,14 @@ public class DataSetServiceImpl implements DataSetService, RecordsManagementMode
/** Records management service */
private RecordsManagementService recordsManagementService;
/** Records management action service */
private RecordsManagementActionService recordsManagementActionService;
/** Permission service */
private PermissionService permissionService;
/** Authority service */
private AuthorityService authorityService;
/** Records management security service */
private RecordsManagementSecurityService recordsManagementSecurityService;
/** File plan role service */
private FilePlanRoleService filePlanRoleService;
/** Records management search behaviour */
private RecordsManagementSearchBehaviour recordsManagementSearchBehaviour;
@@ -137,17 +133,6 @@ public class DataSetServiceImpl implements DataSetService, RecordsManagementMode
this.recordsManagementService = recordsManagementService;
}
/**
* Set records management action service
*
* @param recordsManagementActionService the records management action
* service
*/
public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService)
{
this.recordsManagementActionService = recordsManagementActionService;
}
/**
* Set permission service
*
@@ -169,14 +154,11 @@ public class DataSetServiceImpl implements DataSetService, RecordsManagementMode
}
/**
* Set records management security service
*
* @param recordsManagementSecurityService the records management security
* service
* @param filePlanRoleService file plan role service
*/
public void setRecordsManagementSecurityService(RecordsManagementSecurityService recordsManagementSecurityService)
public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService)
{
this.recordsManagementSecurityService = recordsManagementSecurityService;
this.filePlanRoleService = filePlanRoleService;
}
/**
@@ -392,7 +374,7 @@ public class DataSetServiceImpl implements DataSetService, RecordsManagementMode
"All Roles", null);
// Put all the role groups in it
Set<Role> roles = recordsManagementSecurityService.getRoles(rmRoot);
Set<Role> roles = filePlanRoleService.getRoles(rmRoot);
for (Role role : roles)
{
logger.info(" - adding role group " + role.getRoleGroupName() + " to all roles group");

View File

@@ -32,6 +32,7 @@ import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventActio
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction;
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
import org.alfresco.repo.policy.JavaBehaviour;
import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
@@ -44,7 +45,7 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
/**
*
* Behaviour executed when a references record is actioned upon.
*
* @author Roy Wetherall
*/
@@ -69,6 +70,9 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent
/** Policy component */
private PolicyComponent policyComponent;
/** Record service */
private RecordService recordService;
/** Action name */
private String actionName;
@@ -100,19 +104,31 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent
this.recordsManagementActionService = recordsManagementActionService;
}
/**
* @param recordsManagementAdminService record management admin service
*/
public void setRecordsManagementAdminService(RecordsManagementAdminService recordsManagementAdminService)
{
this.recordsManagementAdminService = recordsManagementAdminService;
}
/**
* @param nodeService node service
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
/**
* Set policy components
*
* @param recordService record service
*/
public void setRecordService(RecordService recordService)
{
this.recordService = recordService;
}
/**
* @param policyComponent policy component
*/
public void setPolicyComponent(PolicyComponent policyComponent)
@@ -121,15 +137,16 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent
}
/**
* Set the reference
*
* @param reference
* @param reference reference name
*/
public void setReferenceName(String reference)
{
this.reference = QName.createQName(reference);
}
/**
* @param actionName action name
*/
public void setActionName(String actionName)
{
this.actionName = actionName;
@@ -157,6 +174,13 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent
return true;
}
/**
* Before action exeuction behaviour.
*
* @param nodeRef
* @param name
* @param parameters
*/
public void beforeActionExecution(final NodeRef nodeRef, final String name, final Map<String, Serializable> parameters)
{
AuthenticationUtil.RunAsWork<Object> work = new AuthenticationUtil.RunAsWork<Object>()
@@ -193,7 +217,7 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent
private void processRecordFolder(NodeRef recordFolder)
{
if (recordsManagementService.isRecord(recordFolder) == true)
if (recordService.isRecord(recordFolder) == true)
{
processRecord(recordFolder);
}

View File

@@ -20,7 +20,6 @@ package org.alfresco.module.org_alfresco_module_rm.event;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -45,34 +44,35 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent
{
/** Reference to the rm event config node */
private static final StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
private static final NodeRef CONFIG_NODE_REF = new NodeRef(SPACES_STORE, "rm_event_config");
/** Node service */
private NodeService nodeService;
/** Content service */
private ContentService contentService;
/** Registered event types */
private Map<String, RecordsManagementEventType> eventTypes = new HashMap<String, RecordsManagementEventType>(7);
/** Available events */
private Map<String, RecordsManagementEvent> events;
/**
* Set the node service
*
* @param nodeService node service
* @param nodeService node service
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
/**
* Set the content service
*
* @param contentService content service
* @param contentService content service
*/
public void setContentService(ContentService contentService)
{
@@ -94,7 +94,7 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent
{
return new ArrayList<RecordsManagementEventType>(this.eventTypes.values());
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#getEvents()
*/
@@ -102,19 +102,17 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent
{
return new ArrayList<RecordsManagementEvent>(this.getEventMap().values());
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#getEvent(java.lang.String)
*/
public RecordsManagementEvent getEvent(String eventName)
public RecordsManagementEvent getEvent(String eventName)
{
if (getEventMap().containsKey(eventName) == false)
{
throw new AlfrescoRuntimeException("The event " + eventName + " does not exist.");
}
if (getEventMap().containsKey(eventName) == false) { throw new AlfrescoRuntimeException("The event "
+ eventName + " does not exist."); }
return getEventMap().get(eventName);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#existsEvent(java.lang.String)
*/
@@ -122,46 +120,36 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent
{
return getEventMap().containsKey(eventName);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#existsEventDisplayLabel(java.lang.String)
*/
@SuppressWarnings("rawtypes")
public boolean existsEventDisplayLabel(String eventDisplayLabel)
{
for (Iterator iterator = getEventMap().values().iterator(); iterator.hasNext();)
{
RecordsManagementEvent recordsManagementEvent = (RecordsManagementEvent) iterator.next();
if (recordsManagementEvent.getDisplayLabel().equalsIgnoreCase(eventDisplayLabel))
{
return true;
}
}
return false;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#addEvent(java.lang.String, java.lang.String, java.lang.String)
* @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#existsEventDisplayLabel(java.lang.String)
*/
public boolean existsEventDisplayLabel(String eventDisplayLabel)
{
for (RecordsManagementEvent recordsManagementEvent : getEventMap().values())
{
if (recordsManagementEvent.getDisplayLabel().equalsIgnoreCase(eventDisplayLabel)) { return true; }
}
return false;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#addEvent(java.lang.String,
* java.lang.String, java.lang.String)
*/
public RecordsManagementEvent addEvent(String eventType, String eventName, String eventDisplayLabel)
{
// Check that the eventType is valid
if (eventTypes.containsKey(eventType) == false)
{
throw new AlfrescoRuntimeException(
"Can not add event because event " +
eventName +
" has an undefined eventType. ("
+ eventType + ")");
}
if (eventTypes.containsKey(eventType) == false) { throw new AlfrescoRuntimeException(
"Can not add event because event " + eventName + " has an undefined eventType. (" + eventType + ")"); }
// Create event and add to map
RecordsManagementEvent event = new RecordsManagementEvent(eventType, eventName, eventDisplayLabel);
getEventMap().put(event.getName(), event);
// Persist the changes to the event list
saveEvents();
return new RecordsManagementEvent(eventType, eventName, eventDisplayLabel);
}
@@ -172,15 +160,17 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent
{
// Remove the event from the map
getEventMap().remove(eventName);
// Persist the changes to the event list
saveEvents();
}
}
/**
* Helper method to get the event map. Loads initial instance from persisted configuration file.
* Helper method to get the event map. Loads initial instance from persisted
* configuration file.
*
* @return Map<String, RecordsManagementEvent> map of available events by event name
* @return Map<String, RecordsManagementEvent> map of available events by
* event name
*/
private Map<String, RecordsManagementEvent> getEventMap()
{
@@ -190,7 +180,7 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent
}
return this.events;
}
/**
* Load the events from the persistant storage
*/
@@ -201,50 +191,43 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent
public Object doWork() throws Exception
{
// Get the event config node
if (nodeService.exists(CONFIG_NODE_REF) == false)
{
throw new AlfrescoRuntimeException("Unable to find records management event configuration node.");
}
if (nodeService.exists(CONFIG_NODE_REF) == false) { throw new AlfrescoRuntimeException(
"Unable to find records management event configuration node."); }
// Read content from config node
ContentReader reader = contentService.getReader(CONFIG_NODE_REF, ContentModel.PROP_CONTENT);
String jsonString = reader.getContentString();
JSONObject configJSON = new JSONObject(jsonString);
JSONArray eventsJSON = configJSON.getJSONArray("events");
events = new HashMap<String, RecordsManagementEvent>(eventsJSON.length());
for (int i = 0; i < eventsJSON.length(); i++)
{
// Get the JSON object that represents the event
JSONObject eventJSON = eventsJSON.getJSONObject(i);
// Get the details of the event
String eventType = eventJSON.getString("eventType");
String eventName = eventJSON.getString("eventName");
String eventDisplayLabel = eventJSON.getString("eventDisplayLabel");
// Check that the eventType is valid
if (eventTypes.containsKey(eventType) == false)
{
throw new AlfrescoRuntimeException(
"Can not load rm event configuration because event " +
eventName +
" has an undefined eventType. ("
+ eventType + ")");
}
if (eventTypes.containsKey(eventType) == false) { throw new AlfrescoRuntimeException(
"Can not load rm event configuration because event " + eventName
+ " has an undefined eventType. (" + eventType + ")"); }
// Create event and add to map
RecordsManagementEvent event = new RecordsManagementEvent(eventType, eventName, eventDisplayLabel);
events.put(event.getName(), event);
events.put(event.getName(), event);
}
return null;
}
}, AuthenticationUtil.getSystemUserName());
}
/**
* Save the events to the peristant storage
*/
@@ -255,14 +238,12 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent
public Object doWork() throws Exception
{
// Get the event config node
if (nodeService.exists(CONFIG_NODE_REF) == false)
{
throw new AlfrescoRuntimeException("Unable to find records management event configuration node.");
}
JSONObject configJSON = new JSONObject();
if (nodeService.exists(CONFIG_NODE_REF) == false) { throw new AlfrescoRuntimeException(
"Unable to find records management event configuration node."); }
JSONObject configJSON = new JSONObject();
JSONArray eventsJSON = new JSONArray();
int index = 0;
for (RecordsManagementEvent event : events.values())
{
@@ -270,19 +251,20 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent
eventJSON.put("eventType", event.getType());
eventJSON.put("eventName", event.getName());
eventJSON.put("eventDisplayLabel", event.getDisplayLabel());
eventsJSON.put(index, eventJSON);
index++;
}
}
configJSON.put("events", eventsJSON);
// Get content writer
ContentWriter contentWriter = contentService.getWriter(CONFIG_NODE_REF, ContentModel.PROP_CONTENT, true);
ContentWriter contentWriter = contentService
.getWriter(CONFIG_NODE_REF, ContentModel.PROP_CONTENT, true);
contentWriter.putContent(configJSON.toString());
return null;
}
}, AuthenticationUtil.getSystemUserName());
}
@@ -294,5 +276,3 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent
return this.eventTypes.get(eventTypeName);
}
}

View File

@@ -213,7 +213,7 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
protected void addTransientProperties(Form form, NodeRef nodeRef)
{
if (rmService.isRecord(nodeRef) == true)
if (recordService.isRecord(nodeRef) == true)
{
addTransientPropertyField(form, TRANSIENT_DECLARED, DataTypeDefinition.BOOLEAN, recordService.isDeclared(nodeRef));
}

View File

@@ -21,7 +21,7 @@ package org.alfresco.module.org_alfresco_module_rm.jscript;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper;
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService;
import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService;
import org.alfresco.repo.jscript.BaseScopableProcessorExtension;
import org.alfresco.repo.jscript.ScriptNode;
import org.alfresco.scripts.ScriptException;
@@ -93,8 +93,8 @@ public class ScriptRecordsManagmentService extends BaseScopableProcessorExtensio
*/
public void setPermission(ScriptNode node, String permission, String authority)
{
RecordsManagementSecurityService securityService = rmServices.getRecordsManagementSecurityService();
securityService.setPermission(node.getNodeRef(), authority, permission);
FilePlanPermissionService filePlanPermissionService = rmServices.getFilePlanPermissionService();
filePlanPermissionService.setPermission(node.getNodeRef(), authority, permission);
}
/**
@@ -106,8 +106,8 @@ public class ScriptRecordsManagmentService extends BaseScopableProcessorExtensio
*/
public void deletePermission(ScriptNode node, String permission, String authority)
{
RecordsManagementSecurityService securityService = rmServices.getRecordsManagementSecurityService();
securityService.deletePermission(node.getNodeRef(), authority, permission);
FilePlanPermissionService filePlanPermissionService = rmServices.getFilePlanPermissionService();
filePlanPermissionService.deletePermission(node.getNodeRef(), authority, permission);
}
/**

View File

@@ -1,90 +0,0 @@
/*
* Copyright (C) 2005-2011 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.model.behaviour;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.repo.node.NodeServicePolicies;
import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.security.PermissionService;
/**
* Behaviour associated with the file plan type
*
* @author Roy Wetherall
*/
public class FilePlanType implements RecordsManagementModel,
NodeServicePolicies.OnCreateNodePolicy
{
/** Policy component */
private PolicyComponent policyComponent;
/** Node service */
private NodeService nodeService;
/** Permission service */
private PermissionService permissionService;
/** New record container name */
private static final String NAME_NR_CONTAINER = "New Records";
/**
* Set the policy component
* @param policyComponent policy component
*/
public void setPolicyComponent(PolicyComponent policyComponent)
{
this.policyComponent = policyComponent;
}
/**
* Set node service
* @param nodeService node service
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
public void setPermissionService(PermissionService permissionService)
{
this.permissionService = permissionService;
}
/**
* Bean initialisation method
*/
public void init()
{
// policyComponent.bindClassBehaviour(
// NodeServicePolicies.OnCreateNodePolicy.QNAME,
// TYPE_FILE_PLAN,
// new JavaBehaviour(this, "onCreateNode", NotificationFrequency.TRANSACTION_COMMIT));
}
/**
* @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef)
*/
@Override
public void onCreateNode(ChildAssociationRef assoc)
{
// TODO refactor the file plan behaviours from the service code
}
}

View File

@@ -19,7 +19,6 @@
package org.alfresco.module.org_alfresco_module_rm.model.behaviour;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService;
import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.repo.node.NodeServicePolicies;
@@ -47,9 +46,6 @@ public class RecordContainerType implements RecordsManagementModel,
/** Policy component */
private PolicyComponent policyComponent;
/** Records Management Action Service */
private RecordsManagementActionService recordsManagementActionService;
/** Node service */
private NodeService nodeService;
@@ -68,16 +64,6 @@ public class RecordContainerType implements RecordsManagementModel,
this.policyComponent = policyComponent;
}
/**
* Set the records management action service
*
* @param recordsManagementActionService records management action service
*/
public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService)
{
this.recordsManagementActionService = recordsManagementActionService;
}
/**
* Set node service
*

View File

@@ -26,12 +26,12 @@ import java.util.Set;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService;
import org.alfresco.module.org_alfresco_module_rm.security.Role;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
import org.alfresco.module.org_alfresco_module_rm.role.Role;
import org.alfresco.repo.node.NodeServicePolicies;
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
import org.alfresco.repo.policy.JavaBehaviour;
import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
@@ -66,8 +66,8 @@ public class ModelSecurityServiceImpl implements ModelSecurityService,
/** Namespace service */
private NamespaceService namespaceService;
/** Security service */
private RecordsManagementSecurityService securityService;
/** File plan role service */
private FilePlanRoleService filePlanRoleService;
/** Records management service */
private RecordsManagementService recordsManagementService;
@@ -130,11 +130,11 @@ public class ModelSecurityServiceImpl implements ModelSecurityService,
}
/**
* @param securityService records management security service
* @param filePlanRoleService file plan role service
*/
public void setSecurityService(RecordsManagementSecurityService securityService)
public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService)
{
this.securityService = securityService;
this.filePlanRoleService = filePlanRoleService;
}
/**
@@ -246,7 +246,7 @@ public class ModelSecurityServiceImpl implements ModelSecurityService,
NodeRef filePlan = recordsManagementService.getFilePlan(nodeRef);
if (filePlan != null)
{
Set<Role> roles = securityService.getRolesByUser(filePlan, AuthenticationUtil.getFullyAuthenticatedUser());
Set<Role> roles = filePlanRoleService.getRolesByUser(filePlan, AuthenticationUtil.getFullyAuthenticatedUser());
for (Role role : roles)
{
if (Collections.disjoint(role.getCapabilities(), artifact.getCapabilities()) == false)

View File

@@ -26,8 +26,8 @@ import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService;
import org.alfresco.module.org_alfresco_module_rm.security.Role;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
import org.alfresco.module.org_alfresco_module_rm.role.Role;
import org.alfresco.repo.notification.EMailNotificationProvider;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
@@ -70,7 +70,7 @@ public class RecordsManagementNotificationHelper
/** Services */
private NotificationService notificationService;
private RecordsManagementService recordsManagementService;
private RecordsManagementSecurityService securityService;
private FilePlanRoleService filePlanRoleService;
private SearchService searchService;
private NamespaceService namespaceService;
private SiteService siteService;
@@ -102,11 +102,11 @@ public class RecordsManagementNotificationHelper
}
/**
* @param securityService rm security service
* @param filePlanRoleService file plan role service
*/
public void setSecurityService(RecordsManagementSecurityService securityService)
public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService)
{
this.securityService = securityService;
this.filePlanRoleService = filePlanRoleService;
}
/**
@@ -325,7 +325,7 @@ public class RecordsManagementNotificationHelper
public String doWork() throws Exception
{
// Find the authority for the given role
Role role = securityService.getRole(root, notificationRole);
Role role = filePlanRoleService.getRole(root, notificationRole);
return role.getRoleGroupName();
}
}, AuthenticationUtil.getSystemUserName());

View File

@@ -28,10 +28,10 @@ import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleServiceImpl;
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedReaderDynamicAuthority;
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService;
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityServiceImpl;
import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService;
import org.alfresco.repo.module.AbstractModuleComponent;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
@@ -62,8 +62,11 @@ public class RMv21InPlacePatch extends AbstractModuleComponent
/** Records management service */
private RecordsManagementService recordsManagementService;
/** Records management security service */
private RecordsManagementSecurityService recordsManagementSecurityService;
/** File plan permission service */
private FilePlanPermissionService filePlanPermissionService;
/** File plan role service */
private FilePlanRoleService filePlanRoleService;
/**
* @param nodeService node service
@@ -90,11 +93,19 @@ public class RMv21InPlacePatch extends AbstractModuleComponent
}
/**
* @param recordsManagementSecurityService records management security service
* @param filePlanPermissionService file plan permission service
*/
public void setRecordsManagementSecurityService(RecordsManagementSecurityService recordsManagementSecurityService)
public void setFilePlanPermissionService(FilePlanPermissionService filePlanPermissionService)
{
this.recordsManagementSecurityService = recordsManagementSecurityService;
this.filePlanPermissionService = filePlanPermissionService;
}
/**
* @param filePlanRoleService file plan role service
*/
public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService)
{
this.filePlanRoleService = filePlanRoleService;
}
/**
@@ -123,7 +134,7 @@ public class RMv21InPlacePatch extends AbstractModuleComponent
}
// set permissions
recordsManagementSecurityService.setPermission(filePlan, ExtendedReaderDynamicAuthority.EXTENDED_READER, RMPermissionModel.READ_RECORDS);
filePlanPermissionService.setPermission(filePlan, ExtendedReaderDynamicAuthority.EXTENDED_READER, RMPermissionModel.READ_RECORDS);
permissionService.setPermission(filePlan, ExtendedReaderDynamicAuthority.EXTENDED_READER, RMPermissionModel.VIEW_RECORDS, true);
// create unfiled container
@@ -141,7 +152,7 @@ public class RMv21InPlacePatch extends AbstractModuleComponent
*/
private NodeRef createUnfiledContainer(NodeRef filePlan)
{
String allRoles = recordsManagementSecurityService.getAllRolesContainerGroup(filePlan);
String allRoles = filePlanRoleService.getAllRolesContainerGroup(filePlan);
// create the properties map
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(1);

View File

@@ -28,7 +28,6 @@ import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.module.org_alfresco_module_rm.CustomMetadataException;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel;
import org.alfresco.service.cmr.dictionary.DictionaryException;
import org.alfresco.service.namespace.QName;
import org.json.JSONException;
import org.json.JSONObject;

View File

@@ -53,6 +53,7 @@ public class CustomReferenceDefinitionPut extends AbstractRmWebScript
private static final String SOURCE = "source";
private static final String LABEL = "label";
@SuppressWarnings("unused")
private static Log logger = LogFactory.getLog(CustomReferenceDefinitionPut.class);
private RecordsManagementAdminService rmAdminService;

View File

@@ -29,15 +29,14 @@ import javax.servlet.http.HttpServletResponse;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService;
import org.alfresco.service.cmr.dictionary.AssociationDefinition;
import org.alfresco.service.cmr.dictionary.ChildAssociationDefinition;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.extensions.webscripts.Cache;
import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptException;
import org.springframework.extensions.webscripts.WebScriptRequest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* This class provides the implementation for the customrefdefinitions.get webscript.
@@ -55,12 +54,6 @@ public class CustomReferenceDefinitionsGet extends DeclarativeWebScript
private static Log logger = LogFactory.getLog(CustomReferenceDefinitionsGet.class);
private RecordsManagementAdminService rmAdminService;
private NamespaceService namespaceService;
public void setNamespaceService(NamespaceService namespaceService)
{
this.namespaceService = namespaceService;
}
public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService)
{

View File

@@ -30,7 +30,7 @@ import javax.servlet.http.HttpServletResponse;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
import org.alfresco.repo.exporter.ACPExportPackageHandler;
import org.alfresco.repo.importer.ACPImportPackageHandler;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
@@ -41,6 +41,8 @@ import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.view.ImporterService;
import org.alfresco.service.cmr.view.Location;
import org.alfresco.util.TempFileProvider;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.extensions.webscripts.Cache;
import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status;
@@ -49,8 +51,6 @@ import org.springframework.extensions.webscripts.WebScriptRequest;
import org.springframework.extensions.webscripts.WrappingWebScriptRequest;
import org.springframework.extensions.webscripts.servlet.WebScriptServletRequest;
import org.springframework.extensions.webscripts.servlet.FormData.FormField;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.util.FileCopyUtils;
/**
@@ -72,7 +72,7 @@ public class ImportPost extends DeclarativeWebScript
protected DictionaryService dictionaryService;
protected ImporterService importerService;
protected RecordsManagementService rmService;
protected RecordsManagementSecurityService rmSecurityService;
protected FilePlanRoleService filePlanRoleService;
/**
* @param nodeService
@@ -103,13 +103,11 @@ public class ImportPost extends DeclarativeWebScript
}
/**
* Sets the RecordsManagementSecurityService instance
*
* @param rmSecurityService The RecordsManagementSecurityService instance
* @param filePlanRoleService file plan role service
*/
public void setRecordsManagementSecurityService(RecordsManagementSecurityService rmSecurityService)
public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService)
{
this.rmSecurityService = rmSecurityService;
this.filePlanRoleService = filePlanRoleService;
}
/**
@@ -179,7 +177,7 @@ public class ImportPost extends DeclarativeWebScript
// as there is no 'import capability' and the RM admin user is different from
// the DM admin user (meaning the webscript 'admin' authentication can't be used)
// perform a manual check here to ensure the current user has the RM admin role.
boolean isAdmin = this.rmSecurityService.hasRMAdminRole(
boolean isAdmin = filePlanRoleService.hasRMAdminRole(
this.rmService.getFilePlan(destination),
AuthenticationUtil.getRunAsUser());
if (!isAdmin)

View File

@@ -41,7 +41,6 @@ public class RMConstraintGet extends DeclarativeWebScript
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
String requestUrl = req.getURL();
String extensionPath = req.getExtensionPath();
String constraintName = extensionPath.replace('_', ':');

View File

@@ -28,8 +28,8 @@ import javax.servlet.http.HttpServletResponse;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService;
import org.alfresco.module.org_alfresco_module_rm.security.Role;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
import org.alfresco.module.org_alfresco_module_rm.role.Role;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.security.AuthorityService;
@@ -51,7 +51,7 @@ public class UserRightsReportGet extends DeclarativeWebScript
protected PersonService personService;
protected NodeService nodeService;
protected RecordsManagementService rmService;
protected RecordsManagementSecurityService rmSecurityService;
protected FilePlanRoleService filePlanRoleService;
/**
* Sets the AuthorityService instance
@@ -84,23 +84,19 @@ public class UserRightsReportGet extends DeclarativeWebScript
}
/**
* Sets the RecordsManagementService instance
*
* @param rmService The RecordsManagementService instance
* @param recordsManagementService records management service
*/
public void setRecordsManagementService(RecordsManagementService rmService)
public void setRecordsManagementService(RecordsManagementService recordsManagementService)
{
this.rmService = rmService;
this.rmService = recordsManagementService;
}
/**
* Sets the RecordsManagementSecurityService instance
*
* @param rmSecurityService The RecordsManagementSecurityService instance
* @param filePlanRoleService file plan role service
*/
public void setRecordsManagementSecurityService(RecordsManagementSecurityService rmSecurityService)
public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService)
{
this.rmSecurityService = rmSecurityService;
this.filePlanRoleService = filePlanRoleService;
}
/*
@@ -128,7 +124,7 @@ public class UserRightsReportGet extends DeclarativeWebScript
NodeRef rmRootNode = rmRoots.get(0);
// iterate over all the roles for the file plan and construct models
Set<Role> roles = this.rmSecurityService.getRoles(rmRootNode);
Set<Role> roles = this.filePlanRoleService.getRoles(rmRootNode);
for (Role role : roles)
{
// get or create the RoleModel object for current role

View File

@@ -23,15 +23,15 @@ import java.util.List;
import java.util.Map;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.extensions.webscripts.Cache;
import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptException;
import org.springframework.extensions.webscripts.WebScriptRequest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
*
@@ -44,11 +44,11 @@ public class RmRoleDelete extends DeclarativeWebScript
private static Log logger = LogFactory.getLog(RmRoleDelete.class);
private RecordsManagementService rmService;
private RecordsManagementSecurityService rmSecurityService;
private FilePlanRoleService filePlanRoleService;
public void setRecordsManagementSecurityService(RecordsManagementSecurityService rmSecurityService)
public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService)
{
this.rmSecurityService = rmSecurityService;
this.filePlanRoleService = filePlanRoleService;
}
public void setRecordsManagementService(RecordsManagementService rmService)
@@ -73,12 +73,12 @@ public class RmRoleDelete extends DeclarativeWebScript
NodeRef root = roots.get(0);
// Check that the role exists
if (rmSecurityService.existsRole(root, roleParam) == false)
if (filePlanRoleService.existsRole(root, roleParam) == false)
{
throw new WebScriptException(Status.STATUS_NOT_FOUND, "The role " + roleParam + " does not exist on the records managment root " + root);
}
rmSecurityService.deleteRole(root, roleParam);
filePlanRoleService.deleteRole(root, roleParam);
return model;
}

View File

@@ -23,15 +23,15 @@ import java.util.List;
import java.util.Map;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.extensions.webscripts.Cache;
import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptException;
import org.springframework.extensions.webscripts.WebScriptRequest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
*
@@ -44,11 +44,11 @@ public class RmRoleGet extends DeclarativeWebScript
private static Log logger = LogFactory.getLog(RmRoleGet.class);
private RecordsManagementService rmService;
private RecordsManagementSecurityService rmSecurityService;
private FilePlanRoleService filePlanRoleService;
public void setRecordsManagementSecurityService(RecordsManagementSecurityService rmSecurityService)
public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService)
{
this.rmSecurityService = rmSecurityService;
this.filePlanRoleService = filePlanRoleService;
}
public void setRecordsManagementService(RecordsManagementService rmService)
@@ -75,12 +75,12 @@ public class RmRoleGet extends DeclarativeWebScript
NodeRef root = roots.get(0);
// Check that the role exists
if (rmSecurityService.existsRole(root, roleParam) == false)
if (filePlanRoleService.existsRole(root, roleParam) == false)
{
throw new WebScriptException(Status.STATUS_NOT_FOUND, "The role " + roleParam + " does not exist on the records managment root " + root);
}
model.put("role", rmSecurityService.getRole(root, roleParam));
model.put("role", filePlanRoleService.getRole(root, roleParam));
return model;
}

View File

@@ -28,8 +28,8 @@ import java.util.Set;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService;
import org.alfresco.module.org_alfresco_module_rm.security.Role;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
import org.alfresco.module.org_alfresco_module_rm.role.Role;
import org.alfresco.service.cmr.repository.NodeRef;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -54,12 +54,12 @@ public class RmRolePut extends DeclarativeWebScript
private static Log logger = LogFactory.getLog(RmRolePut.class);
private RecordsManagementService rmService;
private RecordsManagementSecurityService rmSecurityService;
private CapabilityService capabilityService;
private FilePlanRoleService filePlanRoleService;
public void setRecordsManagementSecurityService(RecordsManagementSecurityService rmSecurityService)
public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService)
{
this.rmSecurityService = rmSecurityService;
this.filePlanRoleService = filePlanRoleService;
}
public void setRecordsManagementService(RecordsManagementService rmService)
@@ -105,12 +105,12 @@ public class RmRolePut extends DeclarativeWebScript
NodeRef root = roots.get(0);
// Check that the role exists
if (rmSecurityService.existsRole(root, roleParam) == false)
if (filePlanRoleService.existsRole(root, roleParam) == false)
{
throw new WebScriptException(Status.STATUS_NOT_FOUND, "The role " + roleParam + " does not exist on the records managment root " + root);
}
Role role = rmSecurityService.updateRole(root, name, displayLabel, capabilites);
Role role = filePlanRoleService.updateRole(root, name, displayLabel, capabilites);
model.put("role", role);
}

View File

@@ -25,69 +25,70 @@ import java.util.Map;
import java.util.Set;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService;
import org.alfresco.module.org_alfresco_module_rm.security.Role;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
import org.alfresco.module.org_alfresco_module_rm.role.Role;
import org.alfresco.service.cmr.repository.NodeRef;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.extensions.webscripts.Cache;
import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptRequest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Get information about record management roles
*
*
* @author Roy Wetherall
*/
public class RmRolesGet extends DeclarativeWebScript
{
@SuppressWarnings("unused")
private static Log logger = LogFactory.getLog(RmRolesGet.class);
@SuppressWarnings("unused")
private static Log logger = LogFactory.getLog(RmRolesGet.class);
private RecordsManagementService rmService;
private RecordsManagementSecurityService rmSecurityService;
private RecordsManagementService rmService;
public void setRecordsManagementSecurityService(RecordsManagementSecurityService rmSecurityService)
{
this.rmSecurityService = rmSecurityService;
}
private FilePlanRoleService filePlanRoleService;
public void setRecordsManagementService(RecordsManagementService rmService)
{
this.rmService = rmService;
}
public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService)
{
this.filePlanRoleService = filePlanRoleService;
}
@Override
public Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
Map<String, Object> model = new HashMap<String, Object>();
Set<Role> roles = null;
public void setRecordsManagementService(RecordsManagementService rmService)
{
this.rmService = rmService;
}
// TODO should be passed
List<NodeRef> roots = rmService.getFilePlans();
if (roots != null && roots.size() > 0)
{
NodeRef root = roots.get(0);
@Override
public Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
Map<String, Object> model = new HashMap<String, Object>();
Set<Role> roles = null;
// Get the user filter
String user = req.getParameter("user");
if (user != null && user.length() != 0)
{
roles = rmSecurityService.getRolesByUser(root, user);
}
else
{
roles = rmSecurityService.getRoles(root);
}
}
else
{
roles = new HashSet<Role>(1);
}
// TODO should be passed
List<NodeRef> roots = rmService.getFilePlans();
if (roots != null && roots.size() > 0)
{
NodeRef root = roots.get(0);
model.put("roles", roles);
// Get the user filter
String user = req.getParameter("user");
if (user != null && user.length() != 0)
{
roles = filePlanRoleService.getRolesByUser(root, user);
}
else
{
roles = filePlanRoleService.getRoles(root);
}
}
else
{
roles = new HashSet<Role>(1);
}
return model;
model.put("roles", roles);
return model;
}
}

View File

@@ -28,8 +28,8 @@ import java.util.Set;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService;
import org.alfresco.module.org_alfresco_module_rm.security.Role;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
import org.alfresco.module.org_alfresco_module_rm.role.Role;
import org.alfresco.service.cmr.repository.NodeRef;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -54,12 +54,12 @@ public class RmRolesPost extends DeclarativeWebScript
private static Log logger = LogFactory.getLog(RmRolesPost.class);
private RecordsManagementService rmService;
private RecordsManagementSecurityService rmSecurityService;
private FilePlanRoleService filePlanRoleService;
private CapabilityService capabilityService;
public void setRecordsManagementSecurityService(RecordsManagementSecurityService rmSecurityService)
public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService)
{
this.rmSecurityService = rmSecurityService;
this.filePlanRoleService = filePlanRoleService;
}
public void setRecordsManagementService(RecordsManagementService rmService)
@@ -96,7 +96,7 @@ public class RmRolesPost extends DeclarativeWebScript
List<NodeRef> roots = rmService.getFilePlans();
NodeRef root = roots.get(0);
Role role = rmSecurityService.createRole(root, name, displayString, capabilites);
Role role = filePlanRoleService.createRole(root, name, displayString, capabilites);
//Set<Role> roles = rmSecurityService.getRoles(root);
model.put("role", role);