mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALFCOM-2974 Corrected AVM version for reading properties from AVM Node Service.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14737 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -940,18 +940,26 @@ public class DeploymentServiceImpl implements DeploymentService
|
||||
return stringAspects;
|
||||
}
|
||||
|
||||
private Map<String, Serializable> getProperties(AVMNodeDescriptor src)
|
||||
private Map<String, Serializable> getProperties(AVMNodeDescriptor src, int version)
|
||||
{
|
||||
/**
|
||||
* Get the AVM properties - which do not have any of the "syntetic" Node Service Values.
|
||||
*/
|
||||
Map<QName, PropertyValue> properties = fAVMService.getNodeProperties(src);
|
||||
NodeRef nodeRef = AVMNodeConverter.ToNodeRef(version, src.getPath());
|
||||
|
||||
NodeRef nodeRef = AVMNodeConverter.ToNodeRef(src.getVersionID(), src.getPath());
|
||||
/**
|
||||
* Get the properties in Node Service format
|
||||
*/
|
||||
Map<QName, Serializable> nodeProps = fAVMNodeService.getProperties(nodeRef);
|
||||
|
||||
Map<String, Serializable> stringProperties = new HashMap<String, Serializable>();
|
||||
for(QName key : properties.keySet())
|
||||
{
|
||||
stringProperties.put(key.toString(), fAVMNodeService.getProperty(nodeRef, key));
|
||||
}
|
||||
return stringProperties;
|
||||
Map<String, Serializable> retVal = new HashMap<String, Serializable>();
|
||||
for(QName key : properties.keySet())
|
||||
{
|
||||
Serializable value = nodeProps.get(key);
|
||||
retVal.put(key.toString(), value);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1320,7 +1328,7 @@ public class DeploymentServiceImpl implements DeploymentService
|
||||
sendQueue.add(new DeploymentWork(
|
||||
new DeploymentEvent(DeploymentEvent.Type.UPDATED,
|
||||
new Pair<Integer, String>(version, src.getPath()),
|
||||
extendedPath), ticket, src));
|
||||
extendedPath), ticket, src, version));
|
||||
}
|
||||
src = null;
|
||||
dst = null;
|
||||
@@ -1332,7 +1340,7 @@ public class DeploymentServiceImpl implements DeploymentService
|
||||
String extendedPath = extendPath(dstPath, dst.getName());
|
||||
|
||||
Set<String>stringAspects = getAspects(fAVMService, src);
|
||||
Map<String, Serializable> stringProperties = getProperties(src);
|
||||
Map<String, Serializable> stringProperties = getProperties(src, version);
|
||||
|
||||
/**
|
||||
* Update the directory before any children
|
||||
@@ -1401,7 +1409,7 @@ public class DeploymentServiceImpl implements DeploymentService
|
||||
sendQueue.add(new DeploymentWork(
|
||||
new DeploymentEvent(DeploymentEvent.Type.CREATED,
|
||||
new Pair<Integer, String>(version, src.getPath()),
|
||||
dstPath), ticket, src));
|
||||
dstPath), ticket, src, version));
|
||||
|
||||
if (src.isFile())
|
||||
{
|
||||
@@ -1413,7 +1421,7 @@ public class DeploymentServiceImpl implements DeploymentService
|
||||
// Need to create directories in controlling thread since it needs to be created
|
||||
// BEFORE any children are written
|
||||
Set<String>stringAspects = getAspects(fAVMService, src);
|
||||
Map<String, Serializable> stringProperties = getProperties(src);
|
||||
Map<String, Serializable> stringProperties = getProperties(src, version);
|
||||
|
||||
service.createDirectory(ticket, dstPath, src.getGuid(), stringAspects, stringProperties);
|
||||
|
||||
@@ -1738,7 +1746,7 @@ public class DeploymentServiceImpl implements DeploymentService
|
||||
AVMNodeDescriptor src = work.getSrc();
|
||||
if(src.isFile())
|
||||
{
|
||||
copyFileToFSR(src, event.getDestination(), ticket);
|
||||
copyFileToFSR(src, work.getVersion(), event.getDestination(), ticket);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1748,7 +1756,7 @@ public class DeploymentServiceImpl implements DeploymentService
|
||||
}
|
||||
else if (event.getType().equals(DeploymentEvent.Type.UPDATED))
|
||||
{
|
||||
copyFileToFSR(work.getSrc(), event.getDestination(), ticket);
|
||||
copyFileToFSR(work.getSrc(), work.getVersion(), event.getDestination(), ticket);
|
||||
}
|
||||
// success, now put the event onto the event queue
|
||||
eventQueue.add(event);
|
||||
@@ -1776,6 +1784,7 @@ public class DeploymentServiceImpl implements DeploymentService
|
||||
*/
|
||||
private void copyFileToFSR(
|
||||
final AVMNodeDescriptor src,
|
||||
final int version,
|
||||
final String dstPath,
|
||||
final String ticket)
|
||||
{
|
||||
@@ -1794,7 +1803,7 @@ public class DeploymentServiceImpl implements DeploymentService
|
||||
String mimeType = data.getMimetype();
|
||||
|
||||
Set<String>stringAspects = getAspects(avmService, src);
|
||||
Map<String, Serializable> stringProperties = getProperties(src);
|
||||
Map<String, Serializable> stringProperties = getProperties(src, version);
|
||||
OutputStream out = service.send(ticket, dstPath, src.getGuid(), encoding, mimeType, stringAspects, stringProperties);
|
||||
|
||||
try
|
||||
|
@@ -32,6 +32,7 @@ class DeploymentWork
|
||||
private DeploymentEvent event;
|
||||
private AVMNodeDescriptor src;
|
||||
private String ticket;
|
||||
private int version;
|
||||
|
||||
public DeploymentWork(DeploymentEvent event, String ticket)
|
||||
{
|
||||
@@ -39,12 +40,12 @@ class DeploymentWork
|
||||
this.ticket = ticket;
|
||||
}
|
||||
|
||||
public DeploymentWork(DeploymentEvent event, String ticket, AVMNodeDescriptor src)
|
||||
public DeploymentWork(DeploymentEvent event, String ticket, AVMNodeDescriptor src, int version)
|
||||
{
|
||||
this.event = event;
|
||||
this.ticket = ticket;
|
||||
this.setSrc(src);
|
||||
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public DeploymentEvent getEvent()
|
||||
@@ -65,4 +66,9 @@ class DeploymentWork
|
||||
return src;
|
||||
}
|
||||
|
||||
public int getVersion()
|
||||
{
|
||||
return version;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user