diff --git a/source/java/org/alfresco/rest/api/Nodes.java b/source/java/org/alfresco/rest/api/Nodes.java index 8ead27f7d0..64971c6ed5 100644 --- a/source/java/org/alfresco/rest/api/Nodes.java +++ b/source/java/org/alfresco/rest/api/Nodes.java @@ -36,6 +36,7 @@ import org.alfresco.rest.api.model.Document; import org.alfresco.rest.api.model.Folder; import org.alfresco.rest.api.model.LockInfo; import org.alfresco.rest.api.model.Node; +import org.alfresco.rest.api.model.UnlockInfo; import org.alfresco.rest.api.model.UserInfo; import org.alfresco.rest.framework.resource.content.BasicContentInfo; import org.alfresco.rest.framework.resource.content.BinaryResource; @@ -254,6 +255,15 @@ public interface Nodes * @return */ Node lock(String nodeId, LockInfo lockInfo, Parameters parameters); + + /** + * Unlock a node + * @param nodeId + * @param unlockInfo + * @param parameters + * @return + */ + Node unlock(String nodeId, UnlockInfo unlockInfo, Parameters parameters); /** * Unlock a node diff --git a/source/java/org/alfresco/rest/api/model/UnlockInfo.java b/source/java/org/alfresco/rest/api/model/UnlockInfo.java new file mode 100644 index 0000000000..74b7b36a7f --- /dev/null +++ b/source/java/org/alfresco/rest/api/model/UnlockInfo.java @@ -0,0 +1,60 @@ +/* + * #%L + * Alfresco Remote API + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.rest.api.model; + +/** + * Representation of a unlock info + * + * @author Ancuta Morarasu + */ + +public class UnlockInfo +{ + private Boolean includeChildren; + private Boolean allowCheckedOut; + + public UnlockInfo() {} + + public Boolean getIncludeChildren() + { + return includeChildren; + } + + public void setIncludeChildren(Boolean includeChildren) + { + this.includeChildren = includeChildren; + } + + public Boolean getAllowCheckedOut() + { + return allowCheckedOut; + } + + public void setAllowCheckedOut(Boolean allowCheckedOut) + { + this.allowCheckedOut = allowCheckedOut; + } +} diff --git a/source/java/org/alfresco/rest/api/nodes/NodesEntityResource.java b/source/java/org/alfresco/rest/api/nodes/NodesEntityResource.java index 7fec701ba9..75339f4b95 100644 --- a/source/java/org/alfresco/rest/api/nodes/NodesEntityResource.java +++ b/source/java/org/alfresco/rest/api/nodes/NodesEntityResource.java @@ -33,6 +33,7 @@ import org.alfresco.rest.api.Nodes; import org.alfresco.rest.api.model.LockInfo; import org.alfresco.rest.api.model.Node; import org.alfresco.rest.api.model.NodeTarget; +import org.alfresco.rest.api.model.UnlockInfo; import org.alfresco.rest.framework.BinaryProperties; import org.alfresco.rest.framework.Operation; import org.alfresco.rest.framework.WebApiDescription; @@ -179,6 +180,15 @@ public class NodesEntityResource implements { return nodes.lock(nodeId, lockInfo, parameters); } + + @Operation("unlock") + @WebApiDescription(title = "Unlock Node", + description="Removes a lock on a node.", + successStatus = HttpServletResponse.SC_OK) + public Node unlock(String nodeId, UnlockInfo unlockInfo, Parameters parameters, WithResponse withResponse) + { + return nodes.unlock(nodeId, unlockInfo, parameters); + } @Operation("unlock") @WebApiDescription(title = "Unlock Node", diff --git a/source/test-java/org/alfresco/rest/api/tests/AbstractBaseApiTest.java b/source/test-java/org/alfresco/rest/api/tests/AbstractBaseApiTest.java index e6238c0012..6564003f9f 100644 --- a/source/test-java/org/alfresco/rest/api/tests/AbstractBaseApiTest.java +++ b/source/test-java/org/alfresco/rest/api/tests/AbstractBaseApiTest.java @@ -799,13 +799,13 @@ public abstract class AbstractBaseApiTest extends EnterpriseTestApi } return ResourceUtils.getFile(url); } - + protected Document lock(String nodeId, String body) throws Exception { HttpResponse response = post(getNodeOperationUrl(nodeId, "lock"), body, null, 200); return RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Document.class); } - + protected Document unlock(String nodeId) throws Exception { HttpResponse response = post(getNodeOperationUrl(nodeId, "unlock"), null, null, 200); @@ -884,7 +884,7 @@ public abstract class AbstractBaseApiTest extends EnterpriseTestApi { return URL_NODES + "/" + nodeId + "/" + URL_CONTENT; } - + protected String getNodeOperationUrl(String nodeId, String operation) { return URL_NODES + "/" + nodeId + "/" + operation;