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


Java LockStatus.NO_LOCK属性代码示例

本文整理汇总了Java中org.alfresco.service.cmr.lock.LockStatus.NO_LOCK属性的典型用法代码示例。如果您正苦于以下问题:Java LockStatus.NO_LOCK属性的具体用法?Java LockStatus.NO_LOCK怎么用?Java LockStatus.NO_LOCK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.alfresco.service.cmr.lock.LockStatus的用法示例。


在下文中一共展示了LockStatus.NO_LOCK属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: checkout

@Override
@Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class)
public NodeRef checkout(
        final NodeRef nodeRef, 
        final NodeRef destinationParentNodeRef,
        final QName destinationAssocTypeQName, 
        QName destinationAssocQName) 
{
    if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_CHECKED_OUT))
    {
        throw new CheckOutCheckInServiceException(MSG_ALREADY_CHECKEDOUT);
    }

    // Make sure we are not checking out a working copy node
    if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_WORKING_COPY))
    {
        throw new CheckOutCheckInServiceException(MSG_ERR_ALREADY_WORKING_COPY);
    }
    
    // It is not enough to check LockUtils.isLockedOrReadOnly in case when the same user does offline and online edit (for instance in two open browsers). In this case we get
    // set ContentModel.ASPECT_LOCKABLE and LockType.WRITE_LOCK. So, here we have to check following
    LockStatus lockStatus = lockService.getLockStatus(nodeRef);
    if (lockStatus != LockStatus.NO_LOCK && lockStatus != LockStatus.LOCK_EXPIRED)
    {
        throw new NodeLockedException(nodeRef);
    }
    
    behaviourFilter.disableBehaviour(nodeRef, ContentModel.ASPECT_AUDITABLE);
    behaviourFilter.disableBehaviour(destinationParentNodeRef, ContentModel.ASPECT_AUDITABLE);
    try
    {
        return doCheckout(nodeRef, destinationParentNodeRef, destinationAssocTypeQName, destinationAssocQName);
    }
    finally
    {
        behaviourFilter.enableBehaviour(nodeRef, ContentModel.ASPECT_AUDITABLE);
        behaviourFilter.enableBehaviour(destinationParentNodeRef, ContentModel.ASPECT_AUDITABLE);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:39,代码来源:CheckOutCheckInServiceImpl.java

示例3: initTranslationList

/**
 * Util method which init the lists of translations
 */
private void initTranslationList()
{
    this.translationsCheckedOut = new ArrayList<TranslationWrapper>();
    this.selectableTranslations = new ArrayList<TranslationWrapper>();

    // get all translations of the mlContainer
    Map<Locale, NodeRef> translations = getMultilingualContentService().getTranslations(mlContainerToVersion);

    // fill the data table rows list
    for(Map.Entry<Locale, NodeRef> entry : translations.entrySet())
    {
        NodeRef nodeRef = entry.getValue();

        String name = (String) getNodeService().getProperty(nodeRef, ContentModel.PROP_NAME);
        String langCode = ((Locale) getNodeService().getProperty(nodeRef, ContentModel.PROP_LOCALE)).getLanguage();
        String langText = getContentFilterLanguagesService().getLabelByCode(langCode);
        String lockOwner = (String) getNodeService().getProperty(nodeRef, ContentModel.PROP_LOCK_OWNER);

        // create the row with the current translation
        TranslationWrapper wrapper = new TranslationWrapper(name, langCode, lockOwner, langText);

        if(!getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION))
        {
            // add it to the selectable list if it is not empty
            this.selectableTranslations.add(wrapper);
        }

        if(getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_LOCKABLE))
        {
            LockStatus lockStatus = getLockService().getLockStatus(nodeRef);
            if (lockStatus != LockStatus.NO_LOCK)
            {
                // if the node is locked, add it to the locked translation list
                this.translationsCheckedOut.add(wrapper);
            }
        }

    }
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:42,代码来源:NewEditionWizard.java


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