MT - fix delete node (to ensure tenant-specific re-index)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8143 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2008-01-31 16:23:09 +00:00
parent 5bdd6a9c8b
commit 694396d5ed
4 changed files with 46 additions and 14 deletions

View File

@@ -759,7 +759,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
invokeBeforeDeleteNode(nodeRef); invokeBeforeDeleteNode(nodeRef);
// get the primary parent-child relationship before it is gone // get the primary parent-child relationship before it is gone
ChildAssociationRef childAssocRef = getPrimaryParent(nodeRef); ChildAssociationRef childAssocRef = tenantService.getName(getPrimaryParent(nodeRef)); //note: tenant-specific for re-indexing
// get type and aspect QNames as they will be unavailable after the delete // get type and aspect QNames as they will be unavailable after the delete
QName nodeTypeQName = node.getTypeQName(); QName nodeTypeQName = node.getTypeQName();
Set<QName> nodeAspectQNames = node.getAspects(); Set<QName> nodeAspectQNames = node.getAspects();
@@ -1255,13 +1255,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
// no match - ignore // no match - ignore
continue; continue;
} }
ChildAssociationRef childAssocRef = new ChildAssociationRef( ChildAssociationRef childAssocRef = tenantService.getBaseName(assoc.getChildAssocRef());
assoc.getChildAssocRef().getTypeQName(),
tenantService.getBaseName(assoc.getChildAssocRef().getParentRef()),
assoc.getChildAssocRef().getQName(),
tenantService.getBaseName(assoc.getChildAssocRef().getChildRef()),
assoc.getChildAssocRef().isPrimary(),
assoc.getChildAssocRef().getNthSibling());
results.add(childAssocRef); results.add(childAssocRef);
} }
// done // done
@@ -1357,12 +1351,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
} }
else else
{ {
assocRef = new ChildAssociationRef(assoc.getChildAssocRef().getTypeQName(), assocRef = tenantService.getBaseName(assoc.getChildAssocRef());
tenantService.getBaseName(assoc.getChildAssocRef().getParentRef()),
assoc.getChildAssocRef().getQName(),
tenantService.getBaseName(assoc.getChildAssocRef().getChildRef()),
assoc.getChildAssocRef().isPrimary(),
assoc.getChildAssocRef().getNthSibling());
} }
return assocRef; return assocRef;
} }

View File

@@ -29,6 +29,7 @@ import java.util.List;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.cache.SimpleCache; import org.alfresco.repo.cache.SimpleCache;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.repository.StoreRef;
@@ -91,6 +92,19 @@ public class MultiTServiceImpl implements TenantService
return new StoreRef(storeRef.getProtocol(), getName(storeRef.getIdentifier())); return new StoreRef(storeRef.getProtocol(), getName(storeRef.getIdentifier()));
} }
public ChildAssociationRef getName(ChildAssociationRef childAssocRef)
{
// Check that all the passed values are not null
ParameterCheck.mandatory("ChildAssocRef", childAssocRef);
return new ChildAssociationRef(childAssocRef.getTypeQName(),
getName(childAssocRef.getParentRef()),
childAssocRef.getQName(),
getName(childAssocRef.getChildRef()),
childAssocRef.isPrimary(),
childAssocRef.getNthSibling());
}
public StoreRef getName(String username, StoreRef storeRef) public StoreRef getName(String username, StoreRef storeRef)
{ {
// Check that all the passed values are not null // Check that all the passed values are not null
@@ -227,6 +241,19 @@ public class MultiTServiceImpl implements TenantService
return new StoreRef(storeRef.getProtocol(), getBaseName(storeRef.getIdentifier())); return new StoreRef(storeRef.getProtocol(), getBaseName(storeRef.getIdentifier()));
} }
public ChildAssociationRef getBaseName(ChildAssociationRef childAssocRef)
{
// Check that all the passed values are not null
ParameterCheck.mandatory("ChildAssocRef", childAssocRef);
return new ChildAssociationRef(childAssocRef.getTypeQName(),
getBaseName(childAssocRef.getParentRef()),
childAssocRef.getQName(),
getBaseName(childAssocRef.getChildRef()),
childAssocRef.isPrimary(),
childAssocRef.getNthSibling());
}
public String getBaseName(String name) public String getBaseName(String name)
{ {
// get base name, but don't force for non-tenant user (e.g. super admin) // get base name, but don't force for non-tenant user (e.g. super admin)

View File

@@ -24,6 +24,7 @@
*/ */
package org.alfresco.repo.tenant; package org.alfresco.repo.tenant;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.repository.StoreRef;
@@ -52,6 +53,11 @@ public class SingleTServiceImpl implements TenantService
return storeRef; return storeRef;
} }
public ChildAssociationRef getName(ChildAssociationRef childAssocRef)
{
return childAssocRef;
}
public StoreRef getName(String username, StoreRef storeRef) public StoreRef getName(String username, StoreRef storeRef)
{ {
return storeRef; return storeRef;
@@ -82,6 +88,11 @@ public class SingleTServiceImpl implements TenantService
return storeRef; return storeRef;
} }
public ChildAssociationRef getBaseName(ChildAssociationRef childAssocRef)
{
return childAssocRef;
}
public String getBaseName(String name) public String getBaseName(String name)
{ {
return name; return name;

View File

@@ -24,6 +24,7 @@
*/ */
package org.alfresco.repo.tenant; package org.alfresco.repo.tenant;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.repository.StoreRef;
@@ -52,6 +53,8 @@ public interface TenantService
public StoreRef getName(StoreRef storeRef); public StoreRef getName(StoreRef storeRef);
public ChildAssociationRef getName(ChildAssociationRef childAssocRef);
public StoreRef getName(String username, StoreRef storeRef); public StoreRef getName(String username, StoreRef storeRef);
public QName getName(NodeRef inNodeRef, QName name); public QName getName(NodeRef inNodeRef, QName name);
@@ -64,6 +67,8 @@ public interface TenantService
public StoreRef getBaseName(StoreRef storeRef); public StoreRef getBaseName(StoreRef storeRef);
public ChildAssociationRef getBaseName(ChildAssociationRef childAssocRef);
public String getBaseName(String name); public String getBaseName(String name);
public String getBaseName(String name, boolean forceIfNonTenant); public String getBaseName(String name, boolean forceIfNonTenant);