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.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.hold.name=Hold
|
@@ -84,6 +84,7 @@
|
||||
|
||||
<title>File Plan</title>
|
||||
<parent>rma:recordsManagementContainer</parent>
|
||||
|
||||
<mandatory-aspects>
|
||||
<aspect>rma:recordsManagementRoot</aspect>
|
||||
</mandatory-aspects>
|
||||
@@ -95,6 +96,22 @@
|
||||
<parent>rma:recordsManagementContainer</parent>
|
||||
</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 -->
|
||||
|
||||
<type name="rma:dispositionSchedule">
|
||||
@@ -597,6 +614,7 @@
|
||||
<title>Records Management Root</title>
|
||||
<associations>
|
||||
|
||||
<!-- @deprecated as of 2.1 -->
|
||||
<child-association name="rma:holds">
|
||||
<title>Holds</title>
|
||||
<source>
|
||||
@@ -610,7 +628,7 @@
|
||||
</target>
|
||||
</child-association>
|
||||
|
||||
|
||||
<!-- @deprecated as of 2.1 -->
|
||||
<child-association name="rma:transfers">
|
||||
<title>Transfers</title>
|
||||
<source>
|
||||
@@ -625,9 +643,6 @@
|
||||
</child-association>
|
||||
|
||||
</associations>
|
||||
<mandatory-aspects>
|
||||
<aspect>rma:filePlanComponent</aspect>
|
||||
</mandatory-aspects>
|
||||
</aspect>
|
||||
|
||||
<aspect name="rma:declaredRecord">
|
||||
@@ -1198,6 +1213,19 @@
|
||||
</properties>
|
||||
</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>
|
||||
|
||||
</model>
|
@@ -32,4 +32,16 @@
|
||||
<property name="typeAsString" value="{http://www.alfresco.org/model/recordsmanagement/1.0}record"/>
|
||||
</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>
|
@@ -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.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.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.getNodeRefPath=RM.Read.0
|
||||
org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.isFilePlanContainer=RM_ALLOW
|
||||
|
@@ -232,6 +232,7 @@
|
||||
<property name="permissionService" ref="PermissionService" />
|
||||
<property name="mimetypeService" ref="mimetypeService" />
|
||||
<property name="exporterService" ref="ExporterService" />
|
||||
<property name="filePlanService" ref="FilePlanService" />
|
||||
</bean>
|
||||
|
||||
<!-- REST impl for GET transfer -->
|
||||
|
@@ -28,8 +28,12 @@ function doclist_getAllNodes(parsedArgs, filterParams, query, totalItemCount)
|
||||
requestTotalCountMax = 0,
|
||||
paged = false,
|
||||
allNodes = [];
|
||||
if ((filter || "path") == "path" ||
|
||||
(filter || "unfiledRecords") == "unfiledRecords")
|
||||
if (query == "" &&
|
||||
(
|
||||
(filter || "path") == "path" ||
|
||||
(filter || "unfiledRecords") == "unfiledRecords" ||
|
||||
(filter || "holds") == "holds" ||
|
||||
(filter || "transfers") == "transfers"))
|
||||
{
|
||||
// TODO also add DB filter by "node" (in addition to "path")
|
||||
var parentNode = parsedArgs.pathNode;
|
||||
|
@@ -37,8 +37,8 @@ Filters.IGNORED_TYPES =
|
||||
"rma:dispositionSchedule",
|
||||
"rma:dispositionActionDefinition",
|
||||
"rma:dispositionAction",
|
||||
"rma:hold",
|
||||
"rma:transfer",
|
||||
"rma:holdContainer",
|
||||
"rma:transferContainer",
|
||||
"rma:unfiledRecordContainer"
|
||||
];
|
||||
|
||||
@@ -154,11 +154,7 @@ Filters.getFilterParams = function RecordsManagementFilter_getFilterParams(filte
|
||||
case "transfers":
|
||||
if (filterData == null)
|
||||
{
|
||||
filterParams.variablePath = false;
|
||||
filterQuery = "+PATH:\"" + parsedArgs.rootNode.qnamePath + "//*\"";
|
||||
filterQuery += " +TYPE:\"rma:transfer\"";
|
||||
filterParams.query = filterQuery;
|
||||
filterParams.ignoreTypes = "";
|
||||
filterParams.query = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -169,11 +165,7 @@ Filters.getFilterParams = function RecordsManagementFilter_getFilterParams(filte
|
||||
case "holds":
|
||||
if (filterData == null)
|
||||
{
|
||||
filterParams.variablePath = false;
|
||||
filterQuery = "+PATH:\"" + parsedArgs.rootNode.qnamePath + "//*\"";
|
||||
filterQuery += " +TYPE:\"rma:hold\"";
|
||||
filterParams.query = filterQuery;
|
||||
filterParams.ignoreTypes = "";
|
||||
filterParams.query = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -91,6 +91,16 @@ ParseArgs.getParsedArgs = function RecordsManagementFilter_getParsedArgs(contain
|
||||
var unfiledRecordContainer = rootNode.childrenByXPath("rma:Unfiled_x0020_Records");
|
||||
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
|
||||
{
|
||||
// Path input?
|
||||
|
@@ -121,7 +121,7 @@ function itemIsAllowed(item)
|
||||
var typeShort = String(item.typeShort);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
@@ -142,8 +142,9 @@ public class TransferAction extends RMDispositionActionExecuterAbstractBase
|
||||
}
|
||||
}
|
||||
|
||||
transferNodeRef = this.nodeService.createNode(root,
|
||||
ASSOC_TRANSFERS,
|
||||
NodeRef transferContainer = filePlanService.getTransferContainer(root);
|
||||
transferNodeRef = this.nodeService.createNode(transferContainer,
|
||||
ContentModel.ASSOC_CONTAINS,
|
||||
QName.createQName(RM_URI, transferName),
|
||||
TYPE_TRANSFER,
|
||||
transferProps).getChildRef();
|
||||
|
@@ -139,6 +139,34 @@ public interface FilePlanService
|
||||
*/
|
||||
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
|
||||
* 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_EXPECTED = "rm.service.container-expected";
|
||||
|
||||
/** Unfiled record container name */
|
||||
/** File plan containers */
|
||||
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 */
|
||||
private static final String FILE_PLAN_CONTAINER = "documentLibrary";
|
||||
@@ -392,20 +393,49 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
|
||||
*/
|
||||
@Override
|
||||
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);
|
||||
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;
|
||||
|
||||
// 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)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Unable to get unfiled conatiner.");
|
||||
throw new AlfrescoRuntimeException("Unable to get unfiled conatiner " + containerName + ".");
|
||||
}
|
||||
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)
|
||||
*/
|
||||
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);
|
||||
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);
|
||||
|
||||
// create the properties map
|
||||
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
|
||||
NodeRef container = nodeService.createNode(
|
||||
filePlan,
|
||||
ContentModel.ASSOC_CONTAINS,
|
||||
QNAME_UNFILED_CONTAINER,
|
||||
TYPE_UNFILED_RECORD_CONTAINER,
|
||||
QName.createQName(RM_URI, containerName),
|
||||
containerType,
|
||||
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!!!
|
||||
// TODO we will need to be able to get a list of the admin roles from the service
|
||||
if (inheritPermissions == false)
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
|
@@ -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.record.RecordService;
|
||||
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.policy.Behaviour.NotificationFrequency;
|
||||
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.permissions.AccessDeniedException;
|
||||
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.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
@@ -63,7 +61,8 @@ import org.springframework.extensions.surf.util.I18NUtil;
|
||||
* @author Tuna Aksoy
|
||||
* @since 2.1
|
||||
*/
|
||||
public class FreezeServiceImpl implements FreezeService,
|
||||
public class FreezeServiceImpl extends ServiceBaseImpl
|
||||
implements FreezeService,
|
||||
RecordsManagementModel,
|
||||
NodeServicePolicies.BeforeDeleteNodePolicy
|
||||
{
|
||||
@@ -72,33 +71,28 @@ public class FreezeServiceImpl implements FreezeService,
|
||||
|
||||
/** I18N */
|
||||
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 */
|
||||
private static final String KEY_HOLD_NODEREF = "holdNodeRef";
|
||||
|
||||
/** Policy Component */
|
||||
private PolicyComponent policyComponent;
|
||||
|
||||
/** Node Service */
|
||||
private NodeService nodeService;
|
||||
protected PolicyComponent policyComponent;
|
||||
|
||||
/** Records Management Service */
|
||||
private RecordsManagementService recordsManagementService;
|
||||
|
||||
/** Dictionary Service */
|
||||
private DictionaryService dictionaryService;
|
||||
protected RecordsManagementService recordsManagementService;
|
||||
|
||||
/** Record service */
|
||||
private RecordService recordService;
|
||||
protected RecordService recordService;
|
||||
|
||||
/** File Plan Service */
|
||||
private FilePlanService filePlanService;
|
||||
protected FilePlanService filePlanService;
|
||||
|
||||
/** Permission service */
|
||||
private PermissionService permissionService;
|
||||
protected PermissionService permissionService;
|
||||
|
||||
/** file plan role service */
|
||||
private FilePlanRoleService filePlanRoleService;
|
||||
protected FilePlanRoleService filePlanRoleService;
|
||||
|
||||
/**
|
||||
* @param policyComponent policy component
|
||||
@@ -108,14 +102,6 @@ public class FreezeServiceImpl implements FreezeService,
|
||||
this.policyComponent = policyComponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nodeService node service
|
||||
*/
|
||||
public void setNodeService(NodeService nodeService)
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recordsManagementService records management service
|
||||
*/
|
||||
@@ -124,14 +110,6 @@ public class FreezeServiceImpl implements FreezeService,
|
||||
this.recordsManagementService = recordsManagementService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dictionaryService dictionary service
|
||||
*/
|
||||
public void setDictionaryService(DictionaryService dictionaryService)
|
||||
{
|
||||
this.dictionaryService = dictionaryService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recordService record service
|
||||
*/
|
||||
@@ -534,9 +512,8 @@ public class FreezeServiceImpl implements FreezeService,
|
||||
ParameterCheck.mandatory("filePlan", filePlan);
|
||||
|
||||
Set<NodeRef> holds = new HashSet<NodeRef>();
|
||||
|
||||
List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(filePlan, ASSOC_HOLDS,
|
||||
RegexQNamePattern.MATCH_ALL);
|
||||
NodeRef holdContainer = filePlanService.getHoldContainer(filePlan);
|
||||
List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(holdContainer, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
|
||||
if (childAssocs != null && !childAssocs.isEmpty())
|
||||
{
|
||||
for (ChildAssociationRef childAssoc : childAssocs)
|
||||
@@ -618,26 +595,27 @@ public class FreezeServiceImpl implements FreezeService,
|
||||
{
|
||||
NodeRef holdNodeRef = null;
|
||||
|
||||
// Calculate a transfer name
|
||||
QName nodeDbid = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "node-dbid");
|
||||
Long dbId = (Long) nodeService.getProperty(nodeRef, nodeDbid);
|
||||
String transferName = StringUtils.leftPad(dbId.toString(), 10, "0");
|
||||
// get the hold container
|
||||
NodeRef root = filePlanService.getFilePlan(nodeRef);
|
||||
NodeRef holdContainer = filePlanService.getHoldContainer(root);
|
||||
|
||||
// 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
|
||||
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);
|
||||
|
||||
// Get the root rm node and create the hold object
|
||||
NodeRef root = filePlanService.getFilePlan(nodeRef);
|
||||
QName transferQName = QName.createQName(RM_URI, transferName);
|
||||
holdNodeRef = nodeService.createNode(root, ASSOC_HOLDS, transferQName, TYPE_HOLD, holdProps).getChildRef();
|
||||
// create the hold object
|
||||
QName holdQName = QName.createQName(RM_URI, holdName);
|
||||
holdNodeRef = nodeService.createNode(holdContainer, ContentModel.ASSOC_CONTAINS, holdQName, TYPE_HOLD, holdProps).getChildRef();
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
StringBuilder msg = new StringBuilder();
|
||||
msg.append("Created hold object '").append(holdNodeRef).append("' with transfer name '").append(
|
||||
transferQName).append("'.");
|
||||
msg.append("Created hold object '").append(holdNodeRef).append("' with name '").append(holdQName).append("'.");
|
||||
logger.debug(msg.toString());
|
||||
}
|
||||
|
||||
|
@@ -60,6 +60,12 @@ public interface RecordsManagementModel extends RecordsManagementCustomModel
|
||||
// Unfiled record container
|
||||
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
|
||||
public static final QName ASPECT_SCHEDULED = QName.createQName(RM_URI, "scheduled");
|
||||
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
|
||||
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");
|
||||
|
||||
// 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_DATE = QName.createQName(RM_URI, "recordRejectionDate");
|
||||
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
|
||||
final NodeRef child = childAssocRef.getChildRef();
|
||||
QName childType = nodeService.getType(child);
|
||||
|
||||
// We only care about "folder" or sub-types
|
||||
if (dictionaryService.isSubClass(childType, ContentModel.TYPE_FOLDER) == true)
|
||||
if (nodeService.exists(child) == 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
|
||||
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)
|
||||
if (dictionaryService.isSubClass(childType, ContentModel.TYPE_SYSTEM_FOLDER) == true)
|
||||
{
|
||||
// TODO it may not always be a record folder ... perhaps if the current user is a admin it would be a record category??
|
||||
|
||||
// Assume any created folder is a rma:recordFolder
|
||||
nodeService.setType(child, TYPE_RECORD_FOLDER);
|
||||
// this is a rule container, make sure it is an file plan component
|
||||
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??
|
||||
|
||||
// Catch all to generate the rm id (assuming it doesn't already have one!)
|
||||
setIdenifierProperty(child);
|
||||
// Assume any created folder is a rma:recordFolder
|
||||
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, ExtendedWriterDynamicAuthority.EXTENDED_WRITER, RMPermissionModel.FILING);
|
||||
|
||||
// create unfiled container
|
||||
// create fileplan containers
|
||||
filePlanService.createHoldContainer(filePlan);
|
||||
filePlanService.createTransferContainer(filePlan);
|
||||
filePlanService.createUnfiledContainer(filePlan);
|
||||
|
||||
// move any existing holds to new container
|
||||
// TODO
|
||||
|
||||
// move any existing transfers to new container
|
||||
// TODO
|
||||
|
||||
// add the inplace roles
|
||||
filePlanRoleService.createRole(filePlan, ROLE_READERS, ROLE_READERS_LABEL, getCapabilities(ROLE_READERS_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, 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
|
||||
return filePlanService.createUnfiledContainer(rmRootNode);
|
||||
}
|
||||
@@ -310,7 +315,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
||||
* @param rmRootNode
|
||||
* @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>()
|
||||
{
|
||||
@@ -344,9 +349,9 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
||||
if (object.has("name") == true)
|
||||
{
|
||||
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
|
||||
@@ -387,13 +392,13 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
||||
}
|
||||
|
||||
// Create the role
|
||||
Role role = createRole(rmRootNode, name, displayLabel, capabilities);
|
||||
Role role = createRole(filePlan, name, displayLabel, capabilities);
|
||||
|
||||
// Add any additional admin permissions
|
||||
if (isAdmin == true)
|
||||
{
|
||||
// Admin has filing
|
||||
permissionService.setPermission(rmRootNode, role.getRoleGroupName(), RMPermissionModel.FILING, true);
|
||||
permissionService.setPermission(filePlan, role.getRoleGroupName(), RMPermissionModel.FILING, true);
|
||||
if (unfiledContainer != null)
|
||||
{
|
||||
permissionService.setPermission(unfiledContainer, role.getRoleGroupName(), RMPermissionModel.FILING, true);
|
||||
|
@@ -26,6 +26,8 @@ import java.util.Map;
|
||||
|
||||
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.repo.web.scripts.content.StreamACP;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
@@ -50,6 +52,13 @@ public abstract class BaseTransferWebScript extends StreamACP
|
||||
/** Logger */
|
||||
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)
|
||||
*/
|
||||
@@ -167,8 +176,10 @@ public abstract class BaseTransferWebScript extends StreamACP
|
||||
NodeRef transferNode = null;
|
||||
|
||||
// get all the transfer nodes and find the one we need
|
||||
List<ChildAssociationRef> assocs = this.nodeService.getChildAssocs(filePlan,
|
||||
RecordsManagementModel.ASSOC_TRANSFERS, RegexQNamePattern.MATCH_ALL);
|
||||
NodeRef transferContainer = filePlanService.getTransferContainer(filePlan);
|
||||
List<ChildAssociationRef> assocs = this.nodeService.getChildAssocs(transferContainer,
|
||||
ContentModel.ASSOC_CONTAINS,
|
||||
RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef child : assocs)
|
||||
{
|
||||
if (child.getChildRef().getId().equals(transferId))
|
||||
|
@@ -454,19 +454,25 @@ public class FilePlanPermissionServiceImpl implements FilePlanPermissionService,
|
||||
*/
|
||||
private void setPermissionDown(NodeRef nodeRef, String authority, String permission)
|
||||
{
|
||||
setPermissionImpl(nodeRef, authority, permission);
|
||||
if (filePlanService.isFilePlanContainer(nodeRef) == true ||
|
||||
recordsManagementService.isRecordFolder(nodeRef) == true)
|
||||
// skip out node's that inherit (for example hold and transfer)
|
||||
if (permissionService.getInheritParentPermissions(nodeRef) == false)
|
||||
{
|
||||
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef assoc : assocs)
|
||||
// set permissions
|
||||
setPermissionImpl(nodeRef, authority, permission);
|
||||
|
||||
if (filePlanService.isFilePlanContainer(nodeRef) == true ||
|
||||
recordsManagementService.isRecordFolder(nodeRef) == true)
|
||||
{
|
||||
NodeRef child = assoc.getChildRef();
|
||||
if (filePlanService.isFilePlanContainer(child) == true ||
|
||||
recordsManagementService.isRecordFolder(child) == true ||
|
||||
recordService.isRecord(child) == true)
|
||||
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef assoc : assocs)
|
||||
{
|
||||
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
|
||||
{
|
||||
// Delete permission on this node
|
||||
permissionService.deletePermission(nodeRef, authority, permission);
|
||||
|
||||
if (filePlanService.isFilePlanContainer(nodeRef) == true ||
|
||||
recordsManagementService.isRecordFolder(nodeRef) == true)
|
||||
// can't delete permissions if inherited (eg hold and transfer containers)
|
||||
if (permissionService.getInheritParentPermissions(nodeRef) == false)
|
||||
{
|
||||
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef assoc : assocs)
|
||||
// Delete permission on this node
|
||||
permissionService.deletePermission(nodeRef, authority, permission);
|
||||
|
||||
if (filePlanService.isFilePlanContainer(nodeRef) == true ||
|
||||
recordsManagementService.isRecordFolder(nodeRef) == true)
|
||||
{
|
||||
NodeRef child = assoc.getChildRef();
|
||||
if (filePlanService.isFilePlanContainer(child) == true ||
|
||||
recordsManagementService.isRecordFolder(child) == true ||
|
||||
recordService.isRecord(child) == true)
|
||||
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef assoc : assocs)
|
||||
{
|
||||
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;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
import org.alfresco.util.PropertyMap;
|
||||
|
||||
/**
|
||||
* Helper base class for service implementations.
|
||||
@@ -30,7 +32,7 @@ import org.alfresco.util.ParameterCheck;
|
||||
* @author Roy Wetherall
|
||||
* @since 2.1
|
||||
*/
|
||||
public class ServiceBaseImpl
|
||||
public class ServiceBaseImpl implements RecordsManagementModel
|
||||
{
|
||||
/** Node service */
|
||||
protected NodeService nodeService;
|
||||
@@ -74,4 +76,39 @@ public class ServiceBaseImpl
|
||||
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
|
||||
{
|
||||
assertEquals(filePlan, filePlanService.getFilePlanBySiteId(SITE_ID));
|
||||
assertEquals(filePlan, filePlanService.getFilePlanBySiteId(siteId));
|
||||
assertNull(filePlanService.getFilePlanBySiteId("rubbish"));
|
||||
|
||||
String siteId = GUID.generate();
|
||||
|
@@ -84,7 +84,7 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
TestWithUserUtils.createUser(USER2, USER2, rootNodeRef, nodeService, authenticationService);
|
||||
|
||||
// Count the number of pre-defined reports
|
||||
List<SavedSearchDetails> searches = rmSearchService.getSavedSearches(SITE_ID);
|
||||
List<SavedSearchDetails> searches = rmSearchService.getSavedSearches(siteId);
|
||||
assertNotNull(searches);
|
||||
numberOfReports = searches.size();
|
||||
|
||||
@@ -151,7 +151,7 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
String query = "keywords:\"elephant\"";
|
||||
RecordsManagementSearchParameters params = new RecordsManagementSearchParameters();
|
||||
params.setIncludeUndeclaredRecords(true);
|
||||
List<NodeRef> results = rmSearchService.search(SITE_ID, query, params);
|
||||
List<NodeRef> results = rmSearchService.search(siteId, query, params);
|
||||
assertNotNull(results);
|
||||
assertEquals(2, results.size());
|
||||
|
||||
@@ -172,10 +172,10 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
@Override
|
||||
public Void run()
|
||||
{
|
||||
SavedSearchDetails details1 = rmSearchService.saveSearch(SITE_ID, SEARCH1, "description1", "query1", new RecordsManagementSearchParameters(), true);
|
||||
checkSearchDetails(details1, "mySite", "search1", "description1", "query1", new RecordsManagementSearchParameters(), true);
|
||||
SavedSearchDetails details2 = rmSearchService.saveSearch(SITE_ID, SEARCH2, "description2", "query2", new RecordsManagementSearchParameters(), false);
|
||||
checkSearchDetails(details2, "mySite", "search2", "description2", "query2", new RecordsManagementSearchParameters(), false);
|
||||
SavedSearchDetails details1 = rmSearchService.saveSearch(siteId, SEARCH1, "description1", "query1", new RecordsManagementSearchParameters(), true);
|
||||
checkSearchDetails(details1, siteId, "search1", "description1", "query1", new RecordsManagementSearchParameters(), true);
|
||||
SavedSearchDetails details2 = rmSearchService.saveSearch(siteId, SEARCH2, "description2", "query2", new RecordsManagementSearchParameters(), false);
|
||||
checkSearchDetails(details2, siteId, "search2", "description2", "query2", new RecordsManagementSearchParameters(), false);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -188,10 +188,10 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
@Override
|
||||
public Void run()
|
||||
{
|
||||
SavedSearchDetails details1 = rmSearchService.saveSearch(SITE_ID, SEARCH3, "description3", "query3", new RecordsManagementSearchParameters(), false);
|
||||
checkSearchDetails(details1, "mySite", SEARCH3, "description3", "query3", new RecordsManagementSearchParameters(), false);
|
||||
SavedSearchDetails details2 = rmSearchService.saveSearch(SITE_ID, SEARCH4, "description4", "query4", new RecordsManagementSearchParameters(), false);
|
||||
checkSearchDetails(details2, "mySite", SEARCH4, "description4", "query4", new RecordsManagementSearchParameters(), false);
|
||||
SavedSearchDetails details1 = rmSearchService.saveSearch(siteId, SEARCH3, "description3", "query3", new RecordsManagementSearchParameters(), false);
|
||||
checkSearchDetails(details1, siteId, SEARCH3, "description3", "query3", new RecordsManagementSearchParameters(), false);
|
||||
SavedSearchDetails details2 = rmSearchService.saveSearch(siteId, SEARCH4, "description4", "query4", new RecordsManagementSearchParameters(), false);
|
||||
checkSearchDetails(details2, siteId, SEARCH4, "description4", "query4", new RecordsManagementSearchParameters(), false);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -204,22 +204,22 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
@Override
|
||||
public Void run()
|
||||
{
|
||||
List<SavedSearchDetails> searches = rmSearchService.getSavedSearches(SITE_ID);
|
||||
List<SavedSearchDetails> searches = rmSearchService.getSavedSearches(siteId);
|
||||
assertNotNull(searches);
|
||||
assertEquals(numberOfReports + 2, searches.size());
|
||||
|
||||
SavedSearchDetails search1 = rmSearchService.getSavedSearch(SITE_ID, SEARCH1);
|
||||
SavedSearchDetails search1 = rmSearchService.getSavedSearch(siteId, 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);
|
||||
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);
|
||||
|
||||
SavedSearchDetails search4 = rmSearchService.getSavedSearch(SITE_ID, SEARCH4);
|
||||
SavedSearchDetails search4 = rmSearchService.getSavedSearch(siteId, SEARCH4);
|
||||
assertNull(search4);
|
||||
|
||||
return null;
|
||||
@@ -233,24 +233,24 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
@Override
|
||||
public Void run()
|
||||
{
|
||||
List<SavedSearchDetails> searches = rmSearchService.getSavedSearches(SITE_ID);
|
||||
List<SavedSearchDetails> searches = rmSearchService.getSavedSearches(siteId);
|
||||
assertNotNull(searches);
|
||||
assertEquals(numberOfReports + 3, searches.size());
|
||||
|
||||
SavedSearchDetails search1 = rmSearchService.getSavedSearch(SITE_ID, SEARCH1);
|
||||
SavedSearchDetails search1 = rmSearchService.getSavedSearch(siteId, 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);
|
||||
|
||||
SavedSearchDetails search3 = rmSearchService.getSavedSearch(SITE_ID, SEARCH3);
|
||||
SavedSearchDetails search3 = rmSearchService.getSavedSearch(siteId, 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);
|
||||
checkSearchDetails(search4, "mySite", "search4", "description4", "query4", new RecordsManagementSearchParameters(), false);
|
||||
checkSearchDetails(search4, siteId, "search4", "description4", "query4", new RecordsManagementSearchParameters(), false);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -263,15 +263,15 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
@Override
|
||||
public Void run()
|
||||
{
|
||||
SavedSearchDetails search1 = rmSearchService.getSavedSearch(SITE_ID, SEARCH1);
|
||||
SavedSearchDetails search1 = rmSearchService.getSavedSearch(siteId, 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);
|
||||
checkSearchDetails(search1, SITE_ID, SEARCH1, "change", "change", new RecordsManagementSearchParameters(), true);
|
||||
checkSearchDetails(search1, siteId, SEARCH1, "change", "change", new RecordsManagementSearchParameters(), true);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@@ -96,7 +96,6 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
||||
protected QName ASPECT_RECORD_META_DATA = QName.createQName(URI, "recordMetaData");
|
||||
|
||||
/** site id's */
|
||||
protected static final String SITE_ID = "mySite";
|
||||
protected static final String COLLABORATION_SITE_ID = "collab-site-id";
|
||||
|
||||
/** Common test utils */
|
||||
@@ -140,6 +139,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
||||
protected FilePlanAuthenticationService filePlanAuthenticationService;
|
||||
|
||||
/** test data */
|
||||
protected String siteId;
|
||||
protected StoreRef storeRef;
|
||||
protected NodeRef rootNodeRef;
|
||||
protected SiteInfo siteInfo;
|
||||
@@ -404,7 +404,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
||||
nodeService.deleteNode(folder);
|
||||
|
||||
// Delete the site
|
||||
siteService.deleteSite(SITE_ID);
|
||||
siteService.deleteSite(siteId);
|
||||
|
||||
// delete the collaboration site (if required)
|
||||
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.ADD_CHILDREN, true);
|
||||
|
||||
siteId = GUID.generate();
|
||||
siteInfo = siteService.createSite(
|
||||
"rm-site-dashboard",
|
||||
SITE_ID,
|
||||
siteId,
|
||||
"title",
|
||||
"descrition",
|
||||
SiteVisibility.PUBLIC,
|
||||
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);
|
||||
|
||||
// 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.QName;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.alfresco.util.PropertyMap;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
@@ -70,8 +71,6 @@ import org.springframework.context.ApplicationContext;
|
||||
*/
|
||||
public class BaseRMWebScriptTestCase extends BaseWebScriptTest
|
||||
{
|
||||
/** Site id */
|
||||
protected static final String SITE_ID = "mySite";
|
||||
/** Collab site id */
|
||||
protected static final String COLLAB_SITE_ID = "myCollabSite";
|
||||
|
||||
@@ -111,6 +110,7 @@ public class BaseRMWebScriptTestCase extends BaseWebScriptTest
|
||||
protected FilePlanService filePlanService;
|
||||
|
||||
/** test data */
|
||||
protected String siteId;
|
||||
protected StoreRef storeRef;
|
||||
protected NodeRef rootNodeRef;
|
||||
protected SiteInfo siteInfo;
|
||||
@@ -214,7 +214,7 @@ public class BaseRMWebScriptTestCase extends BaseWebScriptTest
|
||||
nodeService.deleteNode(folder);
|
||||
|
||||
// Delete the site
|
||||
siteService.deleteSite(SITE_ID);
|
||||
siteService.deleteSite(siteId);
|
||||
|
||||
// Delete the collaboration site (if required)
|
||||
if (isCollaborationSiteTest() == true)
|
||||
@@ -275,8 +275,9 @@ public class BaseRMWebScriptTestCase extends BaseWebScriptTest
|
||||
assertNotNull("Could not create base folder", folder);
|
||||
|
||||
// Create the site
|
||||
siteInfo = siteService.createSite("rm-site-dashboard", SITE_ID, "title", "descrition", SiteVisibility.PUBLIC, RecordsManagementModel.TYPE_RM_SITE);
|
||||
filePlan = siteService.getContainer(SITE_ID, RmSiteType.COMPONENT_DOCUMENT_LIBRARY);
|
||||
siteId = GUID.generate();
|
||||
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);
|
||||
|
||||
recordSeries = filePlanService.createRecordCategory(filePlan, "recordSeries");
|
||||
|
@@ -31,7 +31,7 @@ public class DataSetRestApiTest extends BaseRMWebScriptTestCase
|
||||
/** Test GET */
|
||||
|
||||
// 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);
|
||||
|
||||
// Check the content from the response
|
||||
|
@@ -59,7 +59,7 @@ public class RmClassesRestApiTest extends BaseRMWebScriptTestCase
|
||||
public void testRmGetAspectDefinitions() throws IOException, JSONException
|
||||
{
|
||||
// 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);
|
||||
|
||||
// Check the content from the response
|
||||
|
@@ -59,7 +59,7 @@ public class RmPropertiesRestApiTest extends BaseRMWebScriptTestCase
|
||||
public void testRmGetTypeDefinitions() throws IOException, JSONException
|
||||
{
|
||||
// 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);
|
||||
|
||||
// Check the content from the response
|
||||
|
@@ -52,7 +52,7 @@ public class RoleRestApiTest extends BaseRMWebScriptTestCase
|
||||
|
||||
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()
|
||||
|
Reference in New Issue
Block a user