mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
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:
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user