diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-condition-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-condition-context.xml
index b5289096aa..2113dbe123 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-condition-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-condition-context.xml
@@ -12,6 +12,7 @@
+
-
+
@@ -197,7 +197,7 @@
-
+
${rm.rule.runasrmadmin}
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/log4j.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/log4j.properties
index ec18e783e1..d8ed8d931b 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/log4j.properties
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/log4j.properties
@@ -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
\ No newline at end of file
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/module-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/module-context.xml
index 53b74a19bc..a654b96cda 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/module-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/module-context.xml
@@ -55,13 +55,13 @@
-
+
@@ -69,7 +69,7 @@
class="org.alfresco.module.org_alfresco_module_rm.action.evaluator.IsKindEvaluator">
-
+
+
@@ -787,7 +788,9 @@
+ parent="rmAction">
+
+
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml
index fb5c1a63b5..fbaa11b0a6 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml
@@ -56,7 +56,6 @@
parent="org_alfresco_module_rm_BaseBehaviour">
-
-
-
+
+
+
@@ -126,6 +127,7 @@
+
@@ -181,6 +183,7 @@
+
@@ -467,6 +470,9 @@
@@ -626,7 +640,6 @@
-
@@ -1025,6 +1038,7 @@
+
@@ -1067,15 +1081,21 @@
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml
index 226449d727..02d4d81323 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml
@@ -21,6 +21,7 @@
+
+
@@ -198,6 +199,7 @@
class="org.alfresco.module.org_alfresco_module_rm.script.AuditLogDelete"
parent="webscript">
+
@@ -306,7 +308,7 @@
-
+
@@ -385,6 +387,7 @@
+
@@ -474,7 +477,7 @@
-
+
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementService.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementService.java
index d5020c82db..0d31fd1441 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementService.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementService.java
@@ -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.
- *
- * 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.
- *
- * 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 NodeRef sequence from the {@link #getFilePlan(NodeRef) root}
- * down to the fileplan component given. The array will start with the NodeRef of the root
- * and end with the name of the fileplan component node given.
- *
- * @param nodeRef a fileplan component
- * @return Returns a NodeRef path starting with the name of the
- * records management root
+ * @deprecated as of 2.1, see {@link FilePlanService#getNodeRefPath(NodeRef)}
*/
+ @Deprecated
List 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 list of file plan nodes
* @deprecated As of 2.1, see {@link FilePlanService#getFilePlans()}
*/
@Deprecated
List 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 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 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 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 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 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 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 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 getContainedRecordFolders(NodeRef container);
- // TODO List 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 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 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 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
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceImpl.java
index 72dd07686c..11fdaa1180 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceImpl.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementServiceImpl.java
@@ -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 getNodeRefPath(NodeRef nodeRef)
{
- LinkedList nodeRefPath = new LinkedList();
- try
- {
- getNodeRefPathRecursive(nodeRef, nodeRefPath);
- }
- catch (Throwable e)
- {
- throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PATH_NODE, nodeRef), e);
- }
- return nodeRefPath;
- }
-
- /**
- * Helper method to build a NodeRef path from the node to the RM root
- */
- private void getNodeRefPathRecursive(NodeRef nodeRef, LinkedList 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 getFilePlans()
{
- return new ArrayList(serviceRegistry.getFilePlanService().getFilePlans());
+ return new ArrayList(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 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 rmRootProps = new HashMap(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 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 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 props = new HashMap(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 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 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 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 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 result = new ArrayList(1);
- List 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 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 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 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 getContainedRecordFolders(NodeRef container, boolean deep)
{
- return getContained(container, TYPE_RECORD_FOLDER, deep);
+ return getFilePlanService().getContainedRecordFolders(container, deep);
}
/**
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMActionExecuterAbstractBase.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMActionExecuterAbstractBase.java
index d85bcd00fd..10d9c2365b 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMActionExecuterAbstractBase.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMActionExecuterAbstractBase.java
@@ -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;
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionEvaluatorAbstractBase.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionEvaluatorAbstractBase.java
index 42dcab9595..28a10343ea 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionEvaluatorAbstractBase.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionConditionEvaluatorAbstractBase.java
@@ -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
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionDefinition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionDefinition.java
index d122e097c2..ebb555ffd7 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionDefinition.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionDefinition.java
@@ -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;
/**
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionDefinitionImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionDefinitionImpl.java
index 6bf7d90627..b32b4c7dea 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionDefinitionImpl.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionDefinitionImpl.java
@@ -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;
/**
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionServiceImpl.java
index 1f69c6d03e..3195f195a5 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionServiceImpl.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionServiceImpl.java
@@ -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 parameters)
{
// get qnames to invoke against
- Set qnames = RecordsManagementPoliciesUtil.getTypeAndAspectQNames(nodeService, nodeRef);
+ Set 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 parameters)
{
// get qnames to invoke against
- Set qnames = RecordsManagementPoliciesUtil.getTypeAndAspectQNames(nodeService, nodeRef);
+ Set qnames = PoliciesUtil.getTypeAndAspectQNames(nodeService, nodeRef);
// execute policy for node type and aspects
OnRMActionExecution policy = onRMActionExecutionDelegate.get(qnames);
policy.onRMActionExecution(nodeRef, name, parameters);
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/RecordTypeParameterConstraint.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/RecordTypeParameterConstraint.java
index 67e8611937..b2cfc72d38 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/RecordTypeParameterConstraint.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/RecordTypeParameterConstraint.java
@@ -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;
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/DispositionActionRelativePositions.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/DispositionActionRelativePositions.java
similarity index 90%
rename from rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/DispositionActionRelativePositions.java
rename to rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/DispositionActionRelativePositions.java
index 90b1e55539..60f27cfdd5 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/DispositionActionRelativePositions.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/DispositionActionRelativePositions.java
@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see .
*/
-package org.alfresco.module.org_alfresco_module_rm;
+package org.alfresco.module.org_alfresco_module_rm.action.evaluator;
/**
* Disposition action relative position enumeration class.
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/HasDispositionActionEvaluator.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/HasDispositionActionEvaluator.java
index fa8ab9b6b0..9a3353848e 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/HasDispositionActionEvaluator.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/HasDispositionActionEvaluator.java
@@ -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"));
}
-
}
\ No newline at end of file
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsKindEvaluator.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsKindEvaluator.java
index 57ee314af9..cbe6548018 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsKindEvaluator.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/IsKindEvaluator.java
@@ -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))
{
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CreateDispositionScheduleAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CreateDispositionScheduleAction.java
index 8afd659d33..dbeb81e091 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CreateDispositionScheduleAction.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CreateDispositionScheduleAction.java
@@ -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);
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileToAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileToAction.java
index ab371d262d..39d0ceec14 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileToAction.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileToAction.java
@@ -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.");
}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminServiceImpl.java
index 2e2acc24dd..3e52c00226 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminServiceImpl.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminServiceImpl.java
@@ -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 qnames = RecordsManagementPoliciesUtil.getTypeAndAspectQNames(nodeService, fromNodeRef);
+ Set 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 qnames = RecordsManagementPoliciesUtil.getTypeAndAspectQNames(nodeService, fromNodeRef);
+ Set 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 qnames = RecordsManagementPoliciesUtil.getTypeAndAspectQNames(nodeService, fromNodeRef);
+ Set 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 qnames = RecordsManagementPoliciesUtil.getTypeAndAspectQNames(nodeService, fromNodeRef);
+ Set qnames = PoliciesUtil.getTypeAndAspectQNames(nodeService, fromNodeRef);
// execute policy for node type and aspects
OnRemoveReference policy = onRemoveReferenceDelegate.get(qnames);
policy.onRemoveReference(fromNodeRef, toNodeRef, reference);
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/FilePlanNamePathDataExtractor.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/FilePlanNamePathDataExtractor.java
index edd08cc022..2b581e560e 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/FilePlanNamePathDataExtractor.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/FilePlanNamePathDataExtractor.java
@@ -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 true 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 nodeRefPath = rmService.getNodeRefPath(nodeRef);
+ List nodeRefPath = filePlanService.getNodeRefPath(nodeRef);
StringBuilder sb = new StringBuilder(128);
for (NodeRef pathNodeRef : nodeRefPath)
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/FilePlanNodeRefPathDataExtractor.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/FilePlanNodeRefPathDataExtractor.java
index 5248d6bb9a..25f07c10a4 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/FilePlanNodeRefPathDataExtractor.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/FilePlanNodeRefPathDataExtractor.java
@@ -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 true 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 nodeRefPath = rmService.getNodeRefPath(nodeRef);
+ List nodeRefPath = filePlanService.getNodeRefPath(nodeRef);
// Done
return (Serializable) nodeRefPath;
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditService.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditService.java
index f493d4949c..99460c6401 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditService.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditService.java
@@ -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.
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java
index c7a48c1cf1..c19216a9e7 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java
@@ -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 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 nodePropertiesBefore;
private Map nodePropertiesAfter;
- private RMAuditNode()
- {
- }
-
public String getEventName()
{
return eventName;
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/PolicyRegister.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/PolicyRegister.java
new file mode 100644
index 0000000000..de6c9089d4
--- /dev/null
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/PolicyRegister.java
@@ -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 .
+ */
+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);
+}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoter.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoter.java
index 9d21ead256..abfe60681e 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoter.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoter.java
@@ -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 policies = new HashMap();
-
-// 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 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 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 extractSupportedDefinitions(net.sf.acegisecurity.ConfigAttributeDefinition config)
{
@@ -331,6 +390,5 @@ public class RMEntryVoter extends RMSecurityCommon
}
return definitions;
- }
-
+ }
}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMSecurityCommon.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMSecurityCommon.java
index 9eedaa00b5..1e8f2af985 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMSecurityCommon.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMSecurityCommon.java
@@ -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 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]))
{
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/AbstractCapabilityCondition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/AbstractCapabilityCondition.java
index 4d8e8fbc5e..1f6eb5dc23 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/AbstractCapabilityCondition.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/AbstractCapabilityCondition.java
@@ -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()
*/
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java
index 43d17b4fbe..722f689ea5 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java
@@ -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)
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/DeclaredCapabilityCondition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/DeclaredCapabilityCondition.java
index f3f479095c..6b3a9441ae 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/DeclaredCapabilityCondition.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/DeclaredCapabilityCondition.java
@@ -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);
}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenOrHoldCondition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenOrHoldCondition.java
index 3786738672..bad4166a1b 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenOrHoldCondition.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenOrHoldCondition.java
@@ -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)));
}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordCategoryCondition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordCategoryCondition.java
index 4b1379d869..dd637d0983 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordCategoryCondition.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsRecordCategoryCondition.java
@@ -38,7 +38,7 @@ public class IsRecordCategoryCondition extends AbstractCapabilityCondition
{
ParameterCheck.mandatory("nodeRef", nodeRef);
- return rmService.isRecordCategory(nodeRef);
+ return filePlanService.isRecordCategory(nodeRef);
}
}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsTransferAccessionCapabilityCondition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsTransferAccessionCapabilityCondition.java
index cb2dcd8056..ae9a5b68b3 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsTransferAccessionCapabilityCondition.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsTransferAccessionCapabilityCondition.java
@@ -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);
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ChangeOrDeleteReferencesCapability.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ChangeOrDeleteReferencesCapability.java
index 1d7143be12..d06a552ba1 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ChangeOrDeleteReferencesCapability.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ChangeOrDeleteReferencesCapability.java
@@ -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)
{
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/CreateCapability.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/CreateCapability.java
index f0e8868c16..7304d8b16c 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/CreateCapability.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/CreateCapability.java
@@ -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)
{
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/DeleteLinksCapability.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/DeleteLinksCapability.java
index eb35b07b24..d02a569a07 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/DeleteLinksCapability.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/DeleteLinksCapability.java
@@ -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)
{
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ViewRecordsCapability.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ViewRecordsCapability.java
index 4f1cdad10b..4b5cf7558e 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ViewRecordsCapability.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ViewRecordsCapability.java
@@ -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);
}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/AbstractBasePolicy.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/AbstractBasePolicy.java
index 3504cc6b56..7553c67e4d 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/AbstractBasePolicy.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/AbstractBasePolicy.java
@@ -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);
}
/**
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/ReadPolicy.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/ReadPolicy.java
index 6423886b63..7732fd4dba 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/ReadPolicy.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/ReadPolicy.java
@@ -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
{
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionSelectionStrategy.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionSelectionStrategy.java
index e462725a80..74fdbe1e63 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionSelectionStrategy.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionSelectionStrategy.java
@@ -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 sortedFolders = new TreeSet(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 sortedFolders = new TreeSet(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()
+ return filePlanAuthenticationService.runAsRmAdmin(new RunAsWork()
{
public Integer doWork() throws Exception
{
return new Integer(compareImpl(f1, f2));
}
- }, AuthenticationUtil.getAdminUserName()).intValue();
+ }).intValue();
}
private int compareImpl(NodeRef f1, NodeRef f2)
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java
index 071e8d4d8c..224ca3dd78 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java
@@ -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 getDisposableItemsImpl(boolean isRecordLevelDisposition, NodeRef rmContainer)
{
- List items = getRmService().getAllContained(rmContainer);
+ List items = filePlanService.getAllContained(rmContainer);
List result = new ArrayList(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)
{
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/FilePlanComponentKind.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanComponentKind.java
similarity index 91%
rename from rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/FilePlanComponentKind.java
rename to rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanComponentKind.java
index e8b5b94324..76629e21ad 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/FilePlanComponentKind.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanComponentKind.java
@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see .
*/
-package org.alfresco.module.org_alfresco_module_rm;
+package org.alfresco.module.org_alfresco_module_rm.fileplan;
/**
* File plan component kind enumeration class.
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanService.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanService.java
index 4067cbb650..b6dd408f26 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanService.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanService.java
@@ -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.
+ *
+ * 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.
+ *
+ * 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 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 properties);
+
+ // TODO deleteFilePlan
+
+ /**
+ * Gets the NodeRef sequence from the {@link #getFilePlan(NodeRef) root}
+ * down to the fileplan component given. The array will start with the NodeRef of the root
+ * and end with the name of the fileplan component node given.
+ *
+ * @param nodeRef a fileplan component
+ * @return Returns a NodeRef path starting with the file plan
+ */
+ List getNodeRefPath(NodeRef nodeRef);
+
+ /**
+ * Indicates whether the given node is a file plan container or not.
+ *
+ * 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 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 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 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 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 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 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 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 properties);
}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanServiceImpl.java
index b9ba17f09b..b98fdd2386 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanServiceImpl.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanServiceImpl.java
@@ -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 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 rmRootProps = new HashMap(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 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 getNodeRefPath(NodeRef nodeRef)
+ {
+ LinkedList nodeRefPath = new LinkedList();
+ try
+ {
+ getNodeRefPathRecursive(nodeRef, nodeRefPath);
+ }
+ catch (Throwable e)
+ {
+ throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PATH_NODE, nodeRef), e);
+ }
+ return nodeRefPath;
+ }
+
+ /**
+ * Helper method to build a NodeRef path from the node to the RM root
+ */
+ private void getNodeRefPathRecursive(NodeRef nodeRef, LinkedList 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 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 props = new HashMap(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 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 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 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 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 result = new ArrayList(1);
+ List 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 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 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 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 getContainedRecordFolders(NodeRef container, boolean deep)
+ {
+ return getContained(container, TYPE_RECORD_FOLDER, deep);
+ }
}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementNodeFormFilter.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementNodeFormFilter.java
index 4caccbd84a..73c228e350 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementNodeFormFilter.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementNodeFormFilter.java
@@ -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 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
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeServiceImpl.java
index 694dcddc44..b77da6e32d 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeServiceImpl.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeServiceImpl.java
@@ -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)
{
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/BaseEvaluator.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/BaseEvaluator.java
index c8302ffa1c..f9bfbe9960 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/BaseEvaluator.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/BaseEvaluator.java
@@ -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 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);
}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java
index 91083cb218..aaa1ba07c8 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java
@@ -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)
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordContainerType.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordContainerType.java
index d4ed2e9483..887f788ecc 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordContainerType.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordContainerType.java
@@ -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
*
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/RMv2FilePlanNodeRefPatch.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/RMv2FilePlanNodeRefPatch.java
index bd8175f8dd..ffd3623829 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/RMv2FilePlanNodeRefPatch.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/RMv2FilePlanNodeRefPatch.java
@@ -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 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);
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogDelete.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogDelete.java
index 2330b96fb9..4689011a53 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogDelete.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogDelete.java
@@ -39,7 +39,7 @@ public class AuditLogDelete extends BaseAuditAdminWebScript
@Override
protected Map executeImpl(WebScriptRequest req, Status status, Cache cache)
{
- this.rmAuditService.clear();
+ this.rmAuditService.clearAuditLog(getDefaultFilePlan());
// create model object with the audit status model
Map model = new HashMap(1);
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogPut.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogPut.java
index 81cdb7e182..e2381ccb28 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogPut.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogPut.java
@@ -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
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogStatusGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogStatusGet.java
index 5afb650124..8a2861eeef 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogStatusGet.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/AuditLogStatusGet.java
@@ -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 executeImpl(WebScriptRequest req, Status status, Cache cache)
{
Map model = new HashMap(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;
+ }
}
\ No newline at end of file
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditAdminWebScript.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditAdminWebScript.java
index 8f5d97a687..aeee548665 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditAdminWebScript.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseAuditAdminWebScript.java
@@ -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 auditStatus = new HashMap(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;
+ }
}
\ No newline at end of file
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/UserRightsReportGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/UserRightsReportGet.java
index c45f30a702..10df5a2354 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/UserRightsReportGet.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/UserRightsReportGet.java
@@ -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 executeImpl(WebScriptRequest req, Status status, Cache cache)
{
- // get the RM root nodes in the system
- List 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 rolesMap = new HashMap(8);
Map groupsMap = new HashMap(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 roles = this.filePlanRoleService.getRoles(rmRootNode);
+ Set 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 users = this.authorityService.getContainedAuthorities(AuthorityType.USER, group, true);
+ Set 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 groups = this.authorityService.getContainedAuthorities(AuthorityType.GROUP, group, false);
+ Set 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);
}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/capability/CapabilitiesGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/capability/CapabilitiesGet.java
index 15cabbb2d9..2e5b71509a 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/capability/CapabilitiesGet.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/capability/CapabilitiesGet.java
@@ -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 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;
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/forms/RMMetaDataGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/forms/RMMetaDataGet.java
index 1d3345ad88..c4a725c983 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/forms/RMMetaDataGet.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/forms/RMMetaDataGet.java
@@ -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();
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityService.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityService.java
index d886a1a3f8..b4e5c59332 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityService.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityService.java
@@ -30,6 +30,11 @@ import org.alfresco.service.cmr.repository.NodeRef;
*/
public interface ExtendedSecurityService
{
+ /**
+ *
+ * @param nodeRef
+ * @return
+ */
boolean hasExtendedSecurity(NodeRef nodeRef);
/**
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImpl.java
index 2db43e8f4e..1ec0acae86 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImpl.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImpl.java
@@ -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);
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImpl.java
index 7007844c83..2a038e088a 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImpl.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImpl.java
@@ -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 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 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)
{
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementPoliciesUtil.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/PoliciesUtil.java
similarity index 92%
rename from rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementPoliciesUtil.java
rename to rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/PoliciesUtil.java
index b281008a86..dfa4384285 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementPoliciesUtil.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/PoliciesUtil.java
@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see .
*/
-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());
}
-
}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/BroadcastVitalRecordDefinitionAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/BroadcastVitalRecordDefinitionAction.java
index e84d8fb8a1..b07284824c 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/BroadcastVitalRecordDefinitionAction.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/BroadcastVitalRecordDefinitionAction.java
@@ -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))
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordServiceImpl.java
index 224f242b99..a58360e390 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordServiceImpl.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordServiceImpl.java
@@ -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);
diff --git a/rm-server/source/java/org/alfresco/repo/action/ExtendedActionServiceImpl.java b/rm-server/source/java/org/alfresco/repo/action/ExtendedActionServiceImpl.java
index c4f47d1a70..5dcb749af8 100644
--- a/rm-server/source/java/org/alfresco/repo/action/ExtendedActionServiceImpl.java
+++ b/rm-server/source/java/org/alfresco/repo/action/ExtendedActionServiceImpl.java
@@ -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(actionDefinitions.size());
// check each action definition
diff --git a/rm-server/source/java/org/alfresco/repo/rule/ExtendedRuleServiceImpl.java b/rm-server/source/java/org/alfresco/repo/rule/ExtendedRuleServiceImpl.java
index 39270acc45..5c10c24e6b 100644
--- a/rm-server/source/java/org/alfresco/repo/rule/ExtendedRuleServiceImpl.java
+++ b/rm-server/source/java/org/alfresco/repo/rule/ExtendedRuleServiceImpl.java
@@ -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()
{
@@ -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()
{
@@ -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);
}
}
diff --git a/rm-server/source/java/org/alfresco/workflow/requestInfo/RequestInfoNotifier.java b/rm-server/source/java/org/alfresco/workflow/requestInfo/RequestInfoNotifier.java
index c0676e691d..47a2a6f238 100644
--- a/rm-server/source/java/org/alfresco/workflow/requestInfo/RequestInfoNotifier.java
+++ b/rm-server/source/java/org/alfresco/workflow/requestInfo/RequestInfoNotifier.java
@@ -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"));
diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/capabilities/DeclarativeCapabilityTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/capabilities/DeclarativeCapabilityTest.java
index 626d74a84e..948770e112 100644
--- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/capabilities/DeclarativeCapabilityTest.java
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/capabilities/DeclarativeCapabilityTest.java
@@ -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 kinds = capability.getKinds();
if (kinds == null ||
diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/DataSetServiceImplTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/DataSetServiceImplTest.java
index aa8f781644..1a527e06fb 100644
--- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/DataSetServiceImplTest.java
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/DataSetServiceImplTest.java
@@ -139,9 +139,9 @@ public class DataSetServiceImplTest extends BaseRMTestCase
// TestRecordCategory1
NodeRef recCat1 = nodeService.getChildByName(filePlan, ContentModel.ASSOC_CONTAINS, "TestRecordCategory1");
assertNotNull(recCat1);
- List recCat1ImmediateChildren = rmService.getAllContained(recCat1);
+ List recCat1ImmediateChildren = filePlanService.getAllContained(recCat1);
assertTrue(recCat1ImmediateChildren.size() == 3);
- List recCat1AllChildren = rmService.getAllContained(recCat1, true);
+ List 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 recCat2ImmediateChildren = rmService.getAllContained(recCat2);
+ List recCat2ImmediateChildren = filePlanService.getAllContained(recCat2);
assertTrue(recCat2ImmediateChildren.size() == 2);
- List recCat2AllChildren = rmService.getAllContained(recCat2, true);
+ List 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 recCat11ImmediateChilderen = rmService.getAllContained(recCat11);
+ List recCat11ImmediateChilderen = filePlanService.getAllContained(recCat11);
assertTrue(recCat11ImmediateChilderen.size() == 2);
- List recCat11Childeren = rmService.getAllContained(recCat11, true);
+ List 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 recCat12ImmediateChildren = rmService.getAllContained(recCat12);
+ List recCat12ImmediateChildren = filePlanService.getAllContained(recCat12);
assertTrue(recCat12ImmediateChildren.size() == 1);
- List recCat12Children = rmService.getAllContained(recCat12, true);
+ List 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 recCat13ImmediateChildren = rmService.getAllContained(recCat13);
+ List 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 recCat21ImmediateChildren = rmService.getAllContained(recCat21);
+ List 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 recCat22ImmediateChildren = rmService.getAllContained(recCat22);
+ List recCat22ImmediateChildren = filePlanService.getAllContained(recCat22);
assertTrue(recCat22ImmediateChildren.size() == 2);
- List recCat22Children = rmService.getAllContained(recCat22, true);
+ List 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"));
diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/DispositionServiceImplTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/DispositionServiceImplTest.java
index 45e037c538..a929dcc64a 100644
--- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/DispositionServiceImplTest.java
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/DispositionServiceImplTest.java
@@ -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",
diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/ExtendedSecurityServiceImplTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/ExtendedSecurityServiceImplTest.java
index b2d985df81..1407ced003 100644
--- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/ExtendedSecurityServiceImplTest.java
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/ExtendedSecurityServiceImplTest.java
@@ -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");
}
diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/FilePlanServiceImplTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/FilePlanServiceImplTest.java
index 7b4b30a6a2..16b018d3f7 100644
--- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/FilePlanServiceImplTest.java
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/FilePlanServiceImplTest.java
@@ -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()
+ {
+ @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()
+ {
+ @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()
+ {
+ @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()
+ {
+ @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()
+ {
+ @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()
+ {
+ @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()
+ {
+ @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()
+// {
+// @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()
+ {
+ @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 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()
+ {
+ @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 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()
+ {
+ @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 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()
+ {
+ @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
+ }
+ });
+ }
}
diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/FreezeServiceImplTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/FreezeServiceImplTest.java
index a17c05421e..1f3733249a 100644
--- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/FreezeServiceImplTest.java
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/FreezeServiceImplTest.java
@@ -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);
diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/RecordsManagementAuditServiceImplTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/RecordsManagementAuditServiceImplTest.java
index c351a2c2bf..2d1db1a980 100644
--- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/RecordsManagementAuditServiceImplTest.java
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/RecordsManagementAuditServiceImplTest.java
@@ -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()
+ {
+ @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 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 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 result2 = getAuditTrail(rmAdminName);
found = false;
for (RecordsManagementAuditEntry entry : result2)
diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/RecordsManagementServiceImplTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/RecordsManagementServiceImplTest.java
index f387eb4329..4f09db04f4 100644
--- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/RecordsManagementServiceImplTest.java
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/RecordsManagementServiceImplTest.java
@@ -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()
@@ -59,6 +60,7 @@ public class RecordsManagementServiceImplTest extends BaseRMTestCase
/**
* @see RecordsManagementService#getFilePlanComponentKind(NodeRef)
*/
+ @SuppressWarnings("deprecation")
public void testGetFilePlanComponentKind() throws Exception
{
doTestInTransaction(new Test()
@@ -105,6 +107,7 @@ public class RecordsManagementServiceImplTest extends BaseRMTestCase
/**
* @see RecordsManagementService#isRecordCategory(NodeRef)
*/
+ @SuppressWarnings("deprecation")
public void testIsRecordCategory() throws Exception
{
doTestInTransaction(new Test()
@@ -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()
diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/VitalRecordServiceImplTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/VitalRecordServiceImplTest.java
index 38f82203fd..ef2f8eb741 100644
--- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/VitalRecordServiceImplTest.java
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/VitalRecordServiceImplTest.java
@@ -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
diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/system/PerformanceDataLoadSystemTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/system/PerformanceDataLoadSystemTest.java
index 48de8c4a32..f127d040c6 100644
--- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/system/PerformanceDataLoadSystemTest.java
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/system/PerformanceDataLoadSystemTest.java
@@ -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 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++)
{
diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java
index 2b30c05b21..99e1732d3f 100644
--- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java
@@ -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
diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMWebScriptTestCase.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMWebScriptTestCase.java
index 65ec74f94f..9c36f4311f 100644
--- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMWebScriptTestCase.java
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMWebScriptTestCase.java
@@ -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
diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/CommonRMTestUtils.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/CommonRMTestUtils.java
index 534e9106f6..81de5bab82 100644
--- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/CommonRMTestUtils.java
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/CommonRMTestUtils.java
@@ -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);
diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/webscript/CapabilitiesRestApiTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/webscript/CapabilitiesRestApiTest.java
index f35a590185..79128a2a06 100644
--- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/webscript/CapabilitiesRestApiTest.java
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/webscript/CapabilitiesRestApiTest.java
@@ -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&grouped=%s", true, true);
+ getUrl = String.format(baseURL + "includeAll=%s&grouped=%s", true, true);
getResponse = sendRequest(new GetRequest(getUrl), Status.STATUS_OK);
getContentAsString.equalsIgnoreCase(getResponse.getContentAsString());
diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/webscript/DispositionRestApiTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/webscript/DispositionRestApiTest.java
index 3afdca51e1..13b972dc41 100644
--- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/webscript/DispositionRestApiTest.java
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/webscript/DispositionRestApiTest.java
@@ -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