本文整理汇总了Java中org.alfresco.repo.transaction.AlfrescoTransactionSupport类的典型用法代码示例。如果您正苦于以下问题:Java AlfrescoTransactionSupport类的具体用法?Java AlfrescoTransactionSupport怎么用?Java AlfrescoTransactionSupport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AlfrescoTransactionSupport类属于org.alfresco.repo.transaction包,在下文中一共展示了AlfrescoTransactionSupport类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
};
}
示例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);
}
}
}
示例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);
}
示例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();
}
示例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();
}
示例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;
}
示例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();
}
示例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());
}
}
}
示例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);
}
}
示例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();
}
示例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);
}
示例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);
}
示例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));
}
}
示例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));
}
}