/** * Cancel the check-out of a working copy document. The working copy will be deleted and any changes made to it * are lost. Note that this method can only be called on a working copy Node. The reference to this working copy * Node should be discarded. * * @return the original Node that was checked out. */ public ScriptNode cancelCheckout() { NodeRef original = this.services.getCheckOutCheckInService().cancelCheckout(this.nodeRef); return newInstance(original, this.services, this.scope); }
/** * Check-in a working copy document. The current state of the working copy is copied to the original node, * this will include any content updated in the working node. Note that this method can only be called on a * working copy Node. * * @param history Version history note * @param majorVersion True to save as a major version increment, false for minor version. * * @return the original Node that was checked out. */ public ScriptNode checkin(String history, boolean majorVersion) { Map<String, Serializable> props = new HashMap<String, Serializable>(2, 1.0f); props.put(Version.PROP_DESCRIPTION, history); props.put(VersionModel.PROP_VERSION_TYPE, majorVersion ? VersionType.MAJOR : VersionType.MINOR); NodeRef original = this.services.getCheckOutCheckInService().checkin(this.nodeRef, props); this.versions = null; return newInstance(original, this.services, this.scope); }
/** * Check-in a working copy document. The current state of the working copy is copied to the original node, * this will include any content updated in the working node. Note that this method can only be called on a * working copy Node. * * @param history Version history note * @param majorVersion True to save as a major version increment, false for minor version. * * @return the original Node that was checked out. */ public ScriptNode checkin(String history, boolean majorVersion) { Map<String, Serializable> props = new HashMap<String, Serializable>(2, 1.0f); props.put(Version.PROP_DESCRIPTION, history); props.put(VersionModel.PROP_VERSION_TYPE, majorVersion ? VersionType.MAJOR : VersionType.MINOR); NodeRef original = this.services.getCheckOutCheckInService().checkin(this.nodeRef, props); this.versions = null; return newInstance(original, this.services, this.scope); }
/** * Cancel the check-out of a working copy document. The working copy will be deleted and any changes made to it * are lost. Note that this method can only be called on a working copy Node. The reference to this working copy * Node should be discarded. * * @return the original Node that was checked out. */ public ScriptNode cancelCheckout() { NodeRef original = this.services.getCheckOutCheckInService().cancelCheckout(this.nodeRef); return newInstance(original, this.services, this.scope); }
/** * Perform a check-out of this document into the current parent space. * * @return the working copy Node for the checked out document */ public ScriptNode checkout() { NodeRef workingCopyRef = this.services.getCheckOutCheckInService().checkout(this.nodeRef); ScriptNode workingCopy = newInstance(workingCopyRef, this.services, this.scope); // reset the aspect and properties as checking out a document causes changes this.properties = null; this.aspects = null; return workingCopy; }
/** * Perform a check-out of this document into the current parent space. * * @return the working copy Node for the checked out document */ public ScriptNode checkout() { NodeRef workingCopyRef = this.services.getCheckOutCheckInService().checkout(this.nodeRef); ScriptNode workingCopy = newInstance(workingCopyRef, this.services, this.scope); // reset the aspect and properties as checking out a document causes changes this.properties = null; this.aspects = null; return workingCopy; }
/** * Gets the check-out of a working copy document * @return the original Node that was checked out or null if it's not a working copy */ public ScriptNode getCheckedOut() { NodeRef original = this.services.getCheckOutCheckInService().getCheckedOut(this.nodeRef); if(original != null) { return newInstance(original, this.services, this.scope); } else { return null; } }
/** * Gets the check-out of a working copy document * @return the original Node that was checked out or null if it's not a working copy */ public ScriptNode getCheckedOut() { NodeRef original = this.services.getCheckOutCheckInService().getCheckedOut(this.nodeRef); if(original != null) { return newInstance(original, this.services, this.scope); } else { return null; } }
/** * Perform a check-out of this document into the specified destination space. * * @param destination * Destination for the checked out document working copy Node. * @return the working copy Node for the checked out document */ public ScriptNode checkout(ScriptNode destination) { ParameterCheck.mandatory("Destination Node", destination); ChildAssociationRef childAssocRef = this.nodeService.getPrimaryParent(destination.getNodeRef()); NodeRef workingCopyRef = this.services.getCheckOutCheckInService().checkout(this.nodeRef, destination.getNodeRef(), ContentModel.ASSOC_CONTAINS, childAssocRef.getQName()); ScriptNode workingCopy = newInstance(workingCopyRef, this.services, this.scope); // reset the aspect and properties as checking out a document causes changes this.properties = null; this.aspects = null; return workingCopy; }
@Test public final void test13OnCheckIn() throws Exception { Map<String, Serializable> checkinProperties = new HashMap<String, Serializable>(); checkinProperties.put(Version.PROP_DESCRIPTION, null); checkinProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); serviceRegistry.getCheckOutCheckInService().checkin(workingCopyNodeRef, checkinProperties); txn.commit(); txn = null; assertEquals(2, auditMapList.size()); boolean origIn0 = ((String)auditMapList.get(0).get("path")).endsWith("cm:content1"); Map<String, Serializable> origMap = auditMapList.get(origIn0 ? 0 : 1); Map<String, Serializable> workMap = auditMapList.get(origIn0 ? 1 : 0); // working copy assertEquals("DELETE", workMap.get("action")); assertContains("deleteNode", workMap.get("sub-actions")); assertTrue("Expected working copy", ((String)workMap.get("path")).endsWith("(Working Copy)") && ((String)workMap.get("path")).startsWith("/cm:homeFolder/cm:folder1/")); assertEquals("cm:content", workMap.get("type")); // original file assertEquals("CHECK IN", origMap.get("action")); assertContains("deleteNodeAspect", origMap.get("sub-actions")); assertContains("copyNode", origMap.get("sub-actions")); assertContains("createVersion", origMap.get("sub-actions")); assertContains("updateNodeProperties", origMap.get("sub-actions")); assertContains("checkIn", origMap.get("sub-actions")); assertEquals("/cm:homeFolder/cm:folder1/cm:content1", origMap.get("path")); assertEquals("cm:content", origMap.get("type")); }
@Test public final void test12OnCheckOut() throws Exception workingCopyNodeRef = serviceRegistry.getCheckOutCheckInService().checkout(content1);
/** * Perform a check-out of this document into the specified destination space. * * @param destination * Destination for the checked out document working copy Node. * @return the working copy Node for the checked out document */ public ScriptNode checkout(ScriptNode destination) { ParameterCheck.mandatory("Destination Node", destination); ChildAssociationRef childAssocRef = this.nodeService.getPrimaryParent(destination.getNodeRef()); NodeRef workingCopyRef = this.services.getCheckOutCheckInService().checkout(this.nodeRef, destination.getNodeRef(), ContentModel.ASSOC_CONTAINS, childAssocRef.getQName()); ScriptNode workingCopy = newInstance(workingCopyRef, this.services, this.scope); // reset the aspect and properties as checking out a document causes changes this.properties = null; this.aspects = null; return workingCopy; }
@Test public final void test14OnCancelCheckOut() throws Exception workingCopyNodeRef = serviceRegistry.getCheckOutCheckInService().checkout(content1); txn.commit(); txn = null; setUp(); serviceRegistry.getCheckOutCheckInService().cancelCheckout(workingCopyNodeRef);
/** * <br> * Creating node - CheckOut - Add write lock to working copy - Unlock working copy - CancelCheckOut */ @Test public void testCancelCheckoutUnlockedWCopy() { ServiceRegistry serviceRegistry = (ServiceRegistry)this.applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY); CheckOutCheckInService securityCOCIService = serviceRegistry.getCheckOutCheckInService(); NodeRef folderA = createFolder(rootNodeRef, "testMnt9502_" + System.currentTimeMillis()); assertNotNull(folderA); NodeRef clucc = createContent("checkout_lock_unlock_cancelCO", folderA); assertNotNull(clucc); NodeRef wc = securityCOCIService.checkout(clucc); lockService.lock(wc, LockType.WRITE_LOCK, 60*60); lockService.unlock(wc); securityCOCIService.cancelCheckout(wc); }
CheckOutCheckInService cociService = serviceRegistry.getCheckOutCheckInService();
this.nodeService = serviceRegistry.getNodeService(); this.ruleService = serviceRegistry.getRuleService(); this.cociService = serviceRegistry.getCheckOutCheckInService(); this.lockService = serviceRegistry.getLockService(); this.copyService = serviceRegistry.getCopyService();
dictionaryDAO = (DictionaryDAO) ctx.getBean("dictionaryDAO"); tenantService = (TenantService) ctx.getBean("tenantService"); cociService = serviceRegistry.getCheckOutCheckInService();
fileFolderService = serviceRegistry.getFileFolderService(); nodeService = serviceRegistry.getNodeService(); cociService = serviceRegistry.getCheckOutCheckInService();