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


Java AlfrescoTransactionSupport.getResource方法代码示例

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


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

示例1: alreadyDeleted

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private boolean alreadyDeleted(NodeRef nodeRef)
{
    Set<NodeRef> deletedNodes = (Set<NodeRef>)AlfrescoTransactionSupport.getResource(KEY_DELETED_NODES);
    if (deletedNodes != null)
    {
        for (NodeRef deletedNodeRef : deletedNodes)
        {
            if (deletedNodeRef.equals(nodeRef))
            {
                if (logger.isDebugEnabled()) logger.debug("alreadyDeleted: nodeRef="+nodeRef);
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:ContentUsageImpl.java

示例2: beforeDeleteNodePerson

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
public void beforeDeleteNodePerson(NodeRef personNodeRef)
{
    String userId = (String)nodeService.getProperty(personNodeRef, ContentModel.PROP_USERNAME);
    //MNT-9104 If username contains uppercase letters the action of joining a site will not be displayed in "My activities" 
    if (! userNamesAreCaseSensitive)
    {
        userId = userId.toLowerCase();
    }
    Set<String> deletedUserIds = (Set<String>)AlfrescoTransactionSupport.getResource(KEY_DELETED_USER_IDS);
    if (deletedUserIds == null)
    {
        deletedUserIds = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>()); // Java 6
        AlfrescoTransactionSupport.bindResource(KEY_DELETED_USER_IDS, deletedUserIds);
    }
    
    deletedUserIds.add(userId);
    
    AlfrescoTransactionSupport.bindListener(deletePersonTransactionListener);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:FeedCleaner.java

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

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

示例5: executePendingRules

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
@Override
public void executePendingRules() 
{           
    if (AlfrescoTransactionSupport.getResource(KEY_RULES_EXECUTED) == null)
    {
    	 if (logger.isDebugEnabled() == true)
         {
             logger.debug("Creating the executed rules list");
         }
        AlfrescoTransactionSupport.bindResource(KEY_RULES_EXECUTED, new HashSet<ExecutedRuleData>());
    }
    else
    {
    	if (logger.isDebugEnabled() == true)
    	{
    		logger.debug("Executed rules list already exists");
    	}
    }
	
	List<PendingRuleData> executeAtEndRules = new ArrayList<PendingRuleData>();
    executePendingRulesImpl(executeAtEndRules);
    for (PendingRuleData data : executeAtEndRules)
    {
        executePendingRule(data);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:RuleServiceImpl.java

示例6: executePendingRulesImpl

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
/**
 * Executes the pending rules, iterating until all pending rules have been executed
 */
@SuppressWarnings("unchecked")
private void executePendingRulesImpl(List<PendingRuleData> executeAtEndRules)
{
    // get the transaction-local rules to execute
    List<PendingRuleData> pendingRules =
            (List<PendingRuleData>) AlfrescoTransactionSupport.getResource(KEY_RULES_PENDING);
    // only execute if there are rules present
    if (pendingRules != null && !pendingRules.isEmpty())
    {
        PendingRuleData[] pendingRulesArr = pendingRules.toArray(new PendingRuleData[0]);
        // remove all pending rules from the transaction
        AlfrescoTransactionSupport.unbindResource(KEY_RULES_PENDING);
        // execute each rule
        for (PendingRuleData pendingRule : pendingRulesArr) 
        {
            if (pendingRule.getExecuteAtEnd() == false)
            {
                executePendingRule(pendingRule);
            }
            else
            {
                executeAtEndRules.add(pendingRule);
            }
        }
        
        // Run any rules that have been marked as pending during execution
        executePendingRulesImpl(executeAtEndRules);
    }   
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:33,代码来源:RuleServiceImpl.java

示例7: flush

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void flush()
{
    // TODO: Needs fixing if we expose the indexer in JTA
    Map<StoreRef, LuceneIndexer> indexers = (Map<StoreRef, LuceneIndexer>) AlfrescoTransactionSupport.getResource(indexersKey);

    if (indexers != null)
    {
        for (LuceneIndexer indexer : indexers.values())
        {
            indexer.flushPending();
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:15,代码来源:AbstractLuceneIndexerAndSearcherFactory.java

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

示例9: updateAllScopeTags

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void updateAllScopeTags(NodeRef nodeRef, NodeRef parentNodeRef, Boolean isAdd)
{
    if (parentNodeRef != null)
    {
        // Grab an currently pending changes for this node
        Map<NodeRef, Map<String, Boolean>> allQueuedUpdates = (Map<NodeRef, Map<String, Boolean>>)AlfrescoTransactionSupport.getResource(TAG_UPDATES);
        Map<String, Boolean> nodeQueuedUpdates = null;
        if (allQueuedUpdates != null)
        {
            nodeQueuedUpdates = allQueuedUpdates.get(nodeRef);
        }
        
        // Record the changes for the node, cancelling out existing
        //  changes if needed
        List<String> tags = getTags(nodeRef);
        Map<String, Boolean> tagUpdates = new HashMap<String, Boolean>(tags.size());
        for (String tag : tags)
        {
            tagUpdates.put(tag, isAdd);

            if (nodeQueuedUpdates != null)
            {
                Boolean queuedOp = (Boolean)nodeQueuedUpdates.get(tag);
                if ((queuedOp != null) && (queuedOp.booleanValue() == isAdd.booleanValue()))
                {
                    // dequeue - will be handled synchronously
                    nodeQueuedUpdates.remove(tag);
                }
            }
        }
        
        // Find the parent tag scopes and update them
        updateTagScope(parentNodeRef, tagUpdates);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:37,代码来源:TaggingServiceImpl.java

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

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

示例12: recordCreate

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void recordCreate(NodeRef nodeRef)
{
    Set<NodeRef> createdNodes = (Set<NodeRef>)AlfrescoTransactionSupport.getResource(KEY_CREATED_NODES);
    if (createdNodes == null)
    {
        createdNodes = new HashSet<NodeRef>();
        AlfrescoTransactionSupport.bindResource(KEY_CREATED_NODES, createdNodes);
    }
    createdNodes.add(tenantService.getName(nodeRef));
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:ContentUsageImpl.java

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

示例14: beforeCommit

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void beforeCommit(boolean readOnly)
{
    QueueContext queueContext = (QueueContext)AlfrescoTransactionSupport.getResource(QUEUE_CONTEXT_KEY);
    ExecutionContext context = queueContext.queue.poll();
    while (context != null)
    {
        execute(context);
        context = queueContext.queue.poll();
    }
    queueContext.committed = true;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:13,代码来源:TransactionBehaviourQueue.java

示例15: prepare

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
/**
 * Prepare the transaction TODO: Store prepare results
 * 
 * @return - the tx code
 */
@SuppressWarnings("unchecked")
public int prepare() throws IndexerException
{
    boolean isPrepared = true;
    boolean isModified = false;
    Map<StoreRef, LuceneIndexer> indexers = (Map<StoreRef, LuceneIndexer>) AlfrescoTransactionSupport.getResource(indexersKey);
    if (indexers != null)
    {
        for (LuceneIndexer indexer : indexers.values())
        {
            try
            {
                isModified |= indexer.isModified();
                indexer.prepare();
            }
            catch (IndexerException e)
            {
                isPrepared = false;
                throw new IndexerException("Failed to prepare: requires rollback", e);
            }
        }
    }
    if (isPrepared)
    {
        if (isModified)
        {
            return XAResource.XA_OK;
        }
        else
        {
            return XAResource.XA_RDONLY;
        }
    }
    else
    {
        throw new IndexerException("Failed to prepare: requires rollback");
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:44,代码来源:AbstractLuceneIndexerAndSearcherFactory.java


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