本文整理汇总了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;
}
示例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);
}
}
示例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);
}
}
}
}