AnsweredAssumed Answered

removeAspect('cm:lockable') failed

Question asked by vincent-kali on Jul 15, 2014
Latest reply on Aug 16, 2016 by gawadesk
Hi all,
I've created a Web Script to lock/unlock files.
File locking is working fine:

if (!nodeRef.hasAspect("cm:lockable"))
   {// not already locked
   var properties = new Array(2);
   properties["cm:lockType"] = "READ_ONLY_LOCK";
   properties["cm:lockOwner"] = "admin";
   if (nodeRef.addAspect("cm:lockable", properties))
      {//node successfully locked
      nodeRef.save;
      …

But I can't unlock the document using nodeRef.removeAspect("cm:lockable"), because … the document is locked !

org.mozilla.javascript.WrappedException: Wrapped org.alfresco.service.cmr.lock.NodeLockedException: 06150419 Cannot perform operation since the node (id:829a6498-8901-4897-8945-9dad57f9997b) is locked. (workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts Extensions/rLockService.get.js#70)
        at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1757)
        at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:170)
        at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
        at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
        at org.mozilla.javascript.gen.c93._c0(workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts Extensions/rLockService.get.js:70)
        at org.mozilla.javascript.gen.c93.call(workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts Extensions/rLockService.get.js)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
        at org.mozilla.javascript.gen.c93.call(workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts Extensions/rLockService.get.js)
        at org.mozilla.javascript.gen.c93.exec(workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts Extensions/rLockService.get.js)
        at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:502)
        at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:200)
        at org.alfresco.repo.processor.ScriptServiceImpl.execute(ScriptServiceImpl.java:212)
        at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:174)
        at org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:102)

Any idea ?

Thanks for your help,
Vincent


Outcomes