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


Java NotificationFrequency.TRANSACTION_COMMIT属性代码示例

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


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

示例1: onCreateReference

/**
 * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnCreateReference#onCreateReference(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
 */
@Override
@Behaviour
(
   kind = BehaviourKind.CLASS,
   notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT
)
public void onCreateReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference)
{
    // Deal with versioned records
    if (reference.equals(CUSTOM_REF_VERSIONS))
    {
        // Apply the versioned aspect to the from node
        nodeService.addAspect(fromNodeRef, ASPECT_VERSIONED_RECORD, null);
    }

    // Execute script if for the reference event
    executeReferenceScript("onCreate", reference, fromNodeRef, toNodeRef);
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:21,代码来源:RecordAspect.java

示例2: onUpdateProperties

/**
 * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map)
 */
@Override
@Behaviour
(
   kind = BehaviourKind.CLASS,
   notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT
)
public void onUpdateProperties(final NodeRef nodeRef, final Map<QName, Serializable> before, final Map<QName, Serializable> after)
{
    AuthenticationUtil.runAs(new RunAsWork<Void>()
    {
        @Override
        public Void doWork()
        {
            if (nodeService.exists(nodeRef))
            {
                lookupAndExecuteScripts(nodeRef, before, after);
            }

            return null;
        }
    }, AuthenticationUtil.getAdminUserName());
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:25,代码来源:FilePlanComponentAspect.java

示例3: onCopyComplete

@SuppressWarnings("rawtypes")
@Override
@Behaviour
(
   kind = BehaviourKind.CLASS,
   notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT
)
public void onCopyComplete(QName classRef, NodeRef sourceNodeRef, NodeRef targetNodeRef, boolean copyToNewNode, Map copyMap)
{
    //Generate the id for the copy
    String id = identifierService.generateIdentifier(
                                        nodeService.getType(nodeService.getPrimaryParent(targetNodeRef).getParentRef()),
                                        nodeService.getPrimaryParent(targetNodeRef).getParentRef());

    //We need to allow the id to be overwritten disable the policy protecting changes to the id
    behaviourFilter.disableBehaviour();
    try
    {
        nodeService.setProperty(targetNodeRef, PROP_IDENTIFIER, id);
    }
    finally
    {
        behaviourFilter.enableBehaviour();
    }
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:25,代码来源:RecordComponentIdentifierAspect.java

示例4: setUp

@Override
protected void setUp() throws Exception
{
    applicationContext = ApplicationContextHelper.getApplicationContext();
    // initialise policy test model
    DictionaryBootstrap bootstrap = new DictionaryBootstrap();
    List<String> bootstrapModels = new ArrayList<String>();
    bootstrapModels.add(TEST_MODEL);
    bootstrap.setModels(bootstrapModels);
    bootstrap.setDictionaryDAO((DictionaryDAO)applicationContext.getBean("dictionaryDAO"));
    bootstrap.setTenantService((TenantService)applicationContext.getBean("tenantService"));
    bootstrap.bootstrap();
    
    // retrieve policy component
    this.policyComponent = (PolicyComponent)applicationContext.getBean("policyComponent");
    this.behaviourFilter = (BehaviourFilter) applicationContext.getBean("policyBehaviourFilter");
    this.trxService = (TransactionService) applicationContext.getBean("transactionComponent");
    this.nodeService = (NodeService) applicationContext.getBean("nodeService");
    this.nodeLocatorService = (NodeLocatorService) applicationContext.getBean("nodeLocatorService");
    this.authenticationComponent = (AuthenticationComponent)applicationContext.getBean("authenticationComponent");
    this.authenticationComponent.setSystemUserAsCurrentUser();
    
    // Register Policy
    if (sideEffectDelegate == null)
    {
     sideEffectDelegate = policyComponent.registerClassPolicy(SideEffectTestPolicy.class);
	
     // Bind Behaviour to side effect policy
     QName policyName = QName.createQName(TEST_NAMESPACE, "sideEffect");
     Behaviour baseBehaviour = new JavaBehaviour(this, "sideEffectTest", NotificationFrequency.TRANSACTION_COMMIT);
     this.policyComponent.bindClassBehaviour(policyName, BASE_TYPE, baseBehaviour);
    }

    this.companyHome = nodeLocatorService.getNode(CompanyHomeNodeLocator.NAME, null, null);
    createAndEnableBehaviours();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:36,代码来源:PolicyComponentTransactionTest.java

示例5: init

public void init() {
	if (logger.isDebugEnabled()) logger.debug("Initializing process invitation behavior");

	// Create behaviours
	this.onUpdateNode = new JavaBehaviour(this, "onUpdateNode", NotificationFrequency.TRANSACTION_COMMIT);

	// Bind behaviours to node policies
	this.policyComponent.bindClassBehaviour(
		QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateNode"),
		ContentModel.ASPECT_EMAILED,
		this.onUpdateNode
	);
}
 
开发者ID:jpotts,项目名称:share-inbound-invites,代码行数:13,代码来源:OnEmailedNodeUpdate.java

示例6: init

public void init() {
	if (logger.isDebugEnabled()) logger.debug("Initializing site node update behavior");

	// Create behaviours
	this.onUpdateNode = new JavaBehaviour(this, "onUpdateNode", NotificationFrequency.TRANSACTION_COMMIT);

	// Bind behaviours to node policies
	this.policyComponent.bindClassBehaviour(
		QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateNode"),
		SiteModel.TYPE_SITE,
		this.onUpdateNode
	);
}
 
开发者ID:jpotts,项目名称:share-inbound-invites,代码行数:13,代码来源:OnSiteNodeUpdate.java

示例7: setUp

@Override
protected void setUp() throws Exception
{
    // initialise policy test model
    DictionaryBootstrap bootstrap = new DictionaryBootstrap();
    List<String> bootstrapModels = new ArrayList<String>();
    bootstrapModels.add(TEST_MODEL);
    bootstrap.setModels(bootstrapModels);
    bootstrap.setDictionaryDAO((DictionaryDAO)applicationContext.getBean("dictionaryDAO"));
    bootstrap.setTenantService((TenantService)applicationContext.getBean("tenantService"));
    bootstrap.bootstrap();
    
    // retrieve policy component
    this.policyComponent = (PolicyComponent)applicationContext.getBean("policyComponent");
    this.behaviourFilter = (BehaviourFilter) applicationContext.getBean("policyBehaviourFilter");
    this.trxService = (TransactionService) applicationContext.getBean("transactionComponent");
    this.nodeService = (NodeService) applicationContext.getBean("nodeService");
    this.nodeLocatorService = (NodeLocatorService) applicationContext.getBean("nodeLocatorService");
    this.authenticationComponent = (AuthenticationComponent)applicationContext.getBean("authenticationComponent");
    this.authenticationComponent.setSystemUserAsCurrentUser();
    
    // Register Policy
    if (sideEffectDelegate == null)
    {
     sideEffectDelegate = policyComponent.registerClassPolicy(SideEffectTestPolicy.class);
	
     // Bind Behaviour to side effect policy
     QName policyName = QName.createQName(TEST_NAMESPACE, "sideEffect");
     Behaviour baseBehaviour = new JavaBehaviour(this, "sideEffectTest", NotificationFrequency.TRANSACTION_COMMIT);
     this.policyComponent.bindClassBehaviour(policyName, BASE_TYPE, baseBehaviour);
    }

    this.companyHome = nodeLocatorService.getNode(CompanyHomeNodeLocator.NAME, null, null);
    createAndEnableBehaviours();
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:35,代码来源:PolicyComponentTransactionTest.java

示例8: onCreateChildAssociation

/**
 * Behaviour to ensure renditions have the appropriate extended security.
 *
 * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean)
 */
@Override
@Behaviour
(
   kind = BehaviourKind.ASSOCIATION,
   assocType = "rn:rendition",
   notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT
)
public void onCreateChildAssociation(final ChildAssociationRef childAssocRef, boolean bNew)
{
    authenticationUtil.runAsSystem(new RunAsWork<Void>()
    {
        @Override
        public Void doWork()
        {
            NodeRef thumbnail = childAssocRef.getChildRef();

            if (nodeService.exists(thumbnail))
            {
                // apply file plan component aspect to thumbnail
                nodeService.addAspect(thumbnail, ASPECT_FILE_PLAN_COMPONENT, null);

                // manage any extended readers
                NodeRef parent = childAssocRef.getParentRef();
                Set<String> readers = extendedSecurityService.getExtendedReaders(parent);
                Set<String> writers = extendedSecurityService.getExtendedWriters(parent);
                if (readers != null && readers.size() != 0)
                {
                    extendedSecurityService.addExtendedSecurity(thumbnail, readers, writers, false);
                }
            }

            return null;
        }
    });
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:40,代码来源:RecordAspect.java

示例9: onRemoveReference

/**
 * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnRemoveReference#onRemoveReference(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
 */
@Override
@Behaviour
(
   kind = BehaviourKind.CLASS,
   notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT
)
public void onRemoveReference(final NodeRef fromNodeRef, NodeRef toNodeRef, QName reference)
{
    // Deal with versioned records
    if (reference.equals(CUSTOM_REF_VERSIONS))
    {
        authenticationUtil.runAsSystem(new RunAsWork<Void>()
        {
            @Override
            public Void doWork()
            {
                // Apply the versioned aspect to the from node
                nodeService.removeAspect(fromNodeRef, ASPECT_VERSIONED_RECORD);

                return null;
            }
        });
    }

    // Execute script if for the reference event
    executeReferenceScript("onRemove", reference, fromNodeRef, toNodeRef);
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:30,代码来源:RecordAspect.java

示例10: onAddAspect

@Override
@Behaviour
(
        kind = BehaviourKind.CLASS,
        notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT
)
public void onAddAspect(final NodeRef record, final QName aspectTypeQName)
{
    AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
    {
        @Override
        public Void doWork()
        {
            if (nodeService.exists(record) &&
                isRecord(record))
            {
                // get the owning record folder
                NodeRef recordFolder = nodeService.getPrimaryParent(record).getParentRef();
                // check that the aspect has been added
                if (nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN))
                {
                    // increment current count
                    int currentCount = (Integer)nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT);
                    currentCount = currentCount + 1;
                    nodeService.setProperty(recordFolder, PROP_HELD_CHILDREN_COUNT, currentCount);
                }
            }
            return null;
        }
    });        
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:31,代码来源:FrozenAspect.java

示例11: onRemoveAspect

@Override
@Behaviour
(
        kind = BehaviourKind.CLASS,
        notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT
)
public void onRemoveAspect(final NodeRef record, QName aspectTypeQName)
{
    AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
    {
        @Override
        public Void doWork()
        {
            if (nodeService.exists(record) &&
                isRecord(record))
            {
                // get the owning record folder
                NodeRef recordFolder = nodeService.getPrimaryParent(record).getParentRef();
    
                // check that the aspect has been added
                if (nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN))
                {
                    // decrement current count
                    int currentCount = (Integer)nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT);
                    if (currentCount > 0)
                    {
                        currentCount = currentCount - 1;
                        nodeService.setProperty(recordFolder, PROP_HELD_CHILDREN_COUNT, currentCount);
                    }
                }                   
            }
            return null;
        }
    }); 
    
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:36,代码来源:FrozenAspect.java

示例12: onAddAspect

/**
 * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
 */
@Override
@Behaviour
(
        kind = BehaviourKind.CLASS,
        notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT
)
public void onAddAspect(NodeRef nodeRef, QName aspectTypeQName)
{
    if (nodeService.exists(nodeRef) &&
        dispositionService.getAssociatedDispositionSchedule(nodeRef) == null)
    {
       dispositionService.createDispositionSchedule(nodeRef, null);
    }
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:17,代码来源:ScheduledAspect.java

示例13: onAddAspect

/**
 * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
 */
@Override
@Behaviour
(
   kind = BehaviourKind.CLASS,
   notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT
)
public void onAddAspect(final NodeRef nodeRef, final QName aspectTypeQName)
{
    AuthenticationUtil.runAs(new RunAsWork<Void>()
    {
        @Override
        public Void doWork()
        {
            if (nodeService.exists(nodeRef))
            {
                // Look up the root and set on the aspect if found
                NodeRef root = filePlanService.getFilePlan(nodeRef);
                if (root != null)
                {
                    nodeService.setProperty(nodeRef, PROP_ROOT_NODEREF, root);
                }
            }

            return null;
        }
    }, AuthenticationUtil.getSystemUserName());
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:30,代码来源:FilePlanComponentAspect.java

示例14: onMoveNode

/**
 * @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef)
 */
@Override
@Behaviour
(
   kind = BehaviourKind.CLASS,
   notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT
)
public void onMoveNode(final ChildAssociationRef oldChildAssocRef, final ChildAssociationRef newChildAssocRef)
{
    AuthenticationUtil.runAs(new RunAsWork<Void>()
    {
        @Override
        public Void doWork()
        {
            if (nodeService.exists(newChildAssocRef.getParentRef()) &&
                nodeService.exists(newChildAssocRef.getChildRef()))
            {
                // Look up the root and re-set the value currently stored on the aspect
                NodeRef root = filePlanService.getFilePlan(newChildAssocRef.getParentRef());
                // NOTE: set the null value if no root found
                nodeService.setProperty(newChildAssocRef.getChildRef(), PROP_ROOT_NODEREF, root);
            }

            return null;
        }
    }, AuthenticationUtil.getSystemUserName());
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:29,代码来源:FilePlanComponentAspect.java

示例15: onUpdateProperties

/**
 * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map)
 */
@Override
@Behaviour
(
        kind = BehaviourKind.CLASS,
        notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT
)
public void onUpdateProperties(final NodeRef nodeRef, final Map<QName, Serializable> before, final Map<QName, Serializable> after)
{
    AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
    {
        public Void doWork()
        {
            if (nodeService.exists(nodeRef) &&
                nodeService.hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT))
            {
                // check that vital record definition has been changed in the first place
                Map<QName, Serializable> changedProps = PropertyMap.getChangedProperties(before, after);
                if (changedProps.containsKey(PROP_VITAL_RECORD_INDICATOR) ||
                    changedProps.containsKey(PROP_REVIEW_PERIOD))
                {
                    recordsManagementActionService.executeRecordsManagementAction(nodeRef, "broadcastVitalRecordDefinition");
                }
            }
            return null;
        }
    });
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:30,代码来源:VitalRecordDefinitionAspect.java


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