As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
String newParentDir = "/app:company_home/cm:divisionB"; ParentReference folderParentRef = new ParentReference(); folderParentRef.setStore(storeRef); folderParentRef.setPath(newParentDir); folderParentRef.setAssociationType(Constants.ASSOC_CONTAINS); // create ref to current dir String currentDir = "/app:company_home/cm:divisionA/cm:productDetails"; Reference curr = new Reference(); curr.setStore(storeRef); curr.setPath(currentDir); CMLMove move = new CMLMove(); move.setAssociationType(Constants.ASSOC_CONTAINS); move.setChildName("productDetails"); move.setTo(folderParentRef); move.setWhere(new Predicate(new Reference[]{curr}, null, null)); CML cml = new CML(); cml.setMove(new CMLMove[]{move}); WebServiceFactory.getRepositoryService().update(cml);
private static Store WORKSPACE_STORE = new Store(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); public static void main(String[] args) throws RepositoryFault, RemoteException { … alfSoap.startSession(); // Start session Reference refA = new Reference(WORKSPACE_STORE, null, "/app:company_home/cm:divisionB"); // Where to move Reference refB = new Reference(WORKSPACE_STORE, null, "/app:company_home/cm:divisionA/cm:productDetails"); // What to move try { // Move UpdateResult[] results = alfSoap.moveNode(refA, refB, "productDetails"); // important to send wanted nodeName because the new node will have path refA.getPath + "cm:/" + nodeName // Return to original location refA = new Reference(WORKSPACE_STORE, null, "/app:company_home/cm:divisionA"); // Where to move refB = new Reference(WORKSPACE_STORE, null, "/app:company_home/cm:divisionB/cm:productDetails"); // What to move results = moveNode(refA, refB, "productDetails"); // important to send wanted nodeName because the new node will have path refA.getPath + "cm:/" + nodeName } finally { // End session alfSoap.endSession(); } } public UpdateResult[] moveNode(Reference toReference, Reference whatReference, String nodeName) throws RepositoryFault, RemoteException { ParentReference toParentReference = referenceToParent(toReference); toParentReference.setChildName(Constants.createQNameString(Constants.NAMESPACE_CONTENT_MODEL, nodeName)); // Should be the same as whatReference nodeName CMLMove move = new CMLMove(); move.setTo(toParentReference); move.setWhere(new Predicate(new Reference[] { whatReference }, WORKSPACE_STORE, null)); CML cml = new CML(); cml.setMove(new CMLMove[] { move }); return getRepositoryService().update(cml); } private ParentReference referenceToParent(Reference spaceReference) { ParentReference parent = new ParentReference(); parent.setStore(WORKSPACE_STORE); parent.setPath(spaceReference.getPath()); parent.setUuid(spaceReference.getUuid()); parent.setAssociationType(Constants.ASSOC_CONTAINS); return parent; }