本文整理汇总了Java中org.alfresco.service.cmr.lock.LockType.valueOf方法的典型用法代码示例。如果您正苦于以下问题:Java LockType.valueOf方法的具体用法?Java LockType.valueOf怎么用?Java LockType.valueOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.lock.LockType
的用法示例。
在下文中一共展示了LockType.valueOf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLockType
import org.alfresco.service.cmr.lock.LockType; //导入方法依赖的package包/类
/**
* @see LockService#getLockType(NodeRef)
*/
@Extend(traitAPI=LockServiceTrait.class,extensionAPI=LockServiceExtension.class)
public LockType getLockType(NodeRef nodeRef)
{
LockType result = null;
// Don't disable the lockable aspect interceptor - allow it to fetch the lock type
// from the correct place (persistent storage or lockStore).
if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_LOCKABLE) == true)
{
String lockTypeString = (String) this.nodeService.getProperty(nodeRef, ContentModel.PROP_LOCK_TYPE);
if (lockTypeString != null)
{
result = LockType.valueOf(lockTypeString);
}
}
return result;
}
示例2: beforeArchiveNode
import org.alfresco.service.cmr.lock.LockType; //导入方法依赖的package包/类
/**
* beforeArchiveNode policy behaviour
*
* @param nodeRef
* the node reference about to be archived
*/
@Override
public void beforeArchiveNode(NodeRef workingCopyNodeRef)
{
NodeRef checkedOutNodeRef = checkOutCheckInService.getCheckedOut(workingCopyNodeRef);
if (checkedOutNodeRef != null)
{
try
{
policyBehaviourFilter.disableBehaviour(workingCopyNodeRef, ContentModel.ASPECT_AUDITABLE);
if (nodeService.hasAspect(checkedOutNodeRef, ContentModel.ASPECT_LOCKABLE))
{
Map<QName, Serializable> checkedOutNodeProperties = nodeService.getProperties(checkedOutNodeRef);
Map<QName, Serializable> workingCopyProperties = nodeService.getProperties(workingCopyNodeRef);
Long nodeId = nodeDAO.getNodePair(workingCopyNodeRef).getFirst();
//get lock properties from checked out node and set them on working copy node in order to be available for restore
String lockOwner = (String) checkedOutNodeProperties.get(ContentModel.PROP_LOCK_OWNER);
Date expiryDate = (Date) checkedOutNodeProperties.get(ContentModel.PROP_EXPIRY_DATE);
String lockTypeStr = (String) checkedOutNodeProperties.get(ContentModel.PROP_LOCK_TYPE);
LockType lockType = lockTypeStr != null ? LockType.valueOf(lockTypeStr) : null;
String lifetimeStr = (String) checkedOutNodeProperties.get(ContentModel.PROP_LOCK_LIFETIME);
Lifetime lifetime = lifetimeStr != null ? Lifetime.valueOf(lifetimeStr) : null;
String additionalInfo = (String) checkedOutNodeProperties.get(ContentModel.PROP_LOCK_ADDITIONAL_INFO);
nodeService.addAspect(workingCopyNodeRef, ContentModel.ASPECT_ARCHIVE_LOCKABLE, null);
workingCopyProperties.put(ContentModel.PROP_ARCHIVED_LOCK_OWNER, lockOwner);
workingCopyProperties.put(ContentModel.PROP_ARCHIVED_LOCK_TYPE, lockType);
workingCopyProperties.put(ContentModel.PROP_ARCHIVED_LOCK_LIFETIME, lifetime);
workingCopyProperties.put(ContentModel.PROP_ARCHIVED_EXPIRY_DATE, expiryDate);
workingCopyProperties.put(ContentModel.PROP_ARCHIVED_LOCK_ADDITIONAL_INFO, additionalInfo);
// Target associations
Collection<Pair<Long, AssociationRef>> targetAssocs = nodeDAO.getTargetNodeAssocs(nodeId, null);
for (Pair<Long, AssociationRef> targetAssocPair : targetAssocs)
{
if (ContentModel.ASSOC_ORIGINAL.equals(targetAssocPair.getSecond().getTypeQName()))
{
workingCopyProperties.put(ContentModel.PROP_ARCHIVED_TARGET_ASSOCS, targetAssocPair.getSecond());
}
}
// Source associations
Collection<Pair<Long, AssociationRef>> sourceAssocs = nodeDAO.getSourceNodeAssocs(nodeId, null);
for (Pair<Long, AssociationRef> sourceAssocPair : sourceAssocs)
{
if (ContentModel.ASSOC_WORKING_COPY_LINK.equals(sourceAssocPair.getSecond().getTypeQName()))
{
workingCopyProperties.put(ContentModel.PROP_ARCHIVED_SOURCE_ASSOCS, sourceAssocPair.getSecond());
}
}
//update working copy node properties
nodeService.setProperties(workingCopyNodeRef, workingCopyProperties);
}
}
finally
{
policyBehaviourFilter.enableBehaviour(checkedOutNodeRef, ContentModel.ASPECT_AUDITABLE);
}
}
}
示例3: getLockState
import org.alfresco.service.cmr.lock.LockType; //导入方法依赖的package包/类
@Override
@Extend(traitAPI=LockServiceTrait.class,extensionAPI=LockServiceExtension.class)
public LockState getLockState(NodeRef nodeRef)
{
// Check in-memory for ephemeral locks first.
nodeRef = tenantService.getName(nodeRef);
LockState lockState = lockStore.get(nodeRef);
//ALF-20361: It is possible that a rollback has resulted in a "non-lock" lock state being added to
//the lock store. Because of that, we check both whether the retrieved lockState is null and, if it isn't,
//whether it represents a real lock
if (lockState == null || !lockState.isLockInfo())
{
// No in-memory state, so get from the DB.
if (nodeService.exists(nodeRef) && nodeService.hasAspect(nodeRef, ContentModel.ASPECT_LOCKABLE))
{
String lockOwner = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_LOCK_OWNER);
Date expiryDate = (Date) nodeService.getProperty(nodeRef, ContentModel.PROP_EXPIRY_DATE);
String lockTypeStr = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_LOCK_TYPE);
LockType lockType = lockTypeStr != null ? LockType.valueOf(lockTypeStr) : null;
String lifetimeStr = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_LOCK_LIFETIME);
Lifetime lifetime = lifetimeStr != null ? Lifetime.valueOf(lifetimeStr) : null;
String additionalInfo = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_LOCK_ADDITIONAL_INFO);
// Mark lockstate as PERSISTENT as it was in the persistent storage!
lockState = LockState.createLock(
nodeRef,
lockType,
lockOwner,
expiryDate,
lifetime,
additionalInfo);
}
else
{
// There is no lock information
lockState = LockState.createUnlocked(nodeRef);
}
}
// Never return a null LockState
Assert.notNull(lockState);
return lockState;
}