MOB-29: Content Storage Lifecycle Management

- Some collapsing of common code in Constraint hierarchy.
 - Added aspect 'cm:storeSelector' with property 'cm:storeName'.
 - Defined a new, unused content store 'storeSelectorContentStore' (see content-services-context.xml).
   If this store is used, then setting the 'cm:storeName' property will force content to be stored in one
   of the named stores.  A LIST constraint is indirectly enforced for the 'cm:storeName' property.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14329 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-05-15 04:36:20 +00:00
parent d1d35999de
commit e1ada58fef
27 changed files with 982 additions and 166 deletions

View File

@@ -1302,10 +1302,15 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
// TODO Not sure this try block is necessary.
try
{
// Invoke policy behaviors.
// invokeBeforeUpdateNode(nodeRef);
// Map<QName, Serializable> oldProps = getProperties(nodeRef);
// Prepare fr policy invocation.
Map<QName, Serializable> propsBefore = null;
if (fInvokePolicies)
{
propsBefore = getProperties(nodeRef);
}
// Remove all properties
fAVMService.deleteNodeProperties(avmVersionPath.getSecond());
// Rebuild node properties
Map<QName, PropertyValue> values = new HashMap<QName, PropertyValue>();
for (Map.Entry<QName, Serializable> entry : properties.entrySet())
{
@@ -1332,7 +1337,14 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
PropertyValue propertyValue = makePropertyValue(propertyDef, value);
values.put(propertyQName, propertyValue);
}
// Finally set node properties
fAVMService.setNodeProperties(avmVersionPath.getSecond(), values);
// Invoke policies
if (fInvokePolicies)
{
Map<QName, Serializable> propsAfter = properties;
invokeOnUpdateProperties(nodeRef, propsBefore, propsAfter);
}
// Invoke policy behaviors.
// invokeOnUpdateNode(nodeRef);
// invokeOnUpdateProperties(nodeRef, oldProps, properties);
@@ -1413,13 +1425,6 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
try
{
fAVMService.setContentData(avmVersionPath.getSecond(), (ContentData)value);
if (fInvokePolicies)
{
Map<QName, Serializable> propsBefore = new HashMap<QName, Serializable>();
Map<QName, Serializable> propsAfter = new HashMap<QName, Serializable>();
propsAfter.put(ContentModel.PROP_CONTENT, value);
invokeOnUpdateProperties(nodeRef, propsBefore, propsAfter);
}
}
catch (ClassCastException e)
{
@@ -1430,10 +1435,20 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
}
try
{
// Map<QName, Serializable> propsBefore = getProperties(nodeRef);
Map<QName, Serializable> propsBefore = null;
if (fInvokePolicies)
{
propsBefore = getProperties(nodeRef);
}
PropertyDefinition propertyDef = dictionaryService.getProperty(qname);
PropertyValue propertyValue = makePropertyValue(propertyDef, value);
fAVMService.setNodeProperty(avmVersionPath.getSecond(), qname, propertyValue);
if (fInvokePolicies)
{
Map<QName, Serializable> propsAfter = new HashMap<QName, Serializable>(propsBefore);
propsAfter.put(qname, value);
invokeOnUpdateProperties(nodeRef, propsBefore, propsAfter);
}
// Map<QName, Serializable> propsAfter = getProperties(nodeRef);
// Invoke policy behaviors.
// invokeOnUpdateNode(nodeRef);