本文整理汇总了Java中org.alfresco.service.cmr.lock.LockStatus.LOCK_OWNER属性的典型用法代码示例。如果您正苦于以下问题:Java LockStatus.LOCK_OWNER属性的具体用法?Java LockStatus.LOCK_OWNER怎么用?Java LockStatus.LOCK_OWNER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.alfresco.service.cmr.lock.LockStatus
的用法示例。
在下文中一共展示了LockStatus.LOCK_OWNER属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isWorkingCopyOrLocked
private boolean isWorkingCopyOrLocked(NodeRef nodeRef)
{
boolean isWorkingCopy = false;
boolean isLocked = false;
if (nodeRef != null)
{
Set<QName> aspects = nodeService.getAspects(nodeRef);
isWorkingCopy = aspects.contains(ContentModel.ASPECT_WORKING_COPY);
if (!isWorkingCopy)
{
if (aspects.contains(ContentModel.ASPECT_LOCKABLE))
{
LockStatus lockStatus = lockService.getLockStatus(nodeRef);
if (lockStatus == LockStatus.LOCKED || lockStatus == LockStatus.LOCK_OWNER)
{
isLocked = true;
}
}
}
}
return (isWorkingCopy || isLocked);
}
示例2: lockStatus
/**
* Given the lock owner and expiry date of a lock calculates the lock status with respect
* to the user name supplied, e.g. the current user.
*
* @param userName User name to evaluate the lock against.
* @param lockOwner Owner of the lock.
* @param expiryDate Expiry date of the lock.
* @return LockStatus
* @deprecated eventually move into LockService
*/
public static LockStatus lockStatus(String userName, String lockOwner, Date expiryDate)
{
LockStatus result = LockStatus.NO_LOCK;
if (lockOwner != null)
{
if (expiryDate != null && expiryDate.before(new Date()) == true)
{
// Indicate that the lock has expired
result = LockStatus.LOCK_EXPIRED;
}
else
{
if (lockOwner.equals(userName) == true)
{
result = LockStatus.LOCK_OWNER;
}
else
{
result = LockStatus.LOCKED;
}
}
}
return result;
}
示例3: isNodeLocked
/**
* Return whether a Node is currently locked
*
* @param node The Node wrapper to test against
* @param lockService The LockService to use
*
* @return whether a Node is currently locked
*/
public static Boolean isNodeLocked(Node node, LockService lockService)
{
Boolean locked = Boolean.FALSE;
if (node.hasAspect(ContentModel.ASPECT_LOCKABLE))
{
LockStatus lockStatus = lockService.getLockStatus(node.getNodeRef());
if (lockStatus == LockStatus.LOCKED || lockStatus == LockStatus.LOCK_OWNER)
{
locked = Boolean.TRUE;
}
}
return locked;
}
示例4: encodeBegin
/**
* @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext)
*/
public void encodeBegin(FacesContext context) throws IOException
{
if (isRendered() == false)
{
return;
}
// get the value and see if the image is locked
NodeService nodeService = getNodeService(context);
String lockUser = null;
Object val = getValue();
NodeRef ref = null;
if (val instanceof NodeRef)
{
ref = (NodeRef)val;
if (nodeService.exists(ref))
{
LockStatus lockStatus = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getLockService().getLockStatus(ref);
if (lockStatus == LockStatus.LOCK_OWNER || lockStatus == LockStatus.LOCKED)
lockUser = (String)nodeService.getProperty(ref, ContentModel.PROP_LOCK_OWNER);
}
}
final boolean locked = lockUser != null;
final boolean lockedOwner = locked && (lockUser.equals(Application.getCurrentUser(context).getUserName()));
this.encodeBegin(context, locked, lockedOwner, new String[] { lockUser });
}
示例5: isNodeOwnerLocked
/**
* Return whether a Node is currently locked by the current user
*
* @param node The Node wrapper to test against
* @param lockService The LockService to use
*
* @return whether a Node is currently locked by the current user
*/
public static Boolean isNodeOwnerLocked(Node node, LockService lockService)
{
Boolean locked = Boolean.FALSE;
if (node.hasAspect(ContentModel.ASPECT_LOCKABLE) &&
lockService.getLockStatus(node.getNodeRef()) == LockStatus.LOCK_OWNER)
{
locked = Boolean.TRUE;
}
return locked;
}
示例6: isLockOwner
private boolean isLockOwner(NodeRef nodeRef)
{
return lockService.getLockStatus(nodeRef) == LockStatus.LOCK_OWNER;
}