MT - fix node service so that policies are triggered with base refs

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8312 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2008-02-18 16:14:05 +00:00
parent 3d1d97523e
commit 2237d2f748
9 changed files with 41 additions and 79 deletions

View File

@@ -28,6 +28,7 @@ import org.alfresco.repo.node.NodeServicePolicies;
import org.alfresco.repo.policy.JavaBehaviour;
import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.repo.search.Indexer;
import org.alfresco.repo.tenant.TenantService;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.NamespaceService;
@@ -50,6 +51,7 @@ public class NodeIndexer
private PolicyComponent policyComponent;
/** the component to index the node hierarchy */
private Indexer indexer;
private TenantService tenantService;
/**
* @param policyComponent used for registrations
@@ -66,6 +68,11 @@ public class NodeIndexer
{
this.indexer = indexer;
}
public void setTenantService(TenantService tenantService)
{
this.tenantService = tenantService;
}
/**
* Registers the policy behaviour methods
@@ -96,29 +103,29 @@ public class NodeIndexer
public void onCreateNode(ChildAssociationRef childAssocRef)
{
indexer.createNode(childAssocRef);
indexer.createNode(tenantService.getName(childAssocRef));
}
public void onUpdateNode(NodeRef nodeRef)
{
indexer.updateNode(nodeRef);
indexer.updateNode(tenantService.getName(nodeRef));
}
public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isArchivedNode)
{
indexer.deleteNode(childAssocRef);
indexer.deleteNode(tenantService.getName(childAssocRef));
}
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNew)
{
if (!isNew)
{
indexer.createChildRelationship(childAssocRef);
indexer.createChildRelationship(tenantService.getName(childAssocRef));
}
}
public void onDeleteChildAssociation(ChildAssociationRef childAssocRef)
{
indexer.deleteChildRelationship(childAssocRef);
indexer.deleteChildRelationship(tenantService.getName(childAssocRef));
}
}