RM: RecordsManagementService refactor

* move candiate methods into FilePlanService
  * deprecation of RMService methods
  * remove all deprecation warnings from code
  * update filePlanService unit tests
  * remove all other spurious warnings from RM code
  * a couple of performance enhancements in the bowls of the capability evaluation code
  * first pass at parametising RecordsManagementAuditService with file plan (so capability evaluation had a tangable reference)
  * fix up unit test failures and other fall out from refactors



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@52504 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2013-07-12 06:12:46 +00:00
parent 05c4101d2f
commit 1e6d49dbab
86 changed files with 2189 additions and 1001 deletions

View File

@@ -12,6 +12,7 @@
<property name="nodeService" ref="NodeService" />
<property name="freezeService" ref="FreezeService" />
<property name="recordService" ref="recordService" />
<property name="filePlanService" ref="FilePlanService" />
</bean>
<bean id="capabilityCondition.frozen"

View File

@@ -120,7 +120,7 @@
<!-- Action Service -->
<bean id="actionService" class="org.alfresco.repo.action.ExtendedActionServiceImpl" init-method="init">
<property name="recordsManagementService" ref="RecordsManagementService" />
<property name="filePlanService" ref="FilePlanService" />
<property name="policyComponent">
<ref bean="policyComponent" />
@@ -197,7 +197,7 @@
<!-- Since RM 2.1 -->
<property name="filePlanAuthenticationService" ref="FilePlanAuthenticationService"/>
<property name="recordsManagementService" ref="RecordsManagementService" />
<property name="filePlanService" ref="FilePlanService" />
<property name="runAsRmAdmin">
<value>${rm.rule.runasrmadmin}</value>
</property>

View File

@@ -1,3 +1,16 @@
#
# Warnings
#
log4j.logger.org.alfresco.module.org_alfresco_module_rm.caveat=warn
log4j.logger.org.alfresco.module.org_alfresco_module_rm.security.RMMethodSecurityPostProcessor=warn
log4j.logger.org.alfresco.module.org_alfresco_module_rm.patch=debug
#
# Module patch debug information
#
#log4j.logger.org.alfresco.module.org_alfresco_module_rm.patch=debug
#
# RM Permission Debug Information
#
#log4j.logger.org.alfresco.module.org_alfresco_module_rm.capability.RMEntryVoter=debug
#log4j.logger.org.alfresco.module.org_alfresco_module_rm.capability.declarative=debug

View File

@@ -55,13 +55,13 @@
<bean id="org_alfresco_module_rm_namePathExtractor" class="org.alfresco.module.org_alfresco_module_rm.audit.FilePlanNamePathDataExtractor">
<property name="registry" ref="auditModel.extractorRegistry" />
<property name="nodeService" ref="nodeService" />
<property name="rmService" ref="recordsManagementService" />
<property name="filePlanService" ref="filePlanService" />
</bean>
<bean id="org_alfresco_module_rm_nodeRefPathExtractor" class="org.alfresco.module.org_alfresco_module_rm.audit.FilePlanNodeRefPathDataExtractor">
<property name="registry" ref="auditModel.extractorRegistry" />
<property name="nodeService" ref="nodeService" />
<property name="rmService" ref="recordsManagementService" />
<property name="filePlanService" ref="filePlanService" />
</bean>
<bean id="org_alfresco_module_rm_identifierExtractor" class="org.alfresco.module.org_alfresco_module_rm.audit.FilePlanIdentifierDataExtractor">
@@ -208,6 +208,7 @@
<property name="filterRegistry" ref="nodeFilterRegistry" />
<property name="dictionaryService" ref="DictionaryService" />
<property name="dispositionService" ref="dispositionService"/>
<property name="filePlanService" ref="FilePlanService" />
</bean>
<bean id="rmTypeFormFilter"

View File

@@ -24,7 +24,7 @@
</bean>
<bean id="rm-ac-disposition-action-relative-positions" class="org.alfresco.repo.action.constraint.EnumParameterConstraint" parent="action-constraint">
<property name="enumClassName" value="org.alfresco.module.org_alfresco_module_rm.DispositionActionRelativePositions" />
<property name="enumClassName" value="org.alfresco.module.org_alfresco_module_rm.action.evaluator.DispositionActionRelativePositions" />
</bean>
<bean id="rm-ac-disposition-actions" class="org.alfresco.module.org_alfresco_module_rm.action.constraint.DispositionActionParameterConstraint" parent="action-constraint">
@@ -69,7 +69,7 @@
class="org.alfresco.module.org_alfresco_module_rm.action.evaluator.IsKindEvaluator">
<property name="recordsManagementActionService" ref="RecordsManagementActionService" />
<property name="retryingTransactionHelper" ref="retryingTransactionHelper" />
<property name="recordsManagementService" ref="RecordsManagementService" />
<property name="filePlanService" ref="FilePlanService" />
</bean>
<bean id="hasDispositionAction"
@@ -580,6 +580,7 @@
<bean id="broadcastVitalRecordDefinition"
class="org.alfresco.module.org_alfresco_module_rm.vital.BroadcastVitalRecordDefinitionAction"
parent="rmAction">
<property name="filePlanService" ref="FilePlanService"/>
<property name="filePlanAuthenticationService" ref="FilePlanAuthenticationService"/>
</bean>
@@ -787,7 +788,9 @@
<bean id="createDispositionSchedule"
class="org.alfresco.module.org_alfresco_module_rm.action.impl.CreateDispositionScheduleAction"
parent="rmAction" />
parent="rmAction">
<property name="filePlanService" ref="FilePlanService"/>
</bean>
<!-- Reject record -->

View File

@@ -56,7 +56,6 @@
parent="org_alfresco_module_rm_BaseBehaviour">
<property name="dictionaryService" ref="DictionaryService"/>
<property name="recordsManagementIdentifierService" ref="recordsManagementIdentifierService"/>
<property name="filePlanAuthenticationService" ref="FilePlanAuthenticationService"/>
</bean>
<bean id="org_alfresco_module_rm_RmSiteType"

View File

@@ -62,10 +62,10 @@
<property name="nodeDAO" ref="nodeDAO" />
<property name="qnameDAO" ref="qnameDAO"/>
<property name="nodeService" ref="NodeService"/>
<property name="recordsManagementService" ref="RecordsManagementService" />
<property name="behaviourFilter" ref="policyBehaviourFilter"/>
<property name="permissionService" ref="PermissionService"/>
<property name="recordsManagementSecurityService" ref="RecordsManagementSecurityService" />
<property name="filePlanService" ref="FilePlanService" />
<property name="filePlanRoleService" ref="filePlanRoleService" />
</bean>
<bean id="org_alfresco_module_rm_RMv2SavedSearchPatch"

View File

@@ -41,6 +41,7 @@
<bean id="org_alfresco_module_rm_dispositionSelectionStrategy"
class="org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSelectionStrategy" >
<property name="dispositionService" ref="dispositionService"/>
<property name="filePlanAuthenticationService" ref="FilePlanAuthenticationService"/>
</bean>
<!-- Records Management Service -->
@@ -126,6 +127,7 @@
<property name="nodeService" ref="NodeService"/>
<property name="filePlanAuthenticationService" ref="FilePlanAuthenticationService" />
<property name="policyComponent" ref="policyComponent"/>
<property name="filePlanService" ref="FilePlanService" />
</bean>
<bean id="VitalRecordService" class="org.springframework.aop.framework.ProxyFactoryBean">
@@ -181,6 +183,7 @@
<property name="dictionaryService" ref="DictionaryService"/>
<property name="behaviourFilter" ref="policyBehaviourFilter" />
<property name="policyComponent" ref="policyComponent" />
<property name="filePlanService" ref="FilePlanService" />
<property name="dispositionSelectionStrategy">
<ref local="org_alfresco_module_rm_dispositionSelectionStrategy" />
</property>
@@ -467,6 +470,9 @@
<property name="objectDefinitionSource">
<value>
<![CDATA[
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.isFilePlanComponent=RM_ALLOW
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.getFilePlanComponentKind=RM_ALLOW
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.getFilePlanComponentKindFromType=RM_ALLOW
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.isFilePlan=RM_ALLOW
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.getFilePlans=RM_ALLOW,AFTER_RM.FilterNode
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.getFilePlan=RM_ALLOW,AFTER_RM.FilterNode
@@ -474,6 +480,14 @@
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.existsUnfiledContainer=RM.Read.0
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.getUnfiledContainer=RM.Read.0,AFTER_RM.FilterNode
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.createUnfiledContainer=RM.Write.0
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.createFilePlan=RM_ALLOW
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.getNodeRefPath=RM.Read.0
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.isFilePlanContainer=RM_ALLOW
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.isRecordCategory=RM_ALLOW
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.getAllContained=RM.Read.0,AFTER_RM.FilterNode
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.getContainedRecordCategories=RM.Read.0,AFTER_RM.FilterNode
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.getContainedRecordFolders=RM.Read.0,AFTER_RM.FilterNode
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.createRecordCategory=RM.Write.0
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.*=RM_DENY
]]>
</value>
@@ -626,7 +640,6 @@
<property name="policyComponent" ref="policyComponent"/>
<property name="recordService" ref="recordService"/>
<property name="nodeService" ref="nodeService"/>
<property name="recordsManagementService" ref="recordsManagementService"/>
<property name="filePlanService" ref="filePlanService" />
<property name="filePlanRoleService" ref="filePlanRoleService" />
</bean>
@@ -1025,6 +1038,7 @@
<property name="contentService" ref="ContentService" />
<property name="recordsManagementService" ref="RecordsManagementService" />
<property name="recordsManagementActionService" ref="RecordsManagementActionService" />
<property name="filePlanService" ref="FilePlanService" />
</bean>
<bean id="RecordsManagementAuditService" class="org.springframework.aop.framework.ProxyFactoryBean">
@@ -1067,15 +1081,21 @@
<property name="objectDefinitionSource">
<value>
<![CDATA[
org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.clear=RM_CAP.-1.rma:filePlanComponent.DeleteAudit
org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.clear=RM_ALLOW
org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.clearAuditLog=RM_CAP.0.rma:filePlanComponent.DeleteAudit
org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.getAuditTrail=RM_ALLOW
org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.getAuditTrailFile=RM_ALLOW
org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.getDateLastStarted=RM_ALLOW
org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.getDateAuditLogLastStarted=RM_ALLOW
org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.getDateLastStopped=RM_ALLOW
org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.getDateAuditLogLastStopped=RM_ALLOW
org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.isEnabled=RM_ALLOW
org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.start=RM_CAP.-1.rma:filePlanComponent.EnableDisableAuditByTypes
org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.stop=RM_CAP.-1.rma:filePlanComponent.EnableDisableAuditByTypes
org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.fileAuditTrailAsRecord=RM_CAP.-1.rma:filePlanComponent.DeclareAuditAsRecord
org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.isAuditLogEnabled=RM_ALLOW
org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.start=RM_ALLOW
org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.startAuditLog=RM_CAP.0.rma:filePlanComponent.EnableDisableAuditByTypes
org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.stop=RM_ALLOW
org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.stopAuditLog=RM_CAP.0.rma:filePlanComponent.EnableDisableAuditByTypes
org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.fileAuditTrailAsRecord=RM_CAP.1.rma:filePlanComponent.DeclareAuditAsRecord
org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.getAuditEvents=RM_ALLOW
org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService.*=RM_DENY
]]>

View File

@@ -21,6 +21,7 @@
<property name="namespaceService" ref="NamespaceService"/>
<property name="capabilityService" ref="CapabilityService"/>
<property name="freezeService" ref="FreezeService"/>
<property name="filePlanService" ref="FilePlanService" />
</bean>
<bean id="jsonConversionComponent.baseIndicator"

View File

@@ -191,6 +191,7 @@
class="org.alfresco.module.org_alfresco_module_rm.script.AuditLogPut"
parent="webscript">
<property name="recordsManagementAuditService" ref="RecordsManagementAuditService" />
<property name="filePlanService" ref="FilePlanService"/>
</bean>
<!-- REST impl for DELETE Audit Log (clears audit log) -->
@@ -198,6 +199,7 @@
class="org.alfresco.module.org_alfresco_module_rm.script.AuditLogDelete"
parent="webscript">
<property name="recordsManagementAuditService" ref="RecordsManagementAuditService" />
<property name="filePlanService" ref="FilePlanService"/>
</bean>
<!-- REST impl for POST export -->
@@ -306,7 +308,7 @@
<bean id="webscript.org.alfresco.rma.capability.capabilities.get"
class="org.alfresco.module.org_alfresco_module_rm.script.capability.CapabilitiesGet"
parent="webscript">
<property name="recordsManagementService" ref="RecordsManagementService" />
<property name="filePlanService" ref="FilePlanService" />
<property name="capabilityService" ref="CapabilityService" />
</bean>
@@ -385,6 +387,7 @@
<property name="nodeService" ref="NodeService" />
<property name="recordsManagementService" ref="RecordsManagementService" />
<property name="filePlanRoleService" ref="FilePlanRoleService" />
<property name="filePlanService" ref="FilePlanService" />
</bean>
<!-- REST impl for GET Bootstrap Test Data -->
@@ -474,7 +477,7 @@
<bean id="webscript.org.alfresco.slingshot.forms.metadata.get"
class="org.alfresco.module.org_alfresco_module_rm.script.slingshot.forms.RMMetaDataGet"
parent="webscript">
<property name="recordsManagementService" ref="RecordsManagementService" />
<property name="filePlanService" ref="FilePlanService" />
<property name="namespaceService" ref="namespaceService" />
<property name="nodeService" ref="NodeService" />
</bean>

View File

@@ -5,7 +5,7 @@
<bean id="basePolicy" abstract="true" parent="RMSecurityCommon" init-method="init">
<property name="capabilityService" ref="capabilityService" />
<property name="rmEntryVoter" ref="rmEntryVoter" />
<property name="policyRegister" ref="rmEntryVoter" />
</bean>
<bean id="readPolicy" parent="basePolicy" class="org.alfresco.module.org_alfresco_module_rm.capability.policy.ReadPolicy">

View File

@@ -23,6 +23,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService;
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
@@ -41,66 +42,42 @@ public interface RecordsManagementService
/********** RM Component methods **********/
/**
* Indicates whether the given node is a file plan component or not.
*
* @param nodeRef node reference
* @return boolean true if a file plan component, false otherwise
* @deprecated as of 2.1, see {@link FilePlanService#isFilePlan(NodeRef)}
*/
@Deprecated
boolean isFilePlanComponent(NodeRef nodeRef);
/**
* Returns the 'kind' of file plan component the node reference is.
* <p>
* Returns null if the given node reference is not a
* file plan component.
*
* @param nodeRef node reference
* @return FilePlanComponentKind the kind of file plan component the
* node is
*
* @since 2.0
* @deprecated as of 2.1, see {@link FilePlanService#getFilePlanComponentKind(NodeRef)}
*/
@Deprecated
FilePlanComponentKind getFilePlanComponentKind(NodeRef nodeRef);
/**
* Returns the file plan component 'kind' that relates to the passed
* content type.
* <p>
* Returns null if the type does not relate to a file plan component.
*
* @param type qualified name of content type
* @return FilePlanComponentKind the kind relating to the passed type
*
* @since 2.0
* @deprecated as of 2.1, see {@link FilePlanService#getFilePlanComponentKindFromType(QName)}
*/
@Deprecated
FilePlanComponentKind getFilePlanComponentKindFromType(QName type);
/**
* Indicates whether the given node is a records management container or not.
*
* @param nodeRef node reference
* @return boolean true if node is a record container, false otherwise.
* @deprecated as of 2.1, see {@link FilePlanService#isFilePlanContainer(NodeRef)}
*/
@Deprecated
boolean isRecordsManagementContainer(NodeRef nodeRef);
/**
* Indicates whether the given node is file plan node or not.
*
* @param nodeRef node reference
* @return boolean true if node is a file plan node
*
* @deprecated as of 2.1, see {@link FilePlanService#isFilePlan(NodeRef)}
*/
@Deprecated
boolean isFilePlan(NodeRef nodeRef);
/**
* Indicates whether the given node is a record category or not.
*
* @param nodeRef node reference
* @return boolean true if records category, false otherwise
* @deprecated as of 2.1, see {@link FilePlanService#isRecordCategory(NodeRef)}
*/
boolean isRecordCategory(NodeRef nodeRef);
@Deprecated
boolean isRecordCategory(NodeRef nodeRef);
/**
* Indicates whether the given node is a record folder or not.
@@ -108,7 +85,7 @@ public interface RecordsManagementService
* @param nodeRef node reference
* @return boolean true if record folder, false otherwise
*/
boolean isRecordFolder(NodeRef nodeRef);
boolean isRecordFolder(NodeRef nodeRef); // record folder service
/**
* Indicates whether the given node is a transfer (container) or not.
@@ -118,7 +95,7 @@ public interface RecordsManagementService
*
* @since 2.0
*/
boolean isTransfer(NodeRef nodeRef);
boolean isTransfer(NodeRef nodeRef); // transfer service
/**
* Indicates whether the given node (record or record folder) is a metadata stub or not.
@@ -128,7 +105,7 @@ public interface RecordsManagementService
*
* @since 2.0
*/
boolean isMetadataStub(NodeRef nodeRef);
boolean isMetadataStub(NodeRef nodeRef); // record service
/**
* Indicates whether the item is cutoff or not.
@@ -138,24 +115,15 @@ public interface RecordsManagementService
*
* @since 2.0
*/
boolean isCutoff(NodeRef nodeRef);
boolean isCutoff(NodeRef nodeRef); // disposition service ??
/**
* Gets the <b>NodeRef</b> sequence from the {@link #getFilePlan(NodeRef) root}
* down to the fileplan component given. The array will start with the <b>NodeRef</b> of the root
* and end with the name of the fileplan component node given.
*
* @param nodeRef a fileplan component
* @return Returns a <b>NodeRef</b> path starting with the name of the
* records management root
* @deprecated as of 2.1, see {@link FilePlanService#getNodeRefPath(NodeRef)}
*/
@Deprecated
List<NodeRef> getNodeRefPath(NodeRef nodeRef);
/**
* Gets the file plan the node is in.
*
* @return {@link NodeRef} file node reference, null if none
*
* @deprecated As of 2.1, see {@link FilePlanService#getFilePlan(NodeRef)}
*/
@Deprecated
@@ -164,168 +132,98 @@ public interface RecordsManagementService
/********** File Plan Methods **********/
/**
* Gets all the file plan nodes.
* Searches the SpacesStore by default.
*
* @return List<NodeRef> list of file plan nodes
* @deprecated As of 2.1, see {@link FilePlanService#getFilePlans()}
*/
@Deprecated
List<NodeRef> getFilePlans();
/**
* Creates a file plan as a child of the given parent node, with the name
* provided.
*
* @param parent parent node reference
* @param name name of the root
* @param type type of root created (must be sub-type of rm:filePlan)
* @return NodeRef node reference to the newly create RM root
* @deprecated as of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, QName)}
*/
@Deprecated
NodeRef createFilePlan(NodeRef parent, String name, QName type);
/**
* @see #createFilePlan(NodeRef, String, QName)
*
* @param parent
* @param name
* @param type
* @param properties
* @return
* @deprecated as of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, QName, Map)}
*/
@Deprecated
NodeRef createFilePlan(NodeRef parent, String name, QName type, Map<QName, Serializable> properties);
/**
* Creates a file plan with the default type.
*
* @see RecordsManagementService#createFilePlan(NodeRef, String, QName)
* @deprecated as of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String)}
*/
@Deprecated
NodeRef createFilePlan(NodeRef parent, String name);
/**
*
* @param parent
* @param name
* @param properties
* @return
* @deprecated as of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, Map)}
*/
@Deprecated
NodeRef createFilePlan(NodeRef parent, String name, Map<QName, Serializable> properties);
// TODO void deleteRecordsManagementRoot(NodeRef root);
/********** Record Category Methods **********/
// TODO NodeRef getRecordCategoryByPath(String path);
// TODO NodeRef getRecordCategoryById(String id);
// TODO NodeRef getRecordCategoryByName(NodeRef parent, String id); ??
/**
* Get all the items contained within a container. This will include record folders and other record categories.
*
* @param recordCategory record category node reference
* @param deep if true then return all children including sub-categories and their children in turn, if false then just
* return the immediate children
* @return {@link List}<{@link NodeRef>} list of contained node references
* @deprecated as of 2.1, see {@link FilePlanService#getAllContained(NodeRef, boolean)}
*/
@Deprecated
List<NodeRef> getAllContained(NodeRef recordCategory, boolean deep);
/**
* Only return the immediate children.
*
* @see RecordsManagementService#getAllContained(NodeRef, boolean)
*
* @param recordCategory record category node reference
* @return {@link List}<{@link NodeRef>} list of contained node references
* @deprecated as of 2.1, see {@link FilePlanService#getAllContained(NodeRef)}
*/
@Deprecated
List<NodeRef> getAllContained(NodeRef recordCategory);
/**
* Get all the record categories within a record category.
*
* @param recordCategory record category node reference
* @param deep if true then return all children including sub-categories and their children in turn, if false then just
* return the immediate children
* @return {@link List}<{@link NodeRef>} list of container node references
* @deprecated as of 2.1, see {@link FilePlanService#getContainedRecordCategories(NodeRef, boolean)}
*/
@Deprecated
List<NodeRef> getContainedRecordCategories(NodeRef recordCategory, boolean deep);
/**
* Only return immediate children.
*
* @see RecordsManagementService#getContainedRecordCategories(NodeRef, boolean)
*
* @param recordCategory container node reference
* @return {@link List}<{@link NodeRef>} list of container node references
* @deprecated as of 2.1, see {@link FilePlanService#getContainedRecordCategories(NodeRef)}
*/
@Deprecated
List<NodeRef> getContainedRecordCategories(NodeRef recordCategory);
/**
* Get all the record folders contained within a container
*
* @param container container node reference
* @param deep if true then return all children including sub-containers and their children in turn, if false then just
* return the immediate children
* @return {@link List}<{@link NodeRef>} list of record folder node references
* @deprecated as of 2.1, see {@link FilePlanService#getContainedRecordCategories(NodeRef, boolean)}
*/
@Deprecated
List<NodeRef> getContainedRecordFolders(NodeRef container, boolean deep);
/**
* Only return immediate children.
*
* @see RecordsManagementService#getContainedRecordFolders(NodeRef, boolean)
*
* @param container container node reference
* @return {@link List}<{@link NodeRef>} list of record folder node references
* @deprecated as of 2.1, see {@link FilePlanService#getContainedRecordFolders(NodeRef)}
*/
@Deprecated
List<NodeRef> getContainedRecordFolders(NodeRef container);
// TODO List<NodeRef> getParentRecordCategories(NodeRef container); // also applicable to record folders
/**
* Create a record category.
*
* @param parent parent node reference, must be a record category or file plan.
* @param name name of the new record category
* @param type type of container to create, must be a sub-type of rm:recordCategory
* @return NodeRef node reference of the created record category
* @deprecated as of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String, QName)}
*/
@Deprecated
NodeRef createRecordCategory(NodeRef parent, String name, QName type);
/**
*
* @param parent
* @param name
* @param type
* @param properties
* @return
* @deprecated as of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String, QName, Map)}
*/
@Deprecated
NodeRef createRecordCategory(NodeRef parent, String name, QName type, Map<QName, Serializable> properties);
/**
* Creates a record category of type rma:recordCategory
*
* @see RecordsManagementService#createRecordCategory(NodeRef, String, QName)
*
* @param parent parent node reference, must be a record category or file plan.
* @param name name of the record category
* @return NodeRef node reference of the created record category
* @deprecated as of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String)}
*/
@Deprecated
NodeRef createRecordCategory(NodeRef parent, String name);
/**
*
* @param parent
* @param name
* @param properties
* @return
* @deprecated as of 2.1, see {@link FilePlanService#createRecordCategory(NodeRef, String, Map)}
*/
@Deprecated
NodeRef createRecordCategory(NodeRef parent, String name, Map<QName, Serializable> properties);
// TODO void deleteRecordCategory(NodeRef container);
// TODO move, copy, link ??
/********** Record Folder methods **********/
@@ -421,75 +319,40 @@ public interface RecordsManagementService
/********** Deprecated **********/
/**
* Get a list of all the record meta-data aspects
*
* @return {@link Set}<{@link QName}> list of record meta-data aspects
*
/**
* @deprecated As of 2.1, replaced by {@link RecordService#getRecordMetaDataAspects()}
*/
@Deprecated
Set<QName> getRecordMetaDataAspects();
/**
* Indicates whether the record is declared
*
* @param nodeRef node reference (record)
* @return boolean true if record is declared, false otherwise
*
* @deprecated As of 2.1, replaced by {@link RecordService#isDeclared(NodeRef)}
*/
@Deprecated
boolean isRecordDeclared(NodeRef nodeRef);
/**
* Indicates whether the given node is a hold (container) or not.
*
* @param nodeRef node reference
* @return boolean true if hold, false otherwise
*
* @since 2.0
*
* @deprecated As of 2.1, replaced by {@link FreezeService#isHold(NodeRef)}
*/
@Deprecated
boolean isHold(NodeRef nodeRef);
/**
* Indicates whether the item is frozen or not.
*
* @param nodeRef node reference
* @return boolean true if record is frozen, false otherwise
*
* @since 2.0
*
* @deprecated As of 2.1, replaced by {@link FreezeService#isFrozen(NodeRef)}
*/
@Deprecated
boolean isFrozen(NodeRef nodeRef);
/**
* Indicates whether the item has frozen children or not.
*
* NOTE: this only checks the immediate children and does not check the frozen
* state of the node being passed
*
* @param nodeRef node reference
* @return boolean true if record folder has frozen children, false otherwise
*
* @since 2.0
*
* @deprecated As of 2.1, replaced by {@link FreezeService#hasFrozenChildren(NodeRef)}
*/
@Deprecated
boolean hasFrozenChildren(NodeRef nodeRef);
/**
* Indicates whether the given node is a record or not.
*
* @param nodeRef node reference
* @return boolean true if record, false otherwise
*
* @deprecated As of 2.1, replaced by {@link RecordService#isRecord(NodeRef)}
*/
@Deprecated

