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


Java NotificationFrequency类代码示例

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


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

示例1: init

import org.alfresco.repo.policy.Behaviour.NotificationFrequency; //导入依赖的package包/类
/**
 * Init method.  Registered behaviours.
 */
public void init()
{  
    PropertyCheck.mandatory(this, "actionService", getActionService());
    PropertyCheck.mandatory(this, "policyComponent", getPolicyComponent());
    
    /**
     * Bind policies
     */
    this.getPolicyComponent().bindClassBehaviour(OnAddAspectPolicy.QNAME, 
        ImapModel.ASPECT_IMAP_CONTENT, 
        new JavaBehaviour(this, "onAddAspect", NotificationFrequency.TRANSACTION_COMMIT));
    
    /**
     * Bind policies
     */
    this.getPolicyComponent().bindClassBehaviour(OnCopyNodePolicy.QNAME , 
        ImapModel.ASPECT_IMAP_CONTENT, 
        new JavaBehaviour(this, "getCopyCallback", NotificationFrequency.EVERY_EVENT));
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:ImapContentPolicy.java

示例2: createList

import org.alfresco.repo.policy.Behaviour.NotificationFrequency; //导入依赖的package包/类
/**
 * Construct a collection of Policy implementations for the specified binding
 * 
 * @param binding  the binding
 * @return  the collection of policy implementations
 */
@SuppressWarnings("unchecked")
public Collection<P> createList(B binding)
{
    Collection<BehaviourDefinition> behaviourDefs = index.find(binding);
    List<P> policyInterfaces = new ArrayList<P>(behaviourDefs.size());
    for (BehaviourDefinition behaviourDef : behaviourDefs)
    {
        Behaviour behaviour = behaviourDef.getBehaviour();
        P policyIF = behaviour.getInterface(policyClass);
        if (!(behaviour.getNotificationFrequency().equals(NotificationFrequency.EVERY_EVENT)))
        {
            // wrap behaviour in transaction proxy which deals with delaying invocation until necessary
            if (transactionHandlerFactory == null)
            {
                throw new PolicyException("Transaction-level policies not supported as transaction support for the Policy Component has not been initialised.");
            }
            InvocationHandler trxHandler = transactionHandlerFactory.createHandler(behaviour, behaviourDef.getPolicyDefinition(), policyIF);
            policyIF = (P)Proxy.newProxyInstance(policyClass.getClassLoader(), new Class[]{policyClass}, trxHandler);
        }
        policyInterfaces.add(policyIF);
    }
    
    return policyInterfaces;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:31,代码来源:PolicyFactory.java

示例3: beforeDeleteNode

import org.alfresco.repo.policy.Behaviour.NotificationFrequency; //导入依赖的package包/类
/**
 * Behaviour unfreezes node's that will no longer he held after delete.
 *
 * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef)
 */
@Behaviour(kind=BehaviourKind.CLASS, type="rma:hold", notificationFrequency=NotificationFrequency.EVERY_EVENT)
@Override
public void beforeDeleteNode(final NodeRef hold)
{
    if (nodeService.exists(hold) && isHold(hold))
    {
        RunAsWork<Void> work = new RunAsWork<Void>()
        {
            @Override
            public Void doWork()
            {
                List<NodeRef> frozenNodes = getHeld(hold);
                for (NodeRef frozenNode : frozenNodes)
                {
                    removeFreezeAspect(frozenNode, 1);
                }

                return null;
            }
        };

        // run as system user
        authenticationUtil.runAsSystem(work);
    }
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:31,代码来源:HoldServiceImpl.java

示例4: onCreateReference

import org.alfresco.repo.policy.Behaviour.NotificationFrequency; //导入依赖的package包/类
/**
 * @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,代码行数:22,代码来源:RecordAspect.java

示例5: onContentUpdate

import org.alfresco.repo.policy.Behaviour.NotificationFrequency; //导入依赖的package包/类
/**
 * Ensure that the content of a ghosted node can not be updated.
 *
 * @see org.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy#onContentUpdate(org.alfresco.service.cmr.repository.NodeRef, boolean)
 */
@Override
@Behaviour
(
   // required, use ASSOC for association behaviors
   kind = BehaviourKind.CLASS,
   // (defaults to EVERY_EVENT)
   notificationFrequency = NotificationFrequency.EVERY_EVENT,
   // (defaults to alf:<methodname>)
   policy = "alf:onContentUpdate",
   // required, unless defaultType set
   type = "rma:ghosted"

   // isService (default false)
   // name (only needs to specified if associated behvaiour object needs to be accessed)
   // assocType (defaults to cm:contains, used with BehaviourKind.ASSOC)
)
public void onContentUpdate(NodeRef content, boolean bNew)
{
    throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_GHOSTED_PROP_UPDATE));
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:26,代码来源:GhostedAspect.java

示例6: onUpdateProperties

import org.alfresco.repo.policy.Behaviour.NotificationFrequency; //导入依赖的package包/类
/**
 * @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,代码行数:26,代码来源:FilePlanComponentAspect.java

示例7: onAddAspect

import org.alfresco.repo.policy.Behaviour.NotificationFrequency; //导入依赖的package包/类
/**
 * @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.EVERY_EVENT
)
public void onAddAspect(final NodeRef nodeRef, final QName aspect)
{
    if (nodeService.exists(nodeRef))
    {
        AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
        {
            @Override
            public Void doWork()
            {
                dispositionService.refreshDispositionAction(nodeRef);
                return null;
            }
        });
    }
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:25,代码来源:DispositionLifecycleAspect.java

示例8: beforeDeleteNode

import org.alfresco.repo.policy.Behaviour.NotificationFrequency; //导入依赖的package包/类
/**
 * Cleans up the {@link RecordsManagementModel#PROP_IDENTIFIER rma:identifier} property unique triplet.
 *
 * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef)
 */
@Override
@Behaviour
(
   kind = BehaviourKind.CLASS,
   notificationFrequency = NotificationFrequency.EVERY_EVENT
)
public void beforeDeleteNode(final NodeRef nodeRef)
{
    AuthenticationUtil.runAs(new RunAsWork<Object>()
    {
        public Object doWork()
        {
            String beforeId = (String) nodeService.getProperty(nodeRef, PROP_IDENTIFIER);
            updateUniqueness(nodeRef, beforeId, null);
            return null;
        }
    }, AuthenticationUtil.getSystemUserName());
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:24,代码来源:RecordComponentIdentifierAspect.java

示例9: onCopyComplete

import org.alfresco.repo.policy.Behaviour.NotificationFrequency; //导入依赖的package包/类
@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,代码行数:26,代码来源:RecordComponentIdentifierAspect.java

示例10: onUpdateProperties

import org.alfresco.repo.policy.Behaviour.NotificationFrequency; //导入依赖的package包/类
/**
* Ensure that the visibility of a RM site can not be changed to anything but public.
*
* TODO support other site visibilities
*
* @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map)
*/
  @Behaviour
  (
          kind = BehaviourKind.CLASS,
          notificationFrequency = NotificationFrequency.FIRST_EVENT
  )
  public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after)
  {
      if (nodeService.exists(nodeRef))
      {
          Map<QName, Serializable> changed = PropertyMap.getChangedProperties(before, after);
          if (changed.containsKey(SiteModel.PROP_SITE_VISIBILITY) &&
              changed.get(SiteModel.PROP_SITE_VISIBILITY) != null &&
              !SiteVisibility.PUBLIC.equals(changed.get(SiteModel.PROP_SITE_VISIBILITY)))
          {
              // we do not current support non-public RM sites
              throw new AlfrescoRuntimeException("The records management site must have public visibility.  It can't be changed to " + changed.get(SiteModel.PROP_SITE_VISIBILITY));
          }
      }
  }
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:27,代码来源:RmSiteType.java

示例11: onCreateChildAssociation

import org.alfresco.repo.policy.Behaviour.NotificationFrequency; //导入依赖的package包/类
/**
 * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean)
 */
@Override
@Behaviour
(
         kind = BehaviourKind.ASSOCIATION,
         notificationFrequency = NotificationFrequency.FIRST_EVENT
)
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew)
{
    NodeRef nodeRef = childAssocRef.getChildRef();
    if (nodeService.exists(nodeRef) && instanceOf(nodeRef, TYPE_RECORD_FOLDER))
    {
        // ensure nothing is being added to a closed record folder
        NodeRef recordFolder = childAssocRef.getParentRef();
        Boolean isClosed = (Boolean) nodeService.getProperty(recordFolder, PROP_IS_CLOSED);
        if (isClosed != null && Boolean.TRUE.equals(isClosed))
        {
            throw new AlfrescoRuntimeException("You can't add new items to a closed record folder.");
        }
    }
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:24,代码来源:RecordFolderType.java

示例12: onAddAspect

import org.alfresco.repo.policy.Behaviour.NotificationFrequency; //导入依赖的package包/类
/**
 * Ensure that the DOD record aspect meta-data is applied.
 *
 * @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
 */
@Behaviour
(
        kind=BehaviourKind.CLASS,
        type="rma:record",
        notificationFrequency = NotificationFrequency.FIRST_EVENT
)
@Override
public void onAddAspect(NodeRef nodeRef, QName aspect)
{
    if (nodeService.exists(nodeRef) &&
        !nodeService.hasAspect(nodeRef, ASPECT_DOD_5015_RECORD) &&
        isDODFilePlan(nodeRef))
    {
        nodeService.addAspect(nodeRef, ASPECT_DOD_5015_RECORD, null);
    }
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:22,代码来源:DOD5015RecordAspect.java

示例13: registerRuleTrigger

import org.alfresco.repo.policy.Behaviour.NotificationFrequency; //导入依赖的package包/类
/**
 * @see org.alfresco.repo.rule.ruletrigger.RuleTrigger#registerRuleTrigger()
 */
public void registerRuleTrigger()
{
    if (isClassBehaviour)
    {
        this.policyComponent.bindClassBehaviour(
                QName.createQName(NamespaceService.ALFRESCO_URI, POLICY),
                this,
                new JavaBehaviour(this, POLICY, NotificationFrequency.FIRST_EVENT));
    }
    else
    {
        this.policyComponent.bindAssociationBehaviour(
                QName.createQName(NamespaceService.ALFRESCO_URI, POLICY),
                this,
                new JavaBehaviour(this, POLICY, NotificationFrequency.FIRST_EVENT));
    }
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:21,代码来源:ExtendedBeforeDeleteChildAssociationRuleTrigger.java

示例14: init

import org.alfresco.repo.policy.Behaviour.NotificationFrequency; //导入依赖的package包/类
/**
 * Spring initilaise method used to register the policy behaviours
 */
public void init()
{
    PropertyCheck.mandatory(this, "policyComponent", policyComponent);
    PropertyCheck.mandatory(this, "nodeService", nodeService);
    PropertyCheck.mandatory(this, "attributeService", attributeService);
    
    // Register the policy behaviours
    policyComponent.bindClassBehaviour(OnAddAspectPolicy.QNAME, 
       EmailServerModel.ASPECT_ALIASABLE, 
        new JavaBehaviour(this, "onAddAspect", NotificationFrequency.FIRST_EVENT));
 
    policyComponent.bindClassBehaviour(BeforeRemoveAspectPolicy.QNAME,
       EmailServerModel.ASPECT_ALIASABLE, 
       new JavaBehaviour(this, "beforeRemoveAspect", NotificationFrequency.FIRST_EVENT));

    policyComponent.bindClassBehaviour(OnUpdatePropertiesPolicy.QNAME, 
        EmailServerModel.ASPECT_ALIASABLE, 
        new JavaBehaviour(this, "onUpdateProperties"));
    
    policyComponent.bindClassBehaviour(BeforeDeleteNodePolicy.QNAME, 
            EmailServerModel.ASPECT_ALIASABLE, 
            new JavaBehaviour(this, "beforeDeleteNode"));
    
    policyComponent.bindClassBehaviour(CopyServicePolicies.OnCopyNodePolicy.QNAME, 
        EmailServerModel.ASPECT_ALIASABLE, 
        new JavaBehaviour(this, "getCopyCallback"));
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:31,代码来源:AliasableAspect.java

示例15: bindBehaviour

import org.alfresco.repo.policy.Behaviour.NotificationFrequency; //导入依赖的package包/类
protected void bindBehaviour()
{
    if (logger.isDebugEnabled())
    {
        logger.debug("[bindBeahaviour] Binding behaviours");
    }
    PolicyComponent policyComponent = (PolicyComponent) serviceRegistry.getService(QName.createQName(NamespaceService.ALFRESCO_URI, "policyComponent"));

    // Only listen to folders we've tagged with imap properties - not all folders or we'll really slow down the repository!
    policyComponent.bindAssociationBehaviour(
            OnCreateChildAssociationPolicy.QNAME,
            ImapModel.ASPECT_IMAP_FOLDER,
            ContentModel.ASSOC_CONTAINS,
            new JavaBehaviour(this, "onCreateChildAssociation", NotificationFrequency.EVERY_EVENT));
    policyComponent.bindAssociationBehaviour(
            OnDeleteChildAssociationPolicy.QNAME,
            ImapModel.ASPECT_IMAP_FOLDER,
            ContentModel.ASSOC_CONTAINS,
            new JavaBehaviour(this, "onDeleteChildAssociation", NotificationFrequency.EVERY_EVENT));
    policyComponent.bindClassBehaviour(
            OnUpdatePropertiesPolicy.QNAME,
            ContentModel.TYPE_CONTENT,
            new JavaBehaviour(this, "onUpdateProperties", NotificationFrequency.EVERY_EVENT));
    policyComponent.bindClassBehaviour(
            BeforeDeleteNodePolicy.QNAME,
            ContentModel.TYPE_CONTENT,
            new JavaBehaviour(this, "beforeDeleteNode", NotificationFrequency.EVERY_EVENT));
    policyComponent.bindClassBehaviour(
            OnRestoreNodePolicy.QNAME,
            ContentModel.TYPE_CONTENT,
            new JavaBehaviour(this, "onRestoreNode", NotificationFrequency.EVERY_EVENT));
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:33,代码来源:ImapServiceImpl.java


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