mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
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:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user