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


Java AlfrescoTransactionSupport.bindListener方法代码示例

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


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

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

示例2: saveAssoc

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
/**
 * Ensures that this service is registered with the transaction and saves the node
 * reference for use (association check) later.
 * 
 * @param nodeRef NodeRef
 * @param assocType QName
 */
private void saveAssoc(NodeRef nodeRef, QName assocType)
{
    // register this service
    AlfrescoTransactionSupport.bindListener(this);

    Set<QName> assocs = save(nodeRef);
    if (assocs == null)
    {
        assocs = new HashSet<QName>(7, 0.75f);
        Map<NodeRef, Set<QName>> nodes = getNodes();
        nodes.put(nodeRef, assocs);
    }
    if (assocType != null)
    {
        assocs.add(assocType);
    }
    // done
    if (logger.isDebugEnabled())
    {
        logger.debug("Added association to node: " + nodeRef + ", " + assocType);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:30,代码来源:IncompleteNodeTagger.java

示例3: addToScheduler

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
/**
 * Builds up the Quartz details, and adds it to the Quartz
 *  scheduler when the transaction completes.
 * We have to wait for the transaction to finish, otherwise
 *  Quartz may end up trying and failing to load the details
 *  of a job that hasn't been committed to the repo yet!
 */
protected void addToScheduler(ScheduledPersistedActionImpl schedule)
{
    // Wrap it up in Quartz bits
    final JobDetail details = buildJobDetail(schedule);
    final Trigger trigger = schedule.asTrigger();

    // As soon as the transaction commits, add it
    AlfrescoTransactionSupport.bindListener(
       new TransactionListenerAdapter() {
           @Override
           public void afterCommit() {
              // Schedule it with Quartz
              try
              {
                  scheduler.scheduleJob(details, trigger);
              }
              catch (SchedulerException e)
              {
                  // Probably means scheduler is shutting down
                  log.warn(e);
              }
           }
       }
    );
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:33,代码来源:ScheduledPersistedActionServiceImpl.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: 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

示例6: broadcastEvent

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
/**
 * Broadcast event.
 * 
 * @param event
 *            the event
 */
private void broadcastEvent(PropertyBackedBeanEvent event)
{
    // If the system is up and running, broadcast the event immediately
    if (this.isSchemaAvailable && this.wasDictionaryBootstrapped)
    {
        // If we have a transaction, the changed properties in it should be updated earlier,
        // then the bean restart message will be sent to other node
        // see ALF-20066
        if (AlfrescoTransactionSupport.getTransactionId() != null &&
                (event instanceof PropertyBackedBeanStartedEvent ||
                event instanceof PropertyBackedBeanStoppedEvent))
        {
            this.afterTransactionEvents.add(event);
            AlfrescoTransactionSupport.bindListener(this);
        }
        else
        {
            for (ApplicationListener listener : this.listeners)
            {
                listener.onApplicationEvent(event);
            }
        }
    }
    // Otherwise, defer broadcasting until the schema available event is handled
    else
    {
        this.deferredEvents.add(event);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:36,代码来源:DefaultPropertyBackedBeanRegistry.java

示例7: queueModel

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void queueModel(NodeRef nodeRef)
{
    Set<NodeRef> pendingModels = (Set<NodeRef>)AlfrescoTransactionSupport.getResource(KEY_PENDING_MODELS);
    if (pendingModels == null)
    {
        //pendingModels = Collections.newSetFromMap(new ConcurrentHashMap()); // Java 6
        pendingModels = new CopyOnWriteArraySet<NodeRef>();
        AlfrescoTransactionSupport.bindResource(KEY_PENDING_MODELS, pendingModels);
    }
    pendingModels.add(tenantService.getName(nodeRef));
    
    AlfrescoTransactionSupport.bindListener(this.transactionListener);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:15,代码来源:DictionaryModelType.java

示例8: setInheritParentPermissions

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
@Override
@Extend(traitAPI = PermissionServiceTrait.class, extensionAPI = PermissionServiceExtension.class)
public void setInheritParentPermissions(NodeRef nodeRef, final boolean inheritParentPermissions, boolean asyncCall)
{
    final NodeRef actualRef = tenantService.getName(nodeRef);
    if (asyncCall)
    {
        //use transaction resource to determine later on in ADMAccessControlListDAO.setFixedAcl if asynchronous call may be required
        AlfrescoTransactionSupport.bindResource(FixedAclUpdater.FIXED_ACL_ASYNC_CALL_KEY, true);
        permissionsDaoComponent.setInheritParentPermissions(actualRef, inheritParentPermissions);
        //check if asynchronous call was required
        boolean asyncCallRequired = toBoolean((Boolean) AlfrescoTransactionSupport.getResource(FixedAclUpdater.FIXED_ACL_ASYNC_REQUIRED_KEY));
        if (asyncCallRequired)
        {
            //after transaction is committed FixedAclUpdater will be started in a new thread to process pending nodes 
            AlfrescoTransactionSupport.bindListener(fixedAclUpdater);
        } 
        invokeOnPermissionsInheritedPolicy(nodeRef, inheritParentPermissions, asyncCallRequired);
    }
    else
    {
        //regular method call
        permissionsDaoComponent.setInheritParentPermissions(actualRef, inheritParentPermissions);
        
        invokeOnPermissionsInheritedPolicy(nodeRef, inheritParentPermissions, false);
    }
    
    accessCache.clear();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:30,代码来源:PermissionServiceImpl.java

示例9: testGetAllStores

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
public void testGetAllStores() throws Exception
{
    final RetryingTransactionCallback<Object> txnWork = new RetryingTransactionCallback<Object>()
    {
        public Boolean execute() throws Exception
        {
            // The listener
            final TestAfterRollbackTxnListener listener = new TestAfterRollbackTxnListener();
            AlfrescoTransactionSupport.bindListener(listener);

            NodeRef content = createContent(serviceRegistry);

            ContentWriter writer = contentService.getWriter(content, ContentModel.PROP_CONTENT, true);
            writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
            writer.putContent("The quick brown fox jumps over the lazy dog");

            throw new AlfrescoRuntimeException("Some error that causes RollBack. The transaction will be closed");
        }
    };

    try
    {
        serviceRegistry.getTransactionService().getRetryingTransactionHelper().doInTransaction(txnWork, false, false);
    }
    catch (AlfrescoRuntimeException e)
    {
        // Expected
    }

    assertFalse("getAllStores method returned the list with null entry", isNullEntry);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:32,代码来源:AbstractTenantRoutingContentStoreTest.java

示例10: onContentUpdate

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
/**
 * When content changes, thumbnails are (re)generated.
 * 
 * @param nodeRef
 *            the node ref
 * @param newContent
 *            is the content new?
 */
public void onContentUpdate(NodeRef nodeRef, boolean newContent)
{
    if (!this.nodeService.getType(nodeRef).equals(ContentModel.TYPE_THUMBNAIL)
            && this.nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT) != null)
    {
        // Bind this service to the transaction and add the node to the set of nodes to thumbnail post txn
        AlfrescoTransactionSupport.bindListener(this);
        getPostTxnNodesToThumbnail().add(nodeRef);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:SimpleThumbnailer.java

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

示例12: registerDereferencedContentUrl

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
/**
 * A <b>content_url</b> entity was dereferenced.  This makes no assumptions about the
 * current references - dereference deletion is handled in the commit phase.
 */
protected void registerDereferencedContentUrl(String contentUrl)
{
    Set<String> contentUrls = TransactionalResourceHelper.getSet(KEY_PRE_COMMIT_CONTENT_URL_DELETIONS);
    if (contentUrls.size() == 0)
    {
        ContentUrlDeleteTransactionListener listener = new ContentUrlDeleteTransactionListener();
        AlfrescoTransactionSupport.bindListener(listener);
    }
    contentUrls.add(contentUrl);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:15,代码来源:AbstractContentDataDAOImpl.java

示例13: deleteTranslationContainer

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
/** @inheritDoc */
public void deleteTranslationContainer(NodeRef mlContainerNodeRef)
{
    if (!ContentModel.TYPE_MULTILINGUAL_CONTAINER.equals(nodeService.getType(mlContainerNodeRef)))
    {
        throw new IllegalArgumentException(
                "Node type must be " + ContentModel.TYPE_MULTILINGUAL_CONTAINER);
    }

    // get the translations
    Map<Locale, NodeRef> translations = this.getTranslations(mlContainerNodeRef);

    // remember the number of childs
    int translationCount = translations.size();

    // remove the translations
    for(NodeRef translationToRemove : translations.values())
    {
        if (!nodeService.exists(translationToRemove))
        {
            // We've just queried for these
            throw new ConcurrencyFailureException("Translation has been deleted externally: " + translationToRemove);
        }
        nodeService.deleteNode(translationToRemove);
    }

    // Keep track of the container for pre-commit deletion
    TransactionalResourceHelper.getSet(KEY_ML_CONTAINERS_TO_DELETE).add(mlContainerNodeRef);
    AlfrescoTransactionSupport.bindListener(mlContainerCleaner);

    // done
    if (logger.isDebugEnabled())
    {
        logger.debug("ML container removed: \n" +
                "   Container:  " + mlContainerNodeRef + "\n" +
                "   Number of translations: " + translationCount);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:39,代码来源:MultilingualContentServiceImpl.java

示例14: registerNewContentUrl

import org.alfresco.repo.transaction.AlfrescoTransactionSupport; //导入方法依赖的package包/类
/**
 * Queues orphaned content for post-transaction removal
 */
public void registerNewContentUrl(String contentUrl)
{
    Set<String> urlsToDelete = TransactionalResourceHelper.getSet(KEY_POST_ROLLBACK_DELETION_URLS);
    urlsToDelete.add(contentUrl);
    // Register to listen for transaction rollback
    AlfrescoTransactionSupport.bindListener(this);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:11,代码来源:EagerContentStoreCleaner.java

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


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