本文整理汇总了Java中org.alfresco.repo.transaction.AlfrescoTransactionSupport类的典型用法代码示例。如果您正苦于以下问题:Java AlfrescoTransactionSupport类的具体用法?Java AlfrescoTransactionSupport怎么用?Java AlfrescoTransactionSupport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AlfrescoTransactionSupport类属于org.alfresco.repo.transaction包,在下文中一共展示了AlfrescoTransactionSupport类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: deleteFileCallbackCommand
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入依赖的package包/类
/**
* Called for delete file.
*/
private ResultCallback deleteFileCallbackCommand()
{
return new ResultCallback()
{
@Override
public void execute(Object result)
{
if(result instanceof NodeRef)
{
logger.debug("got node ref of deleted node");
originalNodeRef = (NodeRef)result;
}
}
@Override
public AlfrescoTransactionSupport.TxnReadState getTransactionRequired()
{
return AlfrescoTransactionSupport.TxnReadState.TXN_NONE;
}
};
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:ScenarioMultipleRenameShuffleInstance.java
示例2: onCreateNode
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入依赖的package包/类
public void onCreateNode(ChildAssociationRef childAssocRef)
{
NodeRef nodeRef = childAssocRef.getChildRef();
if (logger.isTraceEnabled())
{
logger.trace("onCreateNode: nodeRef="+nodeRef+ " ["+AlfrescoTransactionSupport.getTransactionId()+"]");
}
if (nodeService.getType(nodeRef).equals(ContentModel.TYPE_DICTIONARY_MODEL))
{
Boolean value = (Boolean)nodeService.getProperty(nodeRef, ContentModel.PROP_MODEL_ACTIVE);
if ((value != null) && (value == true))
{
queueModel(nodeRef);
}
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:DictionaryModelType.java
示例3: 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);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:PermissionServiceImpl.java
示例4: setUp
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入依赖的package包/类
@Override
public void setUp() throws Exception
{
if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE)
{
throw new AlfrescoRuntimeException(
"A previous tests did not clean up transaction: " +
AlfrescoTransactionSupport.getTransactionId());
}
transactionService = (TransactionService) ctx.getBean(ServiceRegistry.TRANSACTION_SERVICE.getLocalName());
authorityService = (AuthorityService) ctx.getBean(ServiceRegistry.AUTHORITY_SERVICE.getLocalName());
tenantAdminService = ctx.getBean("tenantAdminService", TenantAdminService.class);
personService = (PersonService) ctx.getBean(ServiceRegistry.PERSON_SERVICE.getLocalName());
tenantService = (TenantService) ctx.getBean("tenantService");
authorityBridgeTableCache = (AuthorityBridgeTableAsynchronouslyRefreshedCache) ctx.getBean("authorityBridgeTableCache");
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:AuthorityBridgeTableAsynchronouslyRefreshedCacheTest.java
示例5: execute
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入依赖的package包/类
public void execute()
{
if(state != STATE.START)
{
throw new IllegalStateException("Patch is already being applied");
}
if(!patch.requiresTransaction() && AlfrescoTransactionSupport.isActualTransactionActive())
{
throw new AlfrescoRuntimeException("Patch " +
patch.getId() +
" has been configured with requiresTransaction set to false but is being called in a transaction");
}
setup();
applyPatch();
save();
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:PatchServiceImpl.java
示例6: getApplicationId
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入依赖的package包/类
private Long getApplicationId(String applicationName)
{
ParameterCheck.mandatory("applicationName", applicationName);
AlfrescoTransactionSupport.checkTransactionReadState(true);
AuditApplication application = auditModelRegistry.getAuditApplicationByName(applicationName);
if (application == null)
{
if (logger.isDebugEnabled())
{
logger.debug("No audit application named '" + applicationName + "' has been registered.");
}
return null;
}
return application.getApplicationId();
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:AuditComponentImpl.java
示例7: getNodeChange
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入依赖的package包/类
/**
* @return the {@link NodeChange} for the supplied {@code nodeRef} from
* the current transaction context or create one if required.
*/
private NodeChange getNodeChange(NodeRef nodeRef)
{
Map<NodeRef, NodeChange> accessAuditNodes =
TransactionalResourceHelper.getMap(transactionListener);
if (accessAuditNodes.isEmpty())
{
AlfrescoTransactionSupport.bindListener(transactionListener);
}
NodeChange nodeChange = accessAuditNodes.get(nodeRef);
if (nodeChange == null)
{
nodeChange = new NodeChange(nodeInfoFactory, namespaceService, nodeRef);
nodeChange.setAuditSubActions(auditSubActions);
accessAuditNodes.put(nodeRef, nodeChange);
}
return nodeChange;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:AccessAuditor.java
示例8: setUp
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
applicationContext = ApplicationContextHelper.getApplicationContext();
if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE)
{
fail("Detected a leaked transaction from a previous test.");
}
// Get the services by name from the application context
messageService = (MessageService)applicationContext.getBean("messageService");
nodeService = (NodeService)applicationContext.getBean("NodeService");
authenticationService = (MutableAuthenticationService)applicationContext.getBean("AuthenticationService");
contentService = (ContentService) applicationContext.getBean("ContentService");
transactionService = (TransactionService) applicationContext.getBean("transactionComponent");
authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");
dictionaryDAO = (DictionaryDAO) applicationContext.getBean("dictionaryDAO");
// Re-set the current locale to be the default
Locale.setDefault(Locale.ENGLISH);
messageService.setLocale(Locale.getDefault());
testTX = transactionService.getUserTransaction();
testTX.begin();
authenticationComponent.setSystemUserAsCurrentUser();
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:MessageServiceImplTest.java
示例9: postActivity
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入依赖的package包/类
/**
* Posts activities based on the activity_type.
* If the method is called with aSync=true then a TransactionListener is used post the activity
* afterCommit. Otherwise the activity posting is done synchronously.
* @param activity_type
* @param activityInfo
* @param aSync
*/
protected void postActivity(Activity_Type activity_type, ActivityInfo activityInfo, boolean aSync)
{
if (activityInfo == null) return; //Nothing to do.
String activityType = determineActivityType(activity_type, activityInfo.getFileInfo().isFolder());
if (activityType != null)
{
if (aSync)
{
ActivitiesTransactionListener txListener = new ActivitiesTransactionListener(activityType, activityInfo,
TenantUtil.getCurrentDomain(), Activities.APP_TOOL, Activities.RESTAPI_CLIENT,
poster, retryingTransactionHelper);
AlfrescoTransactionSupport.bindListener(txListener);
}
else
{
poster.postFileFolderActivity(activityType, null, TenantUtil.getCurrentDomain(),
activityInfo.getSiteId(), activityInfo.getParentNodeRef(), activityInfo.getNodeRef(),
activityInfo.getFileName(), Activities.APP_TOOL, Activities.RESTAPI_CLIENT,
activityInfo.getFileInfo());
}
}
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:32,代码来源:NodesImpl.java
示例10: 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
示例11: setUp
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
ctx = ApplicationContextHelper.getApplicationContext();
if (AlfrescoTransactionSupport.isActualTransactionActive())
{
fail("Test started with transaction in progress");
}
transactionService = (TransactionService) ctx.getBean("transactionComponent");
repoUsageComponent = (RepoUsageComponent) ctx.getBean("repoUsageComponent");
jobLockService = (JobLockService) ctx.getBean("jobLockService");
AuthenticationUtil.setRunAsUserSystem();
txn = transactionService.getUserTransaction();
txn.begin();
restrictionsBefore = repoUsageComponent.getRestrictions();
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:RepoUsageComponentTest.java
示例12: unmakeTranslation
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入依赖的package包/类
/** @inheritDoc */
public void unmakeTranslation(NodeRef translationNodeRef)
{
if ((nodeService.hasAspect(translationNodeRef, ContentModel.ASPECT_MULTILINGUAL_EMPTY_TRANSLATION) ||
nodeService.hasAspect(translationNodeRef, ContentModel.ASPECT_MULTILINGUAL_DOCUMENT)) &&
isPivotTranslation(translationNodeRef))
{
NodeRef containerNodeRef = getMLContainer(translationNodeRef, true);
// We have not cleaned up all other translations
// Mark the container for deletion
TransactionalResourceHelper.getSet(KEY_ML_CONTAINERS_TO_DELETE).add(containerNodeRef);
AlfrescoTransactionSupport.bindListener(mlContainerCleaner);
}
// Turns the document from a translation into a normal document by removing MLDocument aspect
unmakeTranslationSimple(translationNodeRef);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:MultilingualContentServiceImpl.java
示例13: beforeCommit
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入依赖的package包/类
@Override
public void beforeCommit(boolean readOnly)
{
if (readOnly)
{
return;
}
Long changeSetId = (Long) AlfrescoTransactionSupport.getResource(RESOURCE_KEY_ACL_CHANGE_SET_ID);
if (changeSetId == null)
{
// There has not been a change
return;
}
// Update it
long commitTimeMs = System.currentTimeMillis();
aclCrudDAO.updateAclChangeSet(changeSetId, commitTimeMs);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:AclDAOImpl.java
示例14: disableBehaviour
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入依赖的package包/类
@Override
public void disableBehaviour()
{
if (logger.isDebugEnabled())
{
logger.debug("Behaviour: DISABLE (" + AlfrescoTransactionSupport.getTransactionId() + "): ALL");
}
TransactionalResourceHelper.incrementCount(KEY_FILTER_COUNT);
TransactionalResourceHelper.incrementCount(KEY_GLOBAL_FILTERS);
if (logger.isDebugEnabled())
{
logger.debug(" Now: " + TransactionalResourceHelper.getCount(KEY_GLOBAL_FILTERS));
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:BehaviourFilterImpl.java
示例15: enableBehaviour
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入依赖的package包/类
@Override
public void enableBehaviour()
{
if (logger.isDebugEnabled())
{
logger.debug("Behaviour: ENABLE (" + AlfrescoTransactionSupport.getTransactionId() + "): ALL");
}
TransactionalResourceHelper.decrementCount(KEY_FILTER_COUNT, false);
TransactionalResourceHelper.decrementCount(KEY_GLOBAL_FILTERS, false);
if (logger.isDebugEnabled())
{
logger.debug(" Now: " + TransactionalResourceHelper.getCount(KEY_GLOBAL_FILTERS));
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:BehaviourFilterImpl.java
示例16: checkTxnState
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入依赖的package包/类
/**
* Checks that the 'System' user is active in a read-write txn.
*/
private final void checkTxnState(TxnReadState txnStateNeeded)
{
switch (txnStateNeeded)
{
case TXN_READ_WRITE:
if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_READ_WRITE)
{
throw AlfrescoRuntimeException.create("system.usage.err.no_txn_readwrite");
}
break;
case TXN_READ_ONLY:
if (AlfrescoTransactionSupport.getTransactionReadState() == TxnReadState.TXN_NONE)
{
throw AlfrescoRuntimeException.create("system.usage.err.no_txn");
}
break;
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:RepoUsageComponentImpl.java
示例17: 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));
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:ContentUsageImpl.java
示例18: 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
示例19: alreadyCreated
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private boolean alreadyCreated(NodeRef nodeRef)
{
Set<NodeRef> createdNodes = (Set<NodeRef>)AlfrescoTransactionSupport.getResource(KEY_CREATED_NODES);
if (createdNodes != null)
{
for (NodeRef createdNodeRef : createdNodes)
{
if (createdNodeRef.equals(nodeRef))
{
if (logger.isDebugEnabled()) logger.debug("alreadyCreated: nodeRef="+nodeRef);
return true;
}
}
}
return false;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:ContentUsageImpl.java
示例20: registerOrphanedContentUrl
import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入依赖的package包/类
/**
* Queues orphaned content for post-transaction removal
* <p/>
* <b>NB: </b>Any content registered <u>will</u> be deleted if the current transaction
* commits and if 'eager' cleanup is turned on OR if 'force' is <tt>true</tt>.
* <p/>
* Note that listeners are not called for this process.
*
* @param force <tt>true</tt> for force the post-commit URL deletion
* regardless of the setting {@link #setEagerOrphanCleanup(boolean)}.
* @return Returns <tt>true</tt> if the content was scheduled for post-transaction deletion.
* If the return value is <tt>true</tt> then the calling code <b>must</b> delete
* the row entry for the content URL provided <b>BEFORE THE TRANSACTION COMMITS!</b>
*/
public boolean registerOrphanedContentUrl(String contentUrl, boolean force)
{
if (!eagerOrphanCleanup && !force)
{
return false;
}
Set<String> urlsToDelete = TransactionalResourceHelper.getSet(KEY_POST_COMMIT_DELETION_URLS);
urlsToDelete.add(contentUrl);
// Register to listen for transaction commit
AlfrescoTransactionSupport.bindListener(this);
// Done
if (logger.isDebugEnabled())
{
logger.debug("Scheduled content for post-commit eager cleanup: " + contentUrl);
}
return true;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:32,代码来源:EagerContentStoreCleaner.java
注:本文中的org.alfresco.repo.transaction.AlfrescoTransactionSupport类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论