REPO-1155 / REPO-160 / REPO-340 - V1 REST API: Remove "includeChildren" option for Lock / Unlock in the rest api (REPO-1163)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@129892 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ancuta Morarasu
2016-08-25 16:16:37 +00:00
parent 78ed7e9c2d
commit 8dfbbeaf3d
7 changed files with 31 additions and 261 deletions

View File

@@ -36,7 +36,6 @@ 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;
@@ -259,11 +258,10 @@ public interface Nodes
/**
* Unlock a node
* @param nodeId
* @param unlockInfo
* @param parameters
* @return
*/
Node unlock(String nodeId, UnlockInfo unlockInfo, Parameters parameters);
Node unlock(String nodeId, Parameters parameters);
/**
* API Constants - query parameters, etc

View File

@@ -87,7 +87,6 @@ import org.alfresco.rest.api.model.Node;
import org.alfresco.rest.api.model.PathInfo;
import org.alfresco.rest.api.model.PathInfo.ElementInfo;
import org.alfresco.rest.api.model.QuickShareLink;
import org.alfresco.rest.api.model.UnlockInfo;
import org.alfresco.rest.api.model.UserInfo;
import org.alfresco.rest.api.nodes.NodeAssocService;
import org.alfresco.rest.framework.core.exceptions.ApiException;
@@ -123,7 +122,6 @@ import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
import org.alfresco.service.cmr.lock.LockService;
import org.alfresco.service.cmr.lock.LockStatus;
import org.alfresco.service.cmr.lock.NodeLockedException;
import org.alfresco.service.cmr.model.FileExistsException;
import org.alfresco.service.cmr.model.FileFolderService;
@@ -2958,7 +2956,7 @@ public class NodesImpl implements Nodes
}
lockInfo = validateLockInformation(lockInfo);
lockService.lock(nodeRef, lockInfo.getMappedType(), lockInfo.getTimeToExpire(), lockInfo.getLifetime(), lockInfo.getIncludeChildren());
lockService.lock(nodeRef, lockInfo.getMappedType(), lockInfo.getTimeToExpire(), lockInfo.getLifetime());
return getFolderOrDocument(nodeId, parameters);
}
@@ -2974,10 +2972,6 @@ public class NodesImpl implements Nodes
{
lockInfo.setLifetime(Lifetime.PERSISTENT.name());
}
if (lockInfo.getIncludeChildren() == null)
{
lockInfo.setIncludeChildren(false);
}
if (lockInfo.getTimeToExpire() == null)
{
lockInfo.setTimeToExpire(0);
@@ -2986,7 +2980,7 @@ public class NodesImpl implements Nodes
}
@Override
public Node unlock(String nodeId, UnlockInfo unlockInfo, Parameters parameters)
public Node unlock(String nodeId, Parameters parameters)
{
NodeRef nodeRef = validateOrLookupNode(nodeId, null);
@@ -2994,12 +2988,8 @@ public class NodesImpl implements Nodes
{
throw new PermissionDeniedException("Current user doesn't have permission to unlock node " + nodeId);
}
if (unlockInfo.getIncludeChildren() == null)
{
unlockInfo.setIncludeChildren(false);
}
lockService.unlock(nodeRef, unlockInfo.getIncludeChildren());
lockService.unlock(nodeRef);
return getFolderOrDocument(nodeId, parameters);
}

View File

@@ -38,7 +38,6 @@ import org.codehaus.jackson.annotate.JsonIgnoreProperties;
public class LockInfo
{
private Integer timeToExpire;
private Boolean includeChildren;
private LockType2 type;
private Lifetime lifetime;
@@ -77,16 +76,6 @@ public class LockInfo
return timeToExpire;
}
public void setIncludeChildren(Boolean includeChildren)
{
this.includeChildren = includeChildren;
}
public Boolean getIncludeChildren()
{
return includeChildren;
}
public LockType getMappedType()
{
return type != null ? type.getType() : null;
@@ -116,7 +105,6 @@ public class LockInfo
public String toString()
{
final StringBuilder sb = new StringBuilder("LockInfo{");
sb.append("includeChildren='").append(includeChildren).append('\'');
sb.append(", timeToExpire='").append(timeToExpire).append('\'');
sb.append(", type='").append(type).append('\'');
sb.append(", lifetime='").append(lifetime).append('\'');

View File

@@ -1,60 +0,0 @@
/*
* #%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 <http://www.gnu.org/licenses/>.
* #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;
// }
}

View File

@@ -33,7 +33,6 @@ 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;
@@ -185,9 +184,9 @@ public class NodesEntityResource implements
@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)
public Node unlock(String nodeId, Void ignore, Parameters parameters, WithResponse withResponse)
{
return nodes.unlock(nodeId, unlockInfo, parameters);
return nodes.unlock(nodeId, parameters);
}
}