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.
public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException { String resUnlock; AuthenticationUtils.startSession("admin", "admin"); SiteInfo siteInfo = site.getSite("site1"); NodeRef docLib = site.getContainer(siteInfo.getShortName(), "documentlibrary"); List<ChildAssociationRef> children = nodeService.getChildAssocs(docLib); for (ChildAssociationRef childAssoc : children) { NodeRef childNodeRef = childAssoc.getChildRef(); try { lockService.unlock(childNodeRef, true); } catch (UnableToReleaseLockException exception) { System.out.println(exception.getMessage()); } } }
public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException { RunAsWork<Object> actionRunAs = new RunAsWork<Object>() { public Object doWork() { SiteInfo siteInfo = site.getSite("site1"); NodeRef docLib = site.getContainer(siteInfo.getShortName(), "documentlibrary"); List<ChildAssociationRef> children = nodeService.getChildAssocs(docLib); for (ChildAssociationRef childAssoc : children) { NodeRef childNodeRef = childAssoc.getChildRef(); try { lockService.unlock(childNodeRef, true); } catch (UnableToReleaseLockException exception) { System.out.println(exception.getMessage()); } } return null; }; AuthenticationUtil.runAs(actionRunAs, AuthenticationUtil.getSystemUserName()); }