use of org.alfresco.service.cmr.repository.ChildAssociationRef in project records-management by Alfresco.
the class RM3993Test method createFile.
private NodeRef createFile(NodeRef parentNodeRef, String name, String descrption, QName typeQName) {
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(11);
properties.put(ContentModel.PROP_NAME, (Serializable) name);
properties.put(ContentModel.PROP_DESCRIPTION, (Serializable) descrption);
QName assocQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName(name));
ChildAssociationRef assocRef = nodeService.createNode(parentNodeRef, ContentModel.ASSOC_CONTAINS, assocQName, typeQName, properties);
NodeRef nodeRef = assocRef.getChildRef();
return nodeRef;
}
use of org.alfresco.service.cmr.repository.ChildAssociationRef in project records-management by Alfresco.
the class RM4163Test method createFile.
private NodeRef createFile(NodeRef parentNodeRef, String name, String descrption, QName typeQName) {
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(11);
properties.put(ContentModel.PROP_NAME, (Serializable) name);
properties.put(ContentModel.PROP_DESCRIPTION, (Serializable) descrption);
QName assocQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName(name));
ChildAssociationRef assocRef = nodeService.createNode(parentNodeRef, ContentModel.ASSOC_CONTAINS, assocQName, typeQName, properties);
NodeRef nodeRef = assocRef.getChildRef();
return nodeRef;
}
use of org.alfresco.service.cmr.repository.ChildAssociationRef in project records-management by Alfresco.
the class RMv21InPlacePatch method moveExistingTransfers.
private void moveExistingTransfers(NodeRef filePlan) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(" ... moving existing transfers for file plan " + filePlan.toString());
}
NodeRef container = filePlanService.getTransferContainer(filePlan);
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(filePlan, ASSOC_TRANSFERS, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef assoc : assocs) {
NodeRef transfer = assoc.getChildRef();
String name = (String) nodeService.getProperty(transfer, ContentModel.PROP_NAME);
nodeService.moveNode(transfer, container, ContentModel.ASSOC_CONTAINS, QName.createQName(RM_URI, name));
}
}
use of org.alfresco.service.cmr.repository.ChildAssociationRef in project records-management by Alfresco.
the class RMv21InPlacePatch method moveExistingHolds.
private void moveExistingHolds(NodeRef filePlan) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(" ... moving existing holds for file plan " + filePlan.toString());
}
NodeRef container = filePlanService.getHoldContainer(filePlan);
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(filePlan, ASSOC_HOLDS, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef assoc : assocs) {
NodeRef hold = assoc.getChildRef();
String name = (String) nodeService.getProperty(hold, ContentModel.PROP_NAME);
nodeService.moveNode(hold, container, ContentModel.ASSOC_CONTAINS, QName.createQName(RM_URI, name));
}
}
use of org.alfresco.service.cmr.repository.ChildAssociationRef in project records-management by Alfresco.
the class TransferEvaluator method getTransferNodeRef.
/**
* Helper method to get the transfer node reference.
* <p>
* Takes into account records in tranferred record folders.
*
* @param nodeRef node reference
* @return {@link NodeRef} transfer node
*/
private NodeRef getTransferNodeRef(NodeRef nodeRef) {
NodeRef result = null;
List<ChildAssociationRef> parents = nodeService.getParentAssocs(nodeRef, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL);
if (parents.size() == 1) {
result = parents.get(0).getParentRef();
} else {
if (recordService.isRecord(nodeRef)) {
for (NodeRef recordFolder : recordFolderService.getRecordFolders(nodeRef)) {
result = getTransferNodeRef(recordFolder);
if (result != null) {
break;
}
}
}
}
return result;
}
Aggregations