Merged v3.0 to HEAD

12725: *RECORD ONLY* remove errant comma
   12740: Merged V2.2 to V3.0
      12577: Fix ETWOTWO-973 - Enable Logging of Leaked Transactions By Default.
      12582: *RECORD-ONLY* Fix ETWOTWO-872 - openoffice bootstrap config in WAR bundle.
      12628: *RECORD-ONLY* Fix for ETWOTWO-937: Regression Multi-Valued properties - nullpointerexception if only one value is set initially
   12741: Merged V2.2 to V3.0
      12643: Fixed ETWOTWO-354: null properties created on copy-pasted nodes
      12694: Added NodeService.addProperties() method
      12695: Follow-up fix for  ETWOTWO-354: null properties created on copy-pasted nodes
      12715: Fix ETWOTWO-988: Gather Oracle schema stats before, during and after upgrade
      12730: IndexInfo.main processes multiple directory arguments
      12737: Fixed ETWOTWO-246, ETHREEOH-996 (by merge) and ALFCOM-2299: Cancel discussion orphans nodes
   12745: Merged V2.2 to V3.0
      12744: Fixed ETWOTWO-1011 and (by merge) ALFCOM-2372: Upgrade from 2.1C fails

   svn diff -N .
      Merged /alfresco/BRANCHES/V3.0:r12725,12740-12741,12745
      Merged /alfresco/BRANCHES/V2.2:r12577,12582,12628,12643,12694-12695,12715,12730,12737,12744


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12748 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-01-14 17:32:34 +00:00
parent b7ef06d97c
commit fd15f44b54
12 changed files with 259 additions and 26 deletions

View File

@@ -608,7 +608,8 @@ public class CopyServiceImpl implements CopyService
Collection<CopyServicePolicies.OnCopyNodePolicy> policies = this.onCopyNodeDelegate.getList(sourceClassRef);
if (policies.isEmpty() == true)
{
defaultOnCopy(sourceClassRef, sourceNodeRef, copyDetails);
Map<QName, Serializable> sourceNodeProperties = this.nodeService.getProperties(sourceNodeRef);
defaultOnCopy(sourceClassRef, sourceNodeRef, sourceNodeProperties, copyDetails);
}
else
{
@@ -626,7 +627,11 @@ public class CopyServiceImpl implements CopyService
* @param sourceNodeRef the source node reference
* @param copyDetails details of the state being copied
*/
private void defaultOnCopy(QName classRef, NodeRef sourceNodeRef, PolicyScope copyDetails)
private void defaultOnCopy(
QName classRef,
NodeRef sourceNodeRef,
Map<QName, Serializable> sourceNodeProperties,
PolicyScope copyDetails)
{
ClassDefinition classDefinition = this.dictionaryService.getClass(classRef);
if (classDefinition != null)
@@ -641,8 +646,11 @@ public class CopyServiceImpl implements CopyService
Map<QName,PropertyDefinition> propertyDefinitions = classDefinition.getProperties();
for (QName propertyName : propertyDefinitions.keySet())
{
Serializable propValue = this.nodeService.getProperty(sourceNodeRef, propertyName);
copyDetails.addProperty(classDefinition.getName(), propertyName, propValue);
Serializable propValue = sourceNodeProperties.get(propertyName);
if (propValue != null)
{
copyDetails.addProperty(classDefinition.getName(), propertyName, propValue);
}
}
// Copy the associations (child and target)
@@ -684,10 +692,16 @@ public class CopyServiceImpl implements CopyService
Map<QName, Serializable> props = copyDetails.getProperties();
if (props != null)
{
Map<QName, Serializable> copyProps = new HashMap<QName, Serializable>(props);
for (QName propName : props.keySet())
{
this.nodeService.setProperty(destinationNodeRef, propName, props.get(propName));
Serializable value = props.get(propName);
if (value == null)
{
copyProps.remove(propName);
}
}
this.nodeService.addProperties(destinationNodeRef, copyProps);
}
}