Fix ALF-19749: NodeService/CopyService interface changes breaks backwards compatibility with add-ons

- This maintains binary compatibility with extensions build before 4.2
 - e.g.  GOOGLEDOCS-235 Unable to deploy latest Google Docs Enterprise AMPs onto 4.2 (HEAD-QA) 
 - Reversed ALF-19217: NodeService and CopyService APIs return modified flags
   We are back to creating redundant versions when duplicate changes are made to data


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@54488 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2013-08-27 11:12:54 +00:00
parent b97ff7bae0
commit 0d781560bf
14 changed files with 119 additions and 525 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2013 Alfresco Software Limited.
* Copyright (C) 2005-2010 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -268,7 +268,7 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
/**
* @throws UnsupportedOperationException Always
*/
public boolean deleteStore(StoreRef storeRef) throws InvalidStoreRefException
public void deleteStore(StoreRef storeRef) throws InvalidStoreRefException
{
throw new UnsupportedOperationException();
}
@@ -614,7 +614,7 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
* @see #getChildAssocs(NodeRef, QNamePattern, QNamePattern)
* @see ChildAssociationRef#getNthSibling()
*/
public boolean setChildAssociationIndex(
public void setChildAssociationIndex(
ChildAssociationRef childAssocRef,
int index)
throws InvalidChildAssociationRefException
@@ -622,7 +622,6 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
// TODO We'll keep this a no-op unless there's a
// compelling reason to implement this capability
// for the AVM repository.
return false;
}
/**
@@ -671,7 +670,7 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
*
* @since 1.1
*/
public boolean setType(NodeRef nodeRef, QName typeQName) throws InvalidNodeRefException
public void setType(NodeRef nodeRef, QName typeQName) throws InvalidNodeRefException
{
throw new UnsupportedOperationException("AVM Types are immutable.");
}
@@ -690,13 +689,12 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
* @see org.alfresco.service.cmr.dictionary.DictionaryService#getAspect(QName)
* @see org.alfresco.service.cmr.dictionary.ClassDefinition#getProperties()
*/
public boolean addAspect(
public void addAspect(
NodeRef nodeRef,
QName aspectTypeQName,
Map<QName, Serializable> aspectProperties)
throws InvalidNodeRefException, InvalidAspectException
{
boolean added = false;
// Check that the aspect exists.
AspectDefinition aspectDef = this.dictionaryService.getAspect(aspectTypeQName);
if (aspectDef == null)
@@ -726,7 +724,7 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
Map<QName, Serializable> defaultProperties = getDefaultProperties(aspectDef);
properties.putAll(defaultProperties);
// Now add any cascading aspects.
added = addDefaultAspects(aspectDef, avmPath, properties);
addDefaultAspects(aspectDef, avmPath, properties);
// Set the property values on the AVM Node.
if (properties.size() != 0)
{
@@ -745,14 +743,13 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
}
if (props.size() != 0)
{
added = true;
fAVMService.setNodeProperties(avmPath, props);
}
}
if (isBuiltinAspect(aspectTypeQName))
{
// No more work to do in this case.
return added;
return;
}
try
{
@@ -760,7 +757,6 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
// Invoke policy behaviors.
// invokeOnUpdateNode(nodeRef);
// invokeOnAddAspect(nodeRef, aspectTypeQName);
return added;
}
catch (AVMNotFoundException e)
{
@@ -773,12 +769,10 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
* @param classDef The ClassDefinition.
* @param path The path to the AVMNode.
* @param properties The in/out map of accumulated properties.
* @return <tt>true</tt> if aspect was added
*/
private boolean addDefaultAspects(ClassDefinition classDef, String path,
private void addDefaultAspects(ClassDefinition classDef, String path,
Map<QName, Serializable> properties)
{
boolean added = true;
NodeRef nodeRef = AVMNodeConverter.ToNodeRef(-1, path);
// Get mandatory aspects.
List<AspectDefinition> defaultAspectDefs = classDef.getDefaultAspects();
@@ -786,13 +780,12 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
for (AspectDefinition def : defaultAspectDefs)
{
// invokeBeforeAddAspect(nodeRef, def.getName());
added = added ? true : addAspect(nodeRef, def.getName(), Collections.<QName, Serializable>emptyMap());
addAspect(nodeRef, def.getName(), Collections.<QName, Serializable>emptyMap());
properties.putAll(getDefaultProperties(def));
// invokeOnAddAspect(nodeRef, def.getName());
// recurse
added = added ? true : addDefaultAspects(def, path, properties);
addDefaultAspects(def, path, properties);
}
return added;
}
/**
@@ -804,7 +797,7 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
* @throws InvalidAspectException if the the aspect is unknown or if the
* aspect is mandatory for the <b>class</b> of the <b>node</b>
*/
public boolean removeAspect(NodeRef nodeRef, QName aspectTypeQName)
public void removeAspect(NodeRef nodeRef, QName aspectTypeQName)
throws InvalidNodeRefException, InvalidAspectException
{
// Invoke policy behaviors.
@@ -818,7 +811,7 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
if (isBuiltinAspect(aspectTypeQName))
{
// TODO shouldn't we be throwing some kind of exception here.
return false;
return;
}
Pair<Integer, String> avmVersionPath = AVMNodeConverter.ToAVMVersionPath(nodeRef);
int version = avmVersionPath.getFirst();
@@ -837,9 +830,7 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
{
fAVMService.deleteNodeProperty(path, propertyName);
}
return true;
}
return false;
// Invoke policy behaviors.
// invokeOnUpdateNode(nodeRef);
// invokeOnRemoveAspect(nodeRef, aspectTypeQName);
@@ -930,7 +921,7 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
* @param nodeRef reference to a node within a store
* @throws InvalidNodeRefException if the reference given is invalid
*/
public boolean deleteNode(NodeRef nodeRef) throws InvalidNodeRefException
public void deleteNode(NodeRef nodeRef) throws InvalidNodeRefException
{
// Invoke policy behaviors.
// invokeBeforeDeleteNode(nodeRef);
@@ -956,7 +947,6 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
// avmPathBase[1]),
// nodeRef);
// invokeOnDeleteNode(childAssocRef, nodeTypeQName, aspects, false);
return true;
}
catch (AVMNotFoundException e)
{
@@ -1046,7 +1036,7 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
* @param childRef the child end of the association
* @throws InvalidNodeRefException if the parent or child nodes could not be found
*/
public boolean removeChild(NodeRef parentRef, NodeRef childRef) throws InvalidNodeRefException
public void removeChild(NodeRef parentRef, NodeRef childRef) throws InvalidNodeRefException
{
Pair<Integer, String> parentVersionPath = AVMNodeConverter.ToAVMVersionPath(parentRef);
if (parentVersionPath.getFirst() >= 0)
@@ -1077,7 +1067,6 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
fAVMService.removeNode(childPathBase[0], childPathBase[1]);
// invokeOnDeleteChildAssociation(assocRef);
// invokeOnUpdateNode(AVMNodeConverter.ToNodeRef(-1, parentPath));
return true;
}
catch (AVMNotFoundException e)
{
@@ -1227,18 +1216,17 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
/**
* {@inheritDoc}
*/
public boolean removeProperty(NodeRef nodeRef, QName qname) throws InvalidNodeRefException
public void removeProperty(NodeRef nodeRef, QName qname) throws InvalidNodeRefException
{
Pair<Integer, String> avmVersionPath = AVMNodeConverter.ToAVMVersionPath(nodeRef);
if (isBuiltInProperty(qname))
{
// Ignore
return false;
return;
}
try
{
fAVMService.deleteNodeProperty(avmVersionPath.getSecond(), qname);
return true;
}
catch (AVMNotFoundException e)
{
@@ -1353,7 +1341,7 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
* @param properties all the properties of the node keyed by their qualified names
* @throws InvalidNodeRefException if the node could not be found
*/
public boolean setProperties(NodeRef nodeRef, Map<QName, Serializable> properties) throws InvalidNodeRefException
public void setProperties(NodeRef nodeRef, Map<QName, Serializable> properties) throws InvalidNodeRefException
{
Pair<Integer, String> avmVersionPath = AVMNodeConverter.ToAVMVersionPath(nodeRef);
if (avmVersionPath.getFirst() >= 0)
@@ -1409,7 +1397,6 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
// Invoke policy behaviors.
// invokeOnUpdateNode(nodeRef);
// invokeOnUpdateProperties(nodeRef, oldProps, properties);
return true;
}
catch (AVMNotFoundException e)
{
@@ -1417,12 +1404,12 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
}
}
public boolean addProperties(NodeRef nodeRef, Map<QName, Serializable> properties)
public void addProperties(NodeRef nodeRef, Map<QName, Serializable> properties)
{
// Overwrite the current properties
Map<QName, Serializable> currentProperties = getProperties(nodeRef);
currentProperties.putAll(properties);
return setProperties(nodeRef, currentProperties);
setProperties(nodeRef, currentProperties);
}
static QName [] fgBuiltinProperties = new QName []
@@ -1471,7 +1458,7 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
* @param propertyValue the value of the property - never null
* @throws InvalidNodeRefException if the node could not be found
*/
public boolean setProperty(NodeRef nodeRef, QName qname, Serializable value) throws InvalidNodeRefException
public void setProperty(NodeRef nodeRef, QName qname, Serializable value) throws InvalidNodeRefException
{
// Invoke policy behaviors.
// invokeBeforeUpdateNode(nodeRef);
@@ -1499,15 +1486,14 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
Map<QName, Serializable> propsAfter = new HashMap<QName, Serializable>(propsBefore);
propsAfter.put(ContentModel.PROP_CONTENT, value);
invokeOnUpdateProperties(nodeRef, propsBefore, propsAfter);
}
return true;
}
}
catch (ClassCastException e)
{
throw new AVMException("Invalid ContentData.", e);
}
}
return false;
return;
}
try
{
@@ -1525,7 +1511,6 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
// Invoke policy behaviors.
// invokeOnUpdateNode(nodeRef);
// invokeOnUpdateProperties(nodeRef, propsBefore, propsAfter);
return true;
}
catch (AVMNotFoundException e)
{
@@ -1912,7 +1897,7 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
* @throws UnsupportedOperationException always
*/
@Override
public boolean setAssociations(NodeRef sourceRef, QName assocTypeQName, List<NodeRef> targetRefs)
public void setAssociations(NodeRef sourceRef, QName assocTypeQName, List<NodeRef> targetRefs)
{
throw new UnsupportedOperationException("AVM does not support arbitrary associations.");
}
@@ -1924,7 +1909,7 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
* @param assocTypeQName the qualified name of the association type
* @throws InvalidNodeRefException if either of the nodes could not be found
*/
public boolean removeAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName)
public void removeAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName)
throws InvalidNodeRefException
{
throw new UnsupportedOperationException("AVM does not support arbitrary associations.");