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:
@@ -777,9 +777,6 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="internalNodeService">
|
<property name="internalNodeService">
|
||||||
<ref bean="nodeService" />
|
<ref bean="nodeService" />
|
||||||
</property>
|
|
||||||
<property name="tenantService">
|
|
||||||
<ref bean="tenantService" />
|
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
@@ -100,6 +100,9 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="indexer">
|
<property name="indexer">
|
||||||
<ref bean="indexerComponent" />
|
<ref bean="indexerComponent" />
|
||||||
|
</property>
|
||||||
|
<property name="tenantService">
|
||||||
|
<ref bean="tenantService"/>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
@@ -6,8 +6,7 @@
|
|||||||
|
|
||||||
<bean id="usageService" class="org.alfresco.repo.usage.UsageServiceImpl">
|
<bean id="usageService" class="org.alfresco.repo.usage.UsageServiceImpl">
|
||||||
<property name="usageDeltaDao" ref="usageDeltaDao"/>
|
<property name="usageDeltaDao" ref="usageDeltaDao"/>
|
||||||
<property name="nodeDaoService" ref="nodeDaoService"/>
|
<property name="nodeDaoService" ref="nodeDaoService"/>
|
||||||
<property name="tenantService" ref="tenantService"/>
|
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="contentUsageImpl" class="org.alfresco.repo.usage.ContentUsageImpl" init-method="init">
|
<bean id="contentUsageImpl" class="org.alfresco.repo.usage.ContentUsageImpl" init-method="init">
|
||||||
|
@@ -40,7 +40,6 @@ import org.alfresco.repo.policy.ClassPolicyDelegate;
|
|||||||
import org.alfresco.repo.policy.JavaBehaviour;
|
import org.alfresco.repo.policy.JavaBehaviour;
|
||||||
import org.alfresco.repo.policy.PolicyComponent;
|
import org.alfresco.repo.policy.PolicyComponent;
|
||||||
import org.alfresco.repo.policy.PolicyScope;
|
import org.alfresco.repo.policy.PolicyScope;
|
||||||
import org.alfresco.repo.tenant.TenantService;
|
|
||||||
import org.alfresco.service.cmr.dictionary.AspectDefinition;
|
import org.alfresco.service.cmr.dictionary.AspectDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.AssociationDefinition;
|
import org.alfresco.service.cmr.dictionary.AssociationDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.ChildAssociationDefinition;
|
import org.alfresco.service.cmr.dictionary.ChildAssociationDefinition;
|
||||||
@@ -101,9 +100,6 @@ public class CopyServiceImpl implements CopyService
|
|||||||
|
|
||||||
/** Authentication service */
|
/** Authentication service */
|
||||||
private AuthenticationService authenticationService;
|
private AuthenticationService authenticationService;
|
||||||
|
|
||||||
/** Tenant service */
|
|
||||||
private TenantService tenantService;
|
|
||||||
|
|
||||||
/** Policy delegates */
|
/** Policy delegates */
|
||||||
private ClassPolicyDelegate<CopyServicePolicies.OnCopyNodePolicy> onCopyNodeDelegate;
|
private ClassPolicyDelegate<CopyServicePolicies.OnCopyNodePolicy> onCopyNodeDelegate;
|
||||||
@@ -188,16 +184,6 @@ public class CopyServiceImpl implements CopyService
|
|||||||
{
|
{
|
||||||
this.authenticationService = authenticationService;
|
this.authenticationService = authenticationService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the tenant service
|
|
||||||
*
|
|
||||||
* @param tenantService the tenant service
|
|
||||||
*/
|
|
||||||
public void setTenantService(TenantService tenantService)
|
|
||||||
{
|
|
||||||
this.tenantService = tenantService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise method
|
* Initialise method
|
||||||
@@ -239,8 +225,7 @@ public class CopyServiceImpl implements CopyService
|
|||||||
ParameterCheck.mandatory("Destination Parent", destinationParentRef);
|
ParameterCheck.mandatory("Destination Parent", destinationParentRef);
|
||||||
ParameterCheck.mandatory("Destination Association Name", destinationQName);
|
ParameterCheck.mandatory("Destination Association Name", destinationQName);
|
||||||
|
|
||||||
// AR-2023, need to push down
|
if (sourceNodeRef.getStoreRef().equals(destinationParentRef.getStoreRef()) == false)
|
||||||
if (tenantService.getName(sourceNodeRef.getStoreRef()).equals(tenantService.getName(destinationParentRef.getStoreRef())) == false)
|
|
||||||
{
|
{
|
||||||
// TODO We need to create a new node in the other store with the same id as the source
|
// TODO We need to create a new node in the other store with the same id as the source
|
||||||
|
|
||||||
|
@@ -132,7 +132,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
{
|
{
|
||||||
ParameterCheck.mandatory("nodeRef", nodeRef);
|
ParameterCheck.mandatory("nodeRef", nodeRef);
|
||||||
|
|
||||||
Node unchecked = nodeDaoService.getNode(tenantService.getName(nodeRef));
|
Node unchecked = nodeDaoService.getNode(nodeRef);
|
||||||
if (unchecked == null)
|
if (unchecked == null)
|
||||||
{
|
{
|
||||||
throw new InvalidNodeRefException("Node does not exist: " + nodeRef, nodeRef);
|
throw new InvalidNodeRefException("Node does not exist: " + nodeRef, nodeRef);
|
||||||
@@ -150,7 +150,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
{
|
{
|
||||||
ParameterCheck.mandatory("nodeRef", nodeRef);
|
ParameterCheck.mandatory("nodeRef", nodeRef);
|
||||||
|
|
||||||
NodeStatus nodeStatus = nodeDaoService.getNodeStatus(tenantService.getName(nodeRef), false);
|
NodeStatus nodeStatus = nodeDaoService.getNodeStatus(nodeRef, false);
|
||||||
if (nodeStatus == null || nodeStatus.getNode() == null)
|
if (nodeStatus == null || nodeStatus.getNode() == null)
|
||||||
{
|
{
|
||||||
throw new InvalidNodeRefException("Node does not exist: " + nodeRef, nodeRef);
|
throw new InvalidNodeRefException("Node does not exist: " + nodeRef, nodeRef);
|
||||||
@@ -160,7 +160,6 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
|
|
||||||
public boolean exists(StoreRef storeRef)
|
public boolean exists(StoreRef storeRef)
|
||||||
{
|
{
|
||||||
storeRef = tenantService.getName(storeRef);
|
|
||||||
Store store = nodeDaoService.getStore(storeRef.getProtocol(), storeRef.getIdentifier());
|
Store store = nodeDaoService.getStore(storeRef.getProtocol(), storeRef.getIdentifier());
|
||||||
boolean exists = (store != null);
|
boolean exists = (store != null);
|
||||||
// done
|
// done
|
||||||
@@ -171,7 +170,6 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
{
|
{
|
||||||
ParameterCheck.mandatory("nodeRef", nodeRef);
|
ParameterCheck.mandatory("nodeRef", nodeRef);
|
||||||
|
|
||||||
nodeRef = tenantService.getName(nodeRef);
|
|
||||||
Node node = nodeDaoService.getNode(nodeRef);
|
Node node = nodeDaoService.getNode(nodeRef);
|
||||||
boolean exists = (node != null);
|
boolean exists = (node != null);
|
||||||
// done
|
// done
|
||||||
@@ -182,7 +180,6 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
{
|
{
|
||||||
ParameterCheck.mandatory("nodeRef", nodeRef);
|
ParameterCheck.mandatory("nodeRef", nodeRef);
|
||||||
|
|
||||||
nodeRef = tenantService.getName(nodeRef);
|
|
||||||
NodeStatus nodeStatus = nodeDaoService.getNodeStatus(nodeRef, false);
|
NodeStatus nodeStatus = nodeDaoService.getNodeStatus(nodeRef, false);
|
||||||
if (nodeStatus == null) // node never existed
|
if (nodeStatus == null) // node never existed
|
||||||
{
|
{
|
||||||
@@ -234,8 +231,8 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
*/
|
*/
|
||||||
public StoreRef createStore(String protocol, String identifier)
|
public StoreRef createStore(String protocol, String identifier)
|
||||||
{
|
{
|
||||||
StoreRef storeRef = tenantService.getName(new StoreRef(protocol, identifier));
|
StoreRef storeRef = new StoreRef(protocol, identifier);
|
||||||
identifier = storeRef.getIdentifier();
|
|
||||||
// check that the store does not already exist
|
// check that the store does not already exist
|
||||||
Store store = nodeDaoService.getStore(protocol, identifier);
|
Store store = nodeDaoService.getStore(protocol, identifier);
|
||||||
if (store != null)
|
if (store != null)
|
||||||
@@ -250,20 +247,22 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
store = nodeDaoService.createStore(protocol, identifier);
|
store = nodeDaoService.createStore(protocol, identifier);
|
||||||
// get the root node
|
// get the root node
|
||||||
Node rootNode = store.getRootNode();
|
Node rootNode = store.getRootNode();
|
||||||
|
NodeRef rootNodeRef = tenantService.getBaseName(rootNode.getNodeRef());
|
||||||
|
|
||||||
// assign the root aspect - this is expected of all roots, even store roots
|
// assign the root aspect - this is expected of all roots, even store roots
|
||||||
addAspect(rootNode.getNodeRef(),
|
addAspect(rootNodeRef,
|
||||||
ContentModel.ASPECT_ROOT,
|
ContentModel.ASPECT_ROOT,
|
||||||
Collections.<QName, Serializable>emptyMap());
|
Collections.<QName, Serializable>emptyMap());
|
||||||
|
|
||||||
// invoke policies
|
// invoke policies
|
||||||
invokeOnCreateStore(rootNode.getNodeRef());
|
invokeOnCreateStore(rootNodeRef);
|
||||||
|
|
||||||
// done
|
// done
|
||||||
if (!store.getStoreRef().equals(storeRef))
|
if (!store.getStoreRef().equals(storeRef))
|
||||||
{
|
{
|
||||||
throw new RuntimeException("Incorrect store reference");
|
throw new RuntimeException("Incorrect store reference");
|
||||||
}
|
}
|
||||||
storeRef = tenantService.getBaseName(storeRef);
|
|
||||||
return storeRef;
|
return storeRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,8 +271,6 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
*/
|
*/
|
||||||
public void deleteStore(StoreRef storeRef)
|
public void deleteStore(StoreRef storeRef)
|
||||||
{
|
{
|
||||||
storeRef = tenantService.getName(storeRef);
|
|
||||||
|
|
||||||
String protocol = storeRef.getProtocol();
|
String protocol = storeRef.getProtocol();
|
||||||
String identifier = storeRef.getIdentifier();
|
String identifier = storeRef.getIdentifier();
|
||||||
|
|
||||||
@@ -296,7 +293,6 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
|
|
||||||
public NodeRef getRootNode(StoreRef storeRef) throws InvalidStoreRefException
|
public NodeRef getRootNode(StoreRef storeRef) throws InvalidStoreRefException
|
||||||
{
|
{
|
||||||
storeRef = tenantService.getName(storeRef);
|
|
||||||
Store store = nodeDaoService.getStore(storeRef.getProtocol(), storeRef.getIdentifier());
|
Store store = nodeDaoService.getStore(storeRef.getProtocol(), storeRef.getIdentifier());
|
||||||
if (store == null)
|
if (store == null)
|
||||||
{
|
{
|
||||||
@@ -308,10 +304,8 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
{
|
{
|
||||||
throw new InvalidStoreRefException("Store does not have a root node: " + storeRef, storeRef);
|
throw new InvalidStoreRefException("Store does not have a root node: " + storeRef, storeRef);
|
||||||
}
|
}
|
||||||
NodeRef nodeRef = node.getNodeRef();
|
|
||||||
nodeRef = tenantService.getBaseName(nodeRef);
|
|
||||||
// done
|
// done
|
||||||
return nodeRef;
|
return tenantService.getBaseName(node.getNodeRef());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -341,7 +335,6 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
Assert.notNull(assocQName);
|
Assert.notNull(assocQName);
|
||||||
|
|
||||||
// Get the parent node
|
// Get the parent node
|
||||||
parentRef = tenantService.getName(parentRef);
|
|
||||||
Node parentNode = getNodeNotNull(parentRef);
|
Node parentNode = getNodeNotNull(parentRef);
|
||||||
|
|
||||||
// null property map is allowed
|
// null property map is allowed
|
||||||
@@ -359,8 +352,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
invokeBeforeCreateNode(parentRef, assocTypeQName, assocQName, nodeTypeQName);
|
invokeBeforeCreateNode(parentRef, assocTypeQName, assocQName, nodeTypeQName);
|
||||||
|
|
||||||
// get the store that the parent belongs to
|
// get the store that the parent belongs to
|
||||||
StoreRef storeRef = parentRef.getStoreRef();
|
Store store = nodeDaoService.getStore(parentRef.getStoreRef().getProtocol(), parentRef.getStoreRef().getIdentifier());
|
||||||
Store store = nodeDaoService.getStore(storeRef.getProtocol(), storeRef.getIdentifier());
|
|
||||||
if (store == null)
|
if (store == null)
|
||||||
{
|
{
|
||||||
throw new RuntimeException("No store found for parent node: " + parentRef);
|
throw new RuntimeException("No store found for parent node: " + parentRef);
|
||||||
@@ -378,7 +370,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
|
|
||||||
// create the node instance
|
// create the node instance
|
||||||
Node childNode = nodeDaoService.newNode(store, newId, nodeTypeQName);
|
Node childNode = nodeDaoService.newNode(store, newId, nodeTypeQName);
|
||||||
NodeRef childNodeRef = childNode.getNodeRef();
|
NodeRef childNodeRef = tenantService.getBaseName(childNode.getNodeRef());
|
||||||
|
|
||||||
// We now have enough to declare the child association creation
|
// We now have enough to declare the child association creation
|
||||||
invokeBeforeCreateChildAssociation(parentRef, childNodeRef, assocTypeQName, assocQName, true);
|
invokeBeforeCreateChildAssociation(parentRef, childNodeRef, assocTypeQName, assocQName, true);
|
||||||
@@ -407,7 +399,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
|
|
||||||
// Ensure child uniqueness
|
// Ensure child uniqueness
|
||||||
setChildUniqueName(childNode); // ensure uniqueness
|
setChildUniqueName(childNode); // ensure uniqueness
|
||||||
ChildAssociationRef childAssocRef = childAssoc.getChildAssocRef();
|
ChildAssociationRef childAssocRef = tenantService.getBaseName(childAssoc.getChildAssocRef());
|
||||||
|
|
||||||
// Invoke policy behaviour
|
// Invoke policy behaviour
|
||||||
invokeOnCreateNode(childAssocRef);
|
invokeOnCreateNode(childAssocRef);
|
||||||
@@ -468,10 +460,9 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
Node newParentNode = getNodeNotNull(newParentRef);
|
Node newParentNode = getNodeNotNull(newParentRef);
|
||||||
// get the primary parent assoc
|
// get the primary parent assoc
|
||||||
ChildAssoc oldAssoc = nodeDaoService.getPrimaryParentAssoc(nodeToMove);
|
ChildAssoc oldAssoc = nodeDaoService.getPrimaryParentAssoc(nodeToMove);
|
||||||
ChildAssociationRef oldAssocRef = oldAssoc.getChildAssocRef();
|
ChildAssociationRef oldAssocRef = tenantService.getBaseName(oldAssoc.getChildAssocRef());
|
||||||
|
|
||||||
// AR-2023, need to push down
|
boolean movingStore = !nodeToMoveRef.getStoreRef().equals(newParentRef.getStoreRef());
|
||||||
boolean movingStore = !tenantService.getName(nodeToMoveRef.getStoreRef()).equals(tenantService.getName(newParentRef.getStoreRef()));
|
|
||||||
|
|
||||||
// data needed for policy invocation
|
// data needed for policy invocation
|
||||||
QName nodeToMoveTypeQName = nodeToMove.getTypeQName();
|
QName nodeToMoveTypeQName = nodeToMove.getTypeQName();
|
||||||
@@ -501,7 +492,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
assocTypeQName,
|
assocTypeQName,
|
||||||
assocQName);
|
assocQName);
|
||||||
setChildUniqueName(nodeToMove); // ensure uniqueness
|
setChildUniqueName(nodeToMove); // ensure uniqueness
|
||||||
ChildAssociationRef newAssocRef = newAssoc.getChildAssocRef();
|
ChildAssociationRef newAssocRef = tenantService.getBaseName(newAssoc.getChildAssocRef());
|
||||||
|
|
||||||
// If the node is moving stores, then drag the node hierarchy with it
|
// If the node is moving stores, then drag the node hierarchy with it
|
||||||
if (movingStore)
|
if (movingStore)
|
||||||
@@ -605,7 +596,6 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
Map<QName, Serializable> aspectProperties)
|
Map<QName, Serializable> aspectProperties)
|
||||||
throws InvalidNodeRefException, InvalidAspectException
|
throws InvalidNodeRefException, InvalidAspectException
|
||||||
{
|
{
|
||||||
nodeRef = tenantService.getName(nodeRef);
|
|
||||||
// check that the aspect is legal
|
// check that the aspect is legal
|
||||||
AspectDefinition aspectDef = dictionaryService.getAspect(aspectTypeQName);
|
AspectDefinition aspectDef = dictionaryService.getAspect(aspectTypeQName);
|
||||||
if (aspectDef == null)
|
if (aspectDef == null)
|
||||||
@@ -749,7 +739,6 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
|
|
||||||
public void deleteNode(NodeRef nodeRef)
|
public void deleteNode(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
nodeRef = tenantService.getName(nodeRef);
|
|
||||||
// First get the node to ensure that it exists
|
// First get the node to ensure that it exists
|
||||||
Node node = getNodeNotNull(nodeRef);
|
Node node = getNodeNotNull(nodeRef);
|
||||||
|
|
||||||
@@ -759,7 +748,8 @@ 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 = tenantService.getName(getPrimaryParent(nodeRef)); //note: tenant-specific for re-indexing
|
ChildAssociationRef childAssocRef = getPrimaryParent(nodeRef);
|
||||||
|
|
||||||
// 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();
|
||||||
@@ -778,8 +768,6 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
StoreRef storeRef = nodeRef.getStoreRef();
|
StoreRef storeRef = nodeRef.getStoreRef();
|
||||||
|
|
||||||
// remove tenant domain - to retrieve archive store from map
|
// remove tenant domain - to retrieve archive store from map
|
||||||
storeRef = tenantService.getBaseName(storeRef);
|
|
||||||
|
|
||||||
archiveStoreRef = storeArchiveMap.getArchiveMap().get(storeRef);
|
archiveStoreRef = storeArchiveMap.getArchiveMap().get(storeRef);
|
||||||
// get the type and check if we need archiving
|
// get the type and check if we need archiving
|
||||||
TypeDefinition typeDef = dictionaryService.getType(node.getTypeQName());
|
TypeDefinition typeDef = dictionaryService.getType(node.getTypeQName());
|
||||||
@@ -977,7 +965,6 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
|
|
||||||
public Map<QName, Serializable> getProperties(NodeRef nodeRef) throws InvalidNodeRefException
|
public Map<QName, Serializable> getProperties(NodeRef nodeRef) throws InvalidNodeRefException
|
||||||
{
|
{
|
||||||
nodeRef = tenantService.getName(nodeRef);
|
|
||||||
Node node = getNodeNotNull(nodeRef);
|
Node node = getNodeNotNull(nodeRef);
|
||||||
return getPropertiesImpl(node);
|
return getPropertiesImpl(node);
|
||||||
}
|
}
|
||||||
@@ -1139,7 +1126,6 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
{
|
{
|
||||||
Assert.notNull(qname);
|
Assert.notNull(qname);
|
||||||
|
|
||||||
nodeRef = tenantService.getName(nodeRef);
|
|
||||||
// get the node
|
// get the node
|
||||||
Node node = getNodeNotNull(nodeRef);
|
Node node = getNodeNotNull(nodeRef);
|
||||||
|
|
||||||
@@ -1193,7 +1179,6 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
throw new UnsupportedOperationException("The property " + qname + " may not be removed individually");
|
throw new UnsupportedOperationException("The property " + qname + " may not be removed individually");
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeRef = tenantService.getName(nodeRef);
|
|
||||||
// Get the node
|
// Get the node
|
||||||
Node node = getNodeNotNull(nodeRef);
|
Node node = getNodeNotNull(nodeRef);
|
||||||
|
|
||||||
@@ -1900,7 +1885,6 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
|
|
||||||
public NodeRef getStoreArchiveNode(StoreRef storeRef)
|
public NodeRef getStoreArchiveNode(StoreRef storeRef)
|
||||||
{
|
{
|
||||||
storeRef = tenantService.getBaseName(storeRef);
|
|
||||||
StoreRef archiveStoreRef = storeArchiveMap.getArchiveMap().get(storeRef);
|
StoreRef archiveStoreRef = storeArchiveMap.getArchiveMap().get(storeRef);
|
||||||
if (archiveStoreRef == null)
|
if (archiveStoreRef == null)
|
||||||
{
|
{
|
||||||
|
@@ -450,7 +450,7 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
|||||||
|
|
||||||
public Store getStore(String protocol, String identifier)
|
public Store getStore(String protocol, String identifier)
|
||||||
{
|
{
|
||||||
StoreKey storeKey = new StoreKey(protocol, identifier);
|
StoreKey storeKey = new StoreKey(protocol, tenantService.getName(identifier));
|
||||||
Store store = (Store) getHibernateTemplate().get(StoreImpl.class, storeKey);
|
Store store = (Store) getHibernateTemplate().get(StoreImpl.class, storeKey);
|
||||||
// done
|
// done
|
||||||
return store;
|
return store;
|
||||||
@@ -461,7 +461,7 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
|||||||
*/
|
*/
|
||||||
public NodeStatus getNodeStatus(NodeRef nodeRef, boolean update)
|
public NodeStatus getNodeStatus(NodeRef nodeRef, boolean update)
|
||||||
{
|
{
|
||||||
NodeKey nodeKey = new NodeKey(nodeRef);
|
NodeKey nodeKey = new NodeKey(tenantService.getName(nodeRef));
|
||||||
NodeStatus status = null;
|
NodeStatus status = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -495,7 +495,7 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
|||||||
|
|
||||||
public void recordChangeId(NodeRef nodeRef)
|
public void recordChangeId(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
NodeKey key = new NodeKey(nodeRef);
|
NodeKey key = new NodeKey(tenantService.getName(nodeRef));
|
||||||
|
|
||||||
NodeStatus status = (NodeStatus) getHibernateTemplate().get(NodeStatusImpl.class, key);
|
NodeStatus status = (NodeStatus) getHibernateTemplate().get(NodeStatusImpl.class, key);
|
||||||
if (status == null)
|
if (status == null)
|
||||||
@@ -1434,7 +1434,7 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
|||||||
{
|
{
|
||||||
Query query = session.getNamedQuery(QUERY_GET_NODE_COUNT_FOR_STORE);
|
Query query = session.getNamedQuery(QUERY_GET_NODE_COUNT_FOR_STORE);
|
||||||
query.setString("protocol", storeRef.getProtocol())
|
query.setString("protocol", storeRef.getProtocol())
|
||||||
.setString("identifier", storeRef.getIdentifier())
|
.setString("identifier", tenantService.getName(storeRef.getIdentifier()))
|
||||||
.setMaxResults(1)
|
.setMaxResults(1)
|
||||||
.setReadOnly(true);
|
.setReadOnly(true);
|
||||||
return query.uniqueResult();
|
return query.uniqueResult();
|
||||||
@@ -1455,7 +1455,7 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
|||||||
{
|
{
|
||||||
Query query = session.getNamedQuery(QUERY_NODES_WITH_PROPERTY_STRING_VALUE_FOR_STORE);
|
Query query = session.getNamedQuery(QUERY_NODES_WITH_PROPERTY_STRING_VALUE_FOR_STORE);
|
||||||
query.setString("protocol", storeRef.getProtocol())
|
query.setString("protocol", storeRef.getProtocol())
|
||||||
.setString("identifier", storeRef.getIdentifier())
|
.setString("identifier", tenantService.getName(storeRef.getIdentifier()))
|
||||||
.setParameter("propQName", propQName)
|
.setParameter("propQName", propQName)
|
||||||
.setString("propStringValue", propStringValue)
|
.setString("propStringValue", propStringValue)
|
||||||
.setReadOnly(true);
|
.setReadOnly(true);
|
||||||
|
@@ -28,6 +28,7 @@ import org.alfresco.repo.node.NodeServicePolicies;
|
|||||||
import org.alfresco.repo.policy.JavaBehaviour;
|
import org.alfresco.repo.policy.JavaBehaviour;
|
||||||
import org.alfresco.repo.policy.PolicyComponent;
|
import org.alfresco.repo.policy.PolicyComponent;
|
||||||
import org.alfresco.repo.search.Indexer;
|
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.ChildAssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
@@ -50,6 +51,7 @@ public class NodeIndexer
|
|||||||
private PolicyComponent policyComponent;
|
private PolicyComponent policyComponent;
|
||||||
/** the component to index the node hierarchy */
|
/** the component to index the node hierarchy */
|
||||||
private Indexer indexer;
|
private Indexer indexer;
|
||||||
|
private TenantService tenantService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param policyComponent used for registrations
|
* @param policyComponent used for registrations
|
||||||
@@ -66,6 +68,11 @@ public class NodeIndexer
|
|||||||
{
|
{
|
||||||
this.indexer = indexer;
|
this.indexer = indexer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTenantService(TenantService tenantService)
|
||||||
|
{
|
||||||
|
this.tenantService = tenantService;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers the policy behaviour methods
|
* Registers the policy behaviour methods
|
||||||
@@ -96,29 +103,29 @@ public class NodeIndexer
|
|||||||
|
|
||||||
public void onCreateNode(ChildAssociationRef childAssocRef)
|
public void onCreateNode(ChildAssociationRef childAssocRef)
|
||||||
{
|
{
|
||||||
indexer.createNode(childAssocRef);
|
indexer.createNode(tenantService.getName(childAssocRef));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onUpdateNode(NodeRef nodeRef)
|
public void onUpdateNode(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
indexer.updateNode(nodeRef);
|
indexer.updateNode(tenantService.getName(nodeRef));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isArchivedNode)
|
public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isArchivedNode)
|
||||||
{
|
{
|
||||||
indexer.deleteNode(childAssocRef);
|
indexer.deleteNode(tenantService.getName(childAssocRef));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNew)
|
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNew)
|
||||||
{
|
{
|
||||||
if (!isNew)
|
if (!isNew)
|
||||||
{
|
{
|
||||||
indexer.createChildRelationship(childAssocRef);
|
indexer.createChildRelationship(tenantService.getName(childAssocRef));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDeleteChildAssociation(ChildAssociationRef childAssocRef)
|
public void onDeleteChildAssociation(ChildAssociationRef childAssocRef)
|
||||||
{
|
{
|
||||||
indexer.deleteChildRelationship(childAssocRef);
|
indexer.deleteChildRelationship(tenantService.getName(childAssocRef));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -566,9 +566,6 @@ public class ADMLuceneSearcherImpl extends AbstractLuceneBase implements LuceneS
|
|||||||
boolean followAllParentLinks, String language) throws InvalidNodeRefException, XPathException
|
boolean followAllParentLinks, String language) throws InvalidNodeRefException, XPathException
|
||||||
{
|
{
|
||||||
NodeSearcher nodeSearcher = new NodeSearcher(nodeService, getDictionaryService(), this);
|
NodeSearcher nodeSearcher = new NodeSearcher(nodeService, getDictionaryService(), this);
|
||||||
|
|
||||||
contextNodeRef = tenantService.getName(contextNodeRef);
|
|
||||||
|
|
||||||
return nodeSearcher.selectNodes(contextNodeRef, xpath, parameters, namespacePrefixResolver, followAllParentLinks, language);
|
return nodeSearcher.selectNodes(contextNodeRef, xpath, parameters, namespacePrefixResolver, followAllParentLinks, language);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -29,7 +29,6 @@ import java.util.Set;
|
|||||||
|
|
||||||
import org.alfresco.repo.domain.Node;
|
import org.alfresco.repo.domain.Node;
|
||||||
import org.alfresco.repo.node.db.NodeDaoService;
|
import org.alfresco.repo.node.db.NodeDaoService;
|
||||||
import org.alfresco.repo.tenant.TenantService;
|
|
||||||
import org.alfresco.repo.usage.hibernate.UsageDeltaImpl;
|
import org.alfresco.repo.usage.hibernate.UsageDeltaImpl;
|
||||||
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
@@ -44,10 +43,6 @@ public class UsageServiceImpl implements UsageService
|
|||||||
{
|
{
|
||||||
private UsageDeltaDAO usageDeltaDao;
|
private UsageDeltaDAO usageDeltaDao;
|
||||||
private NodeDaoService nodeDaoService;
|
private NodeDaoService nodeDaoService;
|
||||||
private TenantService tenantService;
|
|
||||||
|
|
||||||
//private static Log logger = LogFactory.getLog(UsageServiceImpl.class);
|
|
||||||
|
|
||||||
|
|
||||||
public void setUsageDeltaDao(UsageDeltaDAO usageDeltaDao)
|
public void setUsageDeltaDao(UsageDeltaDAO usageDeltaDao)
|
||||||
{
|
{
|
||||||
@@ -58,11 +53,6 @@ public class UsageServiceImpl implements UsageService
|
|||||||
{
|
{
|
||||||
this.nodeDaoService = nodeDaoService;
|
this.nodeDaoService = nodeDaoService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTenantService(TenantService tenantService)
|
|
||||||
{
|
|
||||||
this.tenantService = tenantService;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void insertDelta(NodeRef usageNodeRef, long deltaSize)
|
public void insertDelta(NodeRef usageNodeRef, long deltaSize)
|
||||||
@@ -103,7 +93,7 @@ public class UsageServiceImpl implements UsageService
|
|||||||
{
|
{
|
||||||
ParameterCheck.mandatory("nodeRef", nodeRef);
|
ParameterCheck.mandatory("nodeRef", nodeRef);
|
||||||
|
|
||||||
Node unchecked = nodeDaoService.getNode(tenantService.getName(nodeRef));
|
Node unchecked = nodeDaoService.getNode(nodeRef);
|
||||||
if (unchecked == null)
|
if (unchecked == null)
|
||||||
{
|
{
|
||||||
throw new InvalidNodeRefException("Node does not exist: " + nodeRef, nodeRef);
|
throw new InvalidNodeRefException("Node does not exist: " + nodeRef, nodeRef);
|
||||||
|
Reference in New Issue
Block a user