mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM-926: File plan filters (Hold, Transfer, Unfiled) may not show up to date results when Rm configured for SOLR
* transfer and hold containers created under file plan * holds and transfers now contained within these containers * holds named using folder level counter to avoid name clash in container * hold and transfer filters now API driven .. so canned query driven .. so *live* * unit test updates * UI tested git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@55091 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -15,3 +15,4 @@ rm.service.parent-record-folder-type=Can't create record folder, because the par
|
|||||||
rm.service.record-folder-type=Can't create record folder, because the provided type is not a sub-type of rm:recordFolder. (type={0})
|
rm.service.record-folder-type=Can't create record folder, because the provided type is not a sub-type of rm:recordFolder. (type={0})
|
||||||
rm.service.not-record=The node {0} is not a record.
|
rm.service.not-record=The node {0} is not a record.
|
||||||
rm.service.vital-def-missing=Vital record definition aspect is not present on node. (nodeRef={0})
|
rm.service.vital-def-missing=Vital record definition aspect is not present on node. (nodeRef={0})
|
||||||
|
rm.hold.name=Hold
|
@@ -84,6 +84,7 @@
|
|||||||
|
|
||||||
<title>File Plan</title>
|
<title>File Plan</title>
|
||||||
<parent>rma:recordsManagementContainer</parent>
|
<parent>rma:recordsManagementContainer</parent>
|
||||||
|
|
||||||
<mandatory-aspects>
|
<mandatory-aspects>
|
||||||
<aspect>rma:recordsManagementRoot</aspect>
|
<aspect>rma:recordsManagementRoot</aspect>
|
||||||
</mandatory-aspects>
|
</mandatory-aspects>
|
||||||
@@ -95,6 +96,22 @@
|
|||||||
<parent>rma:recordsManagementContainer</parent>
|
<parent>rma:recordsManagementContainer</parent>
|
||||||
</type>
|
</type>
|
||||||
|
|
||||||
|
<type name="rma:holdContainer">
|
||||||
|
<title>Hold Container</title>
|
||||||
|
<parent>rma:recordsManagementContainer</parent>
|
||||||
|
<mandatory-aspects>
|
||||||
|
<aspect>rma:countable</aspect>
|
||||||
|
</mandatory-aspects>
|
||||||
|
</type>
|
||||||
|
|
||||||
|
<type name="rma:transferContainer">
|
||||||
|
<title>Transfer Container</title>
|
||||||
|
<parent>rma:recordsManagementContainer</parent>
|
||||||
|
<mandatory-aspects>
|
||||||
|
<aspect>rma:countable</aspect>
|
||||||
|
</mandatory-aspects>
|
||||||
|
</type>
|
||||||
|
|
||||||
<!-- Disposition Schedule -->
|
<!-- Disposition Schedule -->
|
||||||
|
|
||||||
<type name="rma:dispositionSchedule">
|
<type name="rma:dispositionSchedule">
|
||||||
@@ -597,6 +614,7 @@
|
|||||||
<title>Records Management Root</title>
|
<title>Records Management Root</title>
|
||||||
<associations>
|
<associations>
|
||||||
|
|
||||||
|
<!-- @deprecated as of 2.1 -->
|
||||||
<child-association name="rma:holds">
|
<child-association name="rma:holds">
|
||||||
<title>Holds</title>
|
<title>Holds</title>
|
||||||
<source>
|
<source>
|
||||||
@@ -610,7 +628,7 @@
|
|||||||
</target>
|
</target>
|
||||||
</child-association>
|
</child-association>
|
||||||
|
|
||||||
|
<!-- @deprecated as of 2.1 -->
|
||||||
<child-association name="rma:transfers">
|
<child-association name="rma:transfers">
|
||||||
<title>Transfers</title>
|
<title>Transfers</title>
|
||||||
<source>
|
<source>
|
||||||
@@ -625,9 +643,6 @@
|
|||||||
</child-association>
|
</child-association>
|
||||||
|
|
||||||
</associations>
|
</associations>
|
||||||
<mandatory-aspects>
|
|
||||||
<aspect>rma:filePlanComponent</aspect>
|
|
||||||
</mandatory-aspects>
|
|
||||||
</aspect>
|
</aspect>
|
||||||
|
|
||||||
<aspect name="rma:declaredRecord">
|
<aspect name="rma:declaredRecord">
|
||||||
@@ -1198,6 +1213,19 @@
|
|||||||
</properties>
|
</properties>
|
||||||
</aspect>
|
</aspect>
|
||||||
|
|
||||||
|
<!-- Helper aspect that can be used to keep a count -->
|
||||||
|
<aspect name="rma:countable">
|
||||||
|
<title>Countable aspect</title>
|
||||||
|
<properties>
|
||||||
|
<property name="rma:count">
|
||||||
|
<type>d:int</type>
|
||||||
|
<protected>true</protected>
|
||||||
|
<mandatory>true</mandatory>
|
||||||
|
<default>0</default>
|
||||||
|
</property>
|
||||||
|
</properties>
|
||||||
|
</aspect>
|
||||||
|
|
||||||
</aspects>
|
</aspects>
|
||||||
|
|
||||||
</model>
|
</model>
|
@@ -32,4 +32,16 @@
|
|||||||
<property name="typeAsString" value="{http://www.alfresco.org/model/recordsmanagement/1.0}record"/>
|
<property name="typeAsString" value="{http://www.alfresco.org/model/recordsmanagement/1.0}record"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="holdIdentifierGenerator"
|
||||||
|
parent="baseRecordsManagementIdentifierGenerator"
|
||||||
|
class="org.alfresco.module.org_alfresco_module_rm.identifier.BasicIdentifierGenerator">
|
||||||
|
<property name="typeAsString" value="{http://www.alfresco.org/model/recordsmanagement/1.0}hold"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="transferIdentifierGenerator"
|
||||||
|
parent="baseRecordsManagementIdentifierGenerator"
|
||||||
|
class="org.alfresco.module.org_alfresco_module_rm.identifier.BasicIdentifierGenerator">
|
||||||
|
<property name="typeAsString" value="{http://www.alfresco.org/model/recordsmanagement/1.0}transfer"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
@@ -480,6 +480,10 @@
|
|||||||
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.existsUnfiledContainer=RM.Read.0
|
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.existsUnfiledContainer=RM.Read.0
|
||||||
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.getUnfiledContainer=RM.Read.0,AFTER_RM.FilterNode
|
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.getUnfiledContainer=RM.Read.0,AFTER_RM.FilterNode
|
||||||
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.createUnfiledContainer=RM.Write.0
|
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.createUnfiledContainer=RM.Write.0
|
||||||
|
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.getHoldContainer=RM.Read.0,AFTER_RM.FilterNode
|
||||||
|
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.createHoldContainer=RM.Write.0
|
||||||
|
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.getTransferContainer=RM.Read.0,AFTER_RM.FilterNode
|
||||||
|
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.createTransferContainer=RM.Write.0
|
||||||
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.createFilePlan=RM_ALLOW
|
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.createFilePlan=RM_ALLOW
|
||||||
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.getNodeRefPath=RM.Read.0
|
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.getNodeRefPath=RM.Read.0
|
||||||
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.isFilePlanContainer=RM_ALLOW
|
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.isFilePlanContainer=RM_ALLOW
|
||||||
|
@@ -232,6 +232,7 @@
|
|||||||
<property name="permissionService" ref="PermissionService" />
|
<property name="permissionService" ref="PermissionService" />
|
||||||
<property name="mimetypeService" ref="mimetypeService" />
|
<property name="mimetypeService" ref="mimetypeService" />
|
||||||
<property name="exporterService" ref="ExporterService" />
|
<property name="exporterService" ref="ExporterService" />
|
||||||
|
<property name="filePlanService" ref="FilePlanService" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- REST impl for GET transfer -->
|
<!-- REST impl for GET transfer -->
|
||||||
|
@@ -28,8 +28,12 @@ function doclist_getAllNodes(parsedArgs, filterParams, query, totalItemCount)
|
|||||||
requestTotalCountMax = 0,
|
requestTotalCountMax = 0,
|
||||||
paged = false,
|
paged = false,
|
||||||
allNodes = [];
|
allNodes = [];
|
||||||
if ((filter || "path") == "path" ||
|
if (query == "" &&
|
||||||
(filter || "unfiledRecords") == "unfiledRecords")
|
(
|
||||||
|
(filter || "path") == "path" ||
|
||||||
|
(filter || "unfiledRecords") == "unfiledRecords" ||
|
||||||
|
(filter || "holds") == "holds" ||
|
||||||
|
(filter || "transfers") == "transfers"))
|
||||||
{
|
{
|
||||||
// TODO also add DB filter by "node" (in addition to "path")
|
// TODO also add DB filter by "node" (in addition to "path")
|
||||||
var parentNode = parsedArgs.pathNode;
|
var parentNode = parsedArgs.pathNode;
|
||||||
|
@@ -37,8 +37,8 @@ Filters.IGNORED_TYPES =
|
|||||||
"rma:dispositionSchedule",
|
"rma:dispositionSchedule",
|
||||||
"rma:dispositionActionDefinition",
|
"rma:dispositionActionDefinition",
|
||||||
"rma:dispositionAction",
|
"rma:dispositionAction",
|
||||||
"rma:hold",
|
"rma:holdContainer",
|
||||||
"rma:transfer",
|
"rma:transferContainer",
|
||||||
"rma:unfiledRecordContainer"
|
"rma:unfiledRecordContainer"
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -154,11 +154,7 @@ Filters.getFilterParams = function RecordsManagementFilter_getFilterParams(filte
|
|||||||
case "transfers":
|
case "transfers":
|
||||||
if (filterData == null)
|
if (filterData == null)
|
||||||
{
|
{
|
||||||
filterParams.variablePath = false;
|
filterParams.query = "";
|
||||||
filterQuery = "+PATH:\"" + parsedArgs.rootNode.qnamePath + "//*\"";
|
|
||||||
filterQuery += " +TYPE:\"rma:transfer\"";
|
|
||||||
filterParams.query = filterQuery;
|
|
||||||
filterParams.ignoreTypes = "";
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -169,11 +165,7 @@ Filters.getFilterParams = function RecordsManagementFilter_getFilterParams(filte
|
|||||||
case "holds":
|
case "holds":
|
||||||
if (filterData == null)
|
if (filterData == null)
|
||||||
{
|
{
|
||||||
filterParams.variablePath = false;
|
filterParams.query = "";
|
||||||
filterQuery = "+PATH:\"" + parsedArgs.rootNode.qnamePath + "//*\"";
|
|
||||||
filterQuery += " +TYPE:\"rma:hold\"";
|
|
||||||
filterParams.query = filterQuery;
|
|
||||||
filterParams.ignoreTypes = "";
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -91,6 +91,16 @@ ParseArgs.getParsedArgs = function RecordsManagementFilter_getParsedArgs(contain
|
|||||||
var unfiledRecordContainer = rootNode.childrenByXPath("rma:Unfiled_x0020_Records");
|
var unfiledRecordContainer = rootNode.childrenByXPath("rma:Unfiled_x0020_Records");
|
||||||
pathNode = unfiledRecordContainer.length > 0 ? unfiledRecordContainer[0] : rootNode;
|
pathNode = unfiledRecordContainer.length > 0 ? unfiledRecordContainer[0] : rootNode;
|
||||||
}
|
}
|
||||||
|
else if (args.filter == "holds")
|
||||||
|
{
|
||||||
|
var container = rootNode.childrenByXPath("rma:Holds");
|
||||||
|
pathNode = container.length > 0 ? container[0] : rootNode;
|
||||||
|
}
|
||||||
|
else if (args.filter == "transfers")
|
||||||
|
{
|
||||||
|
var container = rootNode.childrenByXPath("rma:Transfers");
|
||||||
|
pathNode = container.length > 0 ? container[0] : rootNode;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Path input?
|
// Path input?
|
||||||
|
@@ -121,7 +121,7 @@ function itemIsAllowed(item)
|
|||||||
var typeShort = String(item.typeShort);
|
var typeShort = String(item.typeShort);
|
||||||
|
|
||||||
// Don't show Hold and Transfer top-level containers
|
// Don't show Hold and Transfer top-level containers
|
||||||
if (typeShort == "rma:hold" || typeShort == "rma:transfer" || typeShort == "rma:unfiledRecordContainer")
|
if (typeShort == "rma:holdContainer" || typeShort == "rma:transferContainer" || typeShort == "rma:unfiledRecordContainer")
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -142,8 +142,9 @@ public class TransferAction extends RMDispositionActionExecuterAbstractBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
transferNodeRef = this.nodeService.createNode(root,
|
NodeRef transferContainer = filePlanService.getTransferContainer(root);
|
||||||
ASSOC_TRANSFERS,
|
transferNodeRef = this.nodeService.createNode(transferContainer,
|
||||||
|
ContentModel.ASSOC_CONTAINS,
|
||||||
QName.createQName(RM_URI, transferName),
|
QName.createQName(RM_URI, transferName),
|
||||||
TYPE_TRANSFER,
|
TYPE_TRANSFER,
|
||||||
transferProps).getChildRef();
|
transferProps).getChildRef();
|
||||||
|
@@ -139,6 +139,34 @@ public interface FilePlanService
|
|||||||
*/
|
*/
|
||||||
NodeRef createUnfiledContainer(NodeRef filePlan);
|
NodeRef createUnfiledContainer(NodeRef filePlan);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param filePlan
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
NodeRef getHoldContainer(NodeRef filePlan);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param filePlan
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
NodeRef createHoldContainer(NodeRef filePlan);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param filePlan
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
NodeRef getTransferContainer(NodeRef filePlan);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param filePlan
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
NodeRef createTransferContainer(NodeRef filePlan);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a file plan as a child of the given parent node, with the name
|
* Creates a file plan as a child of the given parent node, with the name
|
||||||
* provided.
|
* provided.
|
||||||
|
@@ -78,9 +78,10 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
|
|||||||
private final static String MSG_CONTAINER_TYPE = "rm.service.container-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_CONTAINER_EXPECTED = "rm.service.container-expected";
|
||||||
|
|
||||||
/** Unfiled record container name */
|
/** File plan containers */
|
||||||
private static final String NAME_UNFILED_CONTAINER = "Unfiled Records";
|
private static final String NAME_UNFILED_CONTAINER = "Unfiled Records";
|
||||||
private static final QName QNAME_UNFILED_CONTAINER = QName.createQName(RM_URI, NAME_UNFILED_CONTAINER);
|
private static final String NAME_HOLD_CONTAINER = "Holds";
|
||||||
|
private static final String NAME_TRANSFER_CONTAINER = "Transfers";
|
||||||
|
|
||||||
/** RM site file plan container */
|
/** RM site file plan container */
|
||||||
private static final String FILE_PLAN_CONTAINER = "documentLibrary";
|
private static final String FILE_PLAN_CONTAINER = "documentLibrary";
|
||||||
@@ -392,20 +393,49 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public NodeRef getUnfiledContainer(NodeRef filePlan)
|
public NodeRef getUnfiledContainer(NodeRef filePlan)
|
||||||
|
{
|
||||||
|
return getFilePlanRootContainer(filePlan, NAME_UNFILED_CONTAINER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getHoldContainer(org.alfresco.service.cmr.repository.NodeRef)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public NodeRef getHoldContainer(NodeRef filePlan)
|
||||||
|
{
|
||||||
|
return getFilePlanRootContainer(filePlan, NAME_HOLD_CONTAINER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#getTransferContainer(org.alfresco.service.cmr.repository.NodeRef)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public NodeRef getTransferContainer(NodeRef filePlan)
|
||||||
|
{
|
||||||
|
return getFilePlanRootContainer(filePlan, NAME_TRANSFER_CONTAINER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param filePlan
|
||||||
|
* @param containerName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private NodeRef getFilePlanRootContainer(NodeRef filePlan, String containerName)
|
||||||
{
|
{
|
||||||
ParameterCheck.mandatory("filePlan", filePlan);
|
ParameterCheck.mandatory("filePlan", filePlan);
|
||||||
if (isFilePlan(filePlan) == false)
|
if (isFilePlan(filePlan) == false)
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("Unable to get the unfiled container, because passed node is not a file plan.");
|
throw new AlfrescoRuntimeException("Unable to get the container " + containerName + ", because passed node is not a file plan.");
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeRef result = null;
|
NodeRef result = null;
|
||||||
|
|
||||||
// try and get the unfiled record container
|
// try and get the unfiled record container
|
||||||
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(filePlan, ContentModel.ASSOC_CONTAINS, QNAME_UNFILED_CONTAINER);
|
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(filePlan, ContentModel.ASSOC_CONTAINS, QName.createQName(RM_URI, containerName));
|
||||||
if (assocs.size() > 1)
|
if (assocs.size() > 1)
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("Unable to get unfiled conatiner.");
|
throw new AlfrescoRuntimeException("Unable to get unfiled conatiner " + containerName + ".");
|
||||||
}
|
}
|
||||||
else if (assocs.size() == 1)
|
else if (assocs.size() == 1)
|
||||||
{
|
{
|
||||||
@@ -419,35 +449,76 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
|
|||||||
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createUnfiledContainer(org.alfresco.service.cmr.repository.NodeRef)
|
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createUnfiledContainer(org.alfresco.service.cmr.repository.NodeRef)
|
||||||
*/
|
*/
|
||||||
public NodeRef createUnfiledContainer(NodeRef filePlan)
|
public NodeRef createUnfiledContainer(NodeRef filePlan)
|
||||||
|
{
|
||||||
|
return createFilePlanRootContainer(filePlan, TYPE_UNFILED_RECORD_CONTAINER, NAME_UNFILED_CONTAINER, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createHoldContainer(org.alfresco.service.cmr.repository.NodeRef)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public NodeRef createHoldContainer(NodeRef filePlan)
|
||||||
|
{
|
||||||
|
return createFilePlanRootContainer(filePlan, TYPE_HOLD_CONTAINER, NAME_HOLD_CONTAINER, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService#createTransferContainer(org.alfresco.service.cmr.repository.NodeRef)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public NodeRef createTransferContainer(NodeRef filePlan)
|
||||||
|
{
|
||||||
|
return createFilePlanRootContainer(filePlan, TYPE_TRANSFER_CONTAINER, NAME_TRANSFER_CONTAINER, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param filePlan
|
||||||
|
* @param containerType
|
||||||
|
* @param containerName
|
||||||
|
* @param inheritPermissions
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private NodeRef createFilePlanRootContainer(NodeRef filePlan, QName containerType, String containerName, boolean inheritPermissions)
|
||||||
{
|
{
|
||||||
ParameterCheck.mandatory("filePlan", filePlan);
|
ParameterCheck.mandatory("filePlan", filePlan);
|
||||||
if (isFilePlan(filePlan) == false)
|
if (isFilePlan(filePlan) == false)
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("Unable to create unfiled container, because passed node is not a file plan.");
|
throw new AlfrescoRuntimeException("Unable to create file plan root container, because passed node is not a file plan.");
|
||||||
}
|
}
|
||||||
|
|
||||||
String allRoles = getFilePlanRoleService().getAllRolesContainerGroup(filePlan);
|
String allRoles = getFilePlanRoleService().getAllRolesContainerGroup(filePlan);
|
||||||
|
|
||||||
// create the properties map
|
// create the properties map
|
||||||
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(1);
|
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(1);
|
||||||
properties.put(ContentModel.PROP_NAME, NAME_UNFILED_CONTAINER);
|
properties.put(ContentModel.PROP_NAME, containerName);
|
||||||
|
|
||||||
// create the unfiled container
|
// create the unfiled container
|
||||||
NodeRef container = nodeService.createNode(
|
NodeRef container = nodeService.createNode(
|
||||||
filePlan,
|
filePlan,
|
||||||
ContentModel.ASSOC_CONTAINS,
|
ContentModel.ASSOC_CONTAINS,
|
||||||
QNAME_UNFILED_CONTAINER,
|
QName.createQName(RM_URI, containerName),
|
||||||
TYPE_UNFILED_RECORD_CONTAINER,
|
containerType,
|
||||||
properties).getChildRef();
|
properties).getChildRef();
|
||||||
|
|
||||||
// set inheritance to false
|
|
||||||
getPermissionService().setInheritParentPermissions(container, false);
|
|
||||||
getPermissionService().setPermission(container, allRoles, RMPermissionModel.READ_RECORDS, true);
|
|
||||||
getPermissionService().setPermission(container, ExtendedReaderDynamicAuthority.EXTENDED_READER, RMPermissionModel.READ_RECORDS, true);
|
|
||||||
getPermissionService().setPermission(container, ExtendedWriterDynamicAuthority.EXTENDED_WRITER, RMPermissionModel.FILING, true);
|
|
||||||
|
|
||||||
// TODO set the admin users to have filing permissions on the unfiled container!!!
|
if (inheritPermissions == false)
|
||||||
// TODO we will need to be able to get a list of the admin roles from the service
|
{
|
||||||
|
// set inheritance to false
|
||||||
|
getPermissionService().setInheritParentPermissions(container, false);
|
||||||
|
getPermissionService().setPermission(container, allRoles, RMPermissionModel.READ_RECORDS, true);
|
||||||
|
getPermissionService().setPermission(container, ExtendedReaderDynamicAuthority.EXTENDED_READER, RMPermissionModel.READ_RECORDS, true);
|
||||||
|
getPermissionService().setPermission(container, ExtendedWriterDynamicAuthority.EXTENDED_WRITER, RMPermissionModel.FILING, true);
|
||||||
|
|
||||||
|
// TODO set the admin users to have filing permissions on the unfiled container!!!
|
||||||
|
// TODO we will need to be able to get a list of the admin roles from the service
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// just inherit eveything
|
||||||
|
// TODO will change this when we are able to set permissions on holds and transfers!
|
||||||
|
getPermissionService().setInheritParentPermissions(container, true);
|
||||||
|
}
|
||||||
|
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
@@ -34,6 +34,7 @@ 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.RecordsManagementModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
|
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl;
|
||||||
import org.alfresco.repo.node.NodeServicePolicies;
|
import org.alfresco.repo.node.NodeServicePolicies;
|
||||||
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
||||||
import org.alfresco.repo.policy.JavaBehaviour;
|
import org.alfresco.repo.policy.JavaBehaviour;
|
||||||
@@ -42,12 +43,9 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
|||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
|
||||||
import org.alfresco.service.cmr.security.PermissionService;
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||||
import org.alfresco.util.ParameterCheck;
|
import org.alfresco.util.ParameterCheck;
|
||||||
@@ -63,7 +61,8 @@ import org.springframework.extensions.surf.util.I18NUtil;
|
|||||||
* @author Tuna Aksoy
|
* @author Tuna Aksoy
|
||||||
* @since 2.1
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
public class FreezeServiceImpl implements FreezeService,
|
public class FreezeServiceImpl extends ServiceBaseImpl
|
||||||
|
implements FreezeService,
|
||||||
RecordsManagementModel,
|
RecordsManagementModel,
|
||||||
NodeServicePolicies.BeforeDeleteNodePolicy
|
NodeServicePolicies.BeforeDeleteNodePolicy
|
||||||
{
|
{
|
||||||
@@ -72,33 +71,28 @@ public class FreezeServiceImpl implements FreezeService,
|
|||||||
|
|
||||||
/** I18N */
|
/** I18N */
|
||||||
private static final String MSG_FREEZE_ONLY_RECORDS_FOLDERS = "rm.action.freeze-only-records-folders";
|
private static final String MSG_FREEZE_ONLY_RECORDS_FOLDERS = "rm.action.freeze-only-records-folders";
|
||||||
|
private static final String MSG_HOLD_NAME = "rm.hold.name";
|
||||||
|
|
||||||
/** Hold node reference key */
|
/** Hold node reference key */
|
||||||
private static final String KEY_HOLD_NODEREF = "holdNodeRef";
|
private static final String KEY_HOLD_NODEREF = "holdNodeRef";
|
||||||
|
|
||||||
/** Policy Component */
|
/** Policy Component */
|
||||||
private PolicyComponent policyComponent;
|
protected PolicyComponent policyComponent;
|
||||||
|
|
||||||
/** Node Service */
|
|
||||||
private NodeService nodeService;
|
|
||||||
|
|
||||||
/** Records Management Service */
|
/** Records Management Service */
|
||||||
private RecordsManagementService recordsManagementService;
|
protected RecordsManagementService recordsManagementService;
|
||||||
|
|
||||||
/** Dictionary Service */
|
|
||||||
private DictionaryService dictionaryService;
|
|
||||||
|
|
||||||
/** Record service */
|
/** Record service */
|
||||||
private RecordService recordService;
|
protected RecordService recordService;
|
||||||
|
|
||||||
/** File Plan Service */
|
/** File Plan Service */
|
||||||
private FilePlanService filePlanService;
|
protected FilePlanService filePlanService;
|
||||||
|
|
||||||
/** Permission service */
|
/** Permission service */
|
||||||
private PermissionService permissionService;
|
protected PermissionService permissionService;
|
||||||
|
|
||||||
/** file plan role service */
|
/** file plan role service */
|
||||||
private FilePlanRoleService filePlanRoleService;
|
protected FilePlanRoleService filePlanRoleService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param policyComponent policy component
|
* @param policyComponent policy component
|
||||||
@@ -108,14 +102,6 @@ public class FreezeServiceImpl implements FreezeService,
|
|||||||
this.policyComponent = policyComponent;
|
this.policyComponent = policyComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param nodeService node service
|
|
||||||
*/
|
|
||||||
public void setNodeService(NodeService nodeService)
|
|
||||||
{
|
|
||||||
this.nodeService = nodeService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param recordsManagementService records management service
|
* @param recordsManagementService records management service
|
||||||
*/
|
*/
|
||||||
@@ -124,14 +110,6 @@ public class FreezeServiceImpl implements FreezeService,
|
|||||||
this.recordsManagementService = recordsManagementService;
|
this.recordsManagementService = recordsManagementService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param dictionaryService dictionary service
|
|
||||||
*/
|
|
||||||
public void setDictionaryService(DictionaryService dictionaryService)
|
|
||||||
{
|
|
||||||
this.dictionaryService = dictionaryService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param recordService record service
|
* @param recordService record service
|
||||||
*/
|
*/
|
||||||
@@ -534,9 +512,8 @@ public class FreezeServiceImpl implements FreezeService,
|
|||||||
ParameterCheck.mandatory("filePlan", filePlan);
|
ParameterCheck.mandatory("filePlan", filePlan);
|
||||||
|
|
||||||
Set<NodeRef> holds = new HashSet<NodeRef>();
|
Set<NodeRef> holds = new HashSet<NodeRef>();
|
||||||
|
NodeRef holdContainer = filePlanService.getHoldContainer(filePlan);
|
||||||
List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(filePlan, ASSOC_HOLDS,
|
List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(holdContainer, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
|
||||||
RegexQNamePattern.MATCH_ALL);
|
|
||||||
if (childAssocs != null && !childAssocs.isEmpty())
|
if (childAssocs != null && !childAssocs.isEmpty())
|
||||||
{
|
{
|
||||||
for (ChildAssociationRef childAssoc : childAssocs)
|
for (ChildAssociationRef childAssoc : childAssocs)
|
||||||
@@ -618,26 +595,27 @@ public class FreezeServiceImpl implements FreezeService,
|
|||||||
{
|
{
|
||||||
NodeRef holdNodeRef = null;
|
NodeRef holdNodeRef = null;
|
||||||
|
|
||||||
// Calculate a transfer name
|
// get the hold container
|
||||||
QName nodeDbid = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "node-dbid");
|
NodeRef root = filePlanService.getFilePlan(nodeRef);
|
||||||
Long dbId = (Long) nodeService.getProperty(nodeRef, nodeDbid);
|
NodeRef holdContainer = filePlanService.getHoldContainer(root);
|
||||||
String transferName = StringUtils.leftPad(dbId.toString(), 10, "0");
|
|
||||||
|
// calculate the hold name
|
||||||
|
int nextCount = getNextCount(holdContainer);
|
||||||
|
String holdName = I18NUtil.getMessage(MSG_HOLD_NAME) + " " + StringUtils.leftPad(Integer.toString(nextCount), 10, "0");
|
||||||
|
|
||||||
// Create the properties for the hold object
|
// Create the properties for the hold object
|
||||||
Map<QName, Serializable> holdProps = new HashMap<QName, Serializable>(2);
|
Map<QName, Serializable> holdProps = new HashMap<QName, Serializable>(2);
|
||||||
holdProps.put(ContentModel.PROP_NAME, transferName);
|
holdProps.put(ContentModel.PROP_NAME, holdName);
|
||||||
holdProps.put(PROP_HOLD_REASON, reason);
|
holdProps.put(PROP_HOLD_REASON, reason);
|
||||||
|
|
||||||
// Get the root rm node and create the hold object
|
// create the hold object
|
||||||
NodeRef root = filePlanService.getFilePlan(nodeRef);
|
QName holdQName = QName.createQName(RM_URI, holdName);
|
||||||
QName transferQName = QName.createQName(RM_URI, transferName);
|
holdNodeRef = nodeService.createNode(holdContainer, ContentModel.ASSOC_CONTAINS, holdQName, TYPE_HOLD, holdProps).getChildRef();
|
||||||
holdNodeRef = nodeService.createNode(root, ASSOC_HOLDS, transferQName, TYPE_HOLD, holdProps).getChildRef();
|
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
StringBuilder msg = new StringBuilder();
|
StringBuilder msg = new StringBuilder();
|
||||||
msg.append("Created hold object '").append(holdNodeRef).append("' with transfer name '").append(
|
msg.append("Created hold object '").append(holdNodeRef).append("' with name '").append(holdQName).append("'.");
|
||||||
transferQName).append("'.");
|
|
||||||
logger.debug(msg.toString());
|
logger.debug(msg.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -60,6 +60,12 @@ public interface RecordsManagementModel extends RecordsManagementCustomModel
|
|||||||
// Unfiled record container
|
// Unfiled record container
|
||||||
public static final QName TYPE_UNFILED_RECORD_CONTAINER = QName.createQName(RM_URI, "unfiledRecordContainer");
|
public static final QName TYPE_UNFILED_RECORD_CONTAINER = QName.createQName(RM_URI, "unfiledRecordContainer");
|
||||||
|
|
||||||
|
// Hold container
|
||||||
|
public static final QName TYPE_HOLD_CONTAINER = QName.createQName(RM_URI, "holdContainer");
|
||||||
|
|
||||||
|
// Transfer container
|
||||||
|
public static final QName TYPE_TRANSFER_CONTAINER = QName.createQName(RM_URI, "transferContainer");
|
||||||
|
|
||||||
// Disposition instructions aspect
|
// Disposition instructions aspect
|
||||||
public static final QName ASPECT_SCHEDULED = QName.createQName(RM_URI, "scheduled");
|
public static final QName ASPECT_SCHEDULED = QName.createQName(RM_URI, "scheduled");
|
||||||
public static final QName ASSOC_DISPOSITION_SCHEDULE = QName.createQName(RM_URI, "dispositionSchedule");
|
public static final QName ASSOC_DISPOSITION_SCHEDULE = QName.createQName(RM_URI, "dispositionSchedule");
|
||||||
@@ -169,7 +175,9 @@ public interface RecordsManagementModel extends RecordsManagementCustomModel
|
|||||||
|
|
||||||
// Records management root aspect
|
// Records management root aspect
|
||||||
public static final QName ASPECT_RECORDS_MANAGEMENT_ROOT = QName.createQName(RM_URI, "recordsManagementRoot");
|
public static final QName ASPECT_RECORDS_MANAGEMENT_ROOT = QName.createQName(RM_URI, "recordsManagementRoot");
|
||||||
public static final QName ASSOC_HOLDS = QName.createQName(RM_URI, "holds");
|
@Deprecated // since 2.1
|
||||||
|
public static final QName ASSOC_HOLDS = QName.createQName(RM_URI, "holds");
|
||||||
|
@Deprecated // since 2.1
|
||||||
public static final QName ASSOC_TRANSFERS = QName.createQName(RM_URI, "transfers");
|
public static final QName ASSOC_TRANSFERS = QName.createQName(RM_URI, "transfers");
|
||||||
|
|
||||||
// Hold type
|
// Hold type
|
||||||
@@ -244,4 +252,9 @@ public interface RecordsManagementModel extends RecordsManagementCustomModel
|
|||||||
public static final QName PROP_RECORD_REJECTION_USER_ID = QName.createQName(RM_URI, "recordRejectionUserId");
|
public static final QName PROP_RECORD_REJECTION_USER_ID = QName.createQName(RM_URI, "recordRejectionUserId");
|
||||||
public static final QName PROP_RECORD_REJECTION_DATE = QName.createQName(RM_URI, "recordRejectionDate");
|
public static final QName PROP_RECORD_REJECTION_DATE = QName.createQName(RM_URI, "recordRejectionDate");
|
||||||
public static final QName PROP_RECORD_REJECTION_REASON = QName.createQName(RM_URI, "recordRejectionReason");
|
public static final QName PROP_RECORD_REJECTION_REASON = QName.createQName(RM_URI, "recordRejectionReason");
|
||||||
|
|
||||||
|
// Countable aspect
|
||||||
|
public static final QName ASPECT_COUNTABLE = QName.createQName(RM_URI, "countable");
|
||||||
|
public static final QName PROP_COUNT = QName.createQName(RM_URI, "count");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -123,30 +123,33 @@ public class RecordContainerType implements RecordsManagementModel,
|
|||||||
{
|
{
|
||||||
// Get the elements of the created association
|
// Get the elements of the created association
|
||||||
final NodeRef child = childAssocRef.getChildRef();
|
final NodeRef child = childAssocRef.getChildRef();
|
||||||
QName childType = nodeService.getType(child);
|
if (nodeService.exists(child) == true)
|
||||||
|
|
||||||
// We only care about "folder" or sub-types
|
|
||||||
if (dictionaryService.isSubClass(childType, ContentModel.TYPE_FOLDER) == true)
|
|
||||||
{
|
{
|
||||||
if (dictionaryService.isSubClass(childType, ContentModel.TYPE_SYSTEM_FOLDER) == true)
|
QName childType = nodeService.getType(child);
|
||||||
|
|
||||||
|
// We only care about "folder" or sub-types
|
||||||
|
if (dictionaryService.isSubClass(childType, ContentModel.TYPE_FOLDER) == true)
|
||||||
{
|
{
|
||||||
// this is a rule container, make sure it is an file plan component
|
if (dictionaryService.isSubClass(childType, ContentModel.TYPE_SYSTEM_FOLDER) == true)
|
||||||
nodeService.addAspect(child, ASPECT_FILE_PLAN_COMPONENT, null);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// We need to automatically cast the created folder to RM type if it is a plain folder
|
|
||||||
// This occurs if the RM folder has been created via IMap, WebDav, etc
|
|
||||||
if (nodeService.hasAspect(child, ASPECT_FILE_PLAN_COMPONENT) == false)
|
|
||||||
{
|
{
|
||||||
// TODO it may not always be a record folder ... perhaps if the current user is a admin it would be a record category??
|
// this is a rule container, make sure it is an file plan component
|
||||||
|
nodeService.addAspect(child, ASPECT_FILE_PLAN_COMPONENT, null);
|
||||||
// Assume any created folder is a rma:recordFolder
|
|
||||||
nodeService.setType(child, TYPE_RECORD_FOLDER);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// We need to automatically cast the created folder to RM type if it is a plain folder
|
||||||
|
// This occurs if the RM folder has been created via IMap, WebDav, etc
|
||||||
|
if (nodeService.hasAspect(child, ASPECT_FILE_PLAN_COMPONENT) == false)
|
||||||
|
{
|
||||||
|
// TODO it may not always be a record folder ... perhaps if the current user is a admin it would be a record category??
|
||||||
|
|
||||||
// Catch all to generate the rm id (assuming it doesn't already have one!)
|
// Assume any created folder is a rma:recordFolder
|
||||||
setIdenifierProperty(child);
|
nodeService.setType(child, TYPE_RECORD_FOLDER);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Catch all to generate the rm id (assuming it doesn't already have one!)
|
||||||
|
setIdenifierProperty(child);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -148,9 +148,17 @@ public class RMv21InPlacePatch extends ModulePatchComponent
|
|||||||
filePlanPermissionService.setPermission(filePlan, ExtendedReaderDynamicAuthority.EXTENDED_READER, RMPermissionModel.READ_RECORDS);
|
filePlanPermissionService.setPermission(filePlan, ExtendedReaderDynamicAuthority.EXTENDED_READER, RMPermissionModel.READ_RECORDS);
|
||||||
filePlanPermissionService.setPermission(filePlan, ExtendedWriterDynamicAuthority.EXTENDED_WRITER, RMPermissionModel.FILING);
|
filePlanPermissionService.setPermission(filePlan, ExtendedWriterDynamicAuthority.EXTENDED_WRITER, RMPermissionModel.FILING);
|
||||||
|
|
||||||
// create unfiled container
|
// create fileplan containers
|
||||||
|
filePlanService.createHoldContainer(filePlan);
|
||||||
|
filePlanService.createTransferContainer(filePlan);
|
||||||
filePlanService.createUnfiledContainer(filePlan);
|
filePlanService.createUnfiledContainer(filePlan);
|
||||||
|
|
||||||
|
// move any existing holds to new container
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
// move any existing transfers to new container
|
||||||
|
// TODO
|
||||||
|
|
||||||
// add the inplace roles
|
// add the inplace roles
|
||||||
filePlanRoleService.createRole(filePlan, ROLE_READERS, ROLE_READERS_LABEL, getCapabilities(ROLE_READERS_CAPABILITIES));
|
filePlanRoleService.createRole(filePlan, ROLE_READERS, ROLE_READERS_LABEL, getCapabilities(ROLE_READERS_CAPABILITIES));
|
||||||
filePlanRoleService.createRole(filePlan, ROLE_WRITERS, ROLE_WRITERS_LABEL, getCapabilities(ROLE_WRITERS_CAPABILITIES));
|
filePlanRoleService.createRole(filePlan, ROLE_WRITERS, ROLE_WRITERS_LABEL, getCapabilities(ROLE_WRITERS_CAPABILITIES));
|
||||||
|
@@ -253,6 +253,11 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
permissionService.setPermission(rmRootNode, ExtendedReaderDynamicAuthority.EXTENDED_READER, RMPermissionModel.READ_RECORDS, true);
|
permissionService.setPermission(rmRootNode, ExtendedReaderDynamicAuthority.EXTENDED_READER, RMPermissionModel.READ_RECORDS, true);
|
||||||
permissionService.setPermission(rmRootNode, ExtendedWriterDynamicAuthority.EXTENDED_WRITER, RMPermissionModel.FILING, true);
|
permissionService.setPermission(rmRootNode, ExtendedWriterDynamicAuthority.EXTENDED_WRITER, RMPermissionModel.FILING, true);
|
||||||
|
|
||||||
|
// Create the transfer and hold containers
|
||||||
|
// NOTE: don't need to worry about the admin permissions as for now we just inherit all
|
||||||
|
filePlanService.createHoldContainer(rmRootNode);
|
||||||
|
filePlanService.createTransferContainer(rmRootNode);
|
||||||
|
|
||||||
// Create the unfiled record container
|
// Create the unfiled record container
|
||||||
return filePlanService.createUnfiledContainer(rmRootNode);
|
return filePlanService.createUnfiledContainer(rmRootNode);
|
||||||
}
|
}
|
||||||
@@ -310,7 +315,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
* @param rmRootNode
|
* @param rmRootNode
|
||||||
* @param unfiledContainer
|
* @param unfiledContainer
|
||||||
*/
|
*/
|
||||||
private void bootstrapDefaultRoles(final NodeRef rmRootNode, final NodeRef unfiledContainer)
|
private void bootstrapDefaultRoles(final NodeRef filePlan, final NodeRef unfiledContainer)
|
||||||
{
|
{
|
||||||
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
|
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
|
||||||
{
|
{
|
||||||
@@ -344,9 +349,9 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
if (object.has("name") == true)
|
if (object.has("name") == true)
|
||||||
{
|
{
|
||||||
name = object.getString("name");
|
name = object.getString("name");
|
||||||
if (existsRole(rmRootNode, name) == true)
|
if (existsRole(filePlan, name) == true)
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("The bootstrap role " + name + " already exists on the rm root node " + rmRootNode.toString());
|
throw new AlfrescoRuntimeException("The bootstrap role " + name + " already exists on the rm root node " + filePlan.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -387,13 +392,13 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the role
|
// Create the role
|
||||||
Role role = createRole(rmRootNode, name, displayLabel, capabilities);
|
Role role = createRole(filePlan, name, displayLabel, capabilities);
|
||||||
|
|
||||||
// Add any additional admin permissions
|
// Add any additional admin permissions
|
||||||
if (isAdmin == true)
|
if (isAdmin == true)
|
||||||
{
|
{
|
||||||
// Admin has filing
|
// Admin has filing
|
||||||
permissionService.setPermission(rmRootNode, role.getRoleGroupName(), RMPermissionModel.FILING, true);
|
permissionService.setPermission(filePlan, role.getRoleGroupName(), RMPermissionModel.FILING, true);
|
||||||
if (unfiledContainer != null)
|
if (unfiledContainer != null)
|
||||||
{
|
{
|
||||||
permissionService.setPermission(unfiledContainer, role.getRoleGroupName(), RMPermissionModel.FILING, true);
|
permissionService.setPermission(unfiledContainer, role.getRoleGroupName(), RMPermissionModel.FILING, true);
|
||||||
|
@@ -26,6 +26,8 @@ import java.util.Map;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
|
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.RecordsManagementModel;
|
||||||
import org.alfresco.repo.web.scripts.content.StreamACP;
|
import org.alfresco.repo.web.scripts.content.StreamACP;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
@@ -50,6 +52,13 @@ public abstract class BaseTransferWebScript extends StreamACP
|
|||||||
/** Logger */
|
/** Logger */
|
||||||
private static Log logger = LogFactory.getLog(BaseTransferWebScript.class);
|
private static Log logger = LogFactory.getLog(BaseTransferWebScript.class);
|
||||||
|
|
||||||
|
protected FilePlanService filePlanService;
|
||||||
|
|
||||||
|
public void setFilePlanService(FilePlanService filePlanService)
|
||||||
|
{
|
||||||
|
this.filePlanService = filePlanService;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.web.scripts.WebScript#execute(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse)
|
* @see org.alfresco.web.scripts.WebScript#execute(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse)
|
||||||
*/
|
*/
|
||||||
@@ -167,8 +176,10 @@ public abstract class BaseTransferWebScript extends StreamACP
|
|||||||
NodeRef transferNode = null;
|
NodeRef transferNode = null;
|
||||||
|
|
||||||
// get all the transfer nodes and find the one we need
|
// get all the transfer nodes and find the one we need
|
||||||
List<ChildAssociationRef> assocs = this.nodeService.getChildAssocs(filePlan,
|
NodeRef transferContainer = filePlanService.getTransferContainer(filePlan);
|
||||||
RecordsManagementModel.ASSOC_TRANSFERS, RegexQNamePattern.MATCH_ALL);
|
List<ChildAssociationRef> assocs = this.nodeService.getChildAssocs(transferContainer,
|
||||||
|
ContentModel.ASSOC_CONTAINS,
|
||||||
|
RegexQNamePattern.MATCH_ALL);
|
||||||
for (ChildAssociationRef child : assocs)
|
for (ChildAssociationRef child : assocs)
|
||||||
{
|
{
|
||||||
if (child.getChildRef().getId().equals(transferId))
|
if (child.getChildRef().getId().equals(transferId))
|
||||||
|
@@ -454,19 +454,25 @@ public class FilePlanPermissionServiceImpl implements FilePlanPermissionService,
|
|||||||
*/
|
*/
|
||||||
private void setPermissionDown(NodeRef nodeRef, String authority, String permission)
|
private void setPermissionDown(NodeRef nodeRef, String authority, String permission)
|
||||||
{
|
{
|
||||||
setPermissionImpl(nodeRef, authority, permission);
|
// skip out node's that inherit (for example hold and transfer)
|
||||||
if (filePlanService.isFilePlanContainer(nodeRef) == true ||
|
if (permissionService.getInheritParentPermissions(nodeRef) == false)
|
||||||
recordsManagementService.isRecordFolder(nodeRef) == true)
|
|
||||||
{
|
{
|
||||||
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
|
// set permissions
|
||||||
for (ChildAssociationRef assoc : assocs)
|
setPermissionImpl(nodeRef, authority, permission);
|
||||||
|
|
||||||
|
if (filePlanService.isFilePlanContainer(nodeRef) == true ||
|
||||||
|
recordsManagementService.isRecordFolder(nodeRef) == true)
|
||||||
{
|
{
|
||||||
NodeRef child = assoc.getChildRef();
|
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
|
||||||
if (filePlanService.isFilePlanContainer(child) == true ||
|
for (ChildAssociationRef assoc : assocs)
|
||||||
recordsManagementService.isRecordFolder(child) == true ||
|
|
||||||
recordService.isRecord(child) == true)
|
|
||||||
{
|
{
|
||||||
setPermissionDown(child, authority, permission);
|
NodeRef child = assoc.getChildRef();
|
||||||
|
if (filePlanService.isFilePlanContainer(child) == true ||
|
||||||
|
recordsManagementService.isRecordFolder(child) == true ||
|
||||||
|
recordService.isRecord(child) == true)
|
||||||
|
{
|
||||||
|
setPermissionDown(child, authority, permission);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -499,21 +505,25 @@ public class FilePlanPermissionServiceImpl implements FilePlanPermissionService,
|
|||||||
{
|
{
|
||||||
public Boolean doWork() throws Exception
|
public Boolean doWork() throws Exception
|
||||||
{
|
{
|
||||||
// Delete permission on this node
|
// can't delete permissions if inherited (eg hold and transfer containers)
|
||||||
permissionService.deletePermission(nodeRef, authority, permission);
|
if (permissionService.getInheritParentPermissions(nodeRef) == false)
|
||||||
|
|
||||||
if (filePlanService.isFilePlanContainer(nodeRef) == true ||
|
|
||||||
recordsManagementService.isRecordFolder(nodeRef) == true)
|
|
||||||
{
|
{
|
||||||
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
|
// Delete permission on this node
|
||||||
for (ChildAssociationRef assoc : assocs)
|
permissionService.deletePermission(nodeRef, authority, permission);
|
||||||
|
|
||||||
|
if (filePlanService.isFilePlanContainer(nodeRef) == true ||
|
||||||
|
recordsManagementService.isRecordFolder(nodeRef) == true)
|
||||||
{
|
{
|
||||||
NodeRef child = assoc.getChildRef();
|
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
|
||||||
if (filePlanService.isFilePlanContainer(child) == true ||
|
for (ChildAssociationRef assoc : assocs)
|
||||||
recordsManagementService.isRecordFolder(child) == true ||
|
|
||||||
recordService.isRecord(child) == true)
|
|
||||||
{
|
{
|
||||||
deletePermission(child, authority, permission);
|
NodeRef child = assoc.getChildRef();
|
||||||
|
if (filePlanService.isFilePlanContainer(child) == true ||
|
||||||
|
recordsManagementService.isRecordFolder(child) == true ||
|
||||||
|
recordService.isRecord(child) == true)
|
||||||
|
{
|
||||||
|
deletePermission(child, authority, permission);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,11 +18,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.module.org_alfresco_module_rm.util;
|
package org.alfresco.module.org_alfresco_module_rm.util;
|
||||||
|
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.util.ParameterCheck;
|
import org.alfresco.util.ParameterCheck;
|
||||||
|
import org.alfresco.util.PropertyMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper base class for service implementations.
|
* Helper base class for service implementations.
|
||||||
@@ -30,7 +32,7 @@ import org.alfresco.util.ParameterCheck;
|
|||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
* @since 2.1
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
public class ServiceBaseImpl
|
public class ServiceBaseImpl implements RecordsManagementModel
|
||||||
{
|
{
|
||||||
/** Node service */
|
/** Node service */
|
||||||
protected NodeService nodeService;
|
protected NodeService nodeService;
|
||||||
@@ -74,4 +76,39 @@ public class ServiceBaseImpl
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility method to get the next counter for a node.
|
||||||
|
* <p>
|
||||||
|
* If the node is not already countable, then rma:countable is added and 0 returned.
|
||||||
|
*
|
||||||
|
* @param nodeRef node reference
|
||||||
|
* @return int next counter value
|
||||||
|
*/
|
||||||
|
protected int getNextCount(NodeRef nodeRef)
|
||||||
|
{
|
||||||
|
int counter = 0;
|
||||||
|
if (nodeService.hasAspect(nodeRef, ASPECT_COUNTABLE) == false)
|
||||||
|
{
|
||||||
|
PropertyMap props = new PropertyMap(1);
|
||||||
|
props.put(PROP_COUNT, 1);
|
||||||
|
nodeService.addAspect(nodeRef, ASPECT_COUNTABLE, props);
|
||||||
|
counter = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Integer value = (Integer)this.nodeService.getProperty(nodeRef, PROP_COUNT);
|
||||||
|
if (value != null)
|
||||||
|
{
|
||||||
|
counter = value.intValue() + 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
counter = 1;
|
||||||
|
}
|
||||||
|
nodeService.setProperty(nodeRef, PROP_COUNT, counter);
|
||||||
|
|
||||||
|
}
|
||||||
|
return counter;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -87,7 +87,7 @@ public class FilePlanServiceImplTest extends BaseRMTestCase
|
|||||||
{
|
{
|
||||||
public void runImpl() throws Exception
|
public void runImpl() throws Exception
|
||||||
{
|
{
|
||||||
assertEquals(filePlan, filePlanService.getFilePlanBySiteId(SITE_ID));
|
assertEquals(filePlan, filePlanService.getFilePlanBySiteId(siteId));
|
||||||
assertNull(filePlanService.getFilePlanBySiteId("rubbish"));
|
assertNull(filePlanService.getFilePlanBySiteId("rubbish"));
|
||||||
|
|
||||||
String siteId = GUID.generate();
|
String siteId = GUID.generate();
|
||||||
|
@@ -84,7 +84,7 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
|||||||
TestWithUserUtils.createUser(USER2, USER2, rootNodeRef, nodeService, authenticationService);
|
TestWithUserUtils.createUser(USER2, USER2, rootNodeRef, nodeService, authenticationService);
|
||||||
|
|
||||||
// Count the number of pre-defined reports
|
// Count the number of pre-defined reports
|
||||||
List<SavedSearchDetails> searches = rmSearchService.getSavedSearches(SITE_ID);
|
List<SavedSearchDetails> searches = rmSearchService.getSavedSearches(siteId);
|
||||||
assertNotNull(searches);
|
assertNotNull(searches);
|
||||||
numberOfReports = searches.size();
|
numberOfReports = searches.size();
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
|||||||
String query = "keywords:\"elephant\"";
|
String query = "keywords:\"elephant\"";
|
||||||
RecordsManagementSearchParameters params = new RecordsManagementSearchParameters();
|
RecordsManagementSearchParameters params = new RecordsManagementSearchParameters();
|
||||||
params.setIncludeUndeclaredRecords(true);
|
params.setIncludeUndeclaredRecords(true);
|
||||||
List<NodeRef> results = rmSearchService.search(SITE_ID, query, params);
|
List<NodeRef> results = rmSearchService.search(siteId, query, params);
|
||||||
assertNotNull(results);
|
assertNotNull(results);
|
||||||
assertEquals(2, results.size());
|
assertEquals(2, results.size());
|
||||||
|
|
||||||
@@ -172,10 +172,10 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
|||||||
@Override
|
@Override
|
||||||
public Void run()
|
public Void run()
|
||||||
{
|
{
|
||||||
SavedSearchDetails details1 = rmSearchService.saveSearch(SITE_ID, SEARCH1, "description1", "query1", new RecordsManagementSearchParameters(), true);
|
SavedSearchDetails details1 = rmSearchService.saveSearch(siteId, SEARCH1, "description1", "query1", new RecordsManagementSearchParameters(), true);
|
||||||
checkSearchDetails(details1, "mySite", "search1", "description1", "query1", new RecordsManagementSearchParameters(), true);
|
checkSearchDetails(details1, siteId, "search1", "description1", "query1", new RecordsManagementSearchParameters(), true);
|
||||||
SavedSearchDetails details2 = rmSearchService.saveSearch(SITE_ID, SEARCH2, "description2", "query2", new RecordsManagementSearchParameters(), false);
|
SavedSearchDetails details2 = rmSearchService.saveSearch(siteId, SEARCH2, "description2", "query2", new RecordsManagementSearchParameters(), false);
|
||||||
checkSearchDetails(details2, "mySite", "search2", "description2", "query2", new RecordsManagementSearchParameters(), false);
|
checkSearchDetails(details2, siteId, "search2", "description2", "query2", new RecordsManagementSearchParameters(), false);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -188,10 +188,10 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
|||||||
@Override
|
@Override
|
||||||
public Void run()
|
public Void run()
|
||||||
{
|
{
|
||||||
SavedSearchDetails details1 = rmSearchService.saveSearch(SITE_ID, SEARCH3, "description3", "query3", new RecordsManagementSearchParameters(), false);
|
SavedSearchDetails details1 = rmSearchService.saveSearch(siteId, SEARCH3, "description3", "query3", new RecordsManagementSearchParameters(), false);
|
||||||
checkSearchDetails(details1, "mySite", SEARCH3, "description3", "query3", new RecordsManagementSearchParameters(), false);
|
checkSearchDetails(details1, siteId, SEARCH3, "description3", "query3", new RecordsManagementSearchParameters(), false);
|
||||||
SavedSearchDetails details2 = rmSearchService.saveSearch(SITE_ID, SEARCH4, "description4", "query4", new RecordsManagementSearchParameters(), false);
|
SavedSearchDetails details2 = rmSearchService.saveSearch(siteId, SEARCH4, "description4", "query4", new RecordsManagementSearchParameters(), false);
|
||||||
checkSearchDetails(details2, "mySite", SEARCH4, "description4", "query4", new RecordsManagementSearchParameters(), false);
|
checkSearchDetails(details2, siteId, SEARCH4, "description4", "query4", new RecordsManagementSearchParameters(), false);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -204,22 +204,22 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
|||||||
@Override
|
@Override
|
||||||
public Void run()
|
public Void run()
|
||||||
{
|
{
|
||||||
List<SavedSearchDetails> searches = rmSearchService.getSavedSearches(SITE_ID);
|
List<SavedSearchDetails> searches = rmSearchService.getSavedSearches(siteId);
|
||||||
assertNotNull(searches);
|
assertNotNull(searches);
|
||||||
assertEquals(numberOfReports + 2, searches.size());
|
assertEquals(numberOfReports + 2, searches.size());
|
||||||
|
|
||||||
SavedSearchDetails search1 = rmSearchService.getSavedSearch(SITE_ID, SEARCH1);
|
SavedSearchDetails search1 = rmSearchService.getSavedSearch(siteId, SEARCH1);
|
||||||
assertNotNull(search1);
|
assertNotNull(search1);
|
||||||
checkSearchDetails(search1, "mySite", "search1", "description1", "query1", new RecordsManagementSearchParameters(), true);
|
checkSearchDetails(search1, siteId, "search1", "description1", "query1", new RecordsManagementSearchParameters(), true);
|
||||||
|
|
||||||
SavedSearchDetails search2 = rmSearchService.getSavedSearch(SITE_ID, SEARCH2);
|
SavedSearchDetails search2 = rmSearchService.getSavedSearch(siteId, SEARCH2);
|
||||||
assertNotNull(search2);
|
assertNotNull(search2);
|
||||||
checkSearchDetails(search2, "mySite", "search2", "description2", "query2", new RecordsManagementSearchParameters(), false);
|
checkSearchDetails(search2, siteId, "search2", "description2", "query2", new RecordsManagementSearchParameters(), false);
|
||||||
|
|
||||||
SavedSearchDetails search3 = rmSearchService.getSavedSearch(SITE_ID, SEARCH3);
|
SavedSearchDetails search3 = rmSearchService.getSavedSearch(siteId, SEARCH3);
|
||||||
assertNull(search3);
|
assertNull(search3);
|
||||||
|
|
||||||
SavedSearchDetails search4 = rmSearchService.getSavedSearch(SITE_ID, SEARCH4);
|
SavedSearchDetails search4 = rmSearchService.getSavedSearch(siteId, SEARCH4);
|
||||||
assertNull(search4);
|
assertNull(search4);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@@ -233,24 +233,24 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
|||||||
@Override
|
@Override
|
||||||
public Void run()
|
public Void run()
|
||||||
{
|
{
|
||||||
List<SavedSearchDetails> searches = rmSearchService.getSavedSearches(SITE_ID);
|
List<SavedSearchDetails> searches = rmSearchService.getSavedSearches(siteId);
|
||||||
assertNotNull(searches);
|
assertNotNull(searches);
|
||||||
assertEquals(numberOfReports + 3, searches.size());
|
assertEquals(numberOfReports + 3, searches.size());
|
||||||
|
|
||||||
SavedSearchDetails search1 = rmSearchService.getSavedSearch(SITE_ID, SEARCH1);
|
SavedSearchDetails search1 = rmSearchService.getSavedSearch(siteId, SEARCH1);
|
||||||
assertNotNull(search1);
|
assertNotNull(search1);
|
||||||
checkSearchDetails(search1, "mySite", "search1", "description1", "query1", new RecordsManagementSearchParameters(), true);
|
checkSearchDetails(search1, siteId, "search1", "description1", "query1", new RecordsManagementSearchParameters(), true);
|
||||||
|
|
||||||
SavedSearchDetails search2 = rmSearchService.getSavedSearch(SITE_ID, SEARCH2);
|
SavedSearchDetails search2 = rmSearchService.getSavedSearch(siteId, SEARCH2);
|
||||||
assertNull(search2);
|
assertNull(search2);
|
||||||
|
|
||||||
SavedSearchDetails search3 = rmSearchService.getSavedSearch(SITE_ID, SEARCH3);
|
SavedSearchDetails search3 = rmSearchService.getSavedSearch(siteId, SEARCH3);
|
||||||
assertNotNull(search3);
|
assertNotNull(search3);
|
||||||
checkSearchDetails(search3, "mySite", SEARCH3, "description3", "query3", new RecordsManagementSearchParameters(), false);
|
checkSearchDetails(search3, siteId, SEARCH3, "description3", "query3", new RecordsManagementSearchParameters(), false);
|
||||||
|
|
||||||
SavedSearchDetails search4 = rmSearchService.getSavedSearch(SITE_ID, SEARCH4);
|
SavedSearchDetails search4 = rmSearchService.getSavedSearch(siteId, SEARCH4);
|
||||||
assertNotNull(search4);
|
assertNotNull(search4);
|
||||||
checkSearchDetails(search4, "mySite", "search4", "description4", "query4", new RecordsManagementSearchParameters(), false);
|
checkSearchDetails(search4, siteId, "search4", "description4", "query4", new RecordsManagementSearchParameters(), false);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -263,15 +263,15 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
|||||||
@Override
|
@Override
|
||||||
public Void run()
|
public Void run()
|
||||||
{
|
{
|
||||||
SavedSearchDetails search1 = rmSearchService.getSavedSearch(SITE_ID, SEARCH1);
|
SavedSearchDetails search1 = rmSearchService.getSavedSearch(siteId, SEARCH1);
|
||||||
assertNotNull(search1);
|
assertNotNull(search1);
|
||||||
checkSearchDetails(search1, SITE_ID, SEARCH1, "description1", "query1", new RecordsManagementSearchParameters(), true);
|
checkSearchDetails(search1, siteId, SEARCH1, "description1", "query1", new RecordsManagementSearchParameters(), true);
|
||||||
|
|
||||||
rmSearchService.saveSearch(SITE_ID, SEARCH1, "change", "change", new RecordsManagementSearchParameters(), true);
|
rmSearchService.saveSearch(siteId, SEARCH1, "change", "change", new RecordsManagementSearchParameters(), true);
|
||||||
|
|
||||||
search1 = rmSearchService.getSavedSearch(SITE_ID, SEARCH1);
|
search1 = rmSearchService.getSavedSearch(siteId, SEARCH1);
|
||||||
assertNotNull(search1);
|
assertNotNull(search1);
|
||||||
checkSearchDetails(search1, SITE_ID, SEARCH1, "change", "change", new RecordsManagementSearchParameters(), true);
|
checkSearchDetails(search1, siteId, SEARCH1, "change", "change", new RecordsManagementSearchParameters(), true);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@@ -96,7 +96,6 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
|||||||
protected QName ASPECT_RECORD_META_DATA = QName.createQName(URI, "recordMetaData");
|
protected QName ASPECT_RECORD_META_DATA = QName.createQName(URI, "recordMetaData");
|
||||||
|
|
||||||
/** site id's */
|
/** site id's */
|
||||||
protected static final String SITE_ID = "mySite";
|
|
||||||
protected static final String COLLABORATION_SITE_ID = "collab-site-id";
|
protected static final String COLLABORATION_SITE_ID = "collab-site-id";
|
||||||
|
|
||||||
/** Common test utils */
|
/** Common test utils */
|
||||||
@@ -140,6 +139,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
|||||||
protected FilePlanAuthenticationService filePlanAuthenticationService;
|
protected FilePlanAuthenticationService filePlanAuthenticationService;
|
||||||
|
|
||||||
/** test data */
|
/** test data */
|
||||||
|
protected String siteId;
|
||||||
protected StoreRef storeRef;
|
protected StoreRef storeRef;
|
||||||
protected NodeRef rootNodeRef;
|
protected NodeRef rootNodeRef;
|
||||||
protected SiteInfo siteInfo;
|
protected SiteInfo siteInfo;
|
||||||
@@ -404,7 +404,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
|||||||
nodeService.deleteNode(folder);
|
nodeService.deleteNode(folder);
|
||||||
|
|
||||||
// Delete the site
|
// Delete the site
|
||||||
siteService.deleteSite(SITE_ID);
|
siteService.deleteSite(siteId);
|
||||||
|
|
||||||
// delete the collaboration site (if required)
|
// delete the collaboration site (if required)
|
||||||
if (isCollaborationSiteTest() == true)
|
if (isCollaborationSiteTest() == true)
|
||||||
@@ -488,15 +488,16 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
|||||||
permissionService.setPermission(folder, "rmadmin", PermissionService.WRITE, true);
|
permissionService.setPermission(folder, "rmadmin", PermissionService.WRITE, true);
|
||||||
permissionService.setPermission(folder, "rmadmin", PermissionService.ADD_CHILDREN, true);
|
permissionService.setPermission(folder, "rmadmin", PermissionService.ADD_CHILDREN, true);
|
||||||
|
|
||||||
|
siteId = GUID.generate();
|
||||||
siteInfo = siteService.createSite(
|
siteInfo = siteService.createSite(
|
||||||
"rm-site-dashboard",
|
"rm-site-dashboard",
|
||||||
SITE_ID,
|
siteId,
|
||||||
"title",
|
"title",
|
||||||
"descrition",
|
"descrition",
|
||||||
SiteVisibility.PUBLIC,
|
SiteVisibility.PUBLIC,
|
||||||
RecordsManagementModel.TYPE_RM_SITE);
|
RecordsManagementModel.TYPE_RM_SITE);
|
||||||
|
|
||||||
filePlan = siteService.getContainer(SITE_ID, RmSiteType.COMPONENT_DOCUMENT_LIBRARY);
|
filePlan = siteService.getContainer(siteId, RmSiteType.COMPONENT_DOCUMENT_LIBRARY);
|
||||||
assertNotNull("Site document library container was not created successfully.", filePlan);
|
assertNotNull("Site document library container was not created successfully.", filePlan);
|
||||||
|
|
||||||
// Create RM container
|
// Create RM container
|
||||||
|
@@ -62,6 +62,7 @@ import org.alfresco.service.cmr.tagging.TaggingService;
|
|||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.service.transaction.TransactionService;
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
|
import org.alfresco.util.GUID;
|
||||||
import org.alfresco.util.PropertyMap;
|
import org.alfresco.util.PropertyMap;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
|
|
||||||
@@ -70,8 +71,6 @@ import org.springframework.context.ApplicationContext;
|
|||||||
*/
|
*/
|
||||||
public class BaseRMWebScriptTestCase extends BaseWebScriptTest
|
public class BaseRMWebScriptTestCase extends BaseWebScriptTest
|
||||||
{
|
{
|
||||||
/** Site id */
|
|
||||||
protected static final String SITE_ID = "mySite";
|
|
||||||
/** Collab site id */
|
/** Collab site id */
|
||||||
protected static final String COLLAB_SITE_ID = "myCollabSite";
|
protected static final String COLLAB_SITE_ID = "myCollabSite";
|
||||||
|
|
||||||
@@ -111,6 +110,7 @@ public class BaseRMWebScriptTestCase extends BaseWebScriptTest
|
|||||||
protected FilePlanService filePlanService;
|
protected FilePlanService filePlanService;
|
||||||
|
|
||||||
/** test data */
|
/** test data */
|
||||||
|
protected String siteId;
|
||||||
protected StoreRef storeRef;
|
protected StoreRef storeRef;
|
||||||
protected NodeRef rootNodeRef;
|
protected NodeRef rootNodeRef;
|
||||||
protected SiteInfo siteInfo;
|
protected SiteInfo siteInfo;
|
||||||
@@ -214,7 +214,7 @@ public class BaseRMWebScriptTestCase extends BaseWebScriptTest
|
|||||||
nodeService.deleteNode(folder);
|
nodeService.deleteNode(folder);
|
||||||
|
|
||||||
// Delete the site
|
// Delete the site
|
||||||
siteService.deleteSite(SITE_ID);
|
siteService.deleteSite(siteId);
|
||||||
|
|
||||||
// Delete the collaboration site (if required)
|
// Delete the collaboration site (if required)
|
||||||
if (isCollaborationSiteTest() == true)
|
if (isCollaborationSiteTest() == true)
|
||||||
@@ -275,8 +275,9 @@ public class BaseRMWebScriptTestCase extends BaseWebScriptTest
|
|||||||
assertNotNull("Could not create base folder", folder);
|
assertNotNull("Could not create base folder", folder);
|
||||||
|
|
||||||
// Create the site
|
// Create the site
|
||||||
siteInfo = siteService.createSite("rm-site-dashboard", SITE_ID, "title", "descrition", SiteVisibility.PUBLIC, RecordsManagementModel.TYPE_RM_SITE);
|
siteId = GUID.generate();
|
||||||
filePlan = siteService.getContainer(SITE_ID, RmSiteType.COMPONENT_DOCUMENT_LIBRARY);
|
siteInfo = siteService.createSite("rm-site-dashboard", siteId, "title", "descrition", SiteVisibility.PUBLIC, RecordsManagementModel.TYPE_RM_SITE);
|
||||||
|
filePlan = siteService.getContainer(siteId, RmSiteType.COMPONENT_DOCUMENT_LIBRARY);
|
||||||
assertNotNull("Site document library container was not created successfully.", filePlan);
|
assertNotNull("Site document library container was not created successfully.", filePlan);
|
||||||
|
|
||||||
recordSeries = filePlanService.createRecordCategory(filePlan, "recordSeries");
|
recordSeries = filePlanService.createRecordCategory(filePlan, "recordSeries");
|
||||||
|
@@ -31,7 +31,7 @@ public class DataSetRestApiTest extends BaseRMWebScriptTestCase
|
|||||||
/** Test GET */
|
/** Test GET */
|
||||||
|
|
||||||
// Format url and send request
|
// Format url and send request
|
||||||
String getUrl = String.format(GET_DATASETS_URL, SITE_ID);
|
String getUrl = String.format(GET_DATASETS_URL, siteId);
|
||||||
Response getResponse = sendRequest(new GetRequest(getUrl), Status.STATUS_OK);
|
Response getResponse = sendRequest(new GetRequest(getUrl), Status.STATUS_OK);
|
||||||
|
|
||||||
// Check the content from the response
|
// Check the content from the response
|
||||||
|
@@ -59,7 +59,7 @@ public class RmClassesRestApiTest extends BaseRMWebScriptTestCase
|
|||||||
public void testRmGetAspectDefinitions() throws IOException, JSONException
|
public void testRmGetAspectDefinitions() throws IOException, JSONException
|
||||||
{
|
{
|
||||||
// Format url and send request
|
// Format url and send request
|
||||||
String url = String.format(RM_ASPECTS_URL, "aspect", SITE_ID);
|
String url = String.format(RM_ASPECTS_URL, "aspect", siteId);
|
||||||
Response response = sendRequest(new GetRequest(url), Status.STATUS_OK);
|
Response response = sendRequest(new GetRequest(url), Status.STATUS_OK);
|
||||||
|
|
||||||
// Check the content from the response
|
// Check the content from the response
|
||||||
|
@@ -59,7 +59,7 @@ public class RmPropertiesRestApiTest extends BaseRMWebScriptTestCase
|
|||||||
public void testRmGetTypeDefinitions() throws IOException, JSONException
|
public void testRmGetTypeDefinitions() throws IOException, JSONException
|
||||||
{
|
{
|
||||||
// Format url and send request
|
// Format url and send request
|
||||||
String url = String.format(RM_TYPES_URL, "type", SITE_ID);
|
String url = String.format(RM_TYPES_URL, "type", siteId);
|
||||||
Response response = sendRequest(new GetRequest(url), Status.STATUS_OK);
|
Response response = sendRequest(new GetRequest(url), Status.STATUS_OK);
|
||||||
|
|
||||||
// Check the content from the response
|
// Check the content from the response
|
||||||
|
@@ -52,7 +52,7 @@ public class RoleRestApiTest extends BaseRMWebScriptTestCase
|
|||||||
|
|
||||||
private String getRolesUrlBySite()
|
private String getRolesUrlBySite()
|
||||||
{
|
{
|
||||||
return MessageFormat.format(GET_ROLES_URL_BY_SITE, SITE_ID);
|
return MessageFormat.format(GET_ROLES_URL_BY_SITE, siteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getRoleUrlByFilePlan()
|
private String getRoleUrlByFilePlan()
|
||||||
|
Reference in New Issue
Block a user