mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V2.0 to HEAD
5457: Merge error on copy web project action 5459: AR-1278 5461: 5462: A few deployment fixes 5469: Dictionary messages 5470: L2 cache checks 5478: WCM-374 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5485 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -314,8 +314,15 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
||||
// create the node instance
|
||||
Node childNode = nodeDaoService.newNode(store, newId, nodeTypeQName);
|
||||
|
||||
// get the parent node
|
||||
// Get the parent node
|
||||
Node parentNode = getNodeNotNull(parentRef);
|
||||
// Create the association
|
||||
ChildAssoc childAssoc = nodeDaoService.newChildAssoc(
|
||||
parentNode,
|
||||
childNode,
|
||||
true,
|
||||
assocTypeQName,
|
||||
assocQName);
|
||||
|
||||
// Set the default property values
|
||||
addDefaultPropertyValues(nodeTypeDef, properties);
|
||||
@@ -331,13 +338,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
||||
propertiesAfter = setPropertiesImpl(childNode, properties);
|
||||
}
|
||||
|
||||
// create the association
|
||||
ChildAssoc childAssoc = nodeDaoService.newChildAssoc(
|
||||
parentNode,
|
||||
childNode,
|
||||
true,
|
||||
assocTypeQName,
|
||||
assocQName);
|
||||
// Ensure child uniqueness
|
||||
setChildUniqueName(childNode); // ensure uniqueness
|
||||
ChildAssociationRef childAssocRef = childAssoc.getChildAssocRef();
|
||||
|
||||
@@ -1069,7 +1070,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
||||
{
|
||||
Node node = getNodeNotNull(nodeRef);
|
||||
// get the assocs pointing to it
|
||||
Collection<ChildAssoc> parentAssocs = node.getParentAssocs();
|
||||
Collection<ChildAssoc> parentAssocs = nodeDaoService.getParentAssocs(node);
|
||||
// list of results
|
||||
Collection<NodeRef> results = new ArrayList<NodeRef>(parentAssocs.size());
|
||||
for (ChildAssoc assoc : parentAssocs)
|
||||
@@ -1089,7 +1090,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
||||
{
|
||||
Node node = getNodeNotNull(nodeRef);
|
||||
// get the assocs pointing to it
|
||||
Collection<ChildAssoc> parentAssocs = node.getParentAssocs();
|
||||
Collection<ChildAssoc> parentAssocs = nodeDaoService.getParentAssocs(node);
|
||||
// shortcut if there are no assocs
|
||||
if (parentAssocs.size() == 0)
|
||||
{
|
||||
@@ -1319,7 +1320,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
||||
{
|
||||
NodeRef currentNodeRef = currentNode.getNodeRef();
|
||||
// get the parent associations of the given node
|
||||
Collection<ChildAssoc> parentAssocs = currentNode.getParentAssocs();
|
||||
Collection<ChildAssoc> parentAssocs = nodeDaoService.getParentAssocs(currentNode);
|
||||
// does the node have parents
|
||||
boolean hasParents = parentAssocs.size() > 0;
|
||||
// does the current node have a root aspect?
|
||||
@@ -1651,7 +1652,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
||||
}
|
||||
// parent associations
|
||||
ArrayList<ChildAssociationRef> archivedParentAssocRefs = new ArrayList<ChildAssociationRef>(5);
|
||||
for (ChildAssoc assoc : node.getParentAssocs())
|
||||
for (ChildAssoc assoc : nodeDaoService.getParentAssocs(node))
|
||||
{
|
||||
Long relatedNodeId = assoc.getParent().getId();
|
||||
if (nodeStatusesById.containsKey(relatedNodeId))
|
||||
@@ -1952,7 +1953,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
||||
useName = (String) nameValue.getValue(DataTypeDefinition.TEXT);
|
||||
}
|
||||
// get all the parent assocs
|
||||
Collection<ChildAssoc> parentAssocs = childNode.getParentAssocs();
|
||||
Collection<ChildAssoc> parentAssocs = nodeDaoService.getParentAssocs(childNode);
|
||||
for (ChildAssoc assoc : parentAssocs)
|
||||
{
|
||||
QName assocTypeQName = assoc.getTypeQName();
|
||||
|
@@ -223,6 +223,13 @@ public interface NodeDaoService
|
||||
*/
|
||||
public ChildAssoc getPrimaryParentAssoc(Node node);
|
||||
|
||||
/**
|
||||
* Get all parent associations for the node. This methods includes a cache safety check.
|
||||
* @param node the child node
|
||||
* @return Returns all parent associations for the node.
|
||||
*/
|
||||
public Collection<ChildAssoc> getParentAssocs(Node node);
|
||||
|
||||
/**
|
||||
* @return Returns the persisted and filled association
|
||||
* @see NodeAssoc
|
||||
|
@@ -900,6 +900,49 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
||||
getSession().flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*
|
||||
* This method includes a check to ensure that the <b>parentAssocs</b> cache
|
||||
* isn't incorrectly empty.
|
||||
*/
|
||||
public Collection<ChildAssoc> getParentAssocs(Node node)
|
||||
{
|
||||
Collection<ChildAssoc> parentAssocs = node.getParentAssocs();
|
||||
if (parentAssocs.size() == 0)
|
||||
{
|
||||
// the only condition where this is allowed is if the given node is a root node
|
||||
Store store = node.getStore();
|
||||
Node rootNode = store.getRootNode();
|
||||
if (rootNode == null)
|
||||
{
|
||||
// a store without a root node - the entire store is hosed
|
||||
throw new DataIntegrityViolationException("Store has no root node: \n" +
|
||||
" store: " + store);
|
||||
}
|
||||
if (!rootNode.equals(node))
|
||||
{
|
||||
// Reload the node to ensure that it is properly initialized
|
||||
getSession().refresh(node);
|
||||
// Check if it has any parents yet.
|
||||
if (node.getParentAssocs().size() == 0)
|
||||
{
|
||||
// It wasn't the root node and definitely has no parent
|
||||
throw new DataIntegrityViolationException(
|
||||
"Non-root node has no primary parent: \n" +
|
||||
" child: " + node);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Repeat this method with confidence
|
||||
return getParentAssocs(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Done
|
||||
return parentAssocs;
|
||||
}
|
||||
|
||||
private Set<NodeRef> warnedDuplicateParents = new HashSet<NodeRef>(3);
|
||||
/**
|
||||
* @inheritDoc
|
||||
|
Reference in New Issue
Block a user