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

@@ -97,7 +97,7 @@
<property name="registry" ref="auditModel.extractorRegistry" /> <property name="registry" ref="auditModel.extractorRegistry" />
<property name="nodeService" ref="nodeService" /> <property name="nodeService" ref="nodeService" />
<property name="rmService" ref="recordsManagementService" /> <property name="rmService" ref="recordsManagementService" />
<property name="rmSecurityService" ref="recordsManagementSecurityService" /> <property name="filePlanRoleService" ref="filePlanRoleService" />
</bean> </bean>
<bean id="org_alfresco_module_rm_namePathExtractor" class="org.alfresco.module.org_alfresco_module_rm.audit.FilePlanNamePathDataExtractor"> <bean id="org_alfresco_module_rm_namePathExtractor" class="org.alfresco.module.org_alfresco_module_rm.audit.FilePlanNamePathDataExtractor">
@@ -209,6 +209,7 @@
<property name="recordsManagementAdminService" ref="recordsManagementAdminService"/> <property name="recordsManagementAdminService" ref="recordsManagementAdminService"/>
<property name="recordsManagementActionService" ref="recordsManagementActionService"/> <property name="recordsManagementActionService" ref="recordsManagementActionService"/>
<property name="policyComponent" ref="policyComponent"/> <property name="policyComponent" ref="policyComponent"/>
<property name="recordService" ref="recordService" />
</bean> </bean>
<!-- Job context --> <!-- Job context -->

View File

@@ -55,7 +55,6 @@
class="org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordContainerType" class="org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordContainerType"
parent="org_alfresco_module_rm_BaseBehaviour"> parent="org_alfresco_module_rm_BaseBehaviour">
<property name="dictionaryService" ref="DictionaryService"/> <property name="dictionaryService" ref="DictionaryService"/>
<property name="recordsManagementActionService" ref="RecordsManagementActionService"/>
<property name="recordsManagementIdentifierService" ref="recordsManagementIdentifierService"/> <property name="recordsManagementIdentifierService" ref="recordsManagementIdentifierService"/>
</bean> </bean>
@@ -101,13 +100,6 @@
<property name="namespaceService" ref="NamespaceService"/> <property name="namespaceService" ref="NamespaceService"/>
</bean> </bean>
<!-- File Plan Type Behaviour -->
<bean id="org_alfresco_module_rm_FilePlanType"
class="org.alfresco.module.org_alfresco_module_rm.model.behaviour.FilePlanType"
parent="org_alfresco_module_rm_BaseBehaviour">
<property name="permissionService" ref="PermissionService"/>
</bean>
<!-- Model Security Definitions --> <!-- Model Security Definitions -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/model/rm-model-security-context.xml"/> <import resource="classpath:alfresco/module/org_alfresco_module_rm/model/rm-model-security-context.xml"/>

View File

@@ -43,7 +43,8 @@
<property name="nodeService" ref="NodeService"/> <property name="nodeService" ref="NodeService"/>
<property name="permissionService" ref="PermissionService" /> <property name="permissionService" ref="PermissionService" />
<property name="recordsManagementService" ref="RecordsManagementService"/> <property name="recordsManagementService" ref="RecordsManagementService"/>
<property name="recordsManagementSecurityService" ref="RecordsManagementSecurityService"/> <property name="filePlanPermissionService" ref="FilePlanPermissionService"/>
<property name="filePlanRoleService" ref="FilePlanRoleService"/>
</bean> </bean>
</beans> </beans>

View File

@@ -18,7 +18,6 @@
<bean id="recordsManagementService" class="org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceImpl" <bean id="recordsManagementService" class="org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceImpl"
depends-on="org_alfresco_module_rm_dictionaryBootstrap" init-method="init"> depends-on="org_alfresco_module_rm_dictionaryBootstrap" init-method="init">
<property name="recordsManagementServiceRegistry" ref="RecordsManagementServiceRegistry"/> <property name="recordsManagementServiceRegistry" ref="RecordsManagementServiceRegistry"/>
<property name="rmActionService" ref="recordsManagementActionService"/>
<property name="nodeService" ref="nodeService"/> <property name="nodeService" ref="nodeService"/>
<property name="policyComponent" ref="policyComponent"/> <property name="policyComponent" ref="policyComponent"/>
<property name="nodeDAO" ref="nodeDAO"/> <property name="nodeDAO" ref="nodeDAO"/>
@@ -610,7 +609,7 @@
<property name="policyComponent" ref="policyComponent" /> <property name="policyComponent" ref="policyComponent" />
<property name="nodeService" ref="NodeService" /> <property name="nodeService" ref="NodeService" />
<property name="namespaceService" ref="namespaceService" /> <property name="namespaceService" ref="namespaceService" />
<property name="securityService" ref="RecordsManagementSecurityService" /> <property name="filePlanRoleService" ref="FilePlanRoleService" />
<property name="recordsManagementService" ref="RecordsManagementService" /> <property name="recordsManagementService" ref="RecordsManagementService" />
</bean> </bean>
@@ -891,6 +890,7 @@
<property name="recordsManagementService" ref="RecordsManagementService" /> <property name="recordsManagementService" ref="RecordsManagementService" />
<property name="nodeService" ref="nodeService" /> <property name="nodeService" ref="nodeService" />
<property name="dictionaryService" ref="dictionaryService" /> <property name="dictionaryService" ref="dictionaryService" />
<property name="recordService" ref="RecordService" />
</bean> </bean>
<bean id="FreezeService" class="org.springframework.aop.framework.ProxyFactoryBean"> <bean id="FreezeService" class="org.springframework.aop.framework.ProxyFactoryBean">
@@ -1175,7 +1175,7 @@
<!-- RM Notification Helper --> <!-- RM Notification Helper -->
<bean id="recordsManagementNotificationHelper" class="org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper" > <bean id="recordsManagementNotificationHelper" class="org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper" >
<property name="securityService" ref="RecordsManagementSecurityService"/> <property name="filePlanRoleService" ref="FilePlanRoleService"/>
<property name="notificationService" ref="NotificationService"/> <property name="notificationService" ref="NotificationService"/>
<property name="recordsManagementService" ref="RecordsManagementService"/> <property name="recordsManagementService" ref="RecordsManagementService"/>
<property name="nodeService" ref="nodeService"/> <property name="nodeService" ref="nodeService"/>
@@ -1313,10 +1313,9 @@
<property name="searchService" ref="SearchService"/> <property name="searchService" ref="SearchService"/>
<property name="nodeService" ref="NodeService"/> <property name="nodeService" ref="NodeService"/>
<property name="recordsManagementService" ref="RecordsManagementService"/> <property name="recordsManagementService" ref="RecordsManagementService"/>
<property name="recordsManagementActionService" ref="RecordsManagementActionService"/>
<property name="permissionService" ref="PermissionService"/> <property name="permissionService" ref="PermissionService"/>
<property name="authorityService" ref="AuthorityService"/> <property name="authorityService" ref="AuthorityService"/>
<property name="recordsManagementSecurityService" ref="RecordsManagementSecurityService"/> <property name="filePlanRoleService" ref="FilePlanRoleService"/>
<property name="recordsManagementSearchBehaviour" ref="recordsManagementSearchBehaviour"/> <property name="recordsManagementSearchBehaviour" ref="recordsManagementSearchBehaviour"/>
<property name="dispositionService" ref="DispositionService"/> <property name="dispositionService" ref="DispositionService"/>
</bean> </bean>

View File

@@ -67,7 +67,6 @@
class="org.alfresco.module.org_alfresco_module_rm.script.CustomReferenceDefinitionsGet" class="org.alfresco.module.org_alfresco_module_rm.script.CustomReferenceDefinitionsGet"
parent="webscript"> parent="webscript">
<property name="recordsManagementAdminService" ref="RecordsManagementAdminService" /> <property name="recordsManagementAdminService" ref="RecordsManagementAdminService" />
<property name="namespaceService" ref="NamespaceService" />
</bean> </bean>
<!-- REST impl for PUT Custom Reference Definitions --> <!-- REST impl for PUT Custom Reference Definitions -->
@@ -227,7 +226,7 @@
<property name="dictionaryService" ref="DictionaryService" /> <property name="dictionaryService" ref="DictionaryService" />
<property name="importerService" ref="ImporterService" /> <property name="importerService" ref="ImporterService" />
<property name="recordsManagementService" ref="RecordsManagementService" /> <property name="recordsManagementService" ref="RecordsManagementService" />
<property name="recordsManagementSecurityService" ref="RecordsManagementSecurityService" /> <property name="filePlanRoleService" ref="FilePlanRoleService" />
</bean> </bean>
<!-- Base bean for transfer web scripts --> <!-- Base bean for transfer web scripts -->
@@ -270,14 +269,14 @@
class="org.alfresco.module.org_alfresco_module_rm.script.admin.RmRolesGet" class="org.alfresco.module.org_alfresco_module_rm.script.admin.RmRolesGet"
parent="webscript"> parent="webscript">
<property name="recordsManagementService" ref="RecordsManagementService" /> <property name="recordsManagementService" ref="RecordsManagementService" />
<property name="recordsManagementSecurityService" ref="RecordsManagementSecurityService" /> <property name="filePlanRoleService" ref="FilePlanRoleService" />
</bean> </bean>
<bean id="webscript.org.alfresco.rma.admin.rmrole.rmroles.post" <bean id="webscript.org.alfresco.rma.admin.rmrole.rmroles.post"
class="org.alfresco.module.org_alfresco_module_rm.script.admin.RmRolesPost" class="org.alfresco.module.org_alfresco_module_rm.script.admin.RmRolesPost"
parent="webscript"> parent="webscript">
<property name="recordsManagementService" ref="RecordsManagementService" /> <property name="recordsManagementService" ref="RecordsManagementService" />
<property name="recordsManagementSecurityService" ref="RecordsManagementSecurityService" /> <property name="filePlanRoleService" ref="FilePlanRoleService" />
<property name="capabilityService" ref="CapabilityService" /> <property name="capabilityService" ref="CapabilityService" />
</bean> </bean>
@@ -285,14 +284,14 @@
class="org.alfresco.module.org_alfresco_module_rm.script.admin.RmRoleGet" class="org.alfresco.module.org_alfresco_module_rm.script.admin.RmRoleGet"
parent="webscript"> parent="webscript">
<property name="recordsManagementService" ref="RecordsManagementService" /> <property name="recordsManagementService" ref="RecordsManagementService" />
<property name="recordsManagementSecurityService" ref="RecordsManagementSecurityService" /> <property name="filePlanRoleService" ref="FilePlanRoleService" />
</bean> </bean>
<bean id="webscript.org.alfresco.rma.admin.rmrole.rmrole.put" <bean id="webscript.org.alfresco.rma.admin.rmrole.rmrole.put"
class="org.alfresco.module.org_alfresco_module_rm.script.admin.RmRolePut" class="org.alfresco.module.org_alfresco_module_rm.script.admin.RmRolePut"
parent="webscript"> parent="webscript">
<property name="recordsManagementService" ref="RecordsManagementService" /> <property name="recordsManagementService" ref="RecordsManagementService" />
<property name="recordsManagementSecurityService" ref="RecordsManagementSecurityService" /> <property name="filePlanRoleService" ref="FilePlanRoleService" />
<property name="capabilityService" ref="CapabilityService" /> <property name="capabilityService" ref="CapabilityService" />
</bean> </bean>
@@ -300,7 +299,7 @@
class="org.alfresco.module.org_alfresco_module_rm.script.admin.RmRoleDelete" class="org.alfresco.module.org_alfresco_module_rm.script.admin.RmRoleDelete"
parent="webscript"> parent="webscript">
<property name="recordsManagementService" ref="RecordsManagementService" /> <property name="recordsManagementService" ref="RecordsManagementService" />
<property name="recordsManagementSecurityService" ref="RecordsManagementSecurityService" /> <property name="filePlanRoleService" ref="FilePlanRoleService" />
</bean> </bean>
<!-- Capability API --> <!-- Capability API -->
@@ -386,7 +385,7 @@
<property name="personService" ref="PersonService" /> <property name="personService" ref="PersonService" />
<property name="nodeService" ref="NodeService" /> <property name="nodeService" ref="NodeService" />
<property name="recordsManagementService" ref="RecordsManagementService" /> <property name="recordsManagementService" ref="RecordsManagementService" />
<property name="recordsManagementSecurityService" ref="RecordsManagementSecurityService" /> <property name="filePlanRoleService" ref="FilePlanRoleService" />
</bean> </bean>
<!-- REST impl for GET Bootstrap Test Data --> <!-- REST impl for GET Bootstrap Test Data -->