View File

@@ -22,7 +22,6 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -30,6 +29,7 @@ import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.model.RenditionModel;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
@@ -68,14 +68,6 @@ public class RecordsManagementServiceImpl extends ServiceBaseImpl
private final static String MSG_ERROR_ADD_CONTENT_CONTAINER = "rm.service.error-add-content-container";
private final static String MSG_UPDATE_DISP_ACT_DEF = "rm.service.update-disposition-action-def";
private final static String MSG_SET_ID = "rm.service.set-id";
private final static String MSG_PATH_NODE = "rm.service.path-node";
private final static String MSG_INVALID_RM_NODE = "rm.service.invalid-rm-node";
private final static String MSG_NO_ROOT = "rm.service.no-root";
private final static String MSG_DUP_ROOT = "rm.service.dup-root";
private final static String MSG_ROOT_TYPE = "rm.service.root-type";
private final static String MSG_CONTAINER_PARENT_TYPE= "rm.service.container-parent-type";
private final static String MSG_CONTAINER_TYPE = "rm.service.container-type";
private final static String MSG_CONTAINER_EXPECTED = "rm.service.container-expected";
private final static String MSG_RECORD_FOLDER_EXPECTED = "rm.service.record-folder-expected";
private final static String MSG_PARENT_RECORD_FOLDER_ROOT = "rm.service.parent-record-folder-root";
private final static String MSG_PARENT_RECORD_FOLDER_TYPE = "rm.service.parent-record-folder-type";
@@ -141,6 +133,11 @@ public class RecordsManagementServiceImpl extends ServiceBaseImpl
{
this.defaultStoreRef = defaultStoreRef;
}
private FilePlanService getFilePlanService()
{
return (FilePlanService)applicationContext.getBean("filePlanService");
}
/**
* Init method. Registered behaviours.
@@ -409,131 +406,49 @@ public class RecordsManagementServiceImpl extends ServiceBaseImpl
@Deprecated
public boolean isFilePlan(NodeRef nodeRef)
{
return serviceRegistry.getFilePlanService().isFilePlan(nodeRef);
return getFilePlanService().isFilePlan(nodeRef);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#isRecordsManagementContainer(org.alfresco.service.cmr.repository.NodeRef)
* @deprecated as of 2.1, see {@link FilePlanService#isFilePlanContainer(NodeRef)}
*/
@Override
public boolean isRecordsManagementContainer(NodeRef nodeRef)
{
return instanceOf(nodeRef, TYPE_RECORDS_MANAGEMENT_CONTAINER);
return getFilePlanService().isFilePlanContainer(nodeRef);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#isFilePlanComponent(org.alfresco.service.cmr.repository.NodeRef)
* @deprecated as of 2.1, see {@link FilePlanService#isFilePlanComponent(NodeRef)}
*/
public boolean isFilePlanComponent(NodeRef nodeRef)
{
boolean result = false;
if (nodeService.exists(nodeRef) == true &&
nodeService.hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT) == true)
{
result = true;
}
return result;
return getFilePlanService().isFilePlan(nodeRef);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#getFilePlanComponentKind(org.alfresco.service.cmr.repository.NodeRef)
* @deprecated as of 2.1, see {@link FilePlanService#getFilePlanComponentKind(NodeRef)}
*/
public FilePlanComponentKind getFilePlanComponentKind(NodeRef nodeRef)
{
FilePlanComponentKind result = null;
if (isFilePlanComponent(nodeRef) == true)
{
result = FilePlanComponentKind.FILE_PLAN_COMPONENT;
if (isFilePlan(nodeRef) == true)
{
result = FilePlanComponentKind.FILE_PLAN;
}
else if (isRecordCategory(nodeRef) == true)
{
result = FilePlanComponentKind.RECORD_CATEGORY;
}
else if (isRecordFolder(nodeRef) == true)
{
result = FilePlanComponentKind.RECORD_FOLDER;
}
else if (isRecord(nodeRef) == true)
{
result = FilePlanComponentKind.RECORD;
}
else if (isHold(nodeRef) == true)
{
result = FilePlanComponentKind.HOLD;
}
else if (isTransfer(nodeRef) == true)
{
result = FilePlanComponentKind.TRANSFER;
}
else if (instanceOf(nodeRef, TYPE_DISPOSITION_SCHEDULE) == true || instanceOf(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION) == true)
{
result = FilePlanComponentKind.DISPOSITION_SCHEDULE;
}
else if (instanceOf(nodeRef, TYPE_UNFILED_RECORD_CONTAINER) == true)
{
result = FilePlanComponentKind.UNFILED_RECORD_CONTAINER;
}
}
return result;
return getFilePlanService().getFilePlanComponentKind(nodeRef);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#getFilePlanComponentKindFromType(org.alfresco.service.namespace.QName)
* @deprecated as of 2.1, see {@link FilePlanService#getFilePlanComponentKindFromType(QName)}
*/
@Override
public FilePlanComponentKind getFilePlanComponentKindFromType(QName type)
{
FilePlanComponentKind result = null;
if (ASPECT_FILE_PLAN_COMPONENT.equals(type) == true)
{
result = FilePlanComponentKind.FILE_PLAN_COMPONENT;
}
else if (dictionaryService.isSubClass(type, ASPECT_RECORD) == true)
{
result = FilePlanComponentKind.RECORD;
}
else if (dictionaryService.isSubClass(type, TYPE_FILE_PLAN) == true)
{
result = FilePlanComponentKind.FILE_PLAN;
}
else if (dictionaryService.isSubClass(type, TYPE_RECORD_CATEGORY) == true)
{
result = FilePlanComponentKind.RECORD_CATEGORY;
}
else if (dictionaryService.isSubClass(type, TYPE_RECORD_FOLDER) == true)
{
result = FilePlanComponentKind.RECORD_FOLDER;
}
else if (dictionaryService.isSubClass(type, TYPE_HOLD) == true)
{
result = FilePlanComponentKind.HOLD;
}
else if (dictionaryService.isSubClass(type, TYPE_TRANSFER) == true)
{
result = FilePlanComponentKind.TRANSFER;
}
else if (dictionaryService.isSubClass(type, TYPE_DISPOSITION_SCHEDULE) == true ||
dictionaryService.isSubClass(type, TYPE_DISPOSITION_ACTION_DEFINITION) == true)
{
result = FilePlanComponentKind.DISPOSITION_SCHEDULE;
}
return result;
return getFilePlanService().getFilePlanComponentKindFromType(type);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#isRecordCategory(org.alfresco.service.cmr.repository.NodeRef)
* @deprecated as of 2.1, see {@link FilePlanService#isRecordCategory(NodeRef)}
*/
public boolean isRecordCategory(NodeRef nodeRef)
{
return instanceOf(nodeRef, TYPE_RECORD_CATEGORY);
return getFilePlanService().isRecordCategory(nodeRef);
}
/**
@@ -577,55 +492,15 @@ public class RecordsManagementServiceImpl extends ServiceBaseImpl
@Deprecated
public NodeRef getFilePlan(NodeRef nodeRef)
{
FilePlanService filePlanService = (FilePlanService)applicationContext.getBean("filePlanService");
return filePlanService.getFilePlan(nodeRef);
return getFilePlanService().getFilePlan(nodeRef);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#getNodeRefPath(org.alfresco.service.cmr.repository.NodeRef)
* @deprecated as of 2.1, see {@link FilePlanService#getNodeRefPath(NodeRef)}
*/
public List<NodeRef> getNodeRefPath(NodeRef nodeRef)
{
LinkedList<NodeRef> nodeRefPath = new LinkedList<NodeRef>();
try
{
getNodeRefPathRecursive(nodeRef, nodeRefPath);
}
catch (Throwable e)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PATH_NODE, nodeRef), e);
}
return nodeRefPath;
}
/**
* Helper method to build a <b>NodeRef</b> path from the node to the RM root
*/
private void getNodeRefPathRecursive(NodeRef nodeRef, LinkedList<NodeRef> nodeRefPath)
{
if (isFilePlanComponent(nodeRef) == false)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_INVALID_RM_NODE, ASPECT_FILE_PLAN_COMPONENT.toString()));
}
// Prepend it to the path
nodeRefPath.addFirst(nodeRef);
// Are we at the root
if (isFilePlan(nodeRef) == true)
{
// We're done
}
else
{
ChildAssociationRef assocRef = nodeService.getPrimaryParent(nodeRef);
if (assocRef == null)
{
// We hit the top of the store
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NO_ROOT));
}
// Recurse
nodeRef = assocRef.getParentRef();
getNodeRefPathRecursive(nodeRef, nodeRefPath);
}
return getFilePlanService().getNodeRefPath(nodeRef);
}
/**
@@ -636,237 +511,126 @@ public class RecordsManagementServiceImpl extends ServiceBaseImpl
@Deprecated
public List<NodeRef> getFilePlans()
{
return new ArrayList<NodeRef>(serviceRegistry.getFilePlanService().getFilePlans());
return new ArrayList<NodeRef>(getFilePlanService().getFilePlans());
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName, java.util.Map)
* @deprecated as of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, QName, Map)}
*/
public NodeRef createFilePlan(NodeRef parent, String name, QName type, Map<QName, Serializable> properties)
{
ParameterCheck.mandatory("parent", parent);
ParameterCheck.mandatory("name", name);
ParameterCheck.mandatory("type", type);
// Check the parent is not already an RM component node
// ie: you can't create a rm root in an existing rm hierarchy
if (isFilePlanComponent(parent) == true)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_DUP_ROOT));
}
// Check that the passed type is a sub-type of rma:filePlan
if (TYPE_FILE_PLAN.equals(type) == false &&
dictionaryService.isSubClass(type, TYPE_FILE_PLAN) == false)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_ROOT_TYPE, type.toString()));
}
// Build map of properties
Map<QName, Serializable> rmRootProps = new HashMap<QName, Serializable>(1);
if (properties != null && properties.size() != 0)
{
rmRootProps.putAll(properties);
}
rmRootProps.put(ContentModel.PROP_NAME, name);
// Create the root
ChildAssociationRef assocRef = nodeService.createNode(
parent,
ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name),
type,
rmRootProps);
// TODO do we need to create role and security groups or is this done automatically?
return assocRef.getChildRef();
return getFilePlanService().createFilePlan(parent, name, type, properties);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map)
* @deprecated as of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, Map)}
*/
public NodeRef createFilePlan(NodeRef parent, String name, Map<QName, Serializable> properties)
{
return createFilePlan(parent, name, TYPE_FILE_PLAN, properties);
return getFilePlanService().createFilePlan(parent, name, properties);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, java.lang.String)
* @deprecated as of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String)}
*/
public NodeRef createFilePlan(NodeRef parent, String name)
{
return createFilePlan(parent, name, TYPE_FILE_PLAN, null);
return getFilePlanService().createFilePlan(parent, name);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName)
* @deprecated as of 2.1, see {@link FilePlanService#createFilePlan(NodeRef, String, QName)}
*/
@Override
public NodeRef createFilePlan(NodeRef parent, String name, QName type)
{
return createFilePlan(parent, name, type, null);
return getFilePlanService().createFilePlan(parent, name, type);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#createRecordCategory(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName, java.util.Map)
* @deprecated as of 2.1
*/
public NodeRef createRecordCategory(NodeRef parent, String name, QName type, Map<QName, Serializable> properties)
{
ParameterCheck.mandatory("parent", parent);
ParameterCheck.mandatory("name", name);
ParameterCheck.mandatory("type", type);
// Check that the parent is a container
QName parentType = nodeService.getType(parent);
if (TYPE_RECORDS_MANAGEMENT_CONTAINER.equals(parentType) == false &&
dictionaryService.isSubClass(parentType, TYPE_RECORDS_MANAGEMENT_CONTAINER) == false)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CONTAINER_PARENT_TYPE, parentType.toString()));
}
// Check that the the provided type is a sub-type of rm:recordCategory
if (TYPE_RECORD_CATEGORY.equals(type) == false &&
dictionaryService.isSubClass(type, TYPE_RECORD_CATEGORY) == false)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CONTAINER_TYPE, type.toString()));
}
// Set the properties for the record category
Map<QName, Serializable> props = new HashMap<QName, Serializable>(1);
if (properties != null && properties.size() != 0)
{
props.putAll(properties);
}
props.put(ContentModel.PROP_NAME, name);
return nodeService.createNode(
parent,
ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name),
type,
props).getChildRef();
return getFilePlanService().createRecordCategory(parent, name, type, properties);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#createRecordCategory(org.alfresco.service.cmr.repository.NodeRef, java.lang.String)
* @deprecated as of 2.1
*/
public NodeRef createRecordCategory(NodeRef parent, String name)
{
return createRecordCategory(parent, name, TYPE_RECORD_CATEGORY);
return getFilePlanService().createRecordCategory(parent, name);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#createRecordCategory(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map)
* @deprecated as of 2.1
*/
public NodeRef createRecordCategory(NodeRef parent, String name, Map<QName, Serializable> properties)
{
return createRecordCategory(parent, name, TYPE_RECORD_CATEGORY, properties);
return getFilePlanService().createRecordCategory(parent, name, properties);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#createRecordCategory(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName)
* @deprecated as of 2.1
*/
public NodeRef createRecordCategory(NodeRef parent, String name, QName type)
{
return createRecordCategory(parent, name, type, null);
return getFilePlanService().createRecordCategory(parent, name, type);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#getAllContained(org.alfresco.service.cmr.repository.NodeRef)
* @deprecated as of 2.1
*/
@Override
public List<NodeRef> getAllContained(NodeRef container)
{
return getAllContained(container, false);
return getFilePlanService().getAllContained(container);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#getAllContained(org.alfresco.service.cmr.repository.NodeRef, boolean)
* @deprecated as of 2.1
*/
@Override
public List<NodeRef> getAllContained(NodeRef container, boolean deep)
{
return getContained(container, null, deep);
return getFilePlanService().getAllContained(container, deep);
}
/**
* Get contained nodes of a particular type. If null return all.
*
* @param container container node reference
* @param typeFilter type filter, null if none
* @return {@link List}<{@link NodeRef> list of contained node references
*/
private List<NodeRef> getContained(NodeRef container, QName typeFilter, boolean deep)
{
// Parameter check
ParameterCheck.mandatory("container", container);
// Check we have a container in our hands
if (isRecordCategory(container) == false)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CONTAINER_EXPECTED));
}
List<NodeRef> result = new ArrayList<NodeRef>(1);
List<ChildAssociationRef> assocs = this.nodeService.getChildAssocs(container, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef assoc : assocs)
{
NodeRef child = assoc.getChildRef();
QName childType = nodeService.getType(child);
if (typeFilter == null ||
typeFilter.equals(childType) == true ||
dictionaryService.isSubClass(childType, typeFilter) == true)
{
result.add(child);
}
// Inspect the containers and add children if deep
if (deep == true &&
(TYPE_RECORD_CATEGORY.equals(childType) == true ||
dictionaryService.isSubClass(childType, TYPE_RECORD_CATEGORY) == true))
{
result.addAll(getContained(child, typeFilter, deep));
}
}
return result;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#getContainedRecordCategories(org.alfresco.service.cmr.repository.NodeRef)
* @deprecated as of 2.1
*/
@Override
public List<NodeRef> getContainedRecordCategories(NodeRef container)
{
return getContainedRecordCategories(container, false);
return getFilePlanService().getContainedRecordCategories(container);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#getContainedRecordCategories(org.alfresco.service.cmr.repository.NodeRef, boolean)
* @deprecated as of 2.1
*/
@Override
public List<NodeRef> getContainedRecordCategories(NodeRef container, boolean deep)
{
return getContained(container, TYPE_RECORD_CATEGORY, deep);
return getFilePlanService().getContainedRecordCategories(container, deep);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#getContainedRecordFolders(org.alfresco.service.cmr.repository.NodeRef)
* @deprecated as of 2.1
*/
@Override
public List<NodeRef> getContainedRecordFolders(NodeRef container)
{
return getContainedRecordFolders(container, false);
return getFilePlanService().getContainedRecordFolders(container);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#getContainedRecordFolders(org.alfresco.service.cmr.repository.NodeRef, boolean)
* @deprecated as of 2.1
*/
@Override
public List<NodeRef> getContainedRecordFolders(NodeRef container, boolean deep)
{
return getContained(container, TYPE_RECORD_FOLDER, deep);
return getFilePlanService().getContainedRecordFolders(container, deep);
}
/**

View File

@@ -26,7 +26,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService;
@@ -38,6 +37,7 @@ import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails;
import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent;
import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService;
import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
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.record.RecordService;

View File

@@ -20,6 +20,7 @@ package org.alfresco.module.org_alfresco_module_rm.action;
import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.repo.action.evaluator.ActionConditionEvaluatorAbstractBase;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
@@ -40,7 +41,10 @@ public abstract class RecordsManagementActionConditionEvaluatorAbstractBase exte
BeanNameAware
{
/** records management action service */
private RecordsManagementActionService recordsManagementActionService;
protected RecordsManagementActionService recordsManagementActionService;
/** File Plan Service */
protected FilePlanService filePlanService;
/** bean name */
private String name;
@@ -57,6 +61,14 @@ public abstract class RecordsManagementActionConditionEvaluatorAbstractBase exte
{
this.recordsManagementActionService = recordsManagementActionService;
}
/**
* @param filePlanService file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
/**
* @param retryingTransactionHelper

View File

@@ -20,7 +20,7 @@ package org.alfresco.module.org_alfresco_module_rm.action;
import java.util.Set;
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
import org.alfresco.service.cmr.action.ActionDefinition;
/**

View File

@@ -20,7 +20,7 @@ package org.alfresco.module.org_alfresco_module_rm.action;
import java.util.Set;
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
import org.alfresco.repo.action.ActionDefinitionImpl;
/**

View File

@@ -29,7 +29,7 @@ import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeRMActionExecution;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnRMActionExecution;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPoliciesUtil;
import org.alfresco.module.org_alfresco_module_rm.util.PoliciesUtil;
import org.alfresco.repo.policy.ClassPolicyDelegate;
import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
@@ -134,7 +134,7 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
protected void invokeBeforeRMActionExecution(NodeRef nodeRef, String name, Map<String, Serializable> parameters)
{
// get qnames to invoke against
Set<QName> qnames = RecordsManagementPoliciesUtil.getTypeAndAspectQNames(nodeService, nodeRef);
Set<QName> qnames = PoliciesUtil.getTypeAndAspectQNames(nodeService, nodeRef);
// execute policy for node type and aspects
BeforeRMActionExecution policy = beforeRMActionExecutionDelegate.get(qnames);
policy.beforeRMActionExecution(nodeRef, name, parameters);
@@ -150,7 +150,7 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
protected void invokeOnRMActionExecution(NodeRef nodeRef, String name, Map<String, Serializable> parameters)
{
// get qnames to invoke against
Set<QName> qnames = RecordsManagementPoliciesUtil.getTypeAndAspectQNames(nodeService, nodeRef);
Set<QName> qnames = PoliciesUtil.getTypeAndAspectQNames(nodeService, nodeRef);
// execute policy for node type and aspects
OnRMActionExecution policy = onRMActionExecutionDelegate.get(qnames);
policy.onRMActionExecution(nodeRef, name, parameters);

View File

@@ -25,6 +25,7 @@ import java.util.Set;
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
import org.alfresco.repo.action.constraint.BaseParameterConstraint;
import org.alfresco.repo.i18n.StaticMessageLookup;
import org.alfresco.service.cmr.dictionary.AspectDefinition;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.namespace.QName;
@@ -68,7 +69,7 @@ public class RecordTypeParameterConstraint extends BaseParameterConstraint
AspectDefinition aspectDefinition = dictionaryService.getAspect(recordType);
if (aspectDefinition != null)
{
result.put(aspectDefinition.getName().getLocalName(), aspectDefinition.getTitle());
result.put(aspectDefinition.getName().getLocalName(), aspectDefinition.getTitle(new StaticMessageLookup()));
}
}
return result;

View File

@@ -16,7 +16,7 @@
* 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;
package org.alfresco.module.org_alfresco_module_rm.action.evaluator;
/**
* Disposition action relative position enumeration class. <br>

View File

@@ -20,7 +20,6 @@ package org.alfresco.module.org_alfresco_module_rm.action.evaluator;
import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.DispositionActionRelativePositions;
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionConditionEvaluatorAbstractBase;
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction;
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition;
@@ -128,5 +127,4 @@ public class HasDispositionActionEvaluator extends RecordsManagementActionCondit
"rm-ac-disposition-actions"));
}
}

View File

@@ -20,9 +20,8 @@ package org.alfresco.module.org_alfresco_module_rm.action.evaluator;
import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionConditionEvaluatorAbstractBase;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
import org.alfresco.repo.action.ParameterDefinitionImpl;
import org.alfresco.service.cmr.action.ActionCondition;
import org.alfresco.service.cmr.action.ParameterDefinition;
@@ -50,23 +49,13 @@ public class IsKindEvaluator extends RecordsManagementActionConditionEvaluatorAb
public static final String NAME = "isKind";
public static final String PARAM_KIND = "kind";
private RecordsManagementService rmService;
/**
* @param rmService
*/
public void setRecordsManagementService(RecordsManagementService rmService)
{
this.rmService = rmService;
}
@Override
protected boolean evaluateImpl(ActionCondition actionCondition, NodeRef actionedUponNodeRef)
{
boolean result = false;
String kind = ((QName) actionCondition.getParameterValue(PARAM_KIND)).getLocalName();
FilePlanComponentKind filePlanComponentKind = rmService.getFilePlanComponentKind(actionedUponNodeRef);
FilePlanComponentKind filePlanComponentKind = filePlanService.getFilePlanComponentKind(actionedUponNodeRef);
if (filePlanComponentKind.toString().equals(kind))
{

View File

@@ -20,6 +20,7 @@ package org.alfresco.module.org_alfresco_module_rm.action.impl;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.repository.NodeRef;
import org.apache.commons.logging.Log;
@@ -35,6 +36,17 @@ public class CreateDispositionScheduleAction extends RMActionExecuterAbstractBas
/** Logger */
@SuppressWarnings("unused")
private static Log logger = LogFactory.getLog(CreateDispositionScheduleAction.class);
/** file plan service */
private FilePlanService filePlanService;
/**
* @param filePlanService file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
/**
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
@@ -42,7 +54,7 @@ public class CreateDispositionScheduleAction extends RMActionExecuterAbstractBas
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
if (recordsManagementService.isRecordCategory(actionedUponNodeRef) == true)
if (filePlanService.isRecordCategory(actionedUponNodeRef) == true)
{
// Create the disposition schedule
dispositionService.createDispositionSchedule(actionedUponNodeRef, null);

View File

@@ -167,7 +167,7 @@ public class FileToAction extends RMActionExecuterAbstractBase
}
// ensure we are trying to create a record folder in a record category
if (recordsManagementService.isRecordCategory(parent) == false)
if (filePlanService.isRecordCategory(parent) == false)
{
throw new AlfrescoRuntimeException("Unable to create nre record folder, beacuse the parent is not a record category.");
}

View File

@@ -33,7 +33,6 @@ import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPoliciesUtil;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeCreateReference;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeRemoveReference;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnCreateReference;
@@ -43,6 +42,7 @@ import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstrain
import org.alfresco.module.org_alfresco_module_rm.compatibility.CompatibilityModel;
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.util.PoliciesUtil;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.dictionary.DictionaryRepositoryBootstrap;
import org.alfresco.repo.dictionary.IndexTokenisationMode;
@@ -225,7 +225,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
protected void invokeBeforeCreateReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference)
{
// get qnames to invoke against
Set<QName> qnames = RecordsManagementPoliciesUtil.getTypeAndAspectQNames(nodeService, fromNodeRef);
Set<QName> qnames = PoliciesUtil.getTypeAndAspectQNames(nodeService, fromNodeRef);
// execute policy for node type and aspects
BeforeCreateReference policy = beforeCreateReferenceDelegate.get(qnames);
policy.beforeCreateReference(fromNodeRef, toNodeRef, reference);
@@ -234,7 +234,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
protected void invokeOnCreateReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference)
{
// get qnames to invoke against
Set<QName> qnames = RecordsManagementPoliciesUtil.getTypeAndAspectQNames(nodeService, fromNodeRef);
Set<QName> qnames = PoliciesUtil.getTypeAndAspectQNames(nodeService, fromNodeRef);
// execute policy for node type and aspects
OnCreateReference policy = onCreateReferenceDelegate.get(qnames);
policy.onCreateReference(fromNodeRef, toNodeRef, reference);
@@ -243,7 +243,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
protected void invokeBeforeRemoveReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference)
{
// get qnames to invoke against
Set<QName> qnames = RecordsManagementPoliciesUtil.getTypeAndAspectQNames(nodeService, fromNodeRef);
Set<QName> qnames = PoliciesUtil.getTypeAndAspectQNames(nodeService, fromNodeRef);
// execute policy for node type and aspects
BeforeRemoveReference policy = beforeRemoveReferenceDelegate.get(qnames);
policy.beforeRemoveReference(fromNodeRef, toNodeRef, reference);
@@ -258,7 +258,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
protected void invokeOnRemoveReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference)
{
// get qnames to invoke against
Set<QName> qnames = RecordsManagementPoliciesUtil.getTypeAndAspectQNames(nodeService, fromNodeRef);
Set<QName> qnames = PoliciesUtil.getTypeAndAspectQNames(nodeService, fromNodeRef);
// execute policy for node type and aspects
OnRemoveReference policy = onRemoveReferenceDelegate.get(qnames);
policy.onRemoveReference(fromNodeRef, toNodeRef, reference);

View File

@@ -23,6 +23,7 @@ import java.util.List;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.repo.audit.extractor.AbstractDataExtractor;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -41,7 +42,7 @@ import org.alfresco.service.cmr.repository.NodeService;
public final class FilePlanNamePathDataExtractor extends AbstractDataExtractor
{
private NodeService nodeService;
private RecordsManagementService rmService;
private FilePlanService filePlanService;
/**
* Used to check that the node in the context is a fileplan component
@@ -52,12 +53,12 @@ public final class FilePlanNamePathDataExtractor extends AbstractDataExtractor
}
/**
* Used to find the RM root
* @param filePlanService file plan service
*/
public void setRmService(RecordsManagementService rmService)
public void setFilePlanService(FilePlanService filePlanService)
{
this.rmService = rmService;
}
this.filePlanService = filePlanService;
}
/**
* @return Returns <tt>true</tt> if the data is a NodeRef and it represents
@@ -72,12 +73,15 @@ public final class FilePlanNamePathDataExtractor extends AbstractDataExtractor
return nodeService.hasAspect((NodeRef)data, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT);
}
/**
* @see org.alfresco.repo.audit.extractor.DataExtractor#extractData(java.io.Serializable)
*/
public Serializable extractData(Serializable value) throws Throwable
{
NodeRef nodeRef = (NodeRef) value;
// Get path from the RM root
List<NodeRef> nodeRefPath = rmService.getNodeRefPath(nodeRef);
List<NodeRef> nodeRefPath = filePlanService.getNodeRefPath(nodeRef);
StringBuilder sb = new StringBuilder(128);
for (NodeRef pathNodeRef : nodeRefPath)

View File

@@ -22,6 +22,7 @@ import java.io.Serializable;
import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.repo.audit.extractor.AbstractDataExtractor;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -35,12 +36,12 @@ import org.alfresco.service.cmr.repository.NodeService;
* @see RecordsManagementService#getNodeRefPath(NodeRef)
*
* @author Derek Hulley
* @since 3.2
* @since 1.0
*/
public final class FilePlanNodeRefPathDataExtractor extends AbstractDataExtractor
{
private NodeService nodeService;
private RecordsManagementService rmService;
private FilePlanService filePlanService;
/**
* Used to check that the node in the context is a fileplan component
@@ -50,13 +51,10 @@ public final class FilePlanNodeRefPathDataExtractor extends AbstractDataExtracto
this.nodeService = nodeService;
}
/**
* Used to find the RM root
*/
public void setRmService(RecordsManagementService rmService)
public void setFilePlanService(FilePlanService filePlanService)
{
this.rmService = rmService;
}
this.filePlanService = filePlanService;
}
/**
* @return Returns <tt>true</tt> if the data is a NodeRef and it represents
@@ -76,7 +74,7 @@ public final class FilePlanNodeRefPathDataExtractor extends AbstractDataExtracto
NodeRef nodeRef = (NodeRef) value;
// Get path from the RM root
List<NodeRef> nodeRefPath = rmService.getNodeRefPath(nodeRef);
List<NodeRef> nodeRefPath = filePlanService.getNodeRefPath(nodeRef);
// Done
return (Serializable) nodeRefPath;

View File

@@ -68,40 +68,83 @@ public interface RecordsManagementAuditService
public static final String RM_AUDIT_DATA_LOGIN_ERROR = "/RM/login/error/value";
/**
* Starts RM auditing.
* @deprecated as of 2.1, see {@link #start(NodeRef)}
*/
@Deprecated
void start();
/**
* Stops RM auditing.
* Start RM auditing.
*
* @param filePlan file plan
*/
void startAuditLog(NodeRef filePlan);
/**
* @deprecated as of 2.1, see {@link #stop(NodeRef)}
*/
@Deprecated
void stop();
/**
* Clears the RM audit trail.
* Stop RM auditing.
*
* @param filePlan file plan
*/
void stopAuditLog(NodeRef filePlan);
/**
* @deprecated as of 2.1, see {@link #clear(NodeRef)}
*/
@Deprecated
void clear();
/**
* Clears the RM audit.
*
* @param filePlan file plan
*/
void clearAuditLog(NodeRef filePlan);
/**
* @deprecated as of 2.1, see {@link #isEnabled(NodeRef)}
*/
@Deprecated
boolean isEnabled();
/**
* Determines whether the RM audit log is currently enabled.
*
* @param filePlan file plan
* @return true if RM auditing is active false otherwise
*/
boolean isEnabled();
boolean isAuditLogEnabled(NodeRef filePlan);
/**
* @deprecated as of 2.1, see {@link #getDateLastStarted(NodeRef)}
*/
@Deprecated
Date getDateLastStarted();
/**
* Returns the date the RM audit was last started.
*
* @return Date the audit was last started
* @param filePlan file plan
* @return Date the audit was last started
*/
Date getDateLastStarted();
Date getDateAuditLogLastStarted(NodeRef filePlan);
/**
* @deprecated as of 2.1, see {@link #getDateLastStopped(NodeRef)}
*/
Date getDateLastStopped();
/**
* Returns the date the RM audit was last stopped.
*
* @return Date the audit was last stopped
*/
Date getDateLastStopped();
Date getDateAuditLogLastStopped(NodeRef filePlan);
/**
* An explicit call that RM actions can make to have the events logged.
@@ -157,8 +200,7 @@ public interface RecordsManagementAuditService
* @param format The format the report should be produced in
* @return NodeRef of the undeclared record filed
*/
NodeRef fileAuditTrailAsRecord(RecordsManagementAuditQueryParameters params,
NodeRef destination, ReportFormat format);
NodeRef fileAuditTrailAsRecord(RecordsManagementAuditQueryParameters params, NodeRef destination, ReportFormat format);
/**
* Retrieves a list of audit events.

View File

@@ -36,6 +36,7 @@ import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction;
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.repo.audit.AuditComponent;
import org.alfresco.repo.audit.model.AuditApplication;
@@ -88,11 +89,11 @@ import org.springframework.extensions.surf.util.ParameterCheck;
* @since 3.2
*/
public class RecordsManagementAuditServiceImpl
extends AbstractLifecycleBean
implements RecordsManagementAuditService,
NodeServicePolicies.OnCreateNodePolicy,
NodeServicePolicies.BeforeDeleteNodePolicy,
NodeServicePolicies.OnUpdatePropertiesPolicy
extends AbstractLifecycleBean
implements RecordsManagementAuditService,
NodeServicePolicies.OnCreateNodePolicy,
NodeServicePolicies.BeforeDeleteNodePolicy,
NodeServicePolicies.OnUpdatePropertiesPolicy
{
/** I18N */
private static final String MSG_UPDATED_METADATA = "rm.audit.updated-metadata";
@@ -149,16 +150,13 @@ public class RecordsManagementAuditServiceImpl
private AuditService auditService;
private RecordsManagementService rmService;
private RecordsManagementActionService rmActionService;
private FilePlanService filePlanService;
private boolean shutdown = false;
private RMAuditTxnListener txnListener;
private Map<String, AuditEvent> auditEvents;
public RecordsManagementAuditServiceImpl()
{
}
/**
* Set the component used to bind to behaviour callbacks
*/
@@ -230,6 +228,14 @@ public class RecordsManagementAuditServiceImpl
{
this.rmActionService = rmActionService;
}
/**
* @param filePlanService file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
/**
* Checks that all necessary properties have been set.
@@ -245,6 +251,7 @@ public class RecordsManagementAuditServiceImpl
PropertyCheck.mandatory(this, "rmService", rmService);
PropertyCheck.mandatory(this, "rmActionService", rmActionService);
PropertyCheck.mandatory(this, "dictionaryService", dictionaryService);
PropertyCheck.mandatory(this, "filePlanService", filePlanService);
// setup the audit events map
initAuditEvents();
@@ -357,12 +364,44 @@ public class RecordsManagementAuditServiceImpl
{
shutdown = true;
}
/*** TODO remove this when we support multiple file plans ****/
private NodeRef defaultFilePlan;
private NodeRef getDefaultFilePlan()
{
if (defaultFilePlan == null)
{
defaultFilePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
if (defaultFilePlan == null)
{
throw new AlfrescoRuntimeException("Default file plan could not be found.");
}
}
return defaultFilePlan;
}
/*** TODO end ***/
/**
* {@inheritDoc}
*/
public boolean isEnabled()
@Override
@Deprecated
public boolean isEnabled()
{
return isAuditLogEnabled(getDefaultFilePlan());
}
/**
* {@inheritDoc}
*/
public boolean isAuditLogEnabled(NodeRef filePlan)
{
ParameterCheck.mandatory("filePlan", filePlan);
// TODO use file plan to scope audit log
return auditService.isAuditEnabled(
RecordsManagementAuditService.RM_AUDIT_APPLICATION_NAME,
RecordsManagementAuditService.RM_AUDIT_PATH_ROOT);
@@ -371,32 +410,71 @@ public class RecordsManagementAuditServiceImpl
/**
* {@inheritDoc}
*/
@Deprecated
public void start()
{
startAuditLog(getDefaultFilePlan());
}
/**
* {@inheritDoc}
*/
public void startAuditLog(NodeRef filePlan)
{
ParameterCheck.mandatory("filePlan", filePlan);
// TODO use file plan to scope audit log
auditService.enableAudit(
RecordsManagementAuditService.RM_AUDIT_APPLICATION_NAME,
RecordsManagementAuditService.RM_AUDIT_PATH_ROOT);
if (logger.isInfoEnabled())
{
logger.info("Started Records Management auditing");
}
}
/**
* {@inheritDoc}
*/
@Deprecated
public void stop()
{
stopAuditLog(getDefaultFilePlan());
}
/**
* {@inheritDoc}
*/
public void stopAuditLog(NodeRef filePlan)
{
ParameterCheck.mandatory("filePlan", filePlan);
// TODO use file plan to scope audit log
auditService.disableAudit(
RecordsManagementAuditService.RM_AUDIT_APPLICATION_NAME,
RecordsManagementAuditService.RM_AUDIT_PATH_ROOT);
if (logger.isInfoEnabled())
logger.info("Stopped Records Management auditing");
}
/**
* {@inheritDoc}
*/
@Deprecated
public void clear()
{
clearAuditLog(getDefaultFilePlan());
}
/**
* {@inheritDoc}
*/
public void clear()
public void clearAuditLog(NodeRef filePlan)
{
ParameterCheck.mandatory("filePlan", filePlan);
// TODO use file plan to scope audit log
auditService.clearAudit(RecordsManagementAuditService.RM_AUDIT_APPLICATION_NAME, null, null);
if (logger.isInfoEnabled())
logger.debug("Records Management audit log has been cleared");
@@ -405,17 +483,41 @@ public class RecordsManagementAuditServiceImpl
/**
* {@inheritDoc}
*/
@Deprecated
public Date getDateLastStarted()
{
return getDateAuditLogLastStarted(getDefaultFilePlan());
}
/**
* {@inheritDoc}
*/
public Date getDateAuditLogLastStarted(NodeRef filePlan)
{
ParameterCheck.mandatory("filePlan", filePlan);
// TODO use file plan to scope audit log
// TODO: return proper date, for now it's today's date
return new Date();
}
/**
* {@inheritDoc}
*/
@Deprecated
public Date getDateLastStopped()
{
return getDateAuditLogLastStopped(getDefaultFilePlan());
}
/**
* {@inheritDoc}
*/
public Date getDateLastStopped()
public Date getDateAuditLogLastStopped(NodeRef filePlan)
{
ParameterCheck.mandatory("filePlan", filePlan);
// TODO use file plan to scope audit log
// TODO: return proper date, for now it's today's date
return new Date();
}
@@ -432,10 +534,6 @@ public class RecordsManagementAuditServiceImpl
private Map<QName, Serializable> nodePropertiesBefore;
private Map<QName, Serializable> nodePropertiesAfter;
private RMAuditNode()
{
}
public String getEventName()
{
return eventName;

View File

@@ -0,0 +1,29 @@
/*
* 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.capability;
import org.alfresco.module.org_alfresco_module_rm.capability.policy.Policy;
/**
* @author Roy Wetherall
*/
public interface PolicyRegister
{
void registerPolicy(Policy policy);
}

View File

@@ -31,6 +31,8 @@ import net.sf.acegisecurity.vote.AccessDecisionVoter;
import org.alfresco.module.org_alfresco_module_rm.capability.policy.ConfigAttributeDefinition;
import org.alfresco.module.org_alfresco_module_rm.capability.policy.Policy;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
import org.alfresco.repo.transaction.TransactionalResourceHelper;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.cmr.security.OwnableService;
@@ -43,35 +45,38 @@ import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
/**
* Records managment entry voter.
*
* @author Roy Wetherall, Andy Hind
*/
public class RMEntryVoter extends RMSecurityCommon
implements AccessDecisionVoter, InitializingBean, ApplicationContextAware
implements AccessDecisionVoter, InitializingBean, ApplicationContextAware, PolicyRegister
{
/** Logger */
private static Log logger = LogFactory.getLog(RMEntryVoter.class);
private NamespacePrefixResolver nspr;
private SearchService searchService;
/** Namespace resolver */
private NamespacePrefixResolver nspr;
/** Search service */
private SearchService searchService;
/** Ownable service */
private OwnableService ownableService;
/** Capability Service */
private CapabilityService capabilityService;
/** Policy map */
private HashMap<String, Policy> policies = new HashMap<String, Policy>();
// static
// {
// policies.put("Read", new ReadPolicy());
// policies.put("Create", new CreatePolicy());
// policies.put("Move", new MovePolicy());
// policies.put("Update", new UpdatePolicy());
// policies.put("Delete", new DeletePolicy());
// policies.put("UpdateProperties", new UpdatePropertiesPolicy());
// policies.put("Assoc", new AssocPolicy());
// policies.put("WriteContent", new WriteContentPolicy());
// policies.put("Capability", new CapabilityPolicy());
// policies.put("Declare", new DeclarePolicy());
// policies.put("ReadProperty", new ReadPropertyPolicy());
// }
/** Application context */
private ApplicationContext applicationContext;
/**
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
*/
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
{
@@ -87,7 +92,6 @@ public class RMEntryVoter extends RMSecurityCommon
}
/**
* Get the search service
* @return search service
*/
public SearchService getSearchService()
@@ -100,8 +104,7 @@ public class RMEntryVoter extends RMSecurityCommon
}
/**
*
* @return
* @return ownable service
*/
public OwnableService getOwnableService()
{
@@ -113,9 +116,7 @@ public class RMEntryVoter extends RMSecurityCommon
}
/**
* Set the name space prefix resolver
*
* @param nspr
* @param nspr namespace prefix resolver
*/
public void setNamespacePrefixResolver(NamespacePrefixResolver nspr)
{
@@ -138,10 +139,13 @@ public class RMEntryVoter extends RMSecurityCommon
@Override
public boolean supports(ConfigAttribute attribute)
{
if ((attribute.getAttribute() != null)
&& (attribute.getAttribute().equals(ConfigAttributeDefinition.RM_ABSTAIN)
|| attribute.getAttribute().equals(ConfigAttributeDefinition.RM_QUERY) || attribute.getAttribute().equals(ConfigAttributeDefinition.RM_ALLOW) || attribute.getAttribute().equals(ConfigAttributeDefinition.RM_DENY)
|| attribute.getAttribute().startsWith(ConfigAttributeDefinition.RM_CAP) || attribute.getAttribute().startsWith(ConfigAttributeDefinition.RM)))
if ((attribute.getAttribute() != null) &&
(attribute.getAttribute().equals(ConfigAttributeDefinition.RM_ABSTAIN) ||
attribute.getAttribute().equals(ConfigAttributeDefinition.RM_QUERY) ||
attribute.getAttribute().equals(ConfigAttributeDefinition.RM_ALLOW) ||
attribute.getAttribute().equals(ConfigAttributeDefinition.RM_DENY) ||
attribute.getAttribute().startsWith(ConfigAttributeDefinition.RM_CAP) ||
attribute.getAttribute().startsWith(ConfigAttributeDefinition.RM)))
{
return true;
}
@@ -151,132 +155,174 @@ public class RMEntryVoter extends RMSecurityCommon
}
}
/**
* @see net.sf.acegisecurity.vote.AccessDecisionVoter#supports(java.lang.Class)
*/
@SuppressWarnings("unchecked")
public boolean supports(Class clazz)
{
return (MethodInvocation.class.isAssignableFrom(clazz));
}
/**
* @see net.sf.acegisecurity.vote.AccessDecisionVoter#vote(net.sf.acegisecurity.Authentication, java.lang.Object, net.sf.acegisecurity.ConfigAttributeDefinition)
*/
@SuppressWarnings("unchecked")
public int vote(Authentication authentication, Object object, net.sf.acegisecurity.ConfigAttributeDefinition config)
{
if (logger.isDebugEnabled())
{
MethodInvocation mi = (MethodInvocation) object;
logger.debug("Method: " + mi.getMethod().toString());
}
// The system user can do anything
if (AuthenticationUtil.isRunAsUserTheSystemUser())
{
if (logger.isDebugEnabled())
{
logger.debug("Access granted for the system user");
}
return AccessDecisionVoter.ACCESS_GRANTED;
}
List<ConfigAttributeDefinition> supportedDefinitions = extractSupportedDefinitions(config);
// No RM definitions so we do not vote
if (supportedDefinitions.size() == 0)
{
return AccessDecisionVoter.ACCESS_ABSTAIN;
}
MethodInvocation invocation = (MethodInvocation) object;
Method method = invocation.getMethod();
Class[] params = method.getParameterTypes();
// If there are only capability (RM_CAP) and policy (RM) entries non must deny
// If any abstain we deny
// All present must vote to allow unless an explicit direction comes first (e.g. RM_ALLOW)
for (ConfigAttributeDefinition cad : supportedDefinitions)
{
// Whatever is found first takes precedence
if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_DENY))
{
return AccessDecisionVoter.ACCESS_DENIED;
}
else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_ABSTAIN))
{
return AccessDecisionVoter.ACCESS_ABSTAIN;
}
else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_ALLOW))
{
return AccessDecisionVoter.ACCESS_GRANTED;
}
// RM_QUERY is a special case - the entry is allowed and filtering sorts out the results
// It is distinguished from RM_ALLOW so query may have additional behaviour in the future
else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_QUERY))
{
return AccessDecisionVoter.ACCESS_GRANTED;
}
// Ignore config that references method arguments that do not exist
// Arguably we should deny here but that requires a full impact analysis
// These entries effectively abstain
else if (((cad.getParameters().get(0) != null) && (cad.getParameters().get(0) >= invocation.getArguments().length)) ||
((cad.getParameters().get(1) != null) && (cad.getParameters().get(1) >= invocation.getArguments().length)))
{
continue;
}
else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_CAP))
{
switch(checkCapability(invocation, params, cad))
{
case AccessDecisionVoter.ACCESS_DENIED:
return AccessDecisionVoter.ACCESS_DENIED;
case AccessDecisionVoter.ACCESS_ABSTAIN:
if(logger.isDebugEnabled())
{
if(logger.isTraceEnabled())
{
logger.trace("Capability " + cad.getRequired() + " abstained for " + invocation.getMethod(), new IllegalStateException());
}
else
{
logger.debug("Capability " + cad.getRequired() + " abstained for " + invocation.getMethod());
}
}
// abstain denies
return AccessDecisionVoter.ACCESS_DENIED;
case AccessDecisionVoter.ACCESS_GRANTED:
break;
}
}
else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM))
{
switch(checkPolicy(invocation, params, cad))
{
case AccessDecisionVoter.ACCESS_DENIED:
return AccessDecisionVoter.ACCESS_DENIED;
case AccessDecisionVoter.ACCESS_ABSTAIN:
if(logger.isDebugEnabled())
{
if(logger.isTraceEnabled())
{
logger.trace("Policy " + cad.getPolicyName() + " abstained for " + invocation.getMethod(), new IllegalStateException());
}
else
{
logger.debug("Policy " + cad.getPolicyName() + " abstained for " + invocation.getMethod());
}
}
// abstain denies
return AccessDecisionVoter.ACCESS_DENIED;
case AccessDecisionVoter.ACCESS_GRANTED:
break;
}
}
MethodInvocation mi = (MethodInvocation)object;
if (TransactionalResourceHelper.isResourcePresent("voting") == true)
{
if (logger.isDebugEnabled())
{
logger.debug(" .. grant access already voting: " + mi.getMethod().getDeclaringClass().getName() + "." + mi.getMethod().getName());
}
return AccessDecisionVoter.ACCESS_GRANTED;
}
if (logger.isDebugEnabled())
{
logger.debug("Method: " + mi.getMethod().getDeclaringClass().getName() + "." + mi.getMethod().getName());
}
AlfrescoTransactionSupport.bindResource("voting", true);
try
{
// The system user can do anything
if (AuthenticationUtil.isRunAsUserTheSystemUser())
{
if (logger.isDebugEnabled())
{
logger.debug("Access granted for the system user");
}
return AccessDecisionVoter.ACCESS_GRANTED;
}
List<ConfigAttributeDefinition> supportedDefinitions = extractSupportedDefinitions(config);
// No RM definitions so we do not vote
if (supportedDefinitions.size() == 0)
{
return AccessDecisionVoter.ACCESS_ABSTAIN;
}
MethodInvocation invocation = (MethodInvocation) object;
Method method = invocation.getMethod();
Class[] params = method.getParameterTypes();
// If there are only capability (RM_CAP) and policy (RM) entries non must deny
// If any abstain we deny
// All present must vote to allow unless an explicit direction comes first (e.g. RM_ALLOW)
for (ConfigAttributeDefinition cad : supportedDefinitions)
{
// Whatever is found first takes precedence
if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_DENY))
{
return AccessDecisionVoter.ACCESS_DENIED;
}
else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_ABSTAIN))
{
return AccessDecisionVoter.ACCESS_ABSTAIN;
}
else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_ALLOW))
{
return AccessDecisionVoter.ACCESS_GRANTED;
}
// RM_QUERY is a special case - the entry is allowed and filtering sorts out the results
// It is distinguished from RM_ALLOW so query may have additional behaviour in the future
else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_QUERY))
{
return AccessDecisionVoter.ACCESS_GRANTED;
}
// Ignore config that references method arguments that do not exist
// Arguably we should deny here but that requires a full impact analysis
// These entries effectively abstain
else if (((cad.getParameters().get(0) != null) && (cad.getParameters().get(0) >= invocation.getArguments().length)) ||
((cad.getParameters().get(1) != null) && (cad.getParameters().get(1) >= invocation.getArguments().length)))
{
continue;
}
else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM_CAP))
{
switch(checkCapability(invocation, params, cad))
{
case AccessDecisionVoter.ACCESS_DENIED:
{
return AccessDecisionVoter.ACCESS_DENIED;
}
case AccessDecisionVoter.ACCESS_ABSTAIN:
{
if(logger.isDebugEnabled())
{
if(logger.isTraceEnabled())
{
logger.trace("Capability " + cad.getRequired() + " abstained for " + invocation.getMethod(), new IllegalStateException());
}
else
{
logger.debug("Capability " + cad.getRequired() + " abstained for " + invocation.getMethod());
}
}
// abstain denies
return AccessDecisionVoter.ACCESS_DENIED;
}
case AccessDecisionVoter.ACCESS_GRANTED:
{
break;
}
}
}
else if (cad.getTypeString().equals(ConfigAttributeDefinition.RM))
{
switch(checkPolicy(invocation, params, cad))
{
case AccessDecisionVoter.ACCESS_DENIED:
{
return AccessDecisionVoter.ACCESS_DENIED;
}
case AccessDecisionVoter.ACCESS_ABSTAIN:
{
if(logger.isDebugEnabled())
{
if(logger.isTraceEnabled())
{
logger.trace("Policy " + cad.getPolicyName() + " abstained for " + invocation.getMethod(), new IllegalStateException());
}
else
{
logger.debug("Policy " + cad.getPolicyName() + " abstained for " + invocation.getMethod());
}
}
// abstain denies
return AccessDecisionVoter.ACCESS_DENIED;
}
case AccessDecisionVoter.ACCESS_GRANTED:
{
break;
}
}
}
}
}
finally
{
AlfrescoTransactionSupport.unbindResource("voting");
}
// all voted to allow
return AccessDecisionVoter.ACCESS_GRANTED;
}
/**
*
* @param invocation
* @param params
* @param cad
* @return
*/
@SuppressWarnings("unchecked")
private int checkCapability(MethodInvocation invocation, Class[] params, ConfigAttributeDefinition cad)
{
@@ -294,6 +340,13 @@ public class RMEntryVoter extends RMSecurityCommon
}
/**
*
* @param invocation
* @param params
* @param cad
* @return
*/
@SuppressWarnings("unchecked")
private int checkPolicy(MethodInvocation invocation, Class[] params, ConfigAttributeDefinition cad)
{
@@ -308,12 +361,18 @@ public class RMEntryVoter extends RMSecurityCommon
}
}
/**
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
*/
public void afterPropertiesSet() throws Exception
{
// TODO Auto-generated method stub
{
}
/**
*
* @param config
* @return
*/
@SuppressWarnings("unchecked")
private List<ConfigAttributeDefinition> extractSupportedDefinitions(net.sf.acegisecurity.ConfigAttributeDefinition config)
{
@@ -331,6 +390,5 @@ public class RMEntryVoter extends RMSecurityCommon
}
return definitions;
}
}
}

