2013-02-13 63 views
0

我将入站规则添加到露天的文件夹中。我如何确定它刚刚创建的节点,还是从另一个文件夹中移出的?Alfresco入站规则

+0

解决方法:对于新节点“cm:created”等于“cm:modified”。所以我检查“cm:created”是否等于“cm:modified”这是一个新节点。 – mrgrechkinn 2013-02-14 10:08:37

回答

-1

创建新文件夹时,可以使用下一个片段添加新行为。此示例将针对存储库中创建的每个文件夹触发。你必须自己实现你实际要做的事情。

public class SalesProjectFolderBehaviour implements NodeServicePolicies.OnCreateNodePolicy{ 

/** The policy component. */ 
private PolicyComponent policyComponent; 

/** The on create node behaviour. */ 
private Behaviour onCreateNodeBehaviour; 

/** The service registry. */ 
private ServiceRegistry serviceRegistry; 

/** 
    * Inits the. 
    */ 
    public void init() 
    { 
     LOG.error("initializing the behaviours"); 
     // Create behaviours 
       this.onCreateNodeBehaviour = new JavaBehaviour(this, "onCreateNode", 
         NotificationFrequency.TRANSACTION_COMMIT); 



       // Bind behaviours to node policies 
       this.policyComponent.bindClassBehaviour(QName.createQName(
         NamespaceService.ALFRESCO_URI, "onCreateNode"), 
         org.alfresco.model.ContentModel.TYPE_FOLDER, this.onCreateNodeBehaviour); 

    } 

/* (non-Javadoc) 
    * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef) 
    */ 
    @Override 
    public void onCreateNode(ChildAssociationRef childAssocRef) { 
     LOG.trace("created new folder!"); 

    } 
} 
+0

OP正在寻找文件夹规则的帮助,而不是行为。 – 2013-02-13 23:54:33

+0

嗨Jeff 行为的实现不能像文件夹规则一样吗?我知道我的答案不是入站规则,但它可以完成同样的事情。 – Qkyrie 2013-02-14 08:11:48

+0

嗨Qkyrie,谢谢你的回答,但我不想用我的逻辑使用策略。 – mrgrechkinn 2013-02-14 10:06:38