mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V2.0 to HEAD
5116: AWC-1067, AWC-1126 5121: AR-1233 (from 1.4 via 2.0) 5129: AR-966 5131: Overlay copy and duplicate name git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5323 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -282,6 +282,11 @@ public class MailActionExecuter extends ActionExecuterAbstractBase
|
|||||||
|
|
||||||
message.setTo(recipients.toArray(new String[recipients.size()]));
|
message.setTo(recipients.toArray(new String[recipients.size()]));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// No recipiants have been specified
|
||||||
|
logger.error("No recipiant has been specified for the mail action");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// set subject line
|
// set subject line
|
||||||
|
@@ -898,6 +898,9 @@ public class CopyServiceImpl implements CopyService
|
|||||||
// Get the copy details
|
// Get the copy details
|
||||||
PolicyScope copyDetails = getCopyDetails(sourceNodeRef, destinationNodeRef.getStoreRef(), false);
|
PolicyScope copyDetails = getCopyDetails(sourceNodeRef, destinationNodeRef.getStoreRef(), false);
|
||||||
|
|
||||||
|
// Remove the name property from the policy scope to prevent duplicate name exceptions
|
||||||
|
copyDetails.removeProperty(ContentModel.PROP_NAME);
|
||||||
|
|
||||||
// Copy over the top of the destination node
|
// Copy over the top of the destination node
|
||||||
copyProperties(destinationNodeRef, copyDetails);
|
copyProperties(destinationNodeRef, copyDetails);
|
||||||
copyAspects(destinationNodeRef, copyDetails);
|
copyAspects(destinationNodeRef, copyDetails);
|
||||||
|
@@ -124,6 +124,10 @@ public abstract class BaseNodeServiceTest extends BaseSpringTest
|
|||||||
public static final QName ASSOC_TYPE_QNAME_TEST_CONTAINS = ContentModel.ASSOC_CONTAINS;
|
public static final QName ASSOC_TYPE_QNAME_TEST_CONTAINS = ContentModel.ASSOC_CONTAINS;
|
||||||
public static final QName ASSOC_TYPE_QNAME_TEST_NEXT = QName.createQName(NAMESPACE, "next");
|
public static final QName ASSOC_TYPE_QNAME_TEST_NEXT = QName.createQName(NAMESPACE, "next");
|
||||||
|
|
||||||
|
public static final QName ASPECT_WITH_ASSOCIATIONS = QName.createQName(NAMESPACE, "withAssociations");
|
||||||
|
public static final QName ASSOC_ASPECT_CHILD_ASSOC = QName.createQName(NAMESPACE, "aspect-child-assoc");
|
||||||
|
public static final QName ASSOC_ASPECT_NORMAL_ASSOC = QName.createQName(NAMESPACE, "aspect-normal-assoc");
|
||||||
|
|
||||||
public static final QName TYPE_QNAME_TEST_MULTIPLE_TESTER = QName.createQName(NAMESPACE, "multiple-tester");
|
public static final QName TYPE_QNAME_TEST_MULTIPLE_TESTER = QName.createQName(NAMESPACE, "multiple-tester");
|
||||||
public static final QName PROP_QNAME_STRING_PROP_SINGLE = QName.createQName(NAMESPACE, "stringprop-single");
|
public static final QName PROP_QNAME_STRING_PROP_SINGLE = QName.createQName(NAMESPACE, "stringprop-single");
|
||||||
public static final QName PROP_QNAME_STRING_PROP_MULTIPLE = QName.createQName(NAMESPACE, "stringprop-multiple");
|
public static final QName PROP_QNAME_STRING_PROP_MULTIPLE = QName.createQName(NAMESPACE, "stringprop-multiple");
|
||||||
@@ -567,7 +571,7 @@ public abstract class BaseNodeServiceTest extends BaseSpringTest
|
|||||||
QName.createQName(BaseNodeServiceTest.NAMESPACE, "test-container"),
|
QName.createQName(BaseNodeServiceTest.NAMESPACE, "test-container"),
|
||||||
ContentModel.TYPE_CONTAINER);
|
ContentModel.TYPE_CONTAINER);
|
||||||
NodeRef nodeRef = assocRef.getChildRef();
|
NodeRef nodeRef = assocRef.getChildRef();
|
||||||
// add the content aspect to the node, but don't supply any properties
|
// add the titled aspect to the node, but don't supply any properties
|
||||||
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(20);
|
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(20);
|
||||||
nodeService.addAspect(nodeRef, BaseNodeServiceTest.ASPECT_QNAME_TEST_TITLED, properties);
|
nodeService.addAspect(nodeRef, BaseNodeServiceTest.ASPECT_QNAME_TEST_TITLED, properties);
|
||||||
|
|
||||||
@@ -604,6 +608,48 @@ public abstract class BaseNodeServiceTest extends BaseSpringTest
|
|||||||
propertiesAfter.size());
|
propertiesAfter.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testAspectRemoval() throws Exception
|
||||||
|
{
|
||||||
|
// Create a node to add the aspect to
|
||||||
|
NodeRef sourceNodeRef = nodeService.createNode(
|
||||||
|
rootNodeRef,
|
||||||
|
ASSOC_TYPE_QNAME_TEST_CHILDREN,
|
||||||
|
QName.createQName(BaseNodeServiceTest.NAMESPACE, "testAspectRemoval-source"),
|
||||||
|
ContentModel.TYPE_CONTAINER).getChildRef();
|
||||||
|
|
||||||
|
// Create a target for the associations
|
||||||
|
NodeRef targetNodeRef = nodeService.createNode(
|
||||||
|
rootNodeRef,
|
||||||
|
ASSOC_TYPE_QNAME_TEST_CHILDREN,
|
||||||
|
QName.createQName(BaseNodeServiceTest.NAMESPACE, "testAspectRemoval-target"),
|
||||||
|
ContentModel.TYPE_CONTAINER).getChildRef();
|
||||||
|
|
||||||
|
// Add the aspect to the source
|
||||||
|
nodeService.addAspect(sourceNodeRef, ASPECT_WITH_ASSOCIATIONS, null);
|
||||||
|
// Make the associations
|
||||||
|
nodeService.addChild(
|
||||||
|
sourceNodeRef,
|
||||||
|
targetNodeRef,
|
||||||
|
ASSOC_ASPECT_CHILD_ASSOC,
|
||||||
|
QName.createQName(NAMESPACE, "aspect-child"));
|
||||||
|
nodeService.createAssociation(sourceNodeRef, targetNodeRef, ASSOC_ASPECT_NORMAL_ASSOC);
|
||||||
|
|
||||||
|
// Check that the correct associations are present
|
||||||
|
assertEquals("Expected exactly one child",
|
||||||
|
1, nodeService.getChildAssocs(sourceNodeRef).size());
|
||||||
|
assertEquals("Expected exactly one target",
|
||||||
|
1, nodeService.getTargetAssocs(sourceNodeRef, RegexQNamePattern.MATCH_ALL).size());
|
||||||
|
|
||||||
|
// Now remove the aspect
|
||||||
|
nodeService.removeAspect(sourceNodeRef, ASPECT_WITH_ASSOCIATIONS);
|
||||||
|
|
||||||
|
// Check that the associations were removed
|
||||||
|
assertEquals("Expected exactly one child",
|
||||||
|
0, nodeService.getChildAssocs(sourceNodeRef).size());
|
||||||
|
assertEquals("Expected exactly one target",
|
||||||
|
0, nodeService.getTargetAssocs(sourceNodeRef, RegexQNamePattern.MATCH_ALL).size());
|
||||||
|
}
|
||||||
|
|
||||||
public void testCreateNodeNoProperties() throws Exception
|
public void testCreateNodeNoProperties() throws Exception
|
||||||
{
|
{
|
||||||
// flush to ensure that the pure JDBC query will work
|
// flush to ensure that the pure JDBC query will work
|
||||||
|
@@ -324,6 +324,34 @@
|
|||||||
</properties>
|
</properties>
|
||||||
</aspect>
|
</aspect>
|
||||||
|
|
||||||
|
<aspect name="test:withAssociations">
|
||||||
|
<title>Aspect with Associations</title>
|
||||||
|
<associations>
|
||||||
|
<child-association name="test:aspect-child-assoc">
|
||||||
|
<source>
|
||||||
|
<mandatory>false</mandatory>
|
||||||
|
<many>false</many>
|
||||||
|
</source>
|
||||||
|
<target>
|
||||||
|
<class>sys:base</class>
|
||||||
|
<mandatory>true</mandatory>
|
||||||
|
<many>true</many>
|
||||||
|
</target>
|
||||||
|
</child-association>
|
||||||
|
<association name="test:aspect-normal-assoc">
|
||||||
|
<source>
|
||||||
|
<mandatory>false</mandatory>
|
||||||
|
<many>false</many>
|
||||||
|
</source>
|
||||||
|
<target>
|
||||||
|
<class>sys:base</class>
|
||||||
|
<mandatory>true</mandatory>
|
||||||
|
<many>true</many>
|
||||||
|
</target>
|
||||||
|
</association>
|
||||||
|
</associations>
|
||||||
|
</aspect>
|
||||||
|
|
||||||
</aspects>
|
</aspects>
|
||||||
|
|
||||||
</model>
|
</model>
|
||||||
|
@@ -605,7 +605,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
|
|
||||||
// remove the aspect, if present
|
// remove the aspect, if present
|
||||||
boolean removed = node.getAspects().remove(aspectTypeQName);
|
boolean removed = node.getAspects().remove(aspectTypeQName);
|
||||||
// if the aspect was present, remove the associated properties
|
// if the aspect was present, remove the associated properties and associations
|
||||||
if (removed)
|
if (removed)
|
||||||
{
|
{
|
||||||
Map<QName, PropertyValue> nodeProperties = node.getProperties();
|
Map<QName, PropertyValue> nodeProperties = node.getProperties();
|
||||||
@@ -615,6 +615,36 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
nodeProperties.remove(propertyName);
|
nodeProperties.remove(propertyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove child associations
|
||||||
|
Map<QName, ChildAssociationDefinition> childAssocDefs = aspectDef.getChildAssociations();
|
||||||
|
Collection<ChildAssoc> childAssocs = nodeDaoService.getChildAssocs(node);
|
||||||
|
for (ChildAssoc childAssoc : childAssocs)
|
||||||
|
{
|
||||||
|
// Ignore if the association type is not defined by the aspect
|
||||||
|
QName childAssocQName = childAssoc.getTypeQName();
|
||||||
|
if (!childAssocDefs.containsKey(childAssocQName))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// The association is of a type that should be removed
|
||||||
|
nodeDaoService.deleteChildAssoc(childAssoc, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove regular associations
|
||||||
|
Map<QName, AssociationDefinition> assocDefs = aspectDef.getAssociations();
|
||||||
|
List<NodeAssoc> nodeAssocs = nodeDaoService.getTargetNodeAssocs(node);
|
||||||
|
for (NodeAssoc nodeAssoc : nodeAssocs)
|
||||||
|
{
|
||||||
|
// Ignore if the association type is not defined by the aspect
|
||||||
|
QName nodeAssocQName = nodeAssoc.getTypeQName();
|
||||||
|
if (!assocDefs.containsKey(nodeAssocQName))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Delete the association
|
||||||
|
nodeDaoService.deleteNodeAssoc(nodeAssoc);
|
||||||
|
}
|
||||||
|
|
||||||
// Invoke policy behaviours
|
// Invoke policy behaviours
|
||||||
invokeOnUpdateNode(nodeRef);
|
invokeOnUpdateNode(nodeRef);
|
||||||
invokeOnRemoveAspect(nodeRef, aspectTypeQName);
|
invokeOnRemoveAspect(nodeRef, aspectTypeQName);
|
||||||
|
Reference in New Issue
Block a user