0

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

4

1 回答 1

-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!");

    }
}
于 2013-02-13T15:31:29.773 回答