我要在露天的文件夹中添加入站规则。我如何确定它的节点刚刚创建或者它是从另一个文件夹中移出的?
答案 0 :(得分:-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!");
}
}