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