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


Java AlfrescoTransactionSupport.unbindResource方法代码示例

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


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

示例1: rollback

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
/**
 * Roll back the transaction
 */
@SuppressWarnings("unchecked")
public void rollback()
{
    Map<StoreRef, LuceneIndexer> indexers = (Map<StoreRef, LuceneIndexer>) AlfrescoTransactionSupport.getResource(indexersKey);

    if (indexers != null)
    {
        for (LuceneIndexer indexer : indexers.values())
        {
            try
            {
                indexer.rollback();
            }
            catch (IndexerException e)
            {

            }
        }
        indexers.clear();
        AlfrescoTransactionSupport.unbindResource(indexersKey);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:AbstractLuceneIndexerAndSearcherFactory.java

示例2: setReadThrough

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
public void setReadThrough(boolean isReadThrough)
{
    if (isReadThrough)
    {
        AlfrescoTransactionSupport.bindResource(KEY_READ_THROUGH, Boolean.TRUE);
    }
    else
    {
        AlfrescoTransactionSupport.unbindResource(KEY_READ_THROUGH);
    }    
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:IndexerComponent.java

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

示例4: beforeCommit

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
/**
 * Process all the nodes that require checking within the transaction.
 */
@Override
public void beforeCommit(boolean readOnly)
{
    final Map<NodeRef, Set<QName>> nodes = getNodes();
    if (readOnly || nodes == null)
    {
        // Nothing was touched
        return;
    }
    // clear the set out of the transaction
    // there may be processes that react to the addition/removal of the aspect,
    //    and these will, in turn, lead to further events
    AlfrescoTransactionSupport.unbindResource(KEY_NODES);
    
    // Tag/untag the nodes as 'system' to prevent cm:lockable-related issues (ETHREEOH-3983)
    RunAsWork<Void> processNodesWork = new RunAsWork<Void>()
    {
        public Void doWork() throws Exception
        {
            // process each node
            for (Map.Entry<NodeRef, Set<QName>> entry : nodes.entrySet())
            {
                if (nodeService.exists(entry.getKey()))
                {
                    processNode(entry.getKey(), entry.getValue());
                }
            }
            return null;
        }
    };
    AuthenticationUtil.runAs(processNodesWork, AuthenticationUtil.getSystemUserName());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:36,代码来源:IncompleteNodeTagger.java

示例5: commit

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
/**
 * Commit the transaction
 */

@SuppressWarnings("unchecked")
public void commit() throws IndexerException
{
    Map<StoreRef, LuceneIndexer> indexers = null;
    try
    {
        indexers = (Map<StoreRef, LuceneIndexer>) AlfrescoTransactionSupport.getResource(indexersKey);
        if (indexers != null)
        {
            for (LuceneIndexer indexer : indexers.values())
            {
                if (destroyed && Thread.currentThread().isDaemon())
                {
                    rollback();
                    throw new IndexerException("Destroyed ..");
                }
                else
                {
                    try
                    {
                        indexer.commit();
                    }
                    catch (IndexerException e)
                    {
                        rollback();
                        throw e;
                    }
                }
            }
        }
    }
    finally
    {
        if (indexers != null)
        {
            indexers.clear();
            AlfrescoTransactionSupport.unbindResource(indexersKey);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:45,代码来源:AbstractLuceneIndexerAndSearcherFactory.java

示例6: checkIntegrity

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
/**
 * Runs several types of checks, querying specifically for events that
 * will necessitate each type of test.
 * <p>
 * The interface contracts also requires that all events for the transaction
 * get cleaned up.
 */
public void checkIntegrity() throws IntegrityException
{
    if (!enabled)
    {
        return;
    }
    
    // process events and check for failures
    List<IntegrityRecord> failures = processAllEvents();
    // clear out all events
    AlfrescoTransactionSupport.unbindResource(KEY_EVENT_SET);
    
    // drop out quickly if there are no failures
    if (failures.isEmpty())
    {
        return;
    }
    
    // handle errors according to instance flags
    // firstly, log all failures
    int failureCount = failures.size();
    StringBuilder sb = new StringBuilder(300 * failureCount);
    sb.append("Found ").append(failureCount).append(" integrity violations");
    if (maxErrorsPerTransaction < failureCount)
    {
        sb.append(" - first ").append(maxErrorsPerTransaction);
    }
    sb.append(":");
    int count = 0;
    for (IntegrityRecord failure : failures)
    {
        // break if we exceed the maximum number of log entries
        count++;
        if (count > maxErrorsPerTransaction)
        {
            break;
        }
        sb.append("\n").append(failure);
    }
    boolean warnOnly = IntegrityChecker.isWarnInTransaction();
    if (failOnViolation && !warnOnly)
    {
        logger.error(sb.toString());
        throw new IntegrityException(sb.toString(), failures);
    }
    else
    {
        logger.warn(sb.toString());
        // no exception
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:59,代码来源:IntegrityChecker.java


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