View File

@@ -30,7 +30,6 @@ import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.model.RenditionModel; 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.RecordsManagementCustomModel;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService;
@@ -99,9 +98,6 @@ public class RecordsManagementServiceImpl implements RecordsManagementService,
/** Policy component */ /** Policy component */
private PolicyComponent policyComponent; private PolicyComponent policyComponent;
/** Records management action service */
private RecordsManagementActionService rmActionService;
/** Well-known location of the scripts folder. */ /** Well-known location of the scripts folder. */
private NodeRef scriptsFolderNodeRef = new NodeRef("workspace", "SpacesStore", "rm_scripts"); private NodeRef scriptsFolderNodeRef = new NodeRef("workspace", "SpacesStore", "rm_scripts");
@@ -150,16 +146,6 @@ public class RecordsManagementServiceImpl implements RecordsManagementService,
this.nodeDAO = nodeDAO; 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 * Sets the default RM store reference
* @param defaultStoreRef 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.disposition.DispositionService;
import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; 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.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.record.RecordService;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; 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.ExtendedSecurityService;
import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService;
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService; import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService;
import org.alfresco.service.NotAuditable; import org.alfresco.service.NotAuditable;
import org.alfresco.service.ServiceRegistry; import org.alfresco.service.ServiceRegistry;
@@ -38,6 +40,7 @@ import org.alfresco.service.namespace.QName;
* *
* @author Roy Wetherall * @author Roy Wetherall
*/ */
@SuppressWarnings("deprecation")
public interface RecordsManagementServiceRegistry extends ServiceRegistry public interface RecordsManagementServiceRegistry extends ServiceRegistry
{ {
/** Service QName constants */ /** 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_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_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_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 RECORDS_MANAGEMENT_AUDIT_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordsManagementAuditService");
static final QName CAPABILITY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "CapabilityService"); 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 RECORD_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "RecordService");
static final QName FREEZE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "FreezeService"); 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 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_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 * @return records management service
@@ -92,7 +98,10 @@ public interface RecordsManagementServiceRegistry extends ServiceRegistry
/** /**
* @return records management security service * @return records management security service
*
* @deprecated As of release 2.1, replaced with {@link FilePlanRoleService}, {@link FilePlanPermissionService} and {@link ModelSecurityService}
*/ */
@Deprecated
@NotAuditable @NotAuditable
RecordsManagementSecurityService getRecordsManagementSecurityService(); RecordsManagementSecurityService getRecordsManagementSecurityService();
@@ -104,25 +113,36 @@ public interface RecordsManagementServiceRegistry extends ServiceRegistry
/** /**
* @return capability service * @return capability service
* @since 2.0
*/ */
@NotAuditable @NotAuditable
CapabilityService getCapabilityService(); CapabilityService getCapabilityService();
/** /**
* @return freeze service * @return freeze service
* @since 2.1
*/ */
@NotAuditable @NotAuditable
FreezeService getFreezeService(); FreezeService getFreezeService();
/** /**
* @return extended security service * @return extended security service
* @since 2.1
*/ */
@NotAuditable @NotAuditable
ExtendedSecurityService getExtendedSecurityService(); ExtendedSecurityService getExtendedSecurityService();
/** /**
* @return file plan role service * @return file plan role service
* @since 2.1
*/ */
@NotAuditable @NotAuditable
FilePlanRoleService getFilePlanRoleService(); 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.record.RecordService;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; 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.ExtendedSecurityService;
import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService;
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService; import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService;
import org.alfresco.repo.service.ServiceDescriptorRegistry; import org.alfresco.repo.service.ServiceDescriptorRegistry;
@@ -35,6 +36,7 @@ import org.alfresco.repo.service.ServiceDescriptorRegistry;
* *
* @author Roy Wetherall * @author Roy Wetherall
*/ */
@SuppressWarnings("deprecation")
public class RecordsManagementServiceRegistryImpl extends ServiceDescriptorRegistry public class RecordsManagementServiceRegistryImpl extends ServiceDescriptorRegistry
implements RecordsManagementServiceRegistry implements RecordsManagementServiceRegistry
{ {
@@ -86,6 +88,7 @@ public class RecordsManagementServiceRegistryImpl extends ServiceDescriptorRegis
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordsManagementSecurityService() * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegistry#getRecordsManagementSecurityService()
*/ */
@Override @Override
@Deprecated
public RecordsManagementSecurityService getRecordsManagementSecurityService() public RecordsManagementSecurityService getRecordsManagementSecurityService()
{ {
return (RecordsManagementSecurityService) getService(RECORDS_MANAGEMENT_SECURITY_SERVICE); return (RecordsManagementSecurityService) getService(RECORDS_MANAGEMENT_SECURITY_SERVICE);
@@ -144,4 +147,13 @@ public class RecordsManagementServiceRegistryImpl extends ServiceDescriptorRegis
{ {
return (FilePlanRoleService) getService(FILE_PLAN_ROLE_SERVICE); 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.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; 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.module.org_alfresco_module_rm.security.Role; import org.alfresco.module.org_alfresco_module_rm.role.Role;
import org.alfresco.repo.audit.extractor.AbstractDataExtractor; import org.alfresco.repo.audit.extractor.AbstractDataExtractor;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
@@ -42,7 +42,7 @@ public final class AuthenticatedUserRolesDataExtractor extends AbstractDataExtra
{ {
private NodeService nodeService; private NodeService nodeService;
private RecordsManagementService rmService; private RecordsManagementService rmService;
private RecordsManagementSecurityService rmSecurityService; private FilePlanRoleService filePlanRoleService;
/** /**
* Used to check that the node in the context is a fileplan component * 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 // Get the rm root
NodeRef rmRootNodeRef = rmService.getFilePlan(nodeRef); NodeRef rmRootNodeRef = rmService.getFilePlan(nodeRef);
Set<Role> roles = rmSecurityService.getRolesByUser(rmRootNodeRef, user); Set<Role> roles = filePlanRoleService.getRolesByUser(rmRootNodeRef, user);
StringBuilder sb = new StringBuilder(100); StringBuilder sb = new StringBuilder(100);
for (Role role : roles) 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_DELETE_OBJECT = "rm.audit.delte-object";
private static final String MSG_LOGIN_SUCCEEDED = "rm.audit.login-succeeded"; 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_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_REVIEWED = "rm.audit.reviewed";
private static final String MSG_CUT_OFF = "rm.audit.cut-off"; 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_REVERSED_CUT_OFF = "rm.audit.reversed-cut-off";
private static final String MSG_DESTROYED_ITEM = "rm.audit.destroyed-item"; 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_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_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_DECLARED_RECORD = "rm.audit.declared-record";
private static final String MSG_UNDECLARED_RECORD = "rm.audit.undeclared-record"; private static final String MSG_UNDECLARED_RECORD = "rm.audit.undeclared-record";
private static final String MSG_FROZE_ITEM = "rm.audit.froze-item"; 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 fromTime = (params.getDateFrom() == null ? null : new Long(params.getDateFrom().getTime()));
Long toTime = (params.getDateTo() == null ? null : new Long(params.getDateTo().getTime())); Long toTime = (params.getDateTo() == null ? null : new Long(params.getDateTo().getTime()));
NodeRef nodeRef = params.getNodeRef(); NodeRef nodeRef = params.getNodeRef();
String eventName = params.getEvent();
QName propertyQName = params.getProperty();
int maxEntries = params.getMaxEntries(); int maxEntries = params.getMaxEntries();
boolean forward = maxEntries > 0 ? false : true; // Reverse order if the results are limited 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 * RM After Invocation Provider
*/ */
@SuppressWarnings("unused")
public class RMAfterInvocationProvider extends RMSecurityCommon public class RMAfterInvocationProvider extends RMSecurityCommon
implements AfterInvocationProvider, InitializingBean implements AfterInvocationProvider, InitializingBean
{ {

View File

@@ -42,7 +42,7 @@ public class ClosedCapabilityCondition extends AbstractCapabilityCondition
{ {
result = rmService.isRecordFolderClosed(nodeRef); 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); List<ChildAssociationRef> assocs = nodeService.getParentAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef assoc : assocs) for (ChildAssociationRef assoc : assocs)

View File

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

View File

@@ -32,7 +32,7 @@ public class VitalRecordOrFolderCapabilityCondition extends AbstractCapabilityCo
{ {
boolean result = false; boolean result = false;
if (rmService.isRecord(nodeRef) == true) if (recordService.isRecord(nodeRef) == true)
{ {
// Check the record for the vital record aspect // Check the record for the vital record aspect
result = nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_VITAL_RECORD); 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.InputStream;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@@ -511,7 +510,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
if (! (AuthenticationUtil.isMtEnabled() && AuthenticationUtil.isRunAsUserTheSystemUser())) if (! (AuthenticationUtil.isMtEnabled() && AuthenticationUtil.isRunAsUserTheSystemUser()))
{ {
// note: userName and userGroupNames must not be null // 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); Set<String> userGroupFullNames = authorityService.getAuthoritiesForUser(userName);
allowedValues = getRMAllowedValues(userName, userGroupFullNames, constraintName); allowedValues = getRMAllowedValues(userName, userGroupFullNames, constraintName);
} }

View File

@@ -15,15 +15,14 @@ import java.util.Map.Entry;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService; 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.capability.RMPermissionModel;
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; 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.disposition.DispositionService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; 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.model.behaviour.RecordsManagementSearchBehaviour;
import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderServiceImpl; 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.role.FilePlanRoleService;
import org.alfresco.module.org_alfresco_module_rm.security.Role; import org.alfresco.module.org_alfresco_module_rm.role.Role;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
@@ -67,17 +66,14 @@ public class DataSetServiceImpl implements DataSetService, RecordsManagementMode
/** Records management service */ /** Records management service */
private RecordsManagementService recordsManagementService; private RecordsManagementService recordsManagementService;
/** Records management action service */
private RecordsManagementActionService recordsManagementActionService;
/** Permission service */ /** Permission service */
private PermissionService permissionService; private PermissionService permissionService;
/** Authority service */ /** Authority service */
private AuthorityService authorityService; private AuthorityService authorityService;
/** Records management security service */ /** File plan role service */
private RecordsManagementSecurityService recordsManagementSecurityService; private FilePlanRoleService filePlanRoleService;
/** Records management search behaviour */ /** Records management search behaviour */
private RecordsManagementSearchBehaviour recordsManagementSearchBehaviour; private RecordsManagementSearchBehaviour recordsManagementSearchBehaviour;
@@ -137,17 +133,6 @@ public class DataSetServiceImpl implements DataSetService, RecordsManagementMode
this.recordsManagementService = recordsManagementService; 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 * Set permission service
* *
@@ -169,14 +154,11 @@ public class DataSetServiceImpl implements DataSetService, RecordsManagementMode
} }
/** /**
* Set records management security service * @param filePlanRoleService file plan role service
*
* @param recordsManagementSecurityService the records management security
* 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); "All Roles", null);
// Put all the role groups in it // Put all the role groups in it
Set<Role> roles = recordsManagementSecurityService.getRoles(rmRoot); Set<Role> roles = filePlanRoleService.getRoles(rmRoot);
for (Role role : roles) for (Role role : roles)
{ {
logger.info(" - adding role group " + role.getRoleGroupName() + " to all roles group"); 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.DispositionAction;
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; 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.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
import org.alfresco.repo.policy.JavaBehaviour; import org.alfresco.repo.policy.JavaBehaviour;
import org.alfresco.repo.policy.PolicyComponent; import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.repo.policy.Behaviour.NotificationFrequency; import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
@@ -44,7 +45,7 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.service.namespace.RegexQNamePattern;
/** /**
* * Behaviour executed when a references record is actioned upon.
* *
* @author Roy Wetherall * @author Roy Wetherall
*/ */
@@ -70,6 +71,9 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent
/** Policy component */ /** Policy component */
private PolicyComponent policyComponent; private PolicyComponent policyComponent;
/** Record service */
private RecordService recordService;
/** Action name */ /** Action name */
private String actionName; private String actionName;
@@ -100,19 +104,31 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent
this.recordsManagementActionService = recordsManagementActionService; this.recordsManagementActionService = recordsManagementActionService;
} }
/**
* @param recordsManagementAdminService record management admin service
*/
public void setRecordsManagementAdminService(RecordsManagementAdminService recordsManagementAdminService) public void setRecordsManagementAdminService(RecordsManagementAdminService recordsManagementAdminService)
{ {
this.recordsManagementAdminService = recordsManagementAdminService; this.recordsManagementAdminService = recordsManagementAdminService;
} }
/**
* @param nodeService node service
*/
public void setNodeService(NodeService nodeService) public void setNodeService(NodeService nodeService)
{ {
this.nodeService = nodeService; this.nodeService = nodeService;
} }
/** /**
* Set policy components * @param recordService record service
* */
public void setRecordService(RecordService recordService)
{
this.recordService = recordService;
}
/**
* @param policyComponent policy component * @param policyComponent policy component
*/ */
public void setPolicyComponent(PolicyComponent policyComponent) public void setPolicyComponent(PolicyComponent policyComponent)
@@ -121,15 +137,16 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent
} }
/** /**
* Set the reference * @param reference reference name
*
* @param reference
*/ */
public void setReferenceName(String reference) public void setReferenceName(String reference)
{ {
this.reference = QName.createQName(reference); this.reference = QName.createQName(reference);
} }
/**
* @param actionName action name
*/
public void setActionName(String actionName) public void setActionName(String actionName)
{ {
this.actionName = actionName; this.actionName = actionName;
@@ -157,6 +174,13 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent
return true; 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) public void beforeActionExecution(final NodeRef nodeRef, final String name, final Map<String, Serializable> parameters)
{ {
AuthenticationUtil.RunAsWork<Object> work = new AuthenticationUtil.RunAsWork<Object>() AuthenticationUtil.RunAsWork<Object> work = new AuthenticationUtil.RunAsWork<Object>()
@@ -193,7 +217,7 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent
private void processRecordFolder(NodeRef recordFolder) private void processRecordFolder(NodeRef recordFolder)
{ {
if (recordsManagementService.isRecord(recordFolder) == true) if (recordService.isRecord(recordFolder) == true)
{ {
processRecord(recordFolder); processRecord(recordFolder);
} }

View File

@@ -20,7 +20,6 @@ package org.alfresco.module.org_alfresco_module_rm.event;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -45,6 +44,7 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent
{ {
/** Reference to the rm event config node */ /** Reference to the rm event config node */
private static final StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); 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"); private static final NodeRef CONFIG_NODE_REF = new NodeRef(SPACES_STORE, "rm_event_config");
/** Node service */ /** Node service */
@@ -108,10 +108,8 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent
*/ */
public RecordsManagementEvent getEvent(String eventName) public RecordsManagementEvent getEvent(String eventName)
{ {
if (getEventMap().containsKey(eventName) == false) if (getEventMap().containsKey(eventName) == false) { throw new AlfrescoRuntimeException("The event "
{ + eventName + " does not exist."); }
throw new AlfrescoRuntimeException("The event " + eventName + " does not exist.");
}
return getEventMap().get(eventName); return getEventMap().get(eventName);
} }
@@ -126,34 +124,24 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#existsEventDisplayLabel(java.lang.String) * @see org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService#existsEventDisplayLabel(java.lang.String)
*/ */
@SuppressWarnings("rawtypes")
public boolean existsEventDisplayLabel(String eventDisplayLabel) public boolean existsEventDisplayLabel(String eventDisplayLabel)
{ {
for (Iterator iterator = getEventMap().values().iterator(); iterator.hasNext();) for (RecordsManagementEvent recordsManagementEvent : getEventMap().values())
{ {
RecordsManagementEvent recordsManagementEvent = (RecordsManagementEvent) iterator.next(); if (recordsManagementEvent.getDisplayLabel().equalsIgnoreCase(eventDisplayLabel)) { return true; }
if (recordsManagementEvent.getDisplayLabel().equalsIgnoreCase(eventDisplayLabel))
{
return true;
}
} }
return false; 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#addEvent(java.lang.String,
* java.lang.String, java.lang.String)
*/ */
public RecordsManagementEvent addEvent(String eventType, String eventName, String eventDisplayLabel) public RecordsManagementEvent addEvent(String eventType, String eventName, String eventDisplayLabel)
{ {
// Check that the eventType is valid // Check that the eventType is valid
if (eventTypes.containsKey(eventType) == false) if (eventTypes.containsKey(eventType) == false) { throw new AlfrescoRuntimeException(
{ "Can not add event because event " + eventName + " has an undefined eventType. (" + eventType + ")"); }
throw new AlfrescoRuntimeException(
"Can not add event because event " +
eventName +
" has an undefined eventType. ("
+ eventType + ")");
}
// Create event and add to map // Create event and add to map
RecordsManagementEvent event = new RecordsManagementEvent(eventType, eventName, eventDisplayLabel); RecordsManagementEvent event = new RecordsManagementEvent(eventType, eventName, eventDisplayLabel);
@@ -178,9 +166,11 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent
} }
/** /**
* 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() private Map<String, RecordsManagementEvent> getEventMap()
{ {
@@ -201,10 +191,8 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent
public Object doWork() throws Exception public Object doWork() throws Exception
{ {
// Get the event config node // Get the event config node
if (nodeService.exists(CONFIG_NODE_REF) == false) if (nodeService.exists(CONFIG_NODE_REF) == false) { throw new AlfrescoRuntimeException(
{ "Unable to find records management event configuration node."); }
throw new AlfrescoRuntimeException("Unable to find records management event configuration node.");
}
// Read content from config node // Read content from config node
ContentReader reader = contentService.getReader(CONFIG_NODE_REF, ContentModel.PROP_CONTENT); ContentReader reader = contentService.getReader(CONFIG_NODE_REF, ContentModel.PROP_CONTENT);
@@ -226,14 +214,9 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent
String eventDisplayLabel = eventJSON.getString("eventDisplayLabel"); String eventDisplayLabel = eventJSON.getString("eventDisplayLabel");
// Check that the eventType is valid // Check that the eventType is valid
if (eventTypes.containsKey(eventType) == false) if (eventTypes.containsKey(eventType) == false) { throw new AlfrescoRuntimeException(
{ "Can not load rm event configuration because event " + eventName
throw new AlfrescoRuntimeException( + " has an undefined eventType. (" + eventType + ")"); }
"Can not load rm event configuration because event " +
eventName +
" has an undefined eventType. ("
+ eventType + ")");
}
// Create event and add to map // Create event and add to map
RecordsManagementEvent event = new RecordsManagementEvent(eventType, eventName, eventDisplayLabel); RecordsManagementEvent event = new RecordsManagementEvent(eventType, eventName, eventDisplayLabel);
@@ -255,10 +238,8 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent
public Object doWork() throws Exception public Object doWork() throws Exception
{ {
// Get the event config node // Get the event config node
if (nodeService.exists(CONFIG_NODE_REF) == false) if (nodeService.exists(CONFIG_NODE_REF) == false) { throw new AlfrescoRuntimeException(
{ "Unable to find records management event configuration node."); }
throw new AlfrescoRuntimeException("Unable to find records management event configuration node.");
}
JSONObject configJSON = new JSONObject(); JSONObject configJSON = new JSONObject();
JSONArray eventsJSON = new JSONArray(); JSONArray eventsJSON = new JSONArray();
@@ -277,7 +258,8 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent
configJSON.put("events", eventsJSON); configJSON.put("events", eventsJSON);
// Get content writer // 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()); contentWriter.putContent(configJSON.toString());
return null; return null;
@@ -294,5 +276,3 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent
return this.eventTypes.get(eventTypeName); return this.eventTypes.get(eventTypeName);
} }
} }

View File

@@ -213,7 +213,7 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
protected void addTransientProperties(Form form, NodeRef nodeRef) 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)); addTransientPropertyField(form, TRANSIENT_DECLARED, DataTypeDefinition.BOOLEAN, recordService.isDeclared(nodeRef));
} }

View File

@@ -30,10 +30,11 @@ import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService; 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.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
import org.alfresco.repo.node.NodeServicePolicies; import org.alfresco.repo.node.NodeServicePolicies;
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
import org.alfresco.repo.policy.JavaBehaviour; import org.alfresco.repo.policy.JavaBehaviour;
import org.alfresco.repo.policy.PolicyComponent; import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.security.permissions.AccessDeniedException; import org.alfresco.repo.security.permissions.AccessDeniedException;
@@ -55,6 +56,8 @@ import org.springframework.extensions.surf.util.I18NUtil;
* Freeze Service Implementation * Freeze Service Implementation
* *
* @author Roy Wetherall * @author Roy Wetherall
* @author Tuna Askoy
* @since 2.1
*/ */
public class FreezeServiceImpl implements FreezeService, public class FreezeServiceImpl implements FreezeService,
RecordsManagementModel, RecordsManagementModel,
@@ -81,6 +84,9 @@ public class FreezeServiceImpl implements FreezeService,
/** Dictionary Service */ /** Dictionary Service */
private DictionaryService dictionaryService; private DictionaryService dictionaryService;
/** Record service */
private RecordService recordService;
/** /**
* @param policyComponent policy component * @param policyComponent policy component
*/ */
@@ -113,15 +119,21 @@ public class FreezeServiceImpl implements FreezeService,
this.dictionaryService = dictionaryService; this.dictionaryService = dictionaryService;
} }
/**
* @param recordService record service
*/
public void setRecordService(RecordService recordService)
{
this.recordService = recordService;
}
/** /**
* Init service * Init service
*/ */
public void init() public void init()
{ {
policyComponent.bindClassBehaviour( policyComponent.bindClassBehaviour(NodeServicePolicies.BeforeDeleteNodePolicy.QNAME, this, new JavaBehaviour(
NodeServicePolicies.BeforeDeleteNodePolicy.QNAME, this, "beforeDeleteNode", NotificationFrequency.FIRST_EVENT));
this,
new JavaBehaviour(this, "beforeDeleteNode", NotificationFrequency.FIRST_EVENT));
} }
/** /**
@@ -130,13 +142,14 @@ public class FreezeServiceImpl implements FreezeService,
@Override @Override
public void beforeDeleteNode(final NodeRef nodeRef) public void beforeDeleteNode(final NodeRef nodeRef)
{ {
AuthenticationUtil.runAsSystem(new RunAsWork<Void>(){ AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
{
@Override @Override
public Void doWork() throws Exception public Void doWork() throws Exception
{ {
if (nodeService.exists(nodeRef) == true && if (nodeService.exists(nodeRef) == true
recordsManagementService.isFilePlanComponent(nodeRef) == true) && recordsManagementService.isFilePlanComponent(nodeRef) == true)
{ {
if (isFrozen(nodeRef) == true) if (isFrozen(nodeRef) == true)
{ {
@@ -153,7 +166,8 @@ public class FreezeServiceImpl implements FreezeService,
} }
/** /**
* Checks the children for frozen nodes. Throws security error if any are found. * Checks the children for frozen nodes. Throws security error if any are
* found.
* *
* @param assocs * @param assocs
*/ */
@@ -216,7 +230,8 @@ public class FreezeServiceImpl implements FreezeService,
ParameterCheck.mandatory("hold", hold); ParameterCheck.mandatory("hold", hold);
Set<NodeRef> frozenNodes = new HashSet<NodeRef>(); Set<NodeRef> frozenNodes = new HashSet<NodeRef>();
List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(hold, ASSOC_FROZEN_RECORDS, RegexQNamePattern.MATCH_ALL); List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(hold, ASSOC_FROZEN_RECORDS,
RegexQNamePattern.MATCH_ALL);
if (childAssocs != null && !childAssocs.isEmpty()) if (childAssocs != null && !childAssocs.isEmpty())
{ {
for (ChildAssociationRef childAssociationRef : childAssocs) for (ChildAssociationRef childAssociationRef : childAssocs)
@@ -228,7 +243,8 @@ public class FreezeServiceImpl implements FreezeService,
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#freeze(java.lang.String, org.alfresco.service.cmr.repository.NodeRef) * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#freeze(java.lang.String,
* org.alfresco.service.cmr.repository.NodeRef)
*/ */
@Override @Override
public NodeRef freeze(String reason, NodeRef nodeRef) public NodeRef freeze(String reason, NodeRef nodeRef)
@@ -236,15 +252,14 @@ public class FreezeServiceImpl implements FreezeService,
ParameterCheck.mandatoryString("reason", reason); ParameterCheck.mandatoryString("reason", reason);
ParameterCheck.mandatory("nodeRef", nodeRef); ParameterCheck.mandatory("nodeRef", nodeRef);
// FIXME: Should we consider only records and record folders or 'any' node references // FIXME: Should we consider only records and record folders or 'any'
// node references
// Check if the actionedUponNodeRef is a valid file plan component // Check if the actionedUponNodeRef is a valid file plan component
boolean isRecord = recordsManagementService.isRecord(nodeRef); boolean isRecord = recordService.isRecord(nodeRef);
boolean isFolder = recordsManagementService.isRecordFolder(nodeRef); boolean isFolder = recordsManagementService.isRecordFolder(nodeRef);
if (!(isRecord || isFolder)) if (!(isRecord || isFolder)) { throw new AlfrescoRuntimeException(I18NUtil
{ .getMessage(MSG_FREEZE_ONLY_RECORDS_FOLDERS)); }
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_FREEZE_ONLY_RECORDS_FOLDERS));
}
// Log a message about freezing the node with the reason // Log a message about freezing the node with the reason
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
@@ -269,7 +284,8 @@ public class FreezeServiceImpl implements FreezeService,
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#freeze(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#freeze(org.alfresco.service.cmr.repository.NodeRef,
* org.alfresco.service.cmr.repository.NodeRef)
*/ */
@Override @Override
public void freeze(NodeRef hold, NodeRef nodeRef) public void freeze(NodeRef hold, NodeRef nodeRef)
@@ -313,7 +329,8 @@ public class FreezeServiceImpl implements FreezeService,
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#freeze(java.lang.String, java.util.Set) * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#freeze(java.lang.String,
* java.util.Set)
*/ */
@Override @Override
public NodeRef freeze(String reason, Set<NodeRef> nodeRefs) public NodeRef freeze(String reason, Set<NodeRef> nodeRefs)
@@ -331,7 +348,8 @@ public class FreezeServiceImpl implements FreezeService,
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#freeze(org.alfresco.service.cmr.repository.NodeRef, java.util.Set) * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#freeze(org.alfresco.service.cmr.repository.NodeRef,
* java.util.Set)
*/ */
@Override @Override
public void freeze(NodeRef hold, Set<NodeRef> nodeRefs) public void freeze(NodeRef hold, Set<NodeRef> nodeRefs)
@@ -412,28 +430,29 @@ public class FreezeServiceImpl implements FreezeService,
{ {
ParameterCheck.mandatory("hold", hold); ParameterCheck.mandatory("hold", hold);
List<ChildAssociationRef> frozenNodeAssocs = nodeService.getChildAssocs(hold, ASSOC_FROZEN_RECORDS, RegexQNamePattern.MATCH_ALL); List<ChildAssociationRef> frozenNodeAssocs = nodeService.getChildAssocs(hold, ASSOC_FROZEN_RECORDS,
RegexQNamePattern.MATCH_ALL);
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
StringBuilder msg = new StringBuilder(); StringBuilder msg = new StringBuilder();
msg.append("Relinquishing hold '").append(hold) msg.append("Relinquishing hold '").append(hold).append("' which has '").append(frozenNodeAssocs.size())
.append("' which has '").append(frozenNodeAssocs.size()).append("' frozen node(s)."); .append("' frozen node(s).");
logger.debug(msg.toString()); logger.debug(msg.toString());
} }
for (ChildAssociationRef assoc : frozenNodeAssocs) for (ChildAssociationRef assoc : frozenNodeAssocs)
{ {
// Remove the freeze if this is the only hold that references the node // Remove the freeze if this is the only hold that references the
// node
removeFreeze(assoc.getChildRef(), hold); removeFreeze(assoc.getChildRef(), hold);
} }
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
StringBuilder msg = new StringBuilder(); StringBuilder msg = new StringBuilder();
msg.append("Deleting hold object '").append(hold) msg.append("Deleting hold object '").append(hold).append("' with name '").append(
.append("' with name '").append(nodeService.getProperty(hold, ContentModel.PROP_NAME)) nodeService.getProperty(hold, ContentModel.PROP_NAME)).append("'.");
.append("'.");
logger.debug(msg.toString()); logger.debug(msg.toString());
} }
@@ -453,7 +472,8 @@ public class FreezeServiceImpl implements FreezeService,
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#updateReason(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) * @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#updateReason(org.alfresco.service.cmr.repository.NodeRef,
* java.lang.String)
*/ */
@Override @Override
public void updateReason(NodeRef hold, String reason) public void updateReason(NodeRef hold, String reason)
@@ -474,7 +494,8 @@ public class FreezeServiceImpl implements FreezeService,
Set<NodeRef> holds = new HashSet<NodeRef>(); Set<NodeRef> holds = new HashSet<NodeRef>();
List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(filePlan, ASSOC_HOLDS, RegexQNamePattern.MATCH_ALL); List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(filePlan, ASSOC_HOLDS,
RegexQNamePattern.MATCH_ALL);
if (childAssocs != null && !childAssocs.isEmpty()) if (childAssocs != null && !childAssocs.isEmpty())
{ {
for (ChildAssociationRef childAssoc : childAssocs) for (ChildAssociationRef childAssoc : childAssocs)
@@ -494,15 +515,13 @@ public class FreezeServiceImpl implements FreezeService,
{ {
ParameterCheck.mandatory("nodeRef", nodeRef); ParameterCheck.mandatory("nodeRef", nodeRef);
List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(nodeRef, ContentModel.ASSOC_CONTAINS,
RegexQNamePattern.MATCH_ALL);
if (childAssocs != null && !childAssocs.isEmpty()) if (childAssocs != null && !childAssocs.isEmpty())
{ {
for (ChildAssociationRef childAssociationRef : childAssocs) for (ChildAssociationRef childAssociationRef : childAssocs)
{ {
if (isFrozen(childAssociationRef.getChildRef())) if (isFrozen(childAssociationRef.getChildRef())) { return true; }
{
return true;
}
} }
} }
@@ -520,10 +539,7 @@ public class FreezeServiceImpl implements FreezeService,
if (isFrozen(nodeRef)) if (isFrozen(nodeRef))
{ {
Serializable property = nodeService.getProperty(nodeRef, PROP_FROZEN_AT); Serializable property = nodeService.getProperty(nodeRef, PROP_FROZEN_AT);
if (property != null) if (property != null) { return (Date) property; }
{
return (Date) property;
}
} }
return null; return null;
@@ -540,10 +556,7 @@ public class FreezeServiceImpl implements FreezeService,
if (isFrozen(nodeRef)) if (isFrozen(nodeRef))
{ {
Serializable property = nodeService.getProperty(nodeRef, PROP_FROZEN_BY); Serializable property = nodeService.getProperty(nodeRef, PROP_FROZEN_BY);
if (property != null) if (property != null) { return (String) property; }
{
return (String) property;
}
} }
return null; return null;
@@ -582,9 +595,8 @@ public class FreezeServiceImpl implements FreezeService,
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
StringBuilder msg = new StringBuilder(); StringBuilder msg = new StringBuilder();
msg.append("Created hold object '").append(holdNodeRef) msg.append("Created hold object '").append(holdNodeRef).append("' with transfer name '").append(
.append("' with transfer name '").append(transferQName) transferQName).append("'.");
.append("'.");
logger.debug(msg.toString()); logger.debug(msg.toString());
} }
@@ -595,21 +607,23 @@ public class FreezeServiceImpl implements FreezeService,
} }
/** /**
* Removes a freeze from a node. The unfrozen node is automatically removed from the hold(s) it is in. * Removes a freeze from a node. The unfrozen node is automatically removed
* If the hold is subsequently empty, the hold is automatically deleted. * from the hold(s) it is in. If the hold is subsequently empty, the hold is
* automatically deleted.
* *
* @param nodeRef node reference * @param nodeRef node reference
*/ */
private void removeFreeze(NodeRef nodeRef) private void removeFreeze(NodeRef nodeRef)
{ {
// Get all the holds and remove this node from them // Get all the holds and remove this node from them
List<ChildAssociationRef> assocs = nodeService.getParentAssocs(nodeRef, ASSOC_FROZEN_RECORDS, RegexQNamePattern.MATCH_ALL); List<ChildAssociationRef> assocs = nodeService.getParentAssocs(nodeRef, ASSOC_FROZEN_RECORDS,
RegexQNamePattern.MATCH_ALL);
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
StringBuilder msg = new StringBuilder(); StringBuilder msg = new StringBuilder();
msg.append("Removing freeze from node '").append(nodeRef) msg.append("Removing freeze from node '").append(nodeRef).append("' which has '").append(assocs.size())
.append("' which has '").append(assocs.size()).append("' holds."); .append("' holds.");
logger.debug(msg.toString()); logger.debug(msg.toString());
} }
@@ -622,21 +636,22 @@ public class FreezeServiceImpl implements FreezeService,
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
StringBuilder msg = new StringBuilder(); StringBuilder msg = new StringBuilder();
msg.append("Removed frozen node '").append(nodeRef) msg.append("Removed frozen node '").append(nodeRef).append("' from hold '").append(holdNodeRef).append(
.append("' from hold '").append(holdNodeRef).append("'."); "'.");
logger.debug(msg.toString()); logger.debug(msg.toString());
} }
// Check to see if we should delete the hold // Check to see if we should delete the hold
List<ChildAssociationRef> holdAssocs = nodeService.getChildAssocs(holdNodeRef, ASSOC_FROZEN_RECORDS, RegexQNamePattern.MATCH_ALL); List<ChildAssociationRef> holdAssocs = nodeService.getChildAssocs(holdNodeRef, ASSOC_FROZEN_RECORDS,
RegexQNamePattern.MATCH_ALL);
if (holdAssocs != null && holdAssocs.isEmpty()) if (holdAssocs != null && holdAssocs.isEmpty())
{ {
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
StringBuilder msg = new StringBuilder(); StringBuilder msg = new StringBuilder();
msg.append("Hold node '").append(holdNodeRef) msg.append("Hold node '").append(holdNodeRef).append("' with name '").append(
.append("' with name '").append(nodeService.getProperty(holdNodeRef, ContentModel.PROP_NAME)) nodeService.getProperty(holdNodeRef, ContentModel.PROP_NAME)).append(
.append("' has no frozen nodes. Hence deleting it."); "' has no frozen nodes. Hence deleting it.");
logger.debug(msg.toString()); logger.debug(msg.toString());
} }
@@ -664,20 +679,26 @@ public class FreezeServiceImpl implements FreezeService,
*/ */
private void removeFreeze(NodeRef nodeRef, NodeRef hold) private void removeFreeze(NodeRef nodeRef, NodeRef hold)
{ {
// We should only remove the frozen aspect if there are no other 'holds' in effect for this node. // We should only remove the frozen aspect if there are no other 'holds'
// One complication to consider is that holds can be placed on records or on folders. // in effect for this node.
// Therefore if the nodeRef here is a record, we need to go up the containment hierarchy looking // One complication to consider is that holds can be placed on records
// or on folders.
// Therefore if the nodeRef here is a record, we need to go up the
// containment hierarchy looking
// for holds at each level. // for holds at each level.
// Get all the holds and remove this node from them. // Get all the holds and remove this node from them.
List<ChildAssociationRef> parentAssocs = nodeService.getParentAssocs(nodeRef, ASSOC_FROZEN_RECORDS, RegexQNamePattern.MATCH_ALL); List<ChildAssociationRef> parentAssocs = nodeService.getParentAssocs(nodeRef, ASSOC_FROZEN_RECORDS,
// If the nodeRef is a record, there could also be applicable holds as parents of the folder(s). RegexQNamePattern.MATCH_ALL);
if (recordsManagementService.isRecord(nodeRef)) // If the nodeRef is a record, there could also be applicable holds as
// parents of the folder(s).
if (recordService.isRecord(nodeRef))
{ {
List<NodeRef> parentFolders = recordsManagementService.getRecordFolders(nodeRef); List<NodeRef> parentFolders = recordsManagementService.getRecordFolders(nodeRef);
for (NodeRef folder : parentFolders) for (NodeRef folder : parentFolders)
{ {
List<ChildAssociationRef> moreAssocs = nodeService.getParentAssocs(folder, ASSOC_FROZEN_RECORDS, RegexQNamePattern.MATCH_ALL); List<ChildAssociationRef> moreAssocs = nodeService.getParentAssocs(folder, ASSOC_FROZEN_RECORDS,
RegexQNamePattern.MATCH_ALL);
parentAssocs.addAll(moreAssocs); parentAssocs.addAll(moreAssocs);
} }
} }
@@ -685,8 +706,8 @@ public class FreezeServiceImpl implements FreezeService,
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
StringBuilder msg = new StringBuilder(); StringBuilder msg = new StringBuilder();
msg.append("Removing freeze from ").append(nodeRef).append(" which has ") msg.append("Removing freeze from ").append(nodeRef).append(" which has ").append(parentAssocs.size())
.append(parentAssocs.size()).append(" holds"); .append(" holds");
logger.debug(msg.toString()); logger.debug(msg.toString());
} }
@@ -713,7 +734,8 @@ public class FreezeServiceImpl implements FreezeService,
nodeService.removeAspect(nodeRef, ASPECT_FROZEN); nodeService.removeAspect(nodeRef, ASPECT_FROZEN);
} }
// Remove the freezes on the child records as long as there is no other hold referencing them // Remove the freezes on the child records as long as there is no other
// hold referencing them
if (recordsManagementService.isRecordFolder(nodeRef) == true) if (recordsManagementService.isRecordFolder(nodeRef) == true)
{ {
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())

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.RecordsManagementServiceRegistry;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; 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.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.BaseScopableProcessorExtension;
import org.alfresco.repo.jscript.ScriptNode; import org.alfresco.repo.jscript.ScriptNode;
import org.alfresco.scripts.ScriptException; import org.alfresco.scripts.ScriptException;
@@ -93,8 +93,8 @@ public class ScriptRecordsManagmentService extends BaseScopableProcessorExtensio
*/ */
public void setPermission(ScriptNode node, String permission, String authority) public void setPermission(ScriptNode node, String permission, String authority)
{ {
RecordsManagementSecurityService securityService = rmServices.getRecordsManagementSecurityService(); FilePlanPermissionService filePlanPermissionService = rmServices.getFilePlanPermissionService();
securityService.setPermission(node.getNodeRef(), authority, permission); filePlanPermissionService.setPermission(node.getNodeRef(), authority, permission);
} }
/** /**
@@ -106,8 +106,8 @@ public class ScriptRecordsManagmentService extends BaseScopableProcessorExtensio
*/ */
public void deletePermission(ScriptNode node, String permission, String authority) public void deletePermission(ScriptNode node, String permission, String authority)
{ {
RecordsManagementSecurityService securityService = rmServices.getRecordsManagementSecurityService(); FilePlanPermissionService filePlanPermissionService = rmServices.getFilePlanPermissionService();
securityService.deletePermission(node.getNodeRef(), authority, permission); 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; package org.alfresco.module.org_alfresco_module_rm.model.behaviour;
import org.alfresco.model.ContentModel; 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.identifier.IdentifierService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.repo.node.NodeServicePolicies; import org.alfresco.repo.node.NodeServicePolicies;
@@ -47,9 +46,6 @@ public class RecordContainerType implements RecordsManagementModel,
/** Policy component */ /** Policy component */
private PolicyComponent policyComponent; private PolicyComponent policyComponent;
/** Records Management Action Service */
private RecordsManagementActionService recordsManagementActionService;
/** Node service */ /** Node service */
private NodeService nodeService; private NodeService nodeService;
@@ -68,16 +64,6 @@ public class RecordContainerType implements RecordsManagementModel,
this.policyComponent = policyComponent; 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 * 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.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; 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.module.org_alfresco_module_rm.security.Role; import org.alfresco.module.org_alfresco_module_rm.role.Role;
import org.alfresco.repo.node.NodeServicePolicies; import org.alfresco.repo.node.NodeServicePolicies;
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
import org.alfresco.repo.policy.JavaBehaviour; import org.alfresco.repo.policy.JavaBehaviour;
import org.alfresco.repo.policy.PolicyComponent; import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
@@ -66,8 +66,8 @@ public class ModelSecurityServiceImpl implements ModelSecurityService,
/** Namespace service */ /** Namespace service */
private NamespaceService namespaceService; private NamespaceService namespaceService;
/** Security service */ /** File plan role service */
private RecordsManagementSecurityService securityService; private FilePlanRoleService filePlanRoleService;
/** Records management service */ /** Records management service */
private RecordsManagementService recordsManagementService; 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); NodeRef filePlan = recordsManagementService.getFilePlan(nodeRef);
if (filePlan != null) if (filePlan != null)
{ {
Set<Role> roles = securityService.getRolesByUser(filePlan, AuthenticationUtil.getFullyAuthenticatedUser()); Set<Role> roles = filePlanRoleService.getRolesByUser(filePlan, AuthenticationUtil.getFullyAuthenticatedUser());
for (Role role : roles) for (Role role : roles)
{ {
if (Collections.disjoint(role.getCapabilities(), artifact.getCapabilities()) == false) 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.error.AlfrescoRuntimeException;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService; 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.module.org_alfresco_module_rm.security.Role; import org.alfresco.module.org_alfresco_module_rm.role.Role;
import org.alfresco.repo.notification.EMailNotificationProvider; import org.alfresco.repo.notification.EMailNotificationProvider;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
@@ -70,7 +70,7 @@ public class RecordsManagementNotificationHelper
/** Services */ /** Services */
private NotificationService notificationService; private NotificationService notificationService;
private RecordsManagementService recordsManagementService; private RecordsManagementService recordsManagementService;
private RecordsManagementSecurityService securityService; private FilePlanRoleService filePlanRoleService;
private SearchService searchService; private SearchService searchService;
private NamespaceService namespaceService; private NamespaceService namespaceService;
private SiteService siteService; 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 public String doWork() throws Exception
{ {
// Find the authority for the given role // Find the authority for the given role
Role role = securityService.getRole(root, notificationRole); Role role = filePlanRoleService.getRole(root, notificationRole);
return role.getRoleGroupName(); return role.getRoleGroupName();
} }
}, AuthenticationUtil.getSystemUserName()); }, 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.capability.RMPermissionModel;
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; 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.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.role.FilePlanRoleServiceImpl;
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedReaderDynamicAuthority; 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.FilePlanPermissionService;
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityServiceImpl;
import org.alfresco.repo.module.AbstractModuleComponent; import org.alfresco.repo.module.AbstractModuleComponent;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
@@ -62,8 +62,11 @@ public class RMv21InPlacePatch extends AbstractModuleComponent
/** Records management service */ /** Records management service */
private RecordsManagementService recordsManagementService; private RecordsManagementService recordsManagementService;
/** Records management security service */ /** File plan permission service */
private RecordsManagementSecurityService recordsManagementSecurityService; private FilePlanPermissionService filePlanPermissionService;
/** File plan role service */
private FilePlanRoleService filePlanRoleService;
/** /**
* @param nodeService node service * @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 // 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); permissionService.setPermission(filePlan, ExtendedReaderDynamicAuthority.EXTENDED_READER, RMPermissionModel.VIEW_RECORDS, true);
// create unfiled container // create unfiled container
@@ -141,7 +152,7 @@ public class RMv21InPlacePatch extends AbstractModuleComponent
*/ */
private NodeRef createUnfiledContainer(NodeRef filePlan) private NodeRef createUnfiledContainer(NodeRef filePlan)
{ {
String allRoles = recordsManagementSecurityService.getAllRolesContainerGroup(filePlan); String allRoles = filePlanRoleService.getAllRolesContainerGroup(filePlan);
// create the properties map // create the properties map
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(1); 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.CustomMetadataException;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService; import org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; 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.alfresco.service.namespace.QName;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; 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 SOURCE = "source";
private static final String LABEL = "label"; private static final String LABEL = "label";
@SuppressWarnings("unused")
private static Log logger = LogFactory.getLog(CustomReferenceDefinitionPut.class); private static Log logger = LogFactory.getLog(CustomReferenceDefinitionPut.class);
private RecordsManagementAdminService rmAdminService; 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.module.org_alfresco_module_rm.RecordsManagementAdminService;
import org.alfresco.service.cmr.dictionary.AssociationDefinition; import org.alfresco.service.cmr.dictionary.AssociationDefinition;
import org.alfresco.service.cmr.dictionary.ChildAssociationDefinition; import org.alfresco.service.cmr.dictionary.ChildAssociationDefinition;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName; 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.Cache;
import org.springframework.extensions.webscripts.DeclarativeWebScript; import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status; import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptException; import org.springframework.extensions.webscripts.WebScriptException;
import org.springframework.extensions.webscripts.WebScriptRequest; 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. * 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 static Log logger = LogFactory.getLog(CustomReferenceDefinitionsGet.class);
private RecordsManagementAdminService rmAdminService; private RecordsManagementAdminService rmAdminService;
private NamespaceService namespaceService;
public void setNamespaceService(NamespaceService namespaceService)
{
this.namespaceService = namespaceService;
}
public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService)
{ {

View File

@@ -30,7 +30,7 @@ import javax.servlet.http.HttpServletResponse;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService; 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.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.exporter.ACPExportPackageHandler;
import org.alfresco.repo.importer.ACPImportPackageHandler; import org.alfresco.repo.importer.ACPImportPackageHandler;
import org.alfresco.repo.security.authentication.AuthenticationUtil; 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.ImporterService;
import org.alfresco.service.cmr.view.Location; import org.alfresco.service.cmr.view.Location;
import org.alfresco.util.TempFileProvider; 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.Cache;
import org.springframework.extensions.webscripts.DeclarativeWebScript; import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status; 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.WrappingWebScriptRequest;
import org.springframework.extensions.webscripts.servlet.WebScriptServletRequest; import org.springframework.extensions.webscripts.servlet.WebScriptServletRequest;
import org.springframework.extensions.webscripts.servlet.FormData.FormField; 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; import org.springframework.util.FileCopyUtils;
/** /**
@@ -72,7 +72,7 @@ public class ImportPost extends DeclarativeWebScript
protected DictionaryService dictionaryService; protected DictionaryService dictionaryService;
protected ImporterService importerService; protected ImporterService importerService;
protected RecordsManagementService rmService; protected RecordsManagementService rmService;
protected RecordsManagementSecurityService rmSecurityService; protected FilePlanRoleService filePlanRoleService;
/** /**
* @param nodeService * @param nodeService
@@ -103,13 +103,11 @@ public class ImportPost extends DeclarativeWebScript
} }
/** /**
* Sets the RecordsManagementSecurityService instance * @param filePlanRoleService file plan role service
*
* @param rmSecurityService The RecordsManagementSecurityService instance
*/ */
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 // 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) // 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. // 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), this.rmService.getFilePlan(destination),
AuthenticationUtil.getRunAsUser()); AuthenticationUtil.getRunAsUser());
if (!isAdmin) if (!isAdmin)

View File

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

View File

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

View File

@@ -23,15 +23,15 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService; 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.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.Cache;
import org.springframework.extensions.webscripts.DeclarativeWebScript; import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status; import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptException; import org.springframework.extensions.webscripts.WebScriptException;
import org.springframework.extensions.webscripts.WebScriptRequest; 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 static Log logger = LogFactory.getLog(RmRoleDelete.class);
private RecordsManagementService rmService; 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) public void setRecordsManagementService(RecordsManagementService rmService)
@@ -73,12 +73,12 @@ public class RmRoleDelete extends DeclarativeWebScript
NodeRef root = roots.get(0); NodeRef root = roots.get(0);
// Check that the role exists // 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); 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; return model;
} }

View File

@@ -23,15 +23,15 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService; 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.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.Cache;
import org.springframework.extensions.webscripts.DeclarativeWebScript; import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status; import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptException; import org.springframework.extensions.webscripts.WebScriptException;
import org.springframework.extensions.webscripts.WebScriptRequest; 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 static Log logger = LogFactory.getLog(RmRoleGet.class);
private RecordsManagementService rmService; 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) public void setRecordsManagementService(RecordsManagementService rmService)
@@ -75,12 +75,12 @@ public class RmRoleGet extends DeclarativeWebScript
NodeRef root = roots.get(0); NodeRef root = roots.get(0);
// Check that the role exists // 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); 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; 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.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.capability.Capability; 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.capability.CapabilityService;
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService; import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
import org.alfresco.module.org_alfresco_module_rm.security.Role; import org.alfresco.module.org_alfresco_module_rm.role.Role;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@@ -54,12 +54,12 @@ public class RmRolePut extends DeclarativeWebScript
private static Log logger = LogFactory.getLog(RmRolePut.class); private static Log logger = LogFactory.getLog(RmRolePut.class);
private RecordsManagementService rmService; private RecordsManagementService rmService;
private RecordsManagementSecurityService rmSecurityService;
private CapabilityService capabilityService; 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) public void setRecordsManagementService(RecordsManagementService rmService)
@@ -105,12 +105,12 @@ public class RmRolePut extends DeclarativeWebScript
NodeRef root = roots.get(0); NodeRef root = roots.get(0);
// Check that the role exists // 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); 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); model.put("role", role);
} }

View File

@@ -25,15 +25,15 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService; 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.module.org_alfresco_module_rm.security.Role; import org.alfresco.module.org_alfresco_module_rm.role.Role;
import org.alfresco.service.cmr.repository.NodeRef; 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.Cache;
import org.springframework.extensions.webscripts.DeclarativeWebScript; import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status; import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptRequest; import org.springframework.extensions.webscripts.WebScriptRequest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** /**
* Get information about record management roles * Get information about record management roles
@@ -46,11 +46,12 @@ public class RmRolesGet extends DeclarativeWebScript
private static Log logger = LogFactory.getLog(RmRolesGet.class); private static Log logger = LogFactory.getLog(RmRolesGet.class);
private RecordsManagementService rmService; private RecordsManagementService rmService;
private RecordsManagementSecurityService rmSecurityService;
public void setRecordsManagementSecurityService(RecordsManagementSecurityService rmSecurityService) private FilePlanRoleService filePlanRoleService;
public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService)
{ {
this.rmSecurityService = rmSecurityService; this.filePlanRoleService = filePlanRoleService;
} }
public void setRecordsManagementService(RecordsManagementService rmService) public void setRecordsManagementService(RecordsManagementService rmService)
@@ -74,11 +75,11 @@ public class RmRolesGet extends DeclarativeWebScript
String user = req.getParameter("user"); String user = req.getParameter("user");
if (user != null && user.length() != 0) if (user != null && user.length() != 0)
{ {
roles = rmSecurityService.getRolesByUser(root, user); roles = filePlanRoleService.getRolesByUser(root, user);
} }
else else
{ {
roles = rmSecurityService.getRoles(root); roles = filePlanRoleService.getRoles(root);
} }
} }
else else

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

View File

@@ -85,7 +85,7 @@ public class CompositeCapabilityTest extends BaseRMTestCase
// Give all the users file permission objects // Give all the users file permission objects
for (String user : testUsers) for (String user : testUsers)
{ {
securityService.setPermission(rmContainer, user, RMPermissionModel.FILING); filePlanPermissionService.setPermission(rmContainer, user, RMPermissionModel.FILING);
} }
} }

View File

@@ -32,7 +32,7 @@ import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
import org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition; import org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition;
import org.alfresco.module.org_alfresco_module_rm.capability.declarative.CompositeCapability; import org.alfresco.module.org_alfresco_module_rm.capability.declarative.CompositeCapability;
import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability; import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability;
import org.alfresco.module.org_alfresco_module_rm.security.Role; import org.alfresco.module.org_alfresco_module_rm.role.Role;
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
@@ -134,9 +134,9 @@ public class DeclarativeCapabilityTest extends BaseRMTestCase
// Give all the users file permission objects // Give all the users file permission objects
for (String user : testUsers) for (String user : testUsers)
{ {
securityService.setPermission(rmFolder, user, RMPermissionModel.FILING); filePlanPermissionService.setPermission(rmFolder, user, RMPermissionModel.FILING);
securityService.setPermission(moveToFolder, user, RMPermissionModel.READ_RECORDS); filePlanPermissionService.setPermission(moveToFolder, user, RMPermissionModel.READ_RECORDS);
securityService.setPermission(moveToCategory, user, RMPermissionModel.READ_RECORDS); filePlanPermissionService.setPermission(moveToCategory, user, RMPermissionModel.READ_RECORDS);
} }
} }
@@ -177,7 +177,7 @@ public class DeclarativeCapabilityTest extends BaseRMTestCase
{ {
AccessStatus accessStatus = capability.hasPermission(filePlanComponent); AccessStatus accessStatus = capability.hasPermission(filePlanComponent);
Set<Role> roles = securityService.getRolesByUser(filePlan, userName); Set<Role> roles = filePlanRoleService.getRolesByUser(filePlan, userName);
if (roles.isEmpty() == true) if (roles.isEmpty() == true)
{ {
assertEquals("User " + userName + " has no RM role so we expect access to be denied for capability " + capability.getName(), assertEquals("User " + userName + " has no RM role so we expect access to be denied for capability " + capability.getName(),
@@ -339,7 +339,7 @@ public class DeclarativeCapabilityTest extends BaseRMTestCase
{ {
for (String user : testUsers) for (String user : testUsers)
{ {
securityService.setPermission(moveToFolder, user, RMPermissionModel.FILING); filePlanPermissionService.setPermission(moveToFolder, user, RMPermissionModel.FILING);
} }
return null; return null;
} }
@@ -435,7 +435,7 @@ public class DeclarativeCapabilityTest extends BaseRMTestCase
{ {
for (String user : testUsers) for (String user : testUsers)
{ {
securityService.setPermission(moveToCategory, user, RMPermissionModel.FILING); filePlanPermissionService.setPermission(moveToCategory, user, RMPermissionModel.FILING);
} }
return null; return null;
} }

View File

@@ -18,11 +18,8 @@
*/ */
package org.alfresco.module.org_alfresco_module_rm.test.security; package org.alfresco.module.org_alfresco_module_rm.test.security;
import java.net.URL;
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
import org.apache.log4j.PropertyConfigurator;
/** /**
* Tests method level security of core alfresco services. * Tests method level security of core alfresco services.
@@ -66,7 +63,7 @@ public class MethodSecurityTest extends BaseRMTestCase implements RMPermissionMo
@Override @Override
public Void run() public Void run()
{ {
securityService.setPermission(rmContainer, rmUserName, READ_RECORDS); filePlanPermissionService.setPermission(rmContainer, rmUserName, READ_RECORDS);
return null; return null;
} }

View File

@@ -134,8 +134,8 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
// Give all the users file permission objects // Give all the users file permission objects
for (String user : testUsers) for (String user : testUsers)
{ {
securityService.setPermission(filePlan, user, FILING); filePlanPermissionService.setPermission(filePlan, user, FILING);
securityService.setPermission(rmContainer, user, FILING); filePlanPermissionService.setPermission(rmContainer, user, FILING);
} }
} }

View File

@@ -32,6 +32,7 @@ import org.alfresco.util.TestWithUserUtils;
* *
* @author Roy Wetherall * @author Roy Wetherall
*/ */
@SuppressWarnings("unused")
public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
{ {
@Override @Override

View File

@@ -23,7 +23,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper; import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper;
import org.alfresco.module.org_alfresco_module_rm.security.Role; import org.alfresco.module.org_alfresco_module_rm.role.Role;
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
@@ -92,7 +92,7 @@ public class NotificationServiceHelperSystemTest extends BaseRMTestCase
person = personService.createPerson(props); person = personService.createPerson(props);
// Find the authority for the given role // Find the authority for the given role
Role role = securityService.getRole(filePlan, NOTIFICATION_ROLE); Role role = filePlanRoleService.getRole(filePlan, NOTIFICATION_ROLE);
assertNotNull("Notification role could not be retrieved", role); assertNotNull("Notification role could not be retrieved", role);
String roleGroup = role.getRoleGroupName(); String roleGroup = role.getRoleGroupName();
assertNotNull("Notification role group can not be null.", roleGroup); assertNotNull("Notification role group can not be null.", roleGroup);

View File

@@ -36,8 +36,9 @@ import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RmSiteType; import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RmSiteType;
import org.alfresco.module.org_alfresco_module_rm.record.RecordService; 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.search.RecordsManagementSearchService; import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService;
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService; import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService;
import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService;
import org.alfresco.repo.policy.PolicyComponent; import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
@@ -122,7 +123,8 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
protected RecordsManagementAdminService adminService; protected RecordsManagementAdminService adminService;
protected RecordsManagementActionService actionService; protected RecordsManagementActionService actionService;
protected RecordsManagementSearchService rmSearchService; protected RecordsManagementSearchService rmSearchService;
protected RecordsManagementSecurityService securityService; protected FilePlanRoleService filePlanRoleService;
protected FilePlanPermissionService filePlanPermissionService;
protected CapabilityService capabilityService; protected CapabilityService capabilityService;
protected VitalRecordService vitalRecordService; protected VitalRecordService vitalRecordService;
protected DataSetService dataSetService; protected DataSetService dataSetService;
@@ -338,7 +340,8 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
adminService = (RecordsManagementAdminService)applicationContext.getBean("RecordsManagementAdminService"); adminService = (RecordsManagementAdminService)applicationContext.getBean("RecordsManagementAdminService");
actionService = (RecordsManagementActionService)this.applicationContext.getBean("RecordsManagementActionService"); actionService = (RecordsManagementActionService)this.applicationContext.getBean("RecordsManagementActionService");
rmSearchService = (RecordsManagementSearchService)this.applicationContext.getBean("RecordsManagementSearchService"); rmSearchService = (RecordsManagementSearchService)this.applicationContext.getBean("RecordsManagementSearchService");
securityService = (RecordsManagementSecurityService)this.applicationContext.getBean("RecordsManagementSecurityService"); filePlanRoleService = (FilePlanRoleService)this.applicationContext.getBean("FilePlanRoleService");
filePlanPermissionService = (FilePlanPermissionService)this.applicationContext.getBean("FilePlanPermissionService");
capabilityService = (CapabilityService)this.applicationContext.getBean("CapabilityService"); capabilityService = (CapabilityService)this.applicationContext.getBean("CapabilityService");
vitalRecordService = (VitalRecordService)this.applicationContext.getBean("VitalRecordService"); vitalRecordService = (VitalRecordService)this.applicationContext.getBean("VitalRecordService");
dataSetService = (DataSetService) applicationContext.getBean("DataSetService"); dataSetService = (DataSetService) applicationContext.getBean("DataSetService");
@@ -505,23 +508,23 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
rmUserName = GUID.generate(); rmUserName = GUID.generate();
rmUserPerson = createPerson(rmUserName); rmUserPerson = createPerson(rmUserName);
securityService.assignRoleToAuthority(filePlan, "User", rmUserName); filePlanRoleService.assignRoleToAuthority(filePlan, "User", rmUserName);
powerUserName = GUID.generate(); powerUserName = GUID.generate();
powerUserPerson = createPerson(powerUserName); powerUserPerson = createPerson(powerUserName);
securityService.assignRoleToAuthority(filePlan, "PowerUser", powerUserName); filePlanRoleService.assignRoleToAuthority(filePlan, "PowerUser", powerUserName);
securityOfficerName = GUID.generate(); securityOfficerName = GUID.generate();
securityOfficerPerson = createPerson(securityOfficerName); securityOfficerPerson = createPerson(securityOfficerName);
securityService.assignRoleToAuthority(filePlan, "SecurityOfficer", securityOfficerName); filePlanRoleService.assignRoleToAuthority(filePlan, "SecurityOfficer", securityOfficerName);
recordsManagerName = GUID.generate(); recordsManagerName = GUID.generate();
recordsManagerPerson = createPerson(recordsManagerName); recordsManagerPerson = createPerson(recordsManagerName);
securityService.assignRoleToAuthority(filePlan, "RecordsManager", recordsManagerName); filePlanRoleService.assignRoleToAuthority(filePlan, "RecordsManager", recordsManagerName);
rmAdminName = GUID.generate(); rmAdminName = GUID.generate();
rmAdminPerson = createPerson(rmAdminName); rmAdminPerson = createPerson(rmAdminName);
securityService.assignRoleToAuthority(filePlan, "Administrator", rmAdminName); filePlanRoleService.assignRoleToAuthority(filePlan, "Administrator", rmAdminName);
testUsers = new String[] testUsers = new String[]
{ {
@@ -538,8 +541,8 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
// Give all the users file permission objects // Give all the users file permission objects
for (String user : testUsers) for (String user : testUsers)
{ {
securityService.setPermission(filePlan, user, FILING); filePlanPermissionService.setPermission(filePlan, user, FILING);
securityService.setPermission(rmContainer, user, FILING); filePlanPermissionService.setPermission(rmContainer, user, FILING);
} }
} }
} }

View File

@@ -33,8 +33,9 @@ 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.event.RecordsManagementEventService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RmSiteType; import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RmSiteType;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService;
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService; import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService;
import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService;
import org.alfresco.repo.policy.PolicyComponent; import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
@@ -89,7 +90,8 @@ public class BaseRMWebScriptTestCase extends BaseWebScriptTest
protected RecordsManagementAdminService adminService; protected RecordsManagementAdminService adminService;
protected RecordsManagementActionService actionService; protected RecordsManagementActionService actionService;
protected RecordsManagementSearchService rmSearchService; protected RecordsManagementSearchService rmSearchService;
protected RecordsManagementSecurityService securityService; protected FilePlanRoleService filePlanRoleService;
protected FilePlanPermissionService filePlanPermissionService;
protected RecordsManagementAuditService auditService; protected RecordsManagementAuditService auditService;
protected CapabilityService capabilityService; protected CapabilityService capabilityService;
protected VitalRecordService vitalRecordService; protected VitalRecordService vitalRecordService;
@@ -148,7 +150,8 @@ public class BaseRMWebScriptTestCase extends BaseWebScriptTest
adminService = (RecordsManagementAdminService)applicationContext.getBean("RecordsManagementAdminService"); adminService = (RecordsManagementAdminService)applicationContext.getBean("RecordsManagementAdminService");
actionService = (RecordsManagementActionService)applicationContext.getBean("RecordsManagementActionService"); actionService = (RecordsManagementActionService)applicationContext.getBean("RecordsManagementActionService");
rmSearchService = (RecordsManagementSearchService)applicationContext.getBean("RecordsManagementSearchService"); rmSearchService = (RecordsManagementSearchService)applicationContext.getBean("RecordsManagementSearchService");
securityService = (RecordsManagementSecurityService)applicationContext.getBean("RecordsManagementSecurityService"); filePlanRoleService = (FilePlanRoleService)applicationContext.getBean("FilePlanRoleService");
filePlanPermissionService = (FilePlanPermissionService)applicationContext.getBean("FilePlanPermissionService");
auditService = (RecordsManagementAuditService)applicationContext.getBean("RecordsManagementAuditService"); auditService = (RecordsManagementAuditService)applicationContext.getBean("RecordsManagementAuditService");
capabilityService = (CapabilityService)applicationContext.getBean("CapabilityService"); capabilityService = (CapabilityService)applicationContext.getBean("CapabilityService");
vitalRecordService = (VitalRecordService)applicationContext.getBean("VitalRecordService"); vitalRecordService = (VitalRecordService)applicationContext.getBean("VitalRecordService");

View File

@@ -24,7 +24,6 @@ import java.util.List;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigService; import org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigService;
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.service.cmr.security.MutableAuthenticationService; import org.alfresco.service.cmr.security.MutableAuthenticationService;
import org.alfresco.service.cmr.security.PersonService; import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.util.PropertyMap; import org.alfresco.util.PropertyMap;
@@ -42,6 +41,7 @@ import org.springframework.extensions.webscripts.TestWebScriptServer.Response;
* *
* @author Mark Rogers * @author Mark Rogers
*/ */
@SuppressWarnings("unused")
public class RMCaveatConfigScriptTest extends BaseRMWebScriptTestCase public class RMCaveatConfigScriptTest extends BaseRMWebScriptTestCase
{ {
private MutableAuthenticationService authenticationService; private MutableAuthenticationService authenticationService;
@@ -90,7 +90,7 @@ public class RMCaveatConfigScriptTest extends BaseRMWebScriptTestCase
JSONObject top = new JSONObject(response.getContentAsString()); JSONObject top = new JSONObject(response.getContentAsString());
System.out.println(response.getContentAsString()); System.out.println(response.getContentAsString());
JSONArray data = top.getJSONArray("data"); assertNotNull(top.getJSONArray("data"));
} }
/** /**
@@ -167,7 +167,7 @@ public class RMCaveatConfigScriptTest extends BaseRMWebScriptTestCase
String constraintName = data.getString("constraintName"); String constraintName = data.getString("constraintName");
assertNotNull("constraintName is null", constraintName); assertNotNull("constraintName is null", constraintName);
JSONArray allowedValues = data.getJSONArray("allowedValues"); // JSONArray allowedValues = data.getJSONArray("allowedValues");
// assertTrue("values not correct", compare(array, allowedValues)); // assertTrue("values not correct", compare(array, allowedValues));

View File

@@ -38,7 +38,8 @@ import org.springframework.extensions.webscripts.TestWebScriptServer.Response;
* *
* @author Roy Wetherall * @author Roy Wetherall
*/ */
public class RoleRestApiTest extends BaseRMWebScriptTestCase implements RecordsManagementModel public class RoleRestApiTest extends BaseRMWebScriptTestCase
implements RecordsManagementModel
{ {
protected static final String GET_ROLES_URL = "/api/rma/admin/rmroles"; protected static final String GET_ROLES_URL = "/api/rma/admin/rmroles";
protected static final String SERVICE_URL_PREFIX = "/alfresco/service"; protected static final String SERVICE_URL_PREFIX = "/alfresco/service";
@@ -50,11 +51,11 @@ public class RoleRestApiTest extends BaseRMWebScriptTestCase implements RecordsM
String role2 = GUID.generate(); String role2 = GUID.generate();
// Create a couple or roles by hand // Create a couple or roles by hand
securityService.createRole(filePlan, role1, "My Test Role", getListOfCapabilities(5)); filePlanRoleService.createRole(filePlan, role1, "My Test Role", getListOfCapabilities(5));
securityService.createRole(filePlan, role2, "My Test Role Too", getListOfCapabilities(5)); filePlanRoleService.createRole(filePlan, role2, "My Test Role Too", getListOfCapabilities(5));
// Add the admin user to one of the roles // Add the admin user to one of the roles
securityService.assignRoleToAuthority(filePlan, role1, "admin"); filePlanRoleService.assignRoleToAuthority(filePlan, role1, "admin");
try try
{ {
@@ -103,8 +104,8 @@ public class RoleRestApiTest extends BaseRMWebScriptTestCase implements RecordsM
finally finally
{ {
// Clean up // Clean up
securityService.deleteRole(filePlan, role1); filePlanRoleService.deleteRole(filePlan, role1);
securityService.deleteRole(filePlan, role2); filePlanRoleService.deleteRole(filePlan, role2);
} }
} }
@@ -143,7 +144,7 @@ public class RoleRestApiTest extends BaseRMWebScriptTestCase implements RecordsM
} }
finally finally
{ {
securityService.deleteRole(filePlan, roleName); filePlanRoleService.deleteRole(filePlan, roleName);
} }
} }
@@ -151,7 +152,7 @@ public class RoleRestApiTest extends BaseRMWebScriptTestCase implements RecordsM
public void testPutRole() throws Exception public void testPutRole() throws Exception
{ {
String role1 = GUID.generate(); String role1 = GUID.generate();
securityService.createRole(filePlan, role1, "My Test Role", getListOfCapabilities(5)); filePlanRoleService.createRole(filePlan, role1, "My Test Role", getListOfCapabilities(5));
try try
{ {
@@ -189,7 +190,7 @@ public class RoleRestApiTest extends BaseRMWebScriptTestCase implements RecordsM
finally finally
{ {
// Clean up // Clean up
securityService.deleteRole(filePlan, role1); filePlanRoleService.deleteRole(filePlan, role1);
} }
} }
@@ -197,7 +198,7 @@ public class RoleRestApiTest extends BaseRMWebScriptTestCase implements RecordsM
public void testGetRole() throws Exception public void testGetRole() throws Exception
{ {
String role1 = GUID.generate(); String role1 = GUID.generate();
securityService.createRole(filePlan, role1, "My Test Role", getListOfCapabilities(5)); filePlanRoleService.createRole(filePlan, role1, "My Test Role", getListOfCapabilities(5));
try try
{ {
@@ -222,7 +223,7 @@ public class RoleRestApiTest extends BaseRMWebScriptTestCase implements RecordsM
finally finally
{ {
// Clean up // Clean up
securityService.deleteRole(filePlan, role1); filePlanRoleService.deleteRole(filePlan, role1);
} }
} }
@@ -230,11 +231,11 @@ public class RoleRestApiTest extends BaseRMWebScriptTestCase implements RecordsM
public void testDeleteRole() throws Exception public void testDeleteRole() throws Exception
{ {
String role1 = GUID.generate(); String role1 = GUID.generate();
assertFalse(securityService.existsRole(filePlan, role1)); assertFalse(filePlanRoleService.existsRole(filePlan, role1));
securityService.createRole(filePlan, role1, "My Test Role", getListOfCapabilities(5)); filePlanRoleService.createRole(filePlan, role1, "My Test Role", getListOfCapabilities(5));
assertTrue(securityService.existsRole(filePlan, role1)); assertTrue(filePlanRoleService.existsRole(filePlan, role1));
sendRequest(new DeleteRequest(GET_ROLES_URL + "/" + role1),200); sendRequest(new DeleteRequest(GET_ROLES_URL + "/" + role1),200);
assertFalse(securityService.existsRole(filePlan, role1)); assertFalse(filePlanRoleService.existsRole(filePlan, role1));
// Bad request // Bad request
sendRequest(new DeleteRequest(GET_ROLES_URL + "/cheese"), 404); sendRequest(new DeleteRequest(GET_ROLES_URL + "/cheese"), 404);