2013-02-13 74 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