Merged 5.2.N (5.2.1) to HEAD (5.2)

129711 jvonka: REPO-1138 / REPO-983: Add support for the isLocked property
   - can optionally "include" when getting node info, listing children, ...


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@130219 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2016-09-06 14:41:32 +00:00
parent 2a5218afb8
commit 2953ce53de
5 changed files with 86 additions and 4 deletions

View File

@@ -274,6 +274,7 @@ public interface Nodes
String PARAM_INCLUDE_PATH = "path";
String PARAM_INCLUDE_ASPECTNAMES = "aspectNames";
String PARAM_INCLUDE_ISLINK = "isLink";
String PARAM_INCLUDE_ISLOCKED = "isLocked";
String PARAM_INCLUDE_ALLOWABLEOPERATIONS = "allowableOperations";
String PARAM_INCLUDE_ASSOCIATION = "association";

View File

@@ -122,6 +122,7 @@ 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.model.FileExistsException;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.model.FileInfo;
@@ -881,9 +882,11 @@ public class NodesImpl implements Nodes
node.setProperties(mapFromNodeProperties(properties, includeParam, mapUserInfo));
}
Set<QName> aspects = null;
if (includeParam.contains(PARAM_INCLUDE_ASPECTNAMES))
{
node.setAspectNames(mapFromNodeAspects(nodeService.getAspects(nodeRef)));
aspects = nodeService.getAspects(nodeRef);
node.setAspectNames(mapFromNodeAspects(aspects));
}
if (includeParam.contains(PARAM_INCLUDE_ISLINK))
@@ -892,6 +895,12 @@ public class NodesImpl implements Nodes
node.setIsLink(isLink);
}
if (includeParam.contains(PARAM_INCLUDE_ISLOCKED))
{
boolean isLocked = isLocked(nodeRef, aspects);
node.setIsLocked(isLocked);
}
if (includeParam.contains(PARAM_INCLUDE_ALLOWABLEOPERATIONS))
{
// note: refactor when requirements change
@@ -1970,7 +1979,23 @@ public class NodesImpl implements Nodes
return false;
}
private boolean isLocked(NodeRef nodeRef, Set<QName> aspects)
{
boolean locked = false;
if (((aspects != null) && aspects.contains(ContentModel.ASPECT_LOCKABLE))
|| nodeService.hasAspect(nodeRef, ContentModel.ASPECT_LOCKABLE))
{
LockStatus status = lockService.getLockStatus(nodeRef);
if (status == LockStatus.LOCKED || status == LockStatus.LOCK_OWNER)
{
locked = true;
}
}
return locked;
}
@Override
public Node updateNode(String nodeId, Node nodeInfo, Parameters parameters)
{

View File

@@ -73,6 +73,7 @@ public class Node implements Comparable<Node>
protected Boolean isFolder;
protected Boolean isFile;
protected Boolean isLink;
protected Boolean isLocked;
protected NodeRef parentNodeRef;
protected PathInfo pathInfo;
@@ -305,6 +306,16 @@ public class Node implements Comparable<Node>
this.isLink = isLink;
}
public Boolean getIsLocked()
{
return isLocked;
}
public void setIsLocked(Boolean isLocked)
{
this.isLocked = isLocked;
}
public List<String> getAllowableOperations()
{
return allowableOperations;