当前位置: 首页>>代码示例>>Java>>正文


Java LockStatus.LOCK_OWNER属性代码示例

本文整理汇总了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);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:CommentServiceImpl.java

示例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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:35,代码来源:LockUtils.java

示例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;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:23,代码来源:Repository.java

示例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 });
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:30,代码来源:UILockIcon.java

示例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;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:20,代码来源:Repository.java

示例6: isLockOwner

private boolean isLockOwner(NodeRef nodeRef)
{
    return lockService.getLockStatus(nodeRef) == LockStatus.LOCK_OWNER;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:4,代码来源:CommentServiceImpl.java


注:本文中的org.alfresco.service.cmr.lock.LockStatus.LOCK_OWNER属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。