View File

@@ -18,10 +18,9 @@
*/
package org.alfresco.module.org_alfresco_module_rm.capability;
import java.util.List;
import net.sf.acegisecurity.vote.AccessDecisionVoter;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigComponent;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
@@ -143,7 +142,7 @@ public class RMSecurityCommon
{
int result = AccessDecisionVoter.ACCESS_ABSTAIN;
if (rmService.isFilePlanComponent(nodeRef) == true)
if (filePlanService.isFilePlanComponent(nodeRef) == true)
{
result = checkRmRead(nodeRef);
}
@@ -230,18 +229,16 @@ public class RMSecurityCommon
NodeRef testNodeRef = null;
if (position < 0)
{
// Test against the fileplan root node
List<NodeRef> rmRoots = rmService.getFilePlans();
if (rmRoots.size() != 0)
testNodeRef = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
if (testNodeRef == null)
{
throw new AlfrescoRuntimeException("Unable to find default file plan node.");
}
if (logger.isDebugEnabled())
{
// TODO for now we can take the first one as we only support a single rm site
testNodeRef = rmRoots.get(0);
if (logger.isDebugEnabled())
{
logger.debug("\tPermission test against the rm root node " + nodeService.getPath(testNodeRef));
}
}
logger.debug("\tPermission test against the file plan node " + nodeService.getPath(testNodeRef));
}
}
else if (StoreRef.class.isAssignableFrom(params[position]))
{

View File

@@ -19,6 +19,7 @@
package org.alfresco.module.org_alfresco_module_rm.capability.declarative;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
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.record.RecordService;
@@ -44,6 +45,7 @@ public abstract class AbstractCapabilityCondition implements CapabilityCondition
protected PermissionService permissionService;
protected NodeService nodeService;
protected FreezeService freezeService;
protected FilePlanService filePlanService;
/**
* @param rmService records management service
@@ -85,6 +87,14 @@ public abstract class AbstractCapabilityCondition implements CapabilityCondition
this.freezeService = freezeService;
}
/**
* @param filePlanService file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#getName()
*/

View File

@@ -26,9 +26,9 @@ import java.util.Map;
import net.sf.acegisecurity.vote.AccessDecisionVoter;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.capability.AbstractCapability;
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.security.AccessStatus;
import org.apache.commons.logging.Log;
@@ -255,7 +255,7 @@ public class DeclarativeCapability extends AbstractCapability
{
boolean result = false;
FilePlanComponentKind actualKind = rmService.getFilePlanComponentKind(nodeRef);
FilePlanComponentKind actualKind = filePlanService.getFilePlanComponentKind(nodeRef);
if (actualKind != null)
{
@@ -292,7 +292,7 @@ public class DeclarativeCapability extends AbstractCapability
int result = AccessDecisionVoter.ACCESS_ABSTAIN;
// Check we are dealing with a file plan component
if (rmService.isFilePlanComponent(nodeRef) == true)
if (filePlanService.isFilePlanComponent(nodeRef) == true)
{
// Check the kind of the object, the permissions and the conditions
if (checkKinds(nodeRef) == true && checkPermissions(nodeRef) == true && checkConditions(nodeRef) == true)

View File

@@ -18,8 +18,8 @@
*/
package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition;
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
import org.alfresco.service.cmr.repository.NodeRef;
/**
@@ -31,7 +31,7 @@ public class DeclaredCapabilityCondition extends AbstractCapabilityCondition
public boolean evaluate(NodeRef nodeRef)
{
boolean result = false;
if (FilePlanComponentKind.RECORD.equals(rmService.getFilePlanComponentKind(nodeRef)) == true)
if (FilePlanComponentKind.RECORD.equals(filePlanService.getFilePlanComponentKind(nodeRef)) == true)
{
result = recordService.isDeclared(nodeRef);
}

View File

@@ -18,8 +18,8 @@
*/
package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition;
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
import org.alfresco.service.cmr.repository.NodeRef;
/**
@@ -35,7 +35,7 @@ public class FrozenOrHoldCondition extends AbstractCapabilityCondition
@Override
public boolean evaluate(NodeRef nodeRef)
{
FilePlanComponentKind kind = rmService.getFilePlanComponentKind(nodeRef);
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
return (freezeService.isFrozen(nodeRef) ||
(kind != null && kind.equals(FilePlanComponentKind.HOLD)));
}

View File

@@ -38,7 +38,7 @@ public class IsRecordCategoryCondition extends AbstractCapabilityCondition
{
ParameterCheck.mandatory("nodeRef", nodeRef);
return rmService.isRecordCategory(nodeRef);
return filePlanService.isRecordCategory(nodeRef);
}
}

View File

@@ -18,8 +18,8 @@
*/
package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition;
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
import org.alfresco.service.cmr.repository.NodeRef;
/**
@@ -35,7 +35,7 @@ public class IsTransferAccessionCapabilityCondition extends AbstractCapabilityCo
{
boolean result = false;
FilePlanComponentKind kind = rmService.getFilePlanComponentKind(nodeRef);
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
if (FilePlanComponentKind.TRANSFER.equals(kind) == true)
{
Boolean value = (Boolean)nodeService.getProperty(nodeRef, PROP_TRANSFER_ACCESSION_INDICATOR);

View File

@@ -45,11 +45,11 @@ public class ChangeOrDeleteReferencesCapability extends DeclarativeCapability
*/
public int evaluate(NodeRef source, NodeRef target)
{
if (rmService.isFilePlanComponent(source))
if (filePlanService.isFilePlanComponent(source))
{
if (target != null)
{
if (rmService.isFilePlanComponent(target) == true)
if (filePlanService.isFilePlanComponent(target) == true)
{
if (checkConditions(source) == true && checkConditions(target) == true)
{

View File

@@ -72,7 +72,7 @@ public class CreateCapability extends DeclarativeCapability
return AccessDecisionVoter.ACCESS_DENIED;
}
}
if (rmService.isFilePlanComponent(destination))
if (filePlanService.isFilePlanComponent(destination))
{
if ((assocType == null) || assocType.equals(ContentModel.ASSOC_CONTAINS) == false)
{

View File

@@ -45,8 +45,8 @@ public class DeleteLinksCapability extends DeclarativeCapability
*/
public int evaluate(NodeRef source, NodeRef target)
{
if (rmService.isFilePlanComponent(source) == true &&
rmService.isFilePlanComponent(target) == true)
if (filePlanService.isFilePlanComponent(source) == true &&
filePlanService.isFilePlanComponent(target) == true)
{
if (checkConditions(source) == true && checkConditions(target) == true)
{

View File

@@ -32,7 +32,7 @@ public final class ViewRecordsCapability extends DeclarativeCapability
{
if (nodeRef != null)
{
if (rmService.isFilePlanComponent(nodeRef) == true)
if (filePlanService.isFilePlanComponent(nodeRef) == true)
{
return checkRmRead(nodeRef);
}

View File

@@ -22,7 +22,7 @@ import java.io.Serializable;
import java.util.Map;
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
import org.alfresco.module.org_alfresco_module_rm.capability.RMEntryVoter;
import org.alfresco.module.org_alfresco_module_rm.capability.PolicyRegister;
import org.alfresco.module.org_alfresco_module_rm.capability.RMSecurityCommon;
import org.alfresco.repo.security.permissions.impl.acegi.ACLEntryVoterException;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -46,8 +46,8 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
/** Capability service */
protected CapabilityService capabilityService;
/** RM entry */
protected RMEntryVoter rmEntryVoter;
/** Policy register */
protected PolicyRegister policyRegister;
/** Policy name */
protected String name;
@@ -78,19 +78,19 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
}
/**
* @param rmEntryVoter rm entry voter
* @param policyRegister policy register
*/
public void setRmEntryVoter(RMEntryVoter rmEntryVoter)
public void setPolicyRegister(PolicyRegister policyRegister)
{
this.rmEntryVoter = rmEntryVoter;
}
this.policyRegister = policyRegister;
}
/**
* Init method
*/
public void init()
{
rmEntryVoter.registerPolicy(this);
policyRegister.registerPolicy(this);
}
/**

View File

@@ -22,6 +22,10 @@ import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
import org.alfresco.service.cmr.repository.NodeRef;
import org.aopalliance.intercept.MethodInvocation;
/**
* @author Roy Wethearll
* @since 2.1
*/
public class ReadPolicy extends AbstractBasePolicy
{

View File

@@ -25,7 +25,7 @@ import java.util.SortedSet;
import java.util.TreeSet;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationService;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.service.cmr.repository.NodeRef;
import org.apache.commons.logging.Log;
@@ -47,6 +47,9 @@ public class DispositionSelectionStrategy implements RecordsManagementModel
/** Disposition service */
private DispositionService dispositionService;
/** File plan authentication service */
private FilePlanAuthenticationService filePlanAuthenticationService;
/**
* Set the disposition service
*
@@ -57,6 +60,14 @@ public class DispositionSelectionStrategy implements RecordsManagementModel
this.dispositionService = dispositionService;
}
/**
* @param filePlanAuthenticationService file plan authentication service
*/
public void setFilePlanAuthenticationService(FilePlanAuthenticationService filePlanAuthenticationService)
{
this.filePlanAuthenticationService = filePlanAuthenticationService;
}
/**
* Select the disposition schedule to use given there is more than one
*
@@ -79,12 +90,22 @@ public class DispositionSelectionStrategy implements RecordsManagementModel
// period than a time-based one - as we cannot know when an event will occur
// TODO Automatic events?
SortedSet<NodeRef> sortedFolders = new TreeSet<NodeRef>(new DispositionableNodeRefComparator());
for (NodeRef f : recordFolders)
{
sortedFolders.add(f);
}
DispositionSchedule dispSchedule = dispositionService.getDispositionSchedule(sortedFolders.first());
NodeRef recordFolder = null;
if (recordFolders.size() == 1)
{
recordFolder = recordFolders.get(0);
}
else
{
SortedSet<NodeRef> sortedFolders = new TreeSet<NodeRef>(new DispositionableNodeRefComparator());
for (NodeRef f : recordFolders)
{
sortedFolders.add(f);
}
recordFolder = sortedFolders.first();
}
DispositionSchedule dispSchedule = dispositionService.getDispositionSchedule(recordFolder);
if (logger.isDebugEnabled())
{
@@ -112,14 +133,14 @@ public class DispositionSelectionStrategy implements RecordsManagementModel
public int compare(final NodeRef f1, final NodeRef f2)
{
// Run as admin user
return AuthenticationUtil.runAs(new RunAsWork<Integer>()
return filePlanAuthenticationService.runAsRmAdmin(new RunAsWork<Integer>()
{
public Integer doWork() throws Exception
{
return new Integer(compareImpl(f1, f2));
}
}, AuthenticationUtil.getAdminUserName()).intValue();
}).intValue();
}
private int compareImpl(NodeRef f1, NodeRef f2)

View File

@@ -32,6 +32,7 @@ import org.alfresco.module.org_alfresco_module_rm.RecordsManagementServiceRegist
import org.alfresco.module.org_alfresco_module_rm.disposition.property.DispositionProperty;
import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent;
import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.repo.node.NodeServicePolicies;
import org.alfresco.repo.policy.BehaviourFilter;
@@ -85,6 +86,9 @@ public class DispositionServiceImpl implements
/** Disposition selection strategy */
private DispositionSelectionStrategy dispositionSelectionStrategy;
/** File plan service */
private FilePlanService filePlanService;
/** Application context */
private ApplicationContext applicationContext;
@@ -145,6 +149,14 @@ public class DispositionServiceImpl implements
this.policyComponent = policyComponent;
}
/**
* @param filePlanService file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
/**
* Get the records management service
* NOTE: have to pull it out of the app context manually to prevent Spring circular dependancy issue
@@ -296,7 +308,7 @@ public class DispositionServiceImpl implements
if (result == null)
{
NodeRef parent = this.nodeService.getPrimaryParent(nodeRef).getParentRef();
if (parent != null && getRmService().isRecordCategory(parent) == true)
if (parent != null && filePlanService.isRecordCategory(parent) == true)
{
result = getDispositionScheduleImpl(parent);
}
@@ -339,7 +351,7 @@ public class DispositionServiceImpl implements
ParameterCheck.mandatory("nodeRef", nodeRef);
// Make sure we are dealing with an RM node
if (getRmService().isFilePlanComponent(nodeRef) == false)
if (filePlanService.isFilePlanComponent(nodeRef) == false)
{
throw new AlfrescoRuntimeException("Can not find the associated disposition schedule for a non records management component. (nodeRef=" + nodeRef.toString() + ")");
}
@@ -434,7 +446,7 @@ public class DispositionServiceImpl implements
*/
private List<NodeRef> getDisposableItemsImpl(boolean isRecordLevelDisposition, NodeRef rmContainer)
{
List<NodeRef> items = getRmService().getAllContained(rmContainer);
List<NodeRef> items = filePlanService.getAllContained(rmContainer);
List<NodeRef> result = new ArrayList<NodeRef>(items.size());
for (NodeRef item : items)
{
@@ -449,7 +461,7 @@ public class DispositionServiceImpl implements
result.add(item);
}
}
else if (getRmService().isRecordCategory(item) == true)
else if (filePlanService.isRecordCategory(item) == true)
{
if (getAssociatedDispositionScheduleImpl(item) == null)
{

View File

@@ -16,7 +16,7 @@
* 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;
package org.alfresco.module.org_alfresco_module_rm.fileplan;
/**
* File plan component kind enumeration class.

View File

@@ -18,10 +18,15 @@
*/
package org.alfresco.module.org_alfresco_module_rm.fileplan;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.namespace.QName;
import com.hazelcast.impl.Node;
@@ -33,9 +38,42 @@ import com.hazelcast.impl.Node;
*/
public interface FilePlanService
{
/** Default RM site id. Can be used with {@link FilePlanService#getFilePlanBySiteId(String)} to get the file plan node. */
/**
* Default RM site id.
* Can be used with {@link FilePlanService#getFilePlanBySiteId(String)} to get the file plan node.
* */
public static final String DEFAULT_RM_SITE_ID = "rm";
/**
* Indicates whether the given node is a file plan component or not.
*
* @param nodeRef node reference
* @return boolean true if a file plan component, false otherwise
*/
boolean isFilePlanComponent(NodeRef nodeRef);
/**
* Returns the 'kind' of file plan component the node reference is.
* <p>
* Returns null if the given node reference is not a
* file plan component.
*
* @param nodeRef node reference
* @return FilePlanComponentKind the kind of file plan component the node is
*/
FilePlanComponentKind getFilePlanComponentKind(NodeRef nodeRef);
/**
* Returns the file plan component 'kind' that relates to the passed
* content type.
* <p>
* Returns null if the type does not relate to a file plan component.
*
* @param type qualified name of content type
* @return FilePlanComponentKind the kind relating to the passed type
*/
FilePlanComponentKind getFilePlanComponentKindFromType(QName type);
/**
* Indicates whether the given node is file plan node or not.
*
@@ -100,5 +138,182 @@ public interface FilePlanService
* @return {@link Node} unfiled container
*/
NodeRef createUnfiledContainer(NodeRef filePlan);
/**
* Creates a file plan as a child of the given parent node, with the name
* provided.
*
* @param parent parent node reference
* @param name file plan name
* @param type type, must be rma:filePlan or sub-type of
* @return NodeRef file plan node reference
*/
NodeRef createFilePlan(NodeRef parent, String name, QName type);
/**
* Specifies the properties to be set on the created file plan.
*
* @see #createFilePlan(NodeRef, String, QName)
*
* @param parent parent node reference
* @param name file plan name
* @param type type, must be rma:filePlan or sub-type of
* @param properties file plan properties
* @return NodeRef file plan node reference
*/
NodeRef createFilePlan(NodeRef parent, String name, QName type, Map<QName, Serializable> properties);
/**
* Creates a file plan with the default type.
*
* @see #createFilePlan(NodeRef, String, QName)
*
* @param parent parent node reference
* @param name file plan name
* @return NodeRef file plan node reference
*/
NodeRef createFilePlan(NodeRef parent, String name);
/**
* Creates a file plan with the default type, specifying properties.
*
* @see #createFilePlan(NodeRef, String, QName)
*
* @param parent parent node reference
* @param name file plan name
* @param properties file plan properties
* @return NodeRef file plan node reference
*/
NodeRef createFilePlan(NodeRef parent, String name, Map<QName, Serializable> properties);
// TODO deleteFilePlan
/**
* Gets the <b>NodeRef</b> sequence from the {@link #getFilePlan(NodeRef) root}
* down to the fileplan component given. The array will start with the <b>NodeRef</b> of the root
* and end with the name of the fileplan component node given.
*
* @param nodeRef a fileplan component
* @return Returns a <b>NodeRef</b> path starting with the file plan
*/
List<NodeRef> getNodeRefPath(NodeRef nodeRef);
/**
* Indicates whether the given node is a file plan container or not.
* <p>
* This includes file plan and record category nodes.
*
* @param nodeRef node reference
* @return boolean true if node is a file plan container, false otherwise.
*/
boolean isFilePlanContainer(NodeRef nodeRef);
/**
* Indicates whether the given node is a record category or not.
*
* @param nodeRef node reference
* @return boolean true if records category, false otherwise
*/
boolean isRecordCategory(NodeRef nodeRef);
/**
* Get all the items contained within a container. This will include record folders and other record categories.
*
* @param recordCategory record category node reference
* @param deep if true then return all children including sub-categories and their children in turn, if false then just
* return the immediate children
* @return {@link List}<{@link NodeRef>} list of contained node references
*/
List<NodeRef> getAllContained(NodeRef recordCategory, boolean deep);
/**
* Only return the immediate children.
*
* @see RecordsManagementService#getAllContained(NodeRef, boolean)
*
* @param recordCategory record category node reference
* @return {@link List}<{@link NodeRef>} list of contained node references
*/
List<NodeRef> getAllContained(NodeRef recordCategory);
/**
* Get all the record categories within a record category.
*
* @param recordCategory record category node reference
* @param deep if true then return all children including sub-categories and their children in turn, if false then just
* return the immediate children
* @return {@link List}<{@link NodeRef>} list of container node references
*/
List<NodeRef> getContainedRecordCategories(NodeRef recordCategory, boolean deep);
/**
* Only return immediate children.
*
* @see RecordsManagementService#getContainedRecordCategories(NodeRef, boolean)
*
* @param recordCategory container node reference
* @return {@link List}<{@link NodeRef>} list of container node references
*/
List<NodeRef> getContainedRecordCategories(NodeRef recordCategory);
/**
* Get all the record folders contained within a container
*
* @param container container node reference
* @param deep if true then return all children including sub-containers and their children in turn, if false then just
* return the immediate children
* @return {@link List}<{@link NodeRef>} list of record folder node references
*/
List<NodeRef> getContainedRecordFolders(NodeRef container, boolean deep);
/**
* Only return immediate children.
*
* @see RecordsManagementService#getContainedRecordFolders(NodeRef, boolean)
*
* @param container container node reference
* @return {@link List}<{@link NodeRef>} list of record folder node references
*/
List<NodeRef> getContainedRecordFolders(NodeRef container);
/**
* Create a record category.
*
* @param parent parent node reference, must be a record category or file plan.
* @param name name of the new record category
* @param type type of container to create, must be a sub-type of rm:recordCategory
* @return NodeRef node reference of the created record category
*/
NodeRef createRecordCategory(NodeRef parent, String name, QName type);
/**
*
* @param parent
* @param name
* @param type
* @param properties
* @return
*/
NodeRef createRecordCategory(NodeRef parent, String name, QName type, Map<QName, Serializable> properties);
/**
* Creates a record category of type rma:recordCategory
*
* @see RecordsManagementService#createRecordCategory(NodeRef, String, QName)
*
* @param parent parent node reference, must be a record category or file plan.
* @param name name of the record category
* @return NodeRef node reference of the created record category
*/
NodeRef createRecordCategory(NodeRef parent, String name);
/**
*
* @param parent
* @param name
* @param properties
* @return
*/
NodeRef createRecordCategory(NodeRef parent, String name, Map<QName, Serializable> properties);
}

View File

@@ -19,16 +19,22 @@
package org.alfresco.module.org_alfresco_module_rm.fileplan;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
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.record.RecordService;
import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedReaderDynamicAuthority;
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedWriterDynamicAuthority;
@@ -38,15 +44,19 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.security.AccessStatus;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.cmr.site.SiteInfo;
import org.alfresco.service.cmr.site.SiteService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.util.Pair;
import org.alfresco.util.ParameterCheck;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.extensions.surf.util.I18NUtil;
/**
* File plan service implementation.
@@ -59,6 +69,16 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
RecordsManagementModel,
ApplicationContextAware
{
/** I18N */
private final static String MSG_DUP_ROOT = "rm.service.dup-root";
private final static String MSG_ROOT_TYPE = "rm.service.root-type";
private final static String MSG_PATH_NODE = "rm.service.path-node";
private final static String MSG_INVALID_RM_NODE = "rm.service.invalid-rm-node";
private final static String MSG_NO_ROOT = "rm.service.no-root";
private final static String MSG_CONTAINER_PARENT_TYPE= "rm.service.container-parent-type";
private final static String MSG_CONTAINER_TYPE = "rm.service.container-type";
private final static String MSG_CONTAINER_EXPECTED = "rm.service.container-expected";
/** Unfiled record container name */
private static final String NAME_UNFILED_CONTAINER = "Unfiled Records";
private static final QName QNAME_UNFILED_CONTAINER = QName.createQName(RM_URI, NAME_UNFILED_CONTAINER);
@@ -121,6 +141,145 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
return (SiteService)applicationContext.getBean("SiteService");
}
/**
* @return record service
*/
protected RecordService getRecordService()
{
return (RecordService)applicationContext.getBean("RecordService");
}
/**
* @return record folder service
*/
protected RecordFolderService getRecordFolderService()
{
return (RecordFolderService)applicationContext.getBean("RecordFolderService");
}
/**
* @return freeze service
*/
protected FreezeService getFreezeService()
{
return (FreezeService)applicationContext.getBean("FreezeService");
}
/**
* @return records management service
*/
protected RecordsManagementService getRecordsManagementService()
{
return (RecordsManagementService)applicationContext.getBean("RecordsManagementService");
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#isFilePlanComponent(org.alfresco.service.cmr.repository.NodeRef)
*/
public boolean isFilePlanComponent(NodeRef nodeRef)
{
boolean result = false;
if (nodeService.exists(nodeRef) == true &&
nodeService.hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT) == true)
{
result = true;
}
return result;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getFilePlanComponentKind(org.alfresco.service.cmr.repository.NodeRef)
*/
public FilePlanComponentKind getFilePlanComponentKind(NodeRef nodeRef)
{
FilePlanComponentKind result = null;
if (isFilePlanComponent(nodeRef) == true)
{
result = FilePlanComponentKind.FILE_PLAN_COMPONENT;
if (isFilePlan(nodeRef) == true)
{
result = FilePlanComponentKind.FILE_PLAN;
}
else if (isRecordCategory(nodeRef) == true)
{
result = FilePlanComponentKind.RECORD_CATEGORY;
}
else if (getRecordsManagementService().isRecordFolder(nodeRef) == true)
{
result = FilePlanComponentKind.RECORD_FOLDER;
}
else if (getRecordService().isRecord(nodeRef) == true)
{
result = FilePlanComponentKind.RECORD;
}
else if (getFreezeService().isHold(nodeRef) == true)
{
result = FilePlanComponentKind.HOLD;
}
else if (getRecordsManagementService().isTransfer(nodeRef) == true)
{
result = FilePlanComponentKind.TRANSFER;
}
else if (instanceOf(nodeRef, TYPE_DISPOSITION_SCHEDULE) == true || instanceOf(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION) == true)
{
result = FilePlanComponentKind.DISPOSITION_SCHEDULE;
}
else if (instanceOf(nodeRef, TYPE_UNFILED_RECORD_CONTAINER) == true)
{
result = FilePlanComponentKind.UNFILED_RECORD_CONTAINER;
}
}
return result;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#getFilePlanComponentKindFromType(org.alfresco.service.namespace.QName)
*/
@Override
public FilePlanComponentKind getFilePlanComponentKindFromType(QName type)
{
FilePlanComponentKind result = null;
if (ASPECT_FILE_PLAN_COMPONENT.equals(type) == true)
{
result = FilePlanComponentKind.FILE_PLAN_COMPONENT;
}
else if (dictionaryService.isSubClass(type, ASPECT_RECORD) == true)
{
result = FilePlanComponentKind.RECORD;
}
else if (dictionaryService.isSubClass(type, TYPE_FILE_PLAN) == true)
{
result = FilePlanComponentKind.FILE_PLAN;
}
else if (dictionaryService.isSubClass(type, TYPE_RECORD_CATEGORY) == true)
{
result = FilePlanComponentKind.RECORD_CATEGORY;
}
else if (dictionaryService.isSubClass(type, TYPE_RECORD_FOLDER) == true)
{
result = FilePlanComponentKind.RECORD_FOLDER;
}
else if (dictionaryService.isSubClass(type, TYPE_HOLD) == true)
{
result = FilePlanComponentKind.HOLD;
}
else if (dictionaryService.isSubClass(type, TYPE_TRANSFER) == true)
{
result = FilePlanComponentKind.TRANSFER;
}
else if (dictionaryService.isSubClass(type, TYPE_DISPOSITION_SCHEDULE) == true ||
dictionaryService.isSubClass(type, TYPE_DISPOSITION_ACTION_DEFINITION) == true)
{
result = FilePlanComponentKind.DISPOSITION_SCHEDULE;
}
return result;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#isFilePlan(org.alfresco.service.cmr.repository.NodeRef)
*/
@@ -294,5 +453,297 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
return container;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName, java.util.Map)
*/
public NodeRef createFilePlan(NodeRef parent, String name, QName type, Map<QName, Serializable> properties)
{
ParameterCheck.mandatory("parent", parent);
ParameterCheck.mandatory("name", name);
ParameterCheck.mandatory("type", type);
// Check the parent is not already an RM component node
// ie: you can't create a rm root in an existing rm hierarchy
if (isFilePlanComponent(parent) == true)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_DUP_ROOT));
}
// Check that the passed type is a sub-type of rma:filePlan
if (TYPE_FILE_PLAN.equals(type) == false &&
dictionaryService.isSubClass(type, TYPE_FILE_PLAN) == false)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_ROOT_TYPE, type.toString()));
}
// Build map of properties
Map<QName, Serializable> rmRootProps = new HashMap<QName, Serializable>(1);
if (properties != null && properties.size() != 0)
{
rmRootProps.putAll(properties);
}
rmRootProps.put(ContentModel.PROP_NAME, name);
// Create the root
ChildAssociationRef assocRef = nodeService.createNode(
parent,
ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name),
type,
rmRootProps);
// TODO do we need to create role and security groups or is this done automatically?
return assocRef.getChildRef();
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map)
*/
public NodeRef createFilePlan(NodeRef parent, String name, Map<QName, Serializable> properties)
{
return createFilePlan(parent, name, TYPE_FILE_PLAN, properties);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, java.lang.String)
*/
public NodeRef createFilePlan(NodeRef parent, String name)
{
return createFilePlan(parent, name, TYPE_FILE_PLAN, null);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName)
*/
@Override
public NodeRef createFilePlan(NodeRef parent, String name, QName type)
{
return createFilePlan(parent, name, type, null);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getNodeRefPath(org.alfresco.service.cmr.repository.NodeRef)
*/
public List<NodeRef> getNodeRefPath(NodeRef nodeRef)
{
LinkedList<NodeRef> nodeRefPath = new LinkedList<NodeRef>();
try
{
getNodeRefPathRecursive(nodeRef, nodeRefPath);
}
catch (Throwable e)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PATH_NODE, nodeRef), e);
}
return nodeRefPath;
}
/**
* Helper method to build a <b>NodeRef</b> path from the node to the RM root
*/
private void getNodeRefPathRecursive(NodeRef nodeRef, LinkedList<NodeRef> nodeRefPath)
{
if (isFilePlanComponent(nodeRef) == false)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_INVALID_RM_NODE, ASPECT_FILE_PLAN_COMPONENT.toString()));
}
// Prepend it to the path
nodeRefPath.addFirst(nodeRef);
// Are we at the root
if (isFilePlan(nodeRef) == true)
{
// We're done
}
else
{
ChildAssociationRef assocRef = nodeService.getPrimaryParent(nodeRef);
if (assocRef == null)
{
// We hit the top of the store
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NO_ROOT));
}
// Recurse
nodeRef = assocRef.getParentRef();
getNodeRefPathRecursive(nodeRef, nodeRefPath);
}
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#isFilePlanContainer(org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
public boolean isFilePlanContainer(NodeRef nodeRef)
{
return instanceOf(nodeRef, TYPE_RECORDS_MANAGEMENT_CONTAINER);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#isRecordCategory(org.alfresco.service.cmr.repository.NodeRef)
*/
public boolean isRecordCategory(NodeRef nodeRef)
{
return instanceOf(nodeRef, TYPE_RECORD_CATEGORY);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createRecordCategory(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName, java.util.Map)
*/
public NodeRef createRecordCategory(NodeRef parent, String name, QName type, Map<QName, Serializable> properties)
{
ParameterCheck.mandatory("parent", parent);
ParameterCheck.mandatory("name", name);
ParameterCheck.mandatory("type", type);
// Check that the parent is a container
QName parentType = nodeService.getType(parent);
if (TYPE_RECORDS_MANAGEMENT_CONTAINER.equals(parentType) == false &&
dictionaryService.isSubClass(parentType, TYPE_RECORDS_MANAGEMENT_CONTAINER) == false)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CONTAINER_PARENT_TYPE, parentType.toString()));
}
// Check that the the provided type is a sub-type of rm:recordCategory
if (TYPE_RECORD_CATEGORY.equals(type) == false &&
dictionaryService.isSubClass(type, TYPE_RECORD_CATEGORY) == false)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CONTAINER_TYPE, type.toString()));
}
// Set the properties for the record category
Map<QName, Serializable> props = new HashMap<QName, Serializable>(1);
if (properties != null && properties.size() != 0)
{
props.putAll(properties);
}
props.put(ContentModel.PROP_NAME, name);
return nodeService.createNode(
parent,
ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name),
type,
props).getChildRef();
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createRecordCategory(org.alfresco.service.cmr.repository.NodeRef, java.lang.String)
*/
public NodeRef createRecordCategory(NodeRef parent, String name)
{
return createRecordCategory(parent, name, TYPE_RECORD_CATEGORY);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createRecordCategory(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, java.util.Map)
*/
public NodeRef createRecordCategory(NodeRef parent, String name, Map<QName, Serializable> properties)
{
return createRecordCategory(parent, name, TYPE_RECORD_CATEGORY, properties);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createRecordCategory(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName)
*/
public NodeRef createRecordCategory(NodeRef parent, String name, QName type)
{
return createRecordCategory(parent, name, type, null);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getAllContained(org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
public List<NodeRef> getAllContained(NodeRef container)
{
return getAllContained(container, false);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getAllContained(org.alfresco.service.cmr.repository.NodeRef, boolean)
*/
@Override
public List<NodeRef> getAllContained(NodeRef container, boolean deep)
{
return getContained(container, null, deep);
}
/**
* Get contained nodes of a particular type. If null return all.
*
* @param container container node reference
* @param typeFilter type filter, null if none
* @return {@link List}<{@link NodeRef> list of contained node references
*/
private List<NodeRef> getContained(NodeRef container, QName typeFilter, boolean deep)
{
// Parameter check
ParameterCheck.mandatory("container", container);
// Check we have a container in our hands
if (isRecordCategory(container) == false)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CONTAINER_EXPECTED));
}
List<NodeRef> result = new ArrayList<NodeRef>(1);
List<ChildAssociationRef> assocs = this.nodeService.getChildAssocs(container, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef assoc : assocs)
{
NodeRef child = assoc.getChildRef();
QName childType = nodeService.getType(child);
if (typeFilter == null ||
typeFilter.equals(childType) == true ||
dictionaryService.isSubClass(childType, typeFilter) == true)
{
result.add(child);
}
// Inspect the containers and add children if deep
if (deep == true &&
(TYPE_RECORD_CATEGORY.equals(childType) == true ||
dictionaryService.isSubClass(childType, TYPE_RECORD_CATEGORY) == true))
{
result.addAll(getContained(child, typeFilter, deep));
}
}
return result;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getContainedRecordCategories(org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
public List<NodeRef> getContainedRecordCategories(NodeRef container)
{
return getContainedRecordCategories(container, false);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getContainedRecordCategories(org.alfresco.service.cmr.repository.NodeRef, boolean)
*/
@Override
public List<NodeRef> getContainedRecordCategories(NodeRef container, boolean deep)
{
return getContained(container, TYPE_RECORD_CATEGORY, deep);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getContainedRecordFolders(org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
public List<NodeRef> getContainedRecordFolders(NodeRef container)
{
return getContainedRecordFolders(container, false);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getContainedRecordFolders(org.alfresco.service.cmr.repository.NodeRef, boolean)
*/
@Override
public List<NodeRef> getContainedRecordFolders(NodeRef container, boolean deep)
{
return getContained(container, TYPE_RECORD_FOLDER, deep);
}
}

View File

@@ -24,12 +24,13 @@ import java.util.Map;
import java.util.Set;
import org.alfresco.model.ImapModel;
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.compatibility.CompatibilityModel;
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule;
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionScheduleImpl;
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.repo.forms.Field;
@@ -71,6 +72,9 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
/** Disposition service */
protected DispositionService dispositionService;
/** File Plan Service */
protected FilePlanService filePlanService;
/**
* Sets the data dictionary service
@@ -91,6 +95,14 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
{
this.dispositionService = dispositionService;
}
/**
* @param filePlanService file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
/**
* @see org.alfresco.repo.forms.processor.Filter#afterGenerate(java.lang.Object, java.util.List, java.util.List, org.alfresco.repo.forms.Form, java.util.Map)
@@ -103,12 +115,12 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
Form form,
Map<String, Object> context)
{
if (rmService.isFilePlanComponent(nodeRef) == true)
if (filePlanService.isFilePlanComponent(nodeRef) == true)
{
// add all the custom properties
addCustomPropertyFieldsToGroup(form, nodeRef);
FilePlanComponentKind kind = rmService.getFilePlanComponentKind(nodeRef);
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
if (FilePlanComponentKind.RECORD.equals(kind) == true)
{
// add all the record meta-data aspect properties

View File

@@ -160,8 +160,8 @@ public class FreezeServiceImpl implements FreezeService,
@Override
public Void doWork() throws Exception
{
if (nodeService.exists(nodeRef) == true
&& recordsManagementService.isFilePlanComponent(nodeRef) == true)
if (nodeService.exists(nodeRef) == true &&
filePlanService.isFilePlanComponent(nodeRef) == true)
{
if (isFrozen(nodeRef) == true)
{

View File

@@ -23,10 +23,11 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
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.record.RecordService;
@@ -72,6 +73,9 @@ public abstract class BaseEvaluator implements RecordsManagementModel
/** Capabilities */
protected List<String> capabilities;
/** File plan service */
protected FilePlanService filePlanService;
/**
* @param jsonConversionComponent json conversion component
*/
@@ -128,6 +132,14 @@ public abstract class BaseEvaluator implements RecordsManagementModel
this.freezeService = freezeService;
}
/**
* @param filePlanService file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
/**
* @param name
*/
@@ -219,7 +231,7 @@ public abstract class BaseEvaluator implements RecordsManagementModel
*/
private boolean checkKinds(NodeRef nodeRef)
{
FilePlanComponentKind kind = recordsManagementService.getFilePlanComponentKind(nodeRef);
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
return kinds.contains(kind);
}

View File

@@ -21,10 +21,10 @@ package org.alfresco.module.org_alfresco_module_rm.jscript.app;
import java.util.ArrayList;
import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
import org.alfresco.service.cmr.model.FileInfo;
@@ -125,7 +125,7 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
RMPermissionModel.VIEW_RECORDS)) == true)
{
// Indicate whether the node is a RM object or not
boolean isFilePlanComponent = recordsManagementService.isFilePlanComponent(nodeInfo.getNodeRef());
boolean isFilePlanComponent = filePlanService.isFilePlanComponent(nodeInfo.getNodeRef());
rootJSONObject.put("isRmNode", isFilePlanComponent);
if (isFilePlanComponent == true)
@@ -150,7 +150,7 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
rmNodeValues.put("uiType", getUIType(nodeRef));
// Get the 'kind' of the file plan component
FilePlanComponentKind kind = recordsManagementService.getFilePlanComponentKind(nodeRef);
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
rmNodeValues.put("kind", kind.toString());
// File plan node reference
@@ -221,7 +221,7 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
{
String result = "unknown";
FilePlanComponentKind kind = recordsManagementService.getFilePlanComponentKind(nodeRef);
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
if (kind != null)
{
switch (kind)

View File

@@ -21,7 +21,6 @@ package org.alfresco.module.org_alfresco_module_rm.model.behaviour;
import org.alfresco.model.ContentModel;
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.security.FilePlanAuthenticationService;
import org.alfresco.repo.node.NodeServicePolicies;
import org.alfresco.repo.policy.JavaBehaviour;
import org.alfresco.repo.policy.PolicyComponent;
@@ -56,9 +55,6 @@ public class RecordContainerType implements RecordsManagementModel,
/** Identity service */
private IdentifierService recordsManagementIdentifierService;
/** File plan authentication service */
private FilePlanAuthenticationService filePlanAuthenticationService;
/**
* Set the policy component
* @param policyComponent policy component
@@ -88,14 +84,6 @@ public class RecordContainerType implements RecordsManagementModel,
this.dictionaryService = dictionaryService;
}
/**
* @param filePlanAuthenticationService file plan authentication service
*/
public void setFilePlanAuthenticationService(FilePlanAuthenticationService filePlanAuthenticationService)
{
this.filePlanAuthenticationService = filePlanAuthenticationService;
}
/**
* Set the identity service
*

View File

@@ -21,13 +21,13 @@ package org.alfresco.module.org_alfresco_module_rm.patch;
import java.io.Serializable;
import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.security.RecordsManagementSecurityService;
import org.alfresco.module.org_alfresco_module_rm.security.Role;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
import org.alfresco.module.org_alfresco_module_rm.role.Role;
import org.alfresco.repo.domain.node.NodeDAO;
import org.alfresco.repo.domain.patch.PatchDAO;
import org.alfresco.repo.domain.qname.QNameDAO;
@@ -55,24 +55,19 @@ public class RMv2FilePlanNodeRefPatch extends AbstractModuleComponent
private static Log logger = LogFactory.getLog(RMv2FilePlanNodeRefPatch.class);
private NodeService nodeService;
private RecordsManagementService recordsManagementService;
private BehaviourFilter behaviourFilter;
private PatchDAO patchDAO;
private NodeDAO nodeDAO;
private QNameDAO qnameDAO;
private PermissionService permissionService;
private RecordsManagementSecurityService recordsManagementSecurityService;
private FilePlanService filePlanService;
private FilePlanRoleService filePlanRoleService;
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
public void setRecordsManagementService(RecordsManagementService recordsManagementService)
{
this.recordsManagementService = recordsManagementService;
}
public void setBehaviourFilter(BehaviourFilter behaviourFilter)
{
this.behaviourFilter = behaviourFilter;
@@ -93,14 +88,6 @@ public class RMv2FilePlanNodeRefPatch extends AbstractModuleComponent
this.qnameDAO = qnameDAO;
}
/**
* @param recordsManagementSecurityService records management security service
*/
public void setRecordsManagementSecurityService(RecordsManagementSecurityService recordsManagementSecurityService)
{
this.recordsManagementSecurityService = recordsManagementSecurityService;
}
/**
* @param permissionService permission service
*/
@@ -109,6 +96,22 @@ public class RMv2FilePlanNodeRefPatch extends AbstractModuleComponent
this.permissionService = permissionService;
}
/**
* @param filePlanRoleService file plan role service
*/
public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService)
{
this.filePlanRoleService = filePlanRoleService;
}
/**
* @param filePlanService file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
/**
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/
@@ -138,7 +141,7 @@ public class RMv2FilePlanNodeRefPatch extends AbstractModuleComponent
Pair<Long, NodeRef> recordPair = nodeDAO.getNodePair(filePlanComponent);
NodeRef filePlanComponentNodeRef = recordPair.getSecond();
NodeRef filePlan = recordsManagementService.getFilePlan(filePlanComponentNodeRef);
NodeRef filePlan = filePlanService.getFilePlan(filePlanComponentNodeRef);
// set the file plan node reference
if (nodeService.getProperty(filePlanComponentNodeRef, PROP_ROOT_NODEREF) == null)
@@ -147,13 +150,13 @@ public class RMv2FilePlanNodeRefPatch extends AbstractModuleComponent
}
// only set the rmadmin permissions on record categories, record folders and records
FilePlanComponentKind kind = recordsManagementService.getFilePlanComponentKind(filePlanComponentNodeRef);
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(filePlanComponentNodeRef);
if (FilePlanComponentKind.RECORD_CATEGORY.equals(kind) == true ||
FilePlanComponentKind.RECORD_FOLDER.equals(kind) == true ||
FilePlanComponentKind.RECORD.equals(kind) == true )
{
// ensure the that the records management role has read and file on the node
Role adminRole = recordsManagementSecurityService.getRole(filePlan, "Administrator");
Role adminRole = filePlanRoleService.getRole(filePlan, "Administrator");
if (adminRole != null)
{
permissionService.setPermission(filePlanComponentNodeRef, adminRole.getRoleGroupName(), RMPermissionModel.FILING, true);

View File

@@ -39,7 +39,7 @@ public class AuditLogDelete extends BaseAuditAdminWebScript
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
this.rmAuditService.clear();
this.rmAuditService.clearAuditLog(getDefaultFilePlan());
// create model object with the audit status model
Map<String, Object> model = new HashMap<String, Object>(1);

View File

@@ -61,11 +61,11 @@ public class AuditLogPut extends BaseAuditAdminWebScript
boolean enabled = json.getBoolean(PARAM_ENABLED);
if (enabled)
{
this.rmAuditService.start();
this.rmAuditService.startAuditLog(getDefaultFilePlan());
}
else
{
this.rmAuditService.stop();
this.rmAuditService.stopAuditLog(getDefaultFilePlan());
}
// create model object with the audit status model

View File

@@ -21,7 +21,10 @@ package org.alfresco.module.org_alfresco_module_rm.script;
import java.util.HashMap;
import java.util.Map;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.springframework.extensions.webscripts.Cache;
import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status;
@@ -37,6 +40,9 @@ public class AuditLogStatusGet extends DeclarativeWebScript
/** Records management audit service */
protected RecordsManagementAuditService rmAuditService;
/** File plan service */
protected FilePlanService filePlanService;
/**
* Sets the RecordsManagementAuditService instance
*
@@ -47,6 +53,14 @@ public class AuditLogStatusGet extends DeclarativeWebScript
this.rmAuditService = rmAuditService;
}
/**
* @param filePlanService file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
/**
* @see org.alfresco.repo.web.scripts.content.StreamContent#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache)
*/
@@ -54,7 +68,22 @@ public class AuditLogStatusGet extends DeclarativeWebScript
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
Map<String, Object> model = new HashMap<String, Object>(1);
model.put("enabled", Boolean.valueOf(rmAuditService.isEnabled()));
model.put("enabled", Boolean.valueOf(rmAuditService.isAuditLogEnabled(getDefaultFilePlan())));
return model;
}
/**
* Helper method to get default file plan.
*
* @return NodeRef default file plan
*/
protected NodeRef getDefaultFilePlan()
{
NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
if (filePlan == null)
{
throw new AlfrescoRuntimeException("Default file plan not found.");
}
return filePlan;
}
}

View File

@@ -21,7 +21,10 @@ package org.alfresco.module.org_alfresco_module_rm.script;
import java.util.HashMap;
import java.util.Map;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.springframework.extensions.surf.util.ISO8601DateFormat;
import org.springframework.extensions.webscripts.DeclarativeWebScript;
@@ -32,8 +35,12 @@ import org.springframework.extensions.webscripts.DeclarativeWebScript;
*/
public class BaseAuditAdminWebScript extends DeclarativeWebScript
{
/** Records management audit service */
protected RecordsManagementAuditService rmAuditService;
/** File plan service */
protected FilePlanService filePlanService;
/**
* Sets the RecordsManagementAuditService instance
*
@@ -44,6 +51,14 @@ public class BaseAuditAdminWebScript extends DeclarativeWebScript
this.rmAuditService = rmAuditService;
}
/**
* @param filePlanService file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
/**
* Creates a model to represent the current status of the RM audit log.
*
@@ -53,10 +68,25 @@ public class BaseAuditAdminWebScript extends DeclarativeWebScript
{
Map<String, Object> auditStatus = new HashMap<String, Object>(3);
auditStatus.put("started", ISO8601DateFormat.format(rmAuditService.getDateLastStarted()));
auditStatus.put("stopped", ISO8601DateFormat.format(rmAuditService.getDateLastStopped()));
auditStatus.put("enabled", Boolean.valueOf(rmAuditService.isEnabled()));
auditStatus.put("started", ISO8601DateFormat.format(rmAuditService.getDateAuditLogLastStarted(getDefaultFilePlan())));
auditStatus.put("stopped", ISO8601DateFormat.format(rmAuditService.getDateAuditLogLastStopped(getDefaultFilePlan())));
auditStatus.put("enabled", Boolean.valueOf(rmAuditService.isAuditLogEnabled(getDefaultFilePlan())));
return auditStatus;
}
/**
* Helper method to get default file plan.
*
* @return NodeRef default file plan
*/
protected NodeRef getDefaultFilePlan()
{
NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
if (filePlan == null)
{
throw new AlfrescoRuntimeException("Default file plan not found.");
}
return filePlan;
}
}

View File

@@ -20,7 +20,6 @@ package org.alfresco.module.org_alfresco_module_rm.script;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -28,6 +27,7 @@ import javax.servlet.http.HttpServletResponse;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
import org.alfresco.module.org_alfresco_module_rm.role.Role;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -52,6 +52,7 @@ public class UserRightsReportGet extends DeclarativeWebScript
protected NodeService nodeService;
protected RecordsManagementService rmService;
protected FilePlanRoleService filePlanRoleService;
protected FilePlanService filePlanService;
/**
* Sets the AuthorityService instance
@@ -99,19 +100,26 @@ public class UserRightsReportGet extends DeclarativeWebScript
this.filePlanRoleService = filePlanRoleService;
}
/**
* @param filePlanService file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
/*
* @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache)
*/
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
// get the RM root nodes in the system
List<NodeRef> rmRoots = this.rmService.getFilePlans();
NodeRef filePlanNode = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
if (rmRoots == null || rmRoots.size() == 0)
if (filePlanNode == null)
{
status.setCode(HttpServletResponse.SC_BAD_REQUEST,
"There are no Records Management root nodes in the system");
"The default RM site could not be found.");
return null;
}
@@ -120,11 +128,8 @@ public class UserRightsReportGet extends DeclarativeWebScript
Map<String, RoleModel> rolesMap = new HashMap<String, RoleModel>(8);
Map<String, GroupModel> groupsMap = new HashMap<String, GroupModel>(8);
// TODO: deal with presence of more than one root, for now we know it's only 1
NodeRef rmRootNode = rmRoots.get(0);
// iterate over all the roles for the file plan and construct models
Set<Role> roles = this.filePlanRoleService.getRoles(rmRootNode);
Set<Role> roles = filePlanRoleService.getRoles(filePlanNode);
for (Role role : roles)
{
// get or create the RoleModel object for current role
@@ -138,7 +143,7 @@ public class UserRightsReportGet extends DeclarativeWebScript
// get the users for the current RM role
String group = role.getRoleGroupName();
Set<String> users = this.authorityService.getContainedAuthorities(AuthorityType.USER, group, true);
Set<String> users = authorityService.getContainedAuthorities(AuthorityType.USER, group, true);
roleModel.setUsers(users);
// setup a user model object for each user
@@ -158,7 +163,7 @@ public class UserRightsReportGet extends DeclarativeWebScript
}
// get the groups for the cuurent RM role
Set<String> groups = this.authorityService.getContainedAuthorities(AuthorityType.GROUP, group, false);
Set<String> groups = authorityService.getContainedAuthorities(AuthorityType.GROUP, group, false);
roleModel.setGroups(groups);
// setup a user model object for each user in each group
@@ -168,7 +173,7 @@ public class UserRightsReportGet extends DeclarativeWebScript
if (groupModel == null)
{
groupModel = new GroupModel(groupName,
this.authorityService.getAuthorityDisplayName(groupName));
authorityService.getAuthorityDisplayName(groupName));
groupsMap.put(groupName, groupModel);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2011 Alfresco Software Limited.
* Copyright (C) 2005-2013 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -25,10 +25,10 @@ import java.util.TreeMap;
import javax.servlet.http.HttpServletResponse;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
import org.alfresco.module.org_alfresco_module_rm.capability.Group;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.security.AccessStatus;
@@ -39,22 +39,33 @@ import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptException;
import org.springframework.extensions.webscripts.WebScriptRequest;
/**
* Capabilities GET web service implementation.
*/
public class CapabilitiesGet extends DeclarativeWebScript
{
private RecordsManagementService recordsManagementService;
/** File plan service */
private FilePlanService filePlanService;
/** Capability service */
private CapabilityService capabilityService;
public void setRecordsManagementService(RecordsManagementService recordsManagementService)
{
this.recordsManagementService = recordsManagementService;
}
/**
* @param capabilityService capability service
*/
public void setCapabilityService(CapabilityService capabilityService)
{
this.capabilityService = capabilityService;
}
/**
* @param filePlanService file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
/**
* @see org.alfresco.repo.web.scripts.content.StreamContent#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache)
*/
@@ -75,16 +86,11 @@ public class CapabilitiesGet extends DeclarativeWebScript
{
// we are talking about the file plan node
// TODO we are making the assumption there is only one file plan here!
List<NodeRef> filePlans = recordsManagementService.getFilePlans();
if (filePlans.isEmpty() == true)
nodeRef = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
if (nodeRef == null)
{
throw new WebScriptException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "No file plan node has been found.");
throw new WebScriptException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "The default file plan node could not be found.");
}
else if (filePlans.size() != 1)
{
throw new WebScriptException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "More than one file plan has been found.");
}
nodeRef = filePlans.get(0);
}
boolean grouped = false;

