本文整理汇总了Java中org.alfresco.repo.transaction.AlfrescoTransactionSupport.bindResource方法的典型用法代码示例。如果您正苦于以下问题:Java AlfrescoTransactionSupport.bindResource方法的具体用法?Java AlfrescoTransactionSupport.bindResource怎么用?Java AlfrescoTransactionSupport.bindResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.repo.transaction.AlfrescoTransactionSupport
的用法示例。
在下文中一共展示了AlfrescoTransactionSupport.bindResource方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAdmStoreRefs
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
/**
* Helper method that caches ADM store references to prevent repeated and unnecessary calls to the
* NodeService for this list.
*/
private Set<StoreRef> getAdmStoreRefs()
{
Set<StoreRef> storeRefs = (Set<StoreRef>) AlfrescoTransactionSupport.getResource(KEY_STORE_REFS);
if (storeRefs != null)
{
return storeRefs;
}
else
{
storeRefs = new HashSet<StoreRef>(nodeService.getStores());
Iterator<StoreRef> storeRefsIterator = storeRefs.iterator();
while (storeRefsIterator.hasNext())
{
// Remove stores to ignore
StoreRef storeRef = storeRefsIterator.next();
if (isIgnorableStore(storeRef))
{
storeRefsIterator.remove();
}
}
// Bind it in
AlfrescoTransactionSupport.bindResource(KEY_STORE_REFS, storeRefs);
}
return storeRefs;
}
示例2: getAuthorisations
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
@Extend(traitAPI = PermissionServiceTrait.class, extensionAPI = PermissionServiceExtension.class)
public Set<String> getAuthorisations()
{
// Use TX cache
@SuppressWarnings("unchecked")
Set<String> auths = (Set<String>) AlfrescoTransactionSupport.getResource("MyAuthCache");
Authentication auth = AuthenticationUtil.getRunAsAuthentication();
if (auths != null)
{
if (auth == null || !auths.contains(((User)auth.getPrincipal()).getUsername()))
{
auths = null;
}
}
if (auths == null)
{
auths = getCoreAuthorisations(auth);
AlfrescoTransactionSupport.bindResource("MyAuthCache", auths);
}
return Collections.unmodifiableSet(auths);
}
示例3: getTransactionData
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
/**
* To be used in a transaction only.
*/
private TransactionData getTransactionData()
{
@SuppressWarnings("unchecked")
TransactionData data = (TransactionData) AlfrescoTransactionSupport.getResource(resourceKeyTxnData);
if (data == null)
{
data = new TransactionData();
// create and initialize caches
data.updatedItemsCache = new LRULinkedHashMap<Serializable, CacheBucket<V>>(23);
data.removedItemsCache = new HashSet<Serializable>(13);
data.lockedItemsCache = new HashSet<Serializable>(13);
data.isReadOnly = AlfrescoTransactionSupport.getTransactionReadState() == TxnReadState.TXN_READ_ONLY;
data.stats = new TransactionStats();
// ensure that we get the transaction callbacks as we have bound the unique
// transactional caches to a common manager
AlfrescoTransactionSupport.bindListener(this);
AlfrescoTransactionSupport.bindResource(resourceKeyTxnData, data);
}
return data;
}
示例4: getCurrentChangeSetId
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
/**
* Support to get the current ACL change set and bind this to the transaction. So we only make one new version of an
* ACL per change set. If something is in the current change set we can update it.
*/
private long getCurrentChangeSetId()
{
Long changeSetId = (Long) AlfrescoTransactionSupport.getResource(RESOURCE_KEY_ACL_CHANGE_SET_ID);
if (changeSetId == null)
{
changeSetId = aclCrudDAO.createAclChangeSet();
// bind the ID and the listener
AlfrescoTransactionSupport.bindResource(RESOURCE_KEY_ACL_CHANGE_SET_ID, changeSetId);
AlfrescoTransactionSupport.bindListener(updateChangeSetListener);
if (logger.isDebugEnabled())
{
logger.debug("New change set = " + changeSetId);
}
}
return changeSetId;
}
示例5: renameUser
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
private void renameUser(String oldUsername, String newUsername)
{
logInfo("\""+oldUsername+"\" --> \""+newUsername+"\"");
try
{
NodeRef person = getPersonService().getPerson(oldUsername, false);
// Allow us to update the username just like the LDAP process
AlfrescoTransactionSupport.bindResource(PersonServiceImpl.KEY_ALLOW_UID_UPDATE, Boolean.TRUE);
// Update the username property which will result in a PersonServiceImpl.onUpdateProperties call
// on commit.
getNodeService().setProperty(person, ContentModel.PROP_USERNAME, newUsername);
}
catch (NoSuchPersonException e)
{
logError("User does not exist: "+oldUsername);
}
}
示例6: recordDelete
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void recordDelete(NodeRef nodeRef)
{
Set<NodeRef> deletedNodes = (Set<NodeRef>)AlfrescoTransactionSupport.getResource(KEY_DELETED_NODES);
if (deletedNodes == null)
{
deletedNodes = new HashSet<NodeRef>();
AlfrescoTransactionSupport.bindResource(KEY_DELETED_NODES, deletedNodes);
}
deletedNodes.add(tenantService.getName(nodeRef));
Set<NodeRef> updatedNodes = (Set<NodeRef>)AlfrescoTransactionSupport.getResource(KEY_CREATED_NODES);
if (updatedNodes != null)
{
updatedNodes.remove(tenantService.getName(nodeRef));
}
}
示例7: onRemoveAspect
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
public void onRemoveAspect(NodeRef nodeRef, QName aspect)
{
if (logger.isTraceEnabled())
{
logger.trace("onRemoveAspect: nodeRef="+nodeRef+ " ["+AlfrescoTransactionSupport.getTransactionId()+"]");
}
// undo/cancel checkout removes the "workingcopy" aspect prior to deleting the node - hence need to track here
if (aspect.equals(ContentModel.ASPECT_WORKING_COPY))
{
AlfrescoTransactionSupport.bindResource(KEY_WORKING_COPY, nodeRef);
}
}
示例8: queueTagUpdate
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
/**
* Records the fact that the given tag for the given node will need to
* be added or removed from its parent tags scopes.
* {@link #updateTagScope(NodeRef, Map)} will schedule the update
* to occur, and an async action will do it.
*/
@SuppressWarnings("unchecked")
private void queueTagUpdate(NodeRef nodeRef, String tag, boolean add)
{
// Get the updates map
Map<NodeRef, Map<String, Boolean>> updates = (Map<NodeRef, Map<String, Boolean>>)AlfrescoTransactionSupport.getResource(TAG_UPDATES);
if (updates == null)
{
updates = new HashMap<NodeRef, Map<String,Boolean>>(10);
AlfrescoTransactionSupport.bindResource(TAG_UPDATES, updates);
AlfrescoTransactionSupport.bindListener(this);
}
// Add the details of the update to the map
Map<String, Boolean> nodeDetails = updates.get(nodeRef);
if (nodeDetails == null)
{
nodeDetails = new HashMap<String, Boolean>(10);
nodeDetails.put(tag, Boolean.valueOf(add));
updates.put(nodeRef, nodeDetails);
}
else
{
Boolean currentValue = nodeDetails.get(tag);
if (currentValue == null)
{
nodeDetails.put(tag, Boolean.valueOf(add));
updates.put(nodeRef, nodeDetails);
}
else if (currentValue.booleanValue() != add)
{
// If the boolean value is different then the tag had been added and removed or
// removed and then added in the same transaction. In both cases the net change is none.
// So remove the entry in the update map
nodeDetails.remove(tag);
}
// Otherwise do nothing because we have already noted the update
}
}
示例9: setInheritParentPermissions
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
@Override
@Extend(traitAPI = PermissionServiceTrait.class, extensionAPI = PermissionServiceExtension.class)
public void setInheritParentPermissions(NodeRef nodeRef, final boolean inheritParentPermissions, boolean asyncCall)
{
final NodeRef actualRef = tenantService.getName(nodeRef);
if (asyncCall)
{
//use transaction resource to determine later on in ADMAccessControlListDAO.setFixedAcl if asynchronous call may be required
AlfrescoTransactionSupport.bindResource(FixedAclUpdater.FIXED_ACL_ASYNC_CALL_KEY, true);
permissionsDaoComponent.setInheritParentPermissions(actualRef, inheritParentPermissions);
//check if asynchronous call was required
boolean asyncCallRequired = toBoolean((Boolean) AlfrescoTransactionSupport.getResource(FixedAclUpdater.FIXED_ACL_ASYNC_REQUIRED_KEY));
if (asyncCallRequired)
{
//after transaction is committed FixedAclUpdater will be started in a new thread to process pending nodes
AlfrescoTransactionSupport.bindListener(fixedAclUpdater);
}
invokeOnPermissionsInheritedPolicy(nodeRef, inheritParentPermissions, asyncCallRequired);
}
else
{
//regular method call
permissionsDaoComponent.setInheritParentPermissions(actualRef, inheritParentPermissions);
invokeOnPermissionsInheritedPolicy(nodeRef, inheritParentPermissions, false);
}
accessCache.clear();
}
示例10: getPostTxnDuplicates
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
/**
* Get the txn-bound usernames that need cleaning up
*/
private Set<NodeRef> getPostTxnDuplicates()
{
@SuppressWarnings("unchecked")
Set<NodeRef> postTxnDuplicates = (Set<NodeRef>) AlfrescoTransactionSupport.getResource(KEY_POST_TXN_DUPLICATES);
if (postTxnDuplicates == null)
{
postTxnDuplicates = new HashSet<NodeRef>();
AlfrescoTransactionSupport.bindResource(KEY_POST_TXN_DUPLICATES, postTxnDuplicates);
}
return postTxnDuplicates;
}
示例11: recordCreateVersion
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void recordCreateVersion(NodeRef versionableNode, Version version)
{
Map<NodeRef, NodeRef> versionedNodeRefs = (Map<NodeRef, NodeRef>)AlfrescoTransactionSupport.getResource(KEY_VERSIONED_NODEREFS);
if (versionedNodeRefs == null)
{
versionedNodeRefs = new HashMap<NodeRef, NodeRef>();
AlfrescoTransactionSupport.bindResource(KEY_VERSIONED_NODEREFS, versionedNodeRefs);
}
versionedNodeRefs.put(versionableNode, versionableNode);
}
示例12: beforeDeleteNodeSite
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
public void beforeDeleteNodeSite(NodeRef siteNodeRef)
{
String siteId = (String)nodeService.getProperty(siteNodeRef, ContentModel.PROP_NAME);
Set<String> deletedSiteIds = (Set<String>)AlfrescoTransactionSupport.getResource(KEY_DELETED_SITE_IDS);
if (deletedSiteIds == null)
{
deletedSiteIds = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>()); // Java 6
AlfrescoTransactionSupport.bindResource(KEY_DELETED_SITE_IDS, deletedSiteIds);
}
deletedSiteIds.add(siteId);
AlfrescoTransactionSupport.bindListener(deleteSiteTransactionListener);
}
示例13: checkoutForUpload
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
/**
* Performs a check-out of this document for the purposes of an upload
*
* @return ScriptNode
*/
public ScriptNode checkoutForUpload()
{
AlfrescoTransactionSupport.bindResource("checkoutforupload", Boolean.TRUE.toString());
services.getRuleService().disableRules();
try
{
return checkout();
}
finally
{
services.getRuleService().enableRules();
}
}
示例14: removeRulePendingExecution
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void removeRulePendingExecution(NodeRef actionedUponNodeRef)
{
ParameterCheck.mandatory("actionedUponNodeRef", actionedUponNodeRef);
List<PendingRuleData> pendingRules = (List<PendingRuleData>) AlfrescoTransactionSupport.getResource(KEY_RULES_PENDING);
if (pendingRules != null)
{
boolean listUpdated = false;
List<PendingRuleData> temp = new ArrayList<PendingRuleData>(pendingRules);
for (PendingRuleData pendingRuleData : temp)
{
if (pendingRuleData.getActionedUponNodeRef().equals(actionedUponNodeRef) == true)
{
// Remove from the pending list
pendingRules.remove(pendingRuleData);
listUpdated = true;
}
}
if (listUpdated == true)
{
AlfrescoTransactionSupport.bindResource(KEY_RULES_PENDING, pendingRules);
AlfrescoTransactionSupport.bindListener(this.ruleTransactionListener);
}
}
}
示例15: getUidValidityTransactionListener
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
private UidValidityTransactionListener getUidValidityTransactionListener(NodeRef folderRef)
{
String key = UIDVALIDITY_TRANSACTION_LISTENER + folderRef.toString();
UidValidityTransactionListener txnListener = AlfrescoTransactionSupport.getResource(key);
if (txnListener == null)
{
txnListener = new UidValidityTransactionListener(folderRef);
AlfrescoTransactionSupport.bindListener(txnListener);
AlfrescoTransactionSupport.bindResource(key, txnListener);
}
return txnListener;
}