View File

@@ -27,8 +27,8 @@ import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.NamespaceService;
@@ -56,22 +56,14 @@ public class RMMetaDataGet extends DeclarativeWebScript
/** QName pattern */
private static final Pattern qnamePattern = Pattern.compile(".+:[^=,]+");
/** Records management service */
private RecordsManagementService rmService;
/** Namespace service */
private NamespaceService namespaceService;
/** Node service */
private NodeService nodeService;
/**
* @param rmService records management service
*/
public void setRecordsManagementService(RecordsManagementService rmService)
{
this.rmService = rmService;
}
/** File Plan Service */
private FilePlanService filePlanService;
/**
* @param namespaceService namespace service
@@ -81,6 +73,14 @@ public class RMMetaDataGet extends DeclarativeWebScript
this.namespaceService = namespaceService;
}
/**
* @param filePlanService file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
/**
* @param nodeService node service
*/
@@ -112,7 +112,7 @@ public class RMMetaDataGet extends DeclarativeWebScript
if (m.matches() == true)
{
QName qname = QName.createQName(type, namespaceService);
FilePlanComponentKind kind = rmService.getFilePlanComponentKindFromType(qname);
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKindFromType(qname);
if (kind != null)
{
result = kind.toString();
@@ -130,7 +130,7 @@ public class RMMetaDataGet extends DeclarativeWebScript
{
NodeRef nodeRefObj = new NodeRef(nodeRef);
FilePlanComponentKind kind = rmService.getFilePlanComponentKind(nodeRefObj);
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRefObj);
if (kind != null)
{
result = kind.toString();

View File

@@ -30,6 +30,11 @@ import org.alfresco.service.cmr.repository.NodeRef;
*/
public interface ExtendedSecurityService
{
/**
*
* @param nodeRef
* @return
*/
boolean hasExtendedSecurity(NodeRef nodeRef);
/**

View File

@@ -25,7 +25,6 @@ import java.util.Map;
import java.util.Set;
import org.alfresco.model.RenditionModel;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
@@ -62,9 +61,6 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
/** Policy component */
private PolicyComponent policyComponent;
/** Records management service */
private RecordsManagementService recordsManagementService;
/** Record service */
private RecordService recordService;
@@ -90,14 +86,6 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
this.recordService = recordService;
}
/**
* @param recordsManagementService records management service
*/
public void setRecordsManagementService(RecordsManagementService recordsManagementService)
{
this.recordsManagementService = recordsManagementService;
}
/**
* @param filePlanService file plan service
*/
@@ -244,7 +232,7 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
// apply the extended readers up the file plan primary hierarchy
NodeRef parent = nodeService.getPrimaryParent(nodeRef).getParentRef();
if (parent != null &&
recordsManagementService.isFilePlanComponent(parent) == true)
filePlanService.isFilePlanComponent(parent) == true)
{
addExtendedSecurityImpl(parent, readers, null, applyToParents);
addExtendedSecurityImpl(parent, writers, null, applyToParents);
@@ -407,7 +395,7 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
// apply the extended readers up the file plan primary hierarchy
NodeRef parent = nodeService.getPrimaryParent(nodeRef).getParentRef();
if (parent != null &&
recordsManagementService.isFilePlanComponent(parent) == true)
filePlanService.isFilePlanComponent(parent) == true)
{
removeExtendedSecurity(parent, readers, null, applyToParents);
removeExtendedSecurity(parent, writers, null, applyToParents);

View File

@@ -393,7 +393,7 @@ public class FilePlanPermissionServiceImpl implements FilePlanPermissionService,
{
setPermissionDown(nodeRef, authority, permission);
}
else if (recordsManagementService.isRecordsManagementContainer(nodeRef) == true ||
else if (filePlanService.isFilePlanContainer(nodeRef) == true ||
recordsManagementService.isRecordFolder(nodeRef) == true ||
recordService.isRecord(nodeRef) == true)
{
@@ -440,14 +440,14 @@ public class FilePlanPermissionServiceImpl implements FilePlanPermissionService,
private void setPermissionDown(NodeRef nodeRef, String authority, String permission)
{
setPermissionImpl(nodeRef, authority, permission);
if (recordsManagementService.isRecordsManagementContainer(nodeRef) == true ||
if (filePlanService.isFilePlanContainer(nodeRef) == true ||
recordsManagementService.isRecordFolder(nodeRef) == true)
{
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef assoc : assocs)
{
NodeRef child = assoc.getChildRef();
if (recordsManagementService.isRecordsManagementContainer(child) == true ||
if (filePlanService.isFilePlanContainer(child) == true ||
recordsManagementService.isRecordFolder(child) == true ||
recordService.isRecord(child) == true)
{
@@ -487,14 +487,14 @@ public class FilePlanPermissionServiceImpl implements FilePlanPermissionService,
// Delete permission on this node
permissionService.deletePermission(nodeRef, authority, permission);
if (recordsManagementService.isRecordsManagementContainer(nodeRef) == true ||
if (filePlanService.isFilePlanContainer(nodeRef) == true ||
recordsManagementService.isRecordFolder(nodeRef) == true)
{
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef assoc : assocs)
{
NodeRef child = assoc.getChildRef();
if (recordsManagementService.isRecordsManagementContainer(child) == true ||
if (filePlanService.isFilePlanContainer(child) == true ||
recordsManagementService.isRecordFolder(child) == true ||
recordService.isRecord(child) == true)
{

View File

@@ -16,7 +16,7 @@
* 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;
package org.alfresco.module.org_alfresco_module_rm.util;
import java.util.Collections;
import java.util.HashSet;
@@ -29,9 +29,11 @@ import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
/**
* Utility class with policy helper methods.
*
* @author Roy Wetherall
*/
public class RecordsManagementPoliciesUtil
public class PoliciesUtil
{
/**
* Get all aspect and node type qualified names
@@ -67,5 +69,4 @@ public class RecordsManagementPoliciesUtil
}
}, AuthenticationUtil.getAdminUserName());
}
}

View File

@@ -25,6 +25,7 @@ import java.util.Map;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationService;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
@@ -45,7 +46,14 @@ import org.alfresco.service.namespace.RegexQNamePattern;
*/
public class BroadcastVitalRecordDefinitionAction extends RMActionExecuterAbstractBase
{
private FilePlanAuthenticationService filePlanAuthenticationService;
protected FilePlanService filePlanService;
protected FilePlanAuthenticationService filePlanAuthenticationService;
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
public void setFilePlanAuthenticationService(FilePlanAuthenticationService filePlanAuthenticationService)
{
@@ -94,7 +102,7 @@ public class BroadcastVitalRecordDefinitionAction extends RMActionExecuterAbstra
{
NodeRef nextChild = nextAssoc.getChildRef();
if (recordsManagementService.isFilePlanComponent(nextChild) == true)
if (filePlanService.isFilePlanComponent(nextChild) == true)
{
// If the child is a record, then the VitalRecord aspect needs to be applied or updated
if (recordService.isRecord(nextChild))

View File

@@ -24,9 +24,10 @@ import java.util.HashMap;
import java.util.Map;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
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.fileplan.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationService;
import org.alfresco.repo.node.NodeServicePolicies;
@@ -59,6 +60,7 @@ public class VitalRecordServiceImpl implements VitalRecordService,
private RecordsManagementService rmService;
private RecordsManagementActionService rmActionService;
private FilePlanAuthenticationService filePlanAuthenticationService;
private FilePlanService filePlanService;
/** Behaviours */
private JavaBehaviour onUpdateProperties;
@@ -101,6 +103,14 @@ public class VitalRecordServiceImpl implements VitalRecordService,
this.filePlanAuthenticationService = filePlanAuthenticationService;
}
/**
* @param filePlanService file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
/**
* Init method.
*/
@@ -164,7 +174,7 @@ public class VitalRecordServiceImpl implements VitalRecordService,
@Override
public Void doWork() throws Exception
{
if (rmService.isRecordCategory(nodeRef) == true ||
if (filePlanService.isRecordCategory(nodeRef) == true ||
rmService.isRecordFolder(nodeRef) == true)
{
inheritVitalRecordDefinition(nodeRef);
@@ -200,10 +210,10 @@ public class VitalRecordServiceImpl implements VitalRecordService,
// is the parent a record category
if (parentRef != null &&
FilePlanComponentKind.RECORD_CATEGORY.equals(rmService.getFilePlanComponentKind(parentRef)) == true)
FilePlanComponentKind.RECORD_CATEGORY.equals(filePlanService.getFilePlanComponentKind(parentRef)) == true)
{
// is the child a record category or folder
FilePlanComponentKind kind = rmService.getFilePlanComponentKind(nodeRef);
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
if (kind.equals(FilePlanComponentKind.RECORD_CATEGORY) == true ||
kind.equals(FilePlanComponentKind.RECORD_FOLDER) == true)
{
@@ -259,7 +269,7 @@ public class VitalRecordServiceImpl implements VitalRecordService,
{
VitalRecordDefinition result = null;
FilePlanComponentKind kind = rmService.getFilePlanComponentKind(nodeRef);
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
if (FilePlanComponentKind.RECORD.equals(kind) == true)
{
result = resolveVitalRecordDefinition(nodeRef);

View File

@@ -22,9 +22,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionDefinition;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.repo.action.evaluator.ActionConditionEvaluator;
import org.alfresco.service.cmr.action.ActionConditionDefinition;
import org.alfresco.service.cmr.action.ActionDefinition;
@@ -40,25 +40,32 @@ import org.springframework.context.ApplicationContextAware;
*/
public class ExtendedActionServiceImpl extends ActionServiceImpl implements ApplicationContextAware
{
/** Records management service */
private RecordsManagementService recordsManagementService;
/** File plan service */
private FilePlanService filePlanService;
/** Application context */
private ApplicationContext extendedApplicationContext;
/**
* @see org.alfresco.repo.action.ActionServiceImpl#setApplicationContext(org.springframework.context.ApplicationContext)
*/
public void setApplicationContext(ApplicationContext applicationContext)
{
super.setApplicationContext(applicationContext);
extendedApplicationContext = applicationContext;
}
/**
* @param recordsManagementService records management service
*/
public void setRecordsManagementService(RecordsManagementService recordsManagementService)
{
this.recordsManagementService = recordsManagementService;
}
/**
* @param filePlanService file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
/**
* @see org.alfresco.repo.action.ActionServiceImpl#getActionConditionDefinition(java.lang.String)
*/
public ActionConditionDefinition getActionConditionDefinition(String name)
{
// get direct access to action condition definition (i.e. ignoring public flag of executer)
@@ -91,7 +98,7 @@ public class ExtendedActionServiceImpl extends ActionServiceImpl implements Appl
else
{
// get the file component kind of the node reference
FilePlanComponentKind kind = recordsManagementService.getFilePlanComponentKind(nodeRef);
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
result = new ArrayList<ActionDefinition>(actionDefinitions.size());
// check each action definition

View File

@@ -20,7 +20,7 @@ package org.alfresco.repo.rule;
import java.util.Set;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationService;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
@@ -39,13 +39,13 @@ import org.alfresco.service.namespace.QName;
public class ExtendedRuleServiceImpl extends RuleServiceImpl
{
private boolean runAsRmAdmin = true;
private FilePlanService filePlanService;
private FilePlanAuthenticationService filePlanAuthenticationService;
protected NodeService nodeService;
private RecordsManagementService recordsManagementService;
public void setRunAsRmAdmin(boolean runAsRmAdmin)
{
this.runAsRmAdmin = runAsRmAdmin;
@@ -56,20 +56,20 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
this.filePlanAuthenticationService = filePlanAuthenticationService;
}
public void setRecordsManagementService(RecordsManagementService recordsManagementService)
{
this.recordsManagementService = recordsManagementService;
}
public void setNodeService2(NodeService nodeService)
{
this.nodeService = nodeService;
}
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
@Override
public void saveRule(final NodeRef nodeRef, final Rule rule)
{
if (recordsManagementService.isFilePlanComponent(nodeRef) == true && runAsRmAdmin == true)
if (filePlanService.isFilePlanComponent(nodeRef) == true && runAsRmAdmin == true)
{
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
{
@@ -91,7 +91,7 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
@Override
public void removeRule(final NodeRef nodeRef, final Rule rule)
{
if (recordsManagementService.isFilePlanComponent(nodeRef) == true && runAsRmAdmin == true)
if (filePlanService.isFilePlanComponent(nodeRef) == true && runAsRmAdmin == true)
{
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
{
@@ -116,7 +116,7 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
QName typeQName = nodeService.getType(nodeRef);
// The dispositionSchedule node will not be executed by rules
if (recordsManagementService.isFilePlanComponent(nodeRef) == true
if (filePlanService.isFilePlanComponent(nodeRef) == true
&& typeQName.equals(RecordsManagementModel.TYPE_DISPOSITION_SCHEDULE) == false
&& isFilePlanComponentRule(rule) == true && runAsRmAdmin == true)
{
@@ -141,6 +141,6 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
private boolean isFilePlanComponentRule(Rule rule)
{
NodeRef nodeRef = getOwningNodeRef(rule);
return recordsManagementService.isFilePlanComponent(nodeRef);
return filePlanService.isFilePlanComponent(nodeRef);
}
}

View File

@@ -90,7 +90,8 @@ public class RequestInfoNotifier implements TaskListener
* @param recordName The name of the record
* @return Returns the email subject
*/
private String getEmailSubject(String recordName)
@SuppressWarnings("unused")
private String getEmailSubject(String recordName)
{
StringBuilder sb = new StringBuilder();
sb.append(I18NUtil.getMessage("activitiReviewPooled.workflow.email.subject"));
@@ -106,7 +107,8 @@ public class RequestInfoNotifier implements TaskListener
* @param recordName The name of the record
* @return Returns the email body
*/
private String getEmailBody(String recordName)
@SuppressWarnings("unused")
private String getEmailBody(String recordName)
{
StringBuilder sb = new StringBuilder();
sb.append(I18NUtil.getMessage("activitiReviewPooled.workflow.email.body1"));

View File

@@ -26,12 +26,12 @@ import java.util.Set;
import net.sf.acegisecurity.vote.AccessDecisionVoter;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
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.CompositeCapability;
import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.role.Role;
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
@@ -88,7 +88,7 @@ public class DeclarativeCapabilityTest extends BaseRMTestCase
// MoveTo artifacts
moveToFolder = rmService.createRecordFolder(rmContainer, "moveToFolder");
moveToCategory = rmService.createRecordCategory(rmContainer, "moveToCategory");
moveToCategory = filePlanService.createRecordCategory(rmContainer, "moveToCategory");
}
@Override
@@ -187,7 +187,7 @@ public class DeclarativeCapabilityTest extends BaseRMTestCase
else
{
// Do the kind check here ...
FilePlanComponentKind actualKind = rmService.getFilePlanComponentKind(filePlanComponent);
FilePlanComponentKind actualKind = filePlanService.getFilePlanComponentKind(filePlanComponent);
List<String> kinds = capability.getKinds();
if (kinds == null ||

View File

@@ -139,9 +139,9 @@ public class DataSetServiceImplTest extends BaseRMTestCase
// TestRecordCategory1
NodeRef recCat1 = nodeService.getChildByName(filePlan, ContentModel.ASSOC_CONTAINS, "TestRecordCategory1");
assertNotNull(recCat1);
List<NodeRef> recCat1ImmediateChildren = rmService.getAllContained(recCat1);
List<NodeRef> recCat1ImmediateChildren = filePlanService.getAllContained(recCat1);
assertTrue(recCat1ImmediateChildren.size() == 3);
List<NodeRef> recCat1AllChildren = rmService.getAllContained(recCat1, true);
List<NodeRef> recCat1AllChildren = filePlanService.getAllContained(recCat1, true);
assertTrue(recCat1AllChildren.size() == 6);
DispositionSchedule recCat1DispositionSchedule = dispositionService.getDispositionSchedule(recCat1);
assertNull(recCat1DispositionSchedule);
@@ -149,9 +149,9 @@ public class DataSetServiceImplTest extends BaseRMTestCase
// TestRecordCategory2
NodeRef recCat2 = nodeService.getChildByName(filePlan, ContentModel.ASSOC_CONTAINS, "TestRecordCategory2");
assertNotNull(recCat2);
List<NodeRef> recCat2ImmediateChildren = rmService.getAllContained(recCat2);
List<NodeRef> recCat2ImmediateChildren = filePlanService.getAllContained(recCat2);
assertTrue(recCat2ImmediateChildren.size() == 2);
List<NodeRef> recCat2AllChildren = rmService.getAllContained(recCat2, true);
List<NodeRef> recCat2AllChildren = filePlanService.getAllContained(recCat2, true);
assertTrue(recCat2AllChildren.size() == 4);
DispositionSchedule recCat2DispositionSchedule = dispositionService.getDispositionSchedule(recCat2);
assertNull(recCat2DispositionSchedule);
@@ -159,9 +159,9 @@ public class DataSetServiceImplTest extends BaseRMTestCase
// TestRecordCategory1: Test the "second level" categories and record folders
NodeRef recCat11 = nodeService.getChildByName(recCat1, ContentModel.ASSOC_CONTAINS, "TestRecordCategory11");
assertNotNull(recCat11);
List<NodeRef> recCat11ImmediateChilderen = rmService.getAllContained(recCat11);
List<NodeRef> recCat11ImmediateChilderen = filePlanService.getAllContained(recCat11);
assertTrue(recCat11ImmediateChilderen.size() == 2);
List<NodeRef> recCat11Childeren = rmService.getAllContained(recCat11, true);
List<NodeRef> recCat11Childeren = filePlanService.getAllContained(recCat11, true);
assertTrue(recCat11Childeren.size() == 2);
assertNotNull(nodeService.getChildByName(recCat11, ContentModel.ASSOC_CONTAINS, "TestRecordFolder1"));
assertNotNull(nodeService.getChildByName(recCat11, ContentModel.ASSOC_CONTAINS, "TestRecordFolder2"));
@@ -172,9 +172,9 @@ public class DataSetServiceImplTest extends BaseRMTestCase
NodeRef recCat12 = nodeService.getChildByName(recCat1, ContentModel.ASSOC_CONTAINS, "TestRecordCategory12");
assertNotNull(recCat12);
List<NodeRef> recCat12ImmediateChildren = rmService.getAllContained(recCat12);
List<NodeRef> recCat12ImmediateChildren = filePlanService.getAllContained(recCat12);
assertTrue(recCat12ImmediateChildren.size() == 1);
List<NodeRef> recCat12Children = rmService.getAllContained(recCat12, true);
List<NodeRef> recCat12Children = filePlanService.getAllContained(recCat12, true);
assertTrue(recCat12Children.size() == 1);
assertNotNull(nodeService.getChildByName(recCat12, ContentModel.ASSOC_CONTAINS, "TestRecordFolder3"));
DispositionSchedule recCat12DispositionSchedule = dispositionService.getDispositionSchedule(recCat12);
@@ -187,7 +187,7 @@ public class DataSetServiceImplTest extends BaseRMTestCase
NodeRef recCat13 = nodeService.getChildByName(recCat1, ContentModel.ASSOC_CONTAINS, "TestRecordCategory13");
assertNotNull(recCat13);
List<NodeRef> recCat13ImmediateChildren = rmService.getAllContained(recCat13);
List<NodeRef> recCat13ImmediateChildren = filePlanService.getAllContained(recCat13);
assertTrue(recCat13ImmediateChildren.size() == 0);
DispositionSchedule recCat13DispositionSchedule = dispositionService.getDispositionSchedule(recCat13);
assertNotNull(recCat13DispositionSchedule);
@@ -195,16 +195,16 @@ public class DataSetServiceImplTest extends BaseRMTestCase
// TestRecordCategory2: Test the "second level" categories and record folders
NodeRef recCat21 = nodeService.getChildByName(recCat2, ContentModel.ASSOC_CONTAINS, "TestRecordCategory21");
assertNotNull(recCat21);
List<NodeRef> recCat21ImmediateChildren = rmService.getAllContained(recCat21);
List<NodeRef> recCat21ImmediateChildren = filePlanService.getAllContained(recCat21);
assertTrue(recCat21ImmediateChildren.size() == 0);
DispositionSchedule recCat21DispositionSchedule = dispositionService.getDispositionSchedule(recCat21);
assertNotNull(recCat21DispositionSchedule);
NodeRef recCat22 = nodeService.getChildByName(recCat2, ContentModel.ASSOC_CONTAINS, "TestRecordCategory22");
assertNotNull(recCat22);
List<NodeRef> recCat22ImmediateChildren = rmService.getAllContained(recCat22);
List<NodeRef> recCat22ImmediateChildren = filePlanService.getAllContained(recCat22);
assertTrue(recCat22ImmediateChildren.size() == 2);
List<NodeRef> recCat22Children = rmService.getAllContained(recCat22, true);
List<NodeRef> recCat22Children = filePlanService.getAllContained(recCat22, true);
assertTrue(recCat22Children.size() == 2);
assertNotNull(nodeService.getChildByName(recCat22, ContentModel.ASSOC_CONTAINS, "TestRecordFolder4"));
assertNotNull(nodeService.getChildByName(recCat22, ContentModel.ASSOC_CONTAINS, "TestRecordFolder5"));

View File

@@ -308,7 +308,7 @@ public class DispositionServiceImplTest extends BaseRMTestCase
public Void run()
{
// Add a new disposition schedule
NodeRef container = rmService.createRecordCategory(rmContainer, "hasDisposableTest");
NodeRef container = filePlanService.createRecordCategory(rmContainer, "hasDisposableTest");
DispositionSchedule ds = utils.createBasicDispositionSchedule(container);
assertTrue(dispositionService.hasDisposableItems(dispositionSchedule));
@@ -410,7 +410,7 @@ public class DispositionServiceImplTest extends BaseRMTestCase
public NodeRef run()
{
// Create a new container
NodeRef container = rmService.createRecordCategory(filePlan, "testCreateDispositionSchedule");
NodeRef container = filePlanService.createRecordCategory(filePlan, "testCreateDispositionSchedule");
// Create a new disposition schedule
utils.createBasicDispositionSchedule(container, "testCreateDispositionSchedule", "testCreateDispositionSchedule", false, true);
@@ -456,8 +456,8 @@ public class DispositionServiceImplTest extends BaseRMTestCase
public Void run()
{
// Create a new structure container
NodeRef testA = rmService.createRecordCategory(mhContainer, "testA");
NodeRef testB = rmService.createRecordCategory(testA, "testB");
NodeRef testA = filePlanService.createRecordCategory(mhContainer, "testA");
NodeRef testB = filePlanService.createRecordCategory(testA, "testB");
// Create new disposition schedules
utils.createBasicDispositionSchedule(testA, "testA", "testA", false, true);
@@ -839,7 +839,7 @@ public class DispositionServiceImplTest extends BaseRMTestCase
@Override
public Void run() throws Exception
{
testRM263RecordCategory = rmService.createRecordCategory(rmContainer, "rm263");
testRM263RecordCategory = filePlanService.createRecordCategory(rmContainer, "rm263");
testRM263DispositionSchedule = utils.createBasicDispositionSchedule(
testRM263RecordCategory,
"test",
@@ -914,7 +914,7 @@ public class DispositionServiceImplTest extends BaseRMTestCase
@Override
public Void run() throws Exception
{
testRM386RecordCategory = rmService.createRecordCategory(rmContainer, "RM386");
testRM386RecordCategory = filePlanService.createRecordCategory(rmContainer, "RM386");
testRM386DispositionSchedule = utils.createBasicDispositionSchedule(
testRM386RecordCategory,
"disposition instructions",

View File

@@ -65,7 +65,7 @@ public class ExtendedSecurityServiceImplTest extends BaseRMTestCase
record = utils.createRecord(rmFolder, "record.txt");
recordToo = utils.createRecord(rmFolder, "recordToo.txt");
moveRecordCategory = rmService.createRecordCategory(filePlan, "moveRecordCategory");
moveRecordCategory = filePlanService.createRecordCategory(filePlan, "moveRecordCategory");
moveRecordFolder = rmService.createRecordFolder(moveRecordCategory, "moveRecordFolder");
}

View File

@@ -18,9 +18,14 @@
*/
package org.alfresco.module.org_alfresco_module_rm.test.service;
import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.site.SiteVisibility;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.GUID;
/**
@@ -92,4 +97,441 @@ public class FilePlanServiceImplTest extends BaseRMTestCase
});
}
/**
* @see FilePlanService#isFilePlanComponent(org.alfresco.service.cmr.repository.NodeRef)
*/
public void testIsFilePlanComponent() throws Exception
{
doTestInTransaction(new Test<NodeRef>()
{
@Override
public NodeRef run()
{
assertTrue("The rm root container should be a rm component", filePlanService.isFilePlanComponent(filePlan));
assertTrue("The rm container should be a rm component", filePlanService.isFilePlanComponent(rmContainer));
assertTrue("The rm folder should be a rm component", filePlanService.isFilePlanComponent(rmFolder));
return null;
}
});
}
/**
* @see FilePlanService#getFilePlanComponentKind(NodeRef)
*/
public void testGetFilePlanComponentKind() throws Exception
{
doTestInTransaction(new Test<NodeRef>()
{
@Override
public NodeRef run() throws Exception
{
return utils.createRecord(rmFolder, "testRecord.txt");
}
@Override
public void test(NodeRef result) throws Exception
{
assertEquals(FilePlanComponentKind.FILE_PLAN, filePlanService.getFilePlanComponentKind(filePlan));
assertEquals(FilePlanComponentKind.RECORD_CATEGORY, filePlanService.getFilePlanComponentKind(rmContainer));
assertEquals(FilePlanComponentKind.RECORD_FOLDER, filePlanService.getFilePlanComponentKind(rmFolder));
assertEquals(FilePlanComponentKind.RECORD, filePlanService.getFilePlanComponentKind(result));
// TODO HOLD and TRANSFER
assertNull(filePlanService.getFilePlanComponentKind(folder));
}
});
}
/**
* @see FilePlanService#isRecordCategory(NodeRef)
*/
public void testIsRecordCategory() throws Exception
{
doTestInTransaction(new Test<NodeRef>()
{
@Override
public NodeRef run()
{
assertFalse("This should not be a record category.", filePlanService.isRecordCategory(filePlan));
assertTrue("This is a record category.", filePlanService.isRecordCategory(rmContainer));
assertFalse("This should not be a record category.", filePlanService.isRecordCategory(rmFolder));
return null;
}
});
}
/**
* @see FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, String)
* @see FilePlanService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, String, org.alfresco.service.namespace.QName)
*/
public void testCreateFilePlan() throws Exception
{
// Create default type of root
doTestInTransaction(new Test<NodeRef>()
{
@Override
public NodeRef run()
{
String id = setString("id", GUID.generate());
return filePlanService.createFilePlan(folder, id);
}
@Override
public void test(NodeRef result)
{
assertNotNull("Unable to create records management root", result);
basicRMContainerCheck(result, getString("id"), TYPE_FILE_PLAN);
}
});
// Create specific type of root
doTestInTransaction(new Test<NodeRef>()
{
@Override
public NodeRef run()
{
String id = setString("id", GUID.generate());
return filePlanService.createFilePlan(folder, id, TYPE_FILE_PLAN);
}
@Override
public void test(NodeRef result)
{
assertNotNull("Unable to create records management root", result);
basicRMContainerCheck(result, getString("id"), TYPE_FILE_PLAN);
}
});
// Failure: creating root in existing hierarchy
doTestInTransaction(new FailureTest()
{
@Override
public void run()
{
filePlanService.createFilePlan(rmContainer, GUID.generate());
}
});
// Failure: type no extended from root container
doTestInTransaction(new FailureTest()
{
@Override
public void run()
{
filePlanService.createFilePlan(folder, GUID.generate(), TYPE_FOLDER);
}
});
}
/**
* A basic test of a records management container
*
* @param nodeRef node reference
* @param name name of the container
* @param type the type of container
*/
private void basicRMContainerCheck(NodeRef nodeRef, String name, QName type)
{
// Check the basic details
assertEquals(name, nodeService.getProperty(nodeRef, PROP_NAME));
assertNotNull("RM id has not been set", nodeService.getProperty(nodeRef, PROP_IDENTIFIER));
assertEquals(type, nodeService.getType(nodeRef));
}
/**
* @see FilePlanService#createRecordCategory(NodeRef, String)
* @see FilePlanService#createRecordCategory(NodeRef, String, org.alfresco.service.namespace.QName)
*/
public void testCreateRecordCategory() throws Exception
{
// Create container (in root)
doTestInTransaction(new Test<NodeRef>()
{
@Override
public NodeRef run()
{
String id = setString("id", GUID.generate());
return filePlanService.createRecordCategory(filePlan, id);
}
@Override
public void test(NodeRef result)
{
assertNotNull("Unable to create records management container", result);
basicRMContainerCheck(result, getString("id"), TYPE_RECORD_CATEGORY);
}
});
// Create container (in container)
doTestInTransaction(new Test<NodeRef>()
{
@Override
public NodeRef run()
{
String id = setString("id", GUID.generate());
return filePlanService.createRecordCategory(rmContainer, id);
}
@Override
public void test(NodeRef result)
{
assertNotNull("Unable to create records management container", result);
basicRMContainerCheck(result, getString("id"), TYPE_RECORD_CATEGORY);
}
});
// TODO need a custom type of container!
// Create container of a given type
// doTestInTransaction(new Test<NodeRef>()
// {
// @Override
// public NodeRef run()
// {
// String id = setString("id", GUID.generate());
// return rmService.createRecordCategory(filePlan, id, TYPE_RECORD_SERIES);
// }
//
// @Override
// public void test(NodeRef result)
// {
// assertNotNull("Unable to create records management container", result);
// basicRMContainerCheck(result, getString("id"), TYPE_RECORD_SERIES);
// }
// });
// Fail Test: parent is not a container
doTestInTransaction(new FailureTest()
{
@Override
public void run()
{
filePlanService.createRecordCategory(folder, GUID.generate());
}
});
// Fail Test: type is not a sub-type of rm:recordsManagementContainer
doTestInTransaction(new FailureTest()
{
@Override
public void run()
{
filePlanService.createRecordCategory(filePlan, GUID.generate(), TYPE_FOLDER);
}
});
}
/**
* @see FilePlanService#getAllContained(NodeRef)
* @see FilePlanService#getAllContained(NodeRef, boolean)
*/
public void testGetAllContained() throws Exception
{
// Get all contained test
doTestInTransaction(new Test<Void>()
{
@Override
public Void run()
{
// Add to the test data
NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries");
NodeRef seriesChildFolder = rmService.createRecordFolder(series, "seriesRecordFolder");
NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer");
// Put in model
setNodeRef("series", series);
setNodeRef("seriesChildFolder", seriesChildFolder);
setNodeRef("seriesChildContainer", seriesChildContainer);
return null;
}
@Override
public void test(Void result) throws Exception
{
List<NodeRef> nodes = filePlanService.getAllContained(rmContainer);
assertNotNull(nodes);
assertEquals(2, nodes.size());
assertTrue(nodes.contains(getNodeRef("series")));
assertTrue(nodes.contains(rmFolder));
nodes = filePlanService.getAllContained(rmContainer, false);
assertNotNull(nodes);
assertEquals(2, nodes.size());
assertTrue(nodes.contains(getNodeRef("series")));
assertTrue(nodes.contains(rmFolder));
nodes = filePlanService.getAllContained(rmContainer, true);
assertNotNull(nodes);
assertEquals(4, nodes.size());
assertTrue(nodes.contains(getNodeRef("series")));
assertTrue(nodes.contains(rmFolder));
assertTrue(nodes.contains(getNodeRef("seriesChildFolder")));
assertTrue(nodes.contains(getNodeRef("seriesChildContainer")));
}
});
// Failure: call on record folder
doTestInTransaction(new FailureTest()
{
@Override
public void run()
{
filePlanService.getAllContained(rmFolder);
}
});
}
/**
* @see FilePlanService#getContainedRecordCategories(NodeRef)
* @see FilePlanService#getContainedRecordCategories(NodeRef, boolean)
*/
public void testGetContainedRecordCategories() throws Exception
{
// Test getting all contained containers
doTestInTransaction(new Test<Void>()
{
@Override
public Void run()
{
// Add to the test data
NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries");
NodeRef seriesChildFolder = rmService.createRecordFolder(series, "seriesRecordFolder");
NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer");
// Put in model
setNodeRef("series", series);
setNodeRef("seriesChildFolder", seriesChildFolder);
setNodeRef("seriesChildContainer", seriesChildContainer);
return null;
}
@Override
public void test(Void result) throws Exception
{
List<NodeRef> nodes = filePlanService.getContainedRecordCategories(rmContainer);
assertNotNull(nodes);
assertEquals(1, nodes.size());
assertTrue(nodes.contains(getNodeRef("series")));
nodes = filePlanService.getContainedRecordCategories(rmContainer, false);
assertNotNull(nodes);
assertEquals(1, nodes.size());
assertTrue(nodes.contains(getNodeRef("series")));
nodes = filePlanService.getContainedRecordCategories(rmContainer, true);
assertNotNull(nodes);
assertEquals(2, nodes.size());
assertTrue(nodes.contains(getNodeRef("series")));
assertTrue(nodes.contains(getNodeRef("seriesChildContainer")));
}
});
// Failure: call on record folder
doTestInTransaction(new FailureTest()
{
@Override
public void run()
{
filePlanService.getContainedRecordCategories(rmFolder);
}
});
}
/**
* @see FilePlanService#getContainedRecordFolders(NodeRef)
* @see FilePlanService#getContainedRecordFolders(NodeRef, boolean)
*/
public void testGetContainedRecordFolders() throws Exception
{
// Test getting all contained record folders
doTestInTransaction(new Test<Void>()
{
@Override
public Void run()
{
// Add to the test data
NodeRef series = filePlanService.createRecordCategory(rmContainer, "rmSeries");
NodeRef seriesChildFolder = rmService.createRecordFolder(series, "seriesRecordFolder");
NodeRef seriesChildContainer = filePlanService.createRecordCategory(series, "childContainer");
// Put in model
setNodeRef("series", series);
setNodeRef("seriesChildFolder", seriesChildFolder);
setNodeRef("seriesChildContainer", seriesChildContainer);
return null;
}
@Override
public void test(Void result) throws Exception
{
List<NodeRef> nodes = filePlanService.getContainedRecordFolders(rmContainer);
assertNotNull(nodes);
assertEquals(1, nodes.size());
assertTrue(nodes.contains(rmFolder));
nodes = filePlanService.getContainedRecordFolders(rmContainer, false);
assertNotNull(nodes);
assertEquals(1, nodes.size());
assertTrue(nodes.contains(rmFolder));
nodes = filePlanService.getContainedRecordFolders(rmContainer, true);
assertNotNull(nodes);
assertEquals(2, nodes.size());
assertTrue(nodes.contains(rmFolder));
assertTrue(nodes.contains(getNodeRef("seriesChildFolder")));
}
});
// Failure: call on record folder
doTestInTransaction(new FailureTest()
{
@Override
public void run()
{
filePlanService.getContainedRecordFolders(rmFolder);
}
});
}
/**
* Test to create a simple multi-hierarchy record taxonomy
*/
public void testCreateSimpleHierarchy()
{
doTestInTransaction(new Test<Void>()
{
@Override
public Void run()
{
// Create 3 level hierarchy
NodeRef levelOne = setNodeRef("container1", filePlanService.createRecordCategory(filePlan, "container1"));
assertNotNull("Unable to create container", levelOne);
NodeRef levelTwo = setNodeRef("container2", filePlanService.createRecordCategory(levelOne, "container2"));
assertNotNull("Unable to create container", levelTwo);
NodeRef levelThree = setNodeRef("container3", filePlanService.createRecordCategory(levelTwo, "container3"));
assertNotNull("Unable to create container", levelThree);
NodeRef levelThreeRecordFolder = setNodeRef("recordFolder3", rmService.createRecordFolder(levelThree, "recordFolder3"));
assertNotNull("Unable to create record folder", levelThreeRecordFolder);
return null;
}
@Override
public void test(Void result)
{
// Test that the hierarchy has been created correctly
basicRMContainerCheck(getNodeRef("container1"), "container1", TYPE_RECORD_CATEGORY);
basicRMContainerCheck(getNodeRef("container2"), "container2", TYPE_RECORD_CATEGORY);
basicRMContainerCheck(getNodeRef("container3"), "container3", TYPE_RECORD_CATEGORY);
basicRMContainerCheck(getNodeRef("recordFolder3"), "recordFolder3", TYPE_RECORD_FOLDER);
// TODO need to check that the parents and children can be retrieved correctly
}
});
}
}

View File

@@ -55,10 +55,10 @@ public class FreezeServiceImplTest extends BaseRMTestCase
assertTrue(recordService.isRecord(recordTwo));
assertTrue(recordService.isRecord(recordThree));
assertTrue(recordService.isRecord(recordFour));
assertTrue(rmService.isFilePlanComponent(recordOne));
assertTrue(rmService.isFilePlanComponent(recordTwo));
assertTrue(rmService.isFilePlanComponent(recordThree));
assertTrue(rmService.isFilePlanComponent(recordFour));
assertTrue(filePlanService.isFilePlanComponent(recordOne));
assertTrue(filePlanService.isFilePlanComponent(recordTwo));
assertTrue(filePlanService.isFilePlanComponent(recordThree));
assertTrue(filePlanService.isFilePlanComponent(recordFour));
// Freeze a record
freezeService.freeze("FreezeReason", recordOne);

View File

@@ -67,16 +67,25 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
{
super.setUp();
// test start time recorded
testStartTime = new Date();
// Stop and clear the log
auditService.stop();
auditService.clear();
auditService.start();
// check that audit service is started
assertTrue(auditService.isEnabled());
doTestInTransaction(new Test<Void>()
{
@Override
public Void run() throws Exception
{
// test start time recorded
testStartTime = new Date();
// Stop and clear the log
auditService.stopAuditLog(filePlan);
auditService.clearAuditLog(filePlan);
auditService.startAuditLog(filePlan);
// check that audit service is started
assertTrue(auditService.isAuditLogEnabled(filePlan));
return null;
}
});
}
/**
@@ -100,7 +109,7 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
super.tearDown();
// ensure the audit is restarted
auditService.start();
auditService.startAuditLog(filePlan);
}
/**
@@ -274,7 +283,7 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
public void testAdminMethods() throws InterruptedException
{
// Stop the audit
auditService.stop();
auditService.stopAuditLog(filePlan);
Thread.sleep(5000);
@@ -294,7 +303,7 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
result1.size(), result2.size());
// repeat with a start
auditService.start();
auditService.startAuditLog(filePlan);
updateTitle(filePlan, rmAdminName);
Thread.sleep(5000);
@@ -308,8 +317,8 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
Thread.sleep(5000);
// Stop and delete all entries
auditService.stop();
auditService.clear();
auditService.stopAuditLog(filePlan);
auditService.clearAuditLog(filePlan);
// There should be no entries
List<RecordsManagementAuditEntry> result4 = getAuditTrail(rmAdminName);
@@ -327,9 +336,9 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
public void xtestAuditAuthentication()
{
auditService.stop();
auditService.clear();
auditService.start();
auditService.stopAuditLog(filePlan);
auditService.clearAuditLog(filePlan);
auditService.startAuditLog(filePlan);
//MutableAuthenticationService authenticationService = serviceRegistry.getAuthenticationService();
//PersonService personService = serviceRegistry.getPersonService();
@@ -359,7 +368,7 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
{
AuthenticationUtil.popAuthentication();
}
auditService.stop();
auditService.stopAuditLog(filePlan);
List<RecordsManagementAuditEntry> result1 = getAuditTrail(rmAdminName);
// Check that the username is reflected correctly in the results
assertFalse("No audit results were generated for the failed login.", result1.isEmpty());
@@ -392,8 +401,8 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
personProperties.put(ContentModel.PROP_LASTNAME, "Dickons");
personService.createPerson(personProperties);
auditService.clear();
auditService.start();
auditService.clearAuditLog(filePlan);
auditService.startAuditLog(filePlan);
try
{
AuthenticationUtil.pushAuthentication();
@@ -403,7 +412,7 @@ public class RecordsManagementAuditServiceImplTest extends BaseRMTestCase
{
AuthenticationUtil.popAuthentication();
}
auditService.stop();
auditService.stopAuditLog(filePlan);
List<RecordsManagementAuditEntry> result2 = getAuditTrail(rmAdminName);
found = false;
for (RecordsManagementAuditEntry entry : result2)

View File

@@ -20,8 +20,8 @@ package org.alfresco.module.org_alfresco_module_rm.test.service;
import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
@@ -40,6 +40,7 @@ public class RecordsManagementServiceImplTest extends BaseRMTestCase
/**
* @see RecordsManagementService#isFilePlanComponent(org.alfresco.service.cmr.repository.NodeRef)
*/
@SuppressWarnings("deprecation")
public void testIsFilePlanComponent() throws Exception
{
doTestInTransaction(new Test<NodeRef>()
@@ -59,6 +60,7 @@ public class RecordsManagementServiceImplTest extends BaseRMTestCase
/**
* @see RecordsManagementService#getFilePlanComponentKind(NodeRef)
*/
@SuppressWarnings("deprecation")
public void testGetFilePlanComponentKind() throws Exception
{
doTestInTransaction(new Test<NodeRef>()
@@ -105,6 +107,7 @@ public class RecordsManagementServiceImplTest extends BaseRMTestCase
/**
* @see RecordsManagementService#isRecordCategory(NodeRef)
*/
@SuppressWarnings("deprecation")
public void testIsRecordCategory() throws Exception
{
doTestInTransaction(new Test<NodeRef>()
@@ -140,14 +143,6 @@ public class RecordsManagementServiceImplTest extends BaseRMTestCase
});
}
// TODO void testIsRecord()
// TODO void testIsHold()
// TODO void testIsTransfer()
// TODO void testGetNodeRefPath()
/**
* @see RecordsManagementService#getRecordsManagementRoot()
*/
@@ -195,6 +190,7 @@ public class RecordsManagementServiceImplTest extends BaseRMTestCase
* @see RecordsManagementService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, String)
* @see RecordsManagementService#createFilePlan(org.alfresco.service.cmr.repository.NodeRef, String, org.alfresco.service.namespace.QName)
*/
@SuppressWarnings("deprecation")
public void testCreateFilePlan() throws Exception
{
// Create default type of root
@@ -260,6 +256,7 @@ public class RecordsManagementServiceImplTest extends BaseRMTestCase
* @see RecordsManagementService#createRecordCategory(NodeRef, String)
* @see RecordsManagementService#createRecordCategory(NodeRef, String, org.alfresco.service.namespace.QName)
*/
@SuppressWarnings("deprecation")
public void testCreateRecordCategory() throws Exception
{
// Create container (in root)
@@ -342,6 +339,7 @@ public class RecordsManagementServiceImplTest extends BaseRMTestCase
* @see RecordsManagementService#getAllContained(NodeRef)
* @see RecordsManagementService#getAllContained(NodeRef, boolean)
*/
@SuppressWarnings("deprecation")
public void testGetAllContained() throws Exception
{
// Get all contained test
@@ -404,6 +402,7 @@ public class RecordsManagementServiceImplTest extends BaseRMTestCase
* @see RecordsManagementService#getContainedRecordCategories(NodeRef)
* @see RecordsManagementService#getContainedRecordCategories(NodeRef, boolean)
*/
@SuppressWarnings("deprecation")
public void testGetContainedRecordCategories() throws Exception
{
// Test getting all contained containers
@@ -461,6 +460,7 @@ public class RecordsManagementServiceImplTest extends BaseRMTestCase
* @see RecordsManagementService#getContainedRecordFolders(NodeRef)
* @see RecordsManagementService#getContainedRecordFolders(NodeRef, boolean)
*/
@SuppressWarnings("deprecation")
public void testGetContainedRecordFolders() throws Exception
{
// Test getting all contained record folders
@@ -575,6 +575,7 @@ public class RecordsManagementServiceImplTest extends BaseRMTestCase
/**
* Test to create a simple multi-hierarchy record taxonomy
*/
@SuppressWarnings("deprecation")
public void testCreateSimpleHierarchy()
{
doTestInTransaction(new Test<Void>()

View File

@@ -196,7 +196,7 @@ public class VitalRecordServiceImplTest extends BaseRMTestCase
@Override
public NodeRef run()
{
return rmService.createRecordCategory(mhContainer35, GUID.generate());
return filePlanService.createRecordCategory(mhContainer35, GUID.generate());
}
@Override

View File

@@ -20,7 +20,6 @@ package org.alfresco.module.org_alfresco_module_rm.test.system;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.transaction.UserTransaction;
@@ -28,10 +27,10 @@ import javax.transaction.UserTransaction;
import junit.framework.TestCase;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
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.dod5015.DOD5015Model;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.repo.content.MimetypeMap;
@@ -54,12 +53,12 @@ public class PerformanceDataLoadSystemTest extends TestCase implements RecordsMa
{
private ApplicationContext appContext;
private AuthenticationComponent authenticationComponent;
private RecordsManagementService rmService;
private DispositionService dispositionService;
private TransactionService transactionService;
private NodeService nodeService;
private ContentService contentService;
private IdentifierService identifierService;
private FilePlanService filePlanService;
UserTransaction userTransaction;
@@ -75,10 +74,10 @@ public class PerformanceDataLoadSystemTest extends TestCase implements RecordsMa
authenticationComponent = (AuthenticationComponent)appContext.getBean("authenticationComponent");
transactionService = (TransactionService)appContext.getBean("transactionService");
nodeService = (NodeService)appContext.getBean("nodeService");
rmService = (RecordsManagementService)appContext.getBean("recordsManagementService");
contentService = (ContentService)appContext.getBean("contentService");
identifierService = (IdentifierService)appContext.getBean("identifierService");
dispositionService = (DispositionService)appContext.getBean("dispositionService");
filePlanService = (FilePlanService)appContext.getBean("filePlanService");
// Set authentication
authenticationComponent.setCurrentUser("admin");
@@ -96,13 +95,11 @@ public class PerformanceDataLoadSystemTest extends TestCase implements RecordsMa
public void testLoadTestData() throws Exception
{
// Get the file plan node
List<NodeRef> roots = rmService.getFilePlans();
if (roots.size() != 1)
NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
if (filePlan == null)
{
fail("There is more than one root to load the test data into.");
fail("The default RM site is not present.");
}
NodeRef filePlan = roots.get(0);
for (int i = 0; i < SERIES_COUNT; i++)
{

View File

@@ -23,9 +23,9 @@ import java.util.HashMap;
import java.util.Map;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService;
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.admin.RecordsManagementAdminService;
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
import org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService;
@@ -293,7 +293,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
// Get the application context
applicationContext = ApplicationContextHelper.getApplicationContext(CONFIG_LOCATIONS);
utils = new CommonRMTestUtils(applicationContext);
// Initialise the service beans
initServices();
@@ -484,6 +484,9 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
ContentModel.TYPE_FOLDER,
containerProps).getChildRef();
assertNotNull("Could not create base folder", folder);
permissionService.setPermission(folder, "rmadmin", PermissionService.WRITE, true);
permissionService.setPermission(folder, "rmadmin", PermissionService.ADD_CHILDREN, true);
siteInfo = siteService.createSite(
"rm-site-dashboard",
@@ -497,7 +500,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
assertNotNull("Site document library container was not created successfully.", filePlan);
// Create RM container
rmContainer = rmService.createRecordCategory(filePlan, "rmContainer");
rmContainer = filePlanService.createRecordCategory(filePlan, "rmContainer");
assertNotNull("Could not create rm container", rmContainer);
// Create disposition schedule
@@ -633,27 +636,27 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
protected void setupMultiHierarchyTestDataImpl()
{
// Create root mh container
mhContainer = rmService.createRecordCategory(filePlan, "mhContainer");
mhContainer = filePlanService.createRecordCategory(filePlan, "mhContainer");
// Level 1
mhContainer11 = rmService.createRecordCategory(mhContainer, "mhContainer11");
mhContainer11 = filePlanService.createRecordCategory(mhContainer, "mhContainer11");
mhDispositionSchedule11 = utils.createBasicDispositionSchedule(mhContainer11, "ds11", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, false, true);
mhContainer12 = rmService.createRecordCategory(mhContainer, "mhContainer12");
mhContainer12 = filePlanService.createRecordCategory(mhContainer, "mhContainer12");
mhDispositionSchedule12 = utils.createBasicDispositionSchedule(mhContainer12, "ds12", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, false, true);
// Level 2
mhContainer21 = rmService.createRecordCategory(mhContainer11, "mhContainer21");
mhContainer22 = rmService.createRecordCategory(mhContainer12, "mhContainer22");
mhContainer23 = rmService.createRecordCategory(mhContainer12, "mhContainer23");
mhContainer21 = filePlanService.createRecordCategory(mhContainer11, "mhContainer21");
mhContainer22 = filePlanService.createRecordCategory(mhContainer12, "mhContainer22");
mhContainer23 = filePlanService.createRecordCategory(mhContainer12, "mhContainer23");
mhDispositionSchedule23 = utils.createBasicDispositionSchedule(mhContainer23, "ds23", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, false, true);
// Level 3
mhContainer31 = rmService.createRecordCategory(mhContainer21, "mhContainer31");
mhContainer32 = rmService.createRecordCategory(mhContainer22, "mhContainer32");
mhContainer33 = rmService.createRecordCategory(mhContainer22, "mhContainer33");
mhContainer31 = filePlanService.createRecordCategory(mhContainer21, "mhContainer31");
mhContainer32 = filePlanService.createRecordCategory(mhContainer22, "mhContainer32");
mhContainer33 = filePlanService.createRecordCategory(mhContainer22, "mhContainer33");
mhDispositionSchedule33 = utils.createBasicDispositionSchedule(mhContainer33, "ds33", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, true, true);
mhContainer34 = rmService.createRecordCategory(mhContainer23, "mhContainer34");
mhContainer35 = rmService.createRecordCategory(mhContainer23, "mhContainer35");
mhContainer34 = filePlanService.createRecordCategory(mhContainer23, "mhContainer34");
mhContainer35 = filePlanService.createRecordCategory(mhContainer23, "mhContainer35");
mhDispositionSchedule35 = utils.createBasicDispositionSchedule(mhContainer35, "ds35", CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, true, true);
// Record folders

View File

@@ -23,14 +23,15 @@ import java.util.HashMap;
import java.util.Map;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService;
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.admin.RecordsManagementAdminService;
import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService;
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
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.event.RecordsManagementEventService;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
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.role.FilePlanRoleService;
@@ -107,6 +108,7 @@ public class BaseRMWebScriptTestCase extends BaseWebScriptTest
protected RecordsManagementAuditService auditService;
protected CapabilityService capabilityService;
protected VitalRecordService vitalRecordService;
protected FilePlanService filePlanService;
/** test data */
protected StoreRef storeRef;
@@ -178,6 +180,7 @@ public class BaseRMWebScriptTestCase extends BaseWebScriptTest
auditService = (RecordsManagementAuditService)applicationContext.getBean("RecordsManagementAuditService");
capabilityService = (CapabilityService)applicationContext.getBean("CapabilityService");
vitalRecordService = (VitalRecordService)applicationContext.getBean("VitalRecordService");
filePlanService = (FilePlanService)applicationContext.getBean("FilePlanService");
}
/**
@@ -276,10 +279,10 @@ public class BaseRMWebScriptTestCase extends BaseWebScriptTest
filePlan = siteService.getContainer(SITE_ID, RmSiteType.COMPONENT_DOCUMENT_LIBRARY);
assertNotNull("Site document library container was not created successfully.", filePlan);
recordSeries = rmService.createRecordCategory(filePlan, "recordSeries");
recordSeries = filePlanService.createRecordCategory(filePlan, "recordSeries");
assertNotNull("Could not create record category with no disposition schedule", recordSeries);
recordCategory = rmService.createRecordCategory(recordSeries, "rmContainer");
recordCategory = filePlanService.createRecordCategory(recordSeries, "rmContainer");
assertNotNull("Could not create record category", recordCategory);
// Make vital record

View File

@@ -147,7 +147,7 @@ public class CommonRMTestUtils implements RecordsManagementModel
ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name),
ContentModel.TYPE_CONTENT,
properties).getChildRef();
properties).getChildRef();
// Set the content
ContentWriter writer = contentService.getWriter(recordOne, ContentModel.PROP_CONTENT, true);

View File

@@ -19,6 +19,7 @@
package org.alfresco.module.org_alfresco_module_rm.test.webscript;
import java.io.IOException;
import java.text.MessageFormat;
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase;
import org.json.JSONArray;
@@ -37,7 +38,7 @@ import org.springframework.extensions.webscripts.TestWebScriptServer.Response;
public class CapabilitiesRestApiTest extends BaseRMWebScriptTestCase
{
/** URLs for the REST API */
private static final String GET_CAPABILITIES_URL = "/api/capabilities?";
private static final String GET_CAPABILITIES_URL = "/api/node/{0}/{1}/{2}/capabilities?";
/**
* Tests the REST API to get the list of capabilities
@@ -47,14 +48,21 @@ public class CapabilitiesRestApiTest extends BaseRMWebScriptTestCase
*/
public void testGetCapabilitiesAction() throws IOException, JSONException
{
String baseURL = MessageFormat.format(GET_CAPABILITIES_URL,
filePlan.getStoreRef().getProtocol(),
filePlan.getStoreRef().getIdentifier(),
filePlan.getId());
// Format url and send request
String getUrl = String.format(GET_CAPABILITIES_URL + "includeAll=%s", true);
String getUrl = String.format(baseURL + "includeAll=%s", true);
Response getResponse = sendRequest(new GetRequest(getUrl), Status.STATUS_OK);
// Check the content from the response
String getContentAsString = getResponse.getContentAsString();
assertNotNull(getContentAsString);
System.out.println(getContentAsString);
// Convert the response to json and check the data
JSONObject getContentAsJson = new JSONObject(getContentAsString);
JSONObject getData = getContentAsJson.getJSONObject("data");
@@ -65,7 +73,7 @@ public class CapabilitiesRestApiTest extends BaseRMWebScriptTestCase
assertNotNull(getDataSets);
// Format url and send another request with different parameter
getUrl = String.format(GET_CAPABILITIES_URL + "grouped=%s", true);
getUrl = String.format(baseURL + "grouped=%s", true);
getResponse = sendRequest(new GetRequest(getUrl), Status.STATUS_OK);
// Check the content from the response
@@ -73,7 +81,7 @@ public class CapabilitiesRestApiTest extends BaseRMWebScriptTestCase
assertNotNull(getContentAsString);
// If both parameters are specified the result should be the same with only specifying the "grouped" parameter
getUrl = String.format(GET_CAPABILITIES_URL + "includeAll=%s&amp;grouped=%s", true, true);
getUrl = String.format(baseURL + "includeAll=%s&amp;grouped=%s", true, true);
getResponse = sendRequest(new GetRequest(getUrl), Status.STATUS_OK);
getContentAsString.equalsIgnoreCase(getResponse.getContentAsString());

View File

@@ -127,7 +127,7 @@ public class DispositionRestApiTest extends BaseRMWebScriptTestCase implements R
// create a new recordCategory node in the recordSeries and then get
// the disposition schedule
NodeRef newRecordCategory = rmService.createRecordCategory(recordSeries, GUID.generate());
NodeRef newRecordCategory = filePlanService.createRecordCategory(recordSeries, GUID.generate());
dispositionService.createDispositionSchedule(newRecordCategory, null);
categoryNodeUrl = newRecordCategory.toString().replace("://", "/");
@@ -154,7 +154,7 @@ public class DispositionRestApiTest extends BaseRMWebScriptTestCase implements R
{
// create a new recordCategory node in the recordSeries and then get
// the disposition schedule
NodeRef newRecordCategory = rmService.createRecordCategory(recordSeries, GUID.generate());
NodeRef newRecordCategory = filePlanService.createRecordCategory(recordSeries, GUID.generate());
dispositionService.createDispositionSchedule(newRecordCategory, null);
String categoryNodeUrl = newRecordCategory.toString().replace("://", "/");
@@ -232,7 +232,7 @@ public class DispositionRestApiTest extends BaseRMWebScriptTestCase implements R
public void testPutDispositionAction() throws Exception
{
NodeRef newRecordCategory = rmService.createRecordCategory(recordSeries, GUID.generate());
NodeRef newRecordCategory = filePlanService.createRecordCategory(recordSeries, GUID.generate());
dispositionService.createDispositionSchedule(newRecordCategory, null);
// create an action definition to then update
@@ -301,7 +301,7 @@ public class DispositionRestApiTest extends BaseRMWebScriptTestCase implements R
public void testDeleteDispositionAction() throws Exception
{
NodeRef newRecordCategory = rmService.createRecordCategory(recordSeries, GUID.generate());
NodeRef newRecordCategory = filePlanService.createRecordCategory(recordSeries, GUID.generate());
dispositionService.createDispositionSchedule(newRecordCategory, null);
// create an action definition to then delete