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;
|
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);
|
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>();
|
Map<String, Serializable> retVal = new HashMap<String, Serializable>();
|
||||||
for(QName key : properties.keySet())
|
for(QName key : properties.keySet())
|
||||||
{
|
{
|
||||||
stringProperties.put(key.toString(), fAVMNodeService.getProperty(nodeRef, key));
|
Serializable value = nodeProps.get(key);
|
||||||
|
retVal.put(key.toString(), value);
|
||||||
}
|
}
|
||||||
return stringProperties;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1320,7 +1328,7 @@ public class DeploymentServiceImpl implements DeploymentService
|
|||||||
sendQueue.add(new DeploymentWork(
|
sendQueue.add(new DeploymentWork(
|
||||||
new DeploymentEvent(DeploymentEvent.Type.UPDATED,
|
new DeploymentEvent(DeploymentEvent.Type.UPDATED,
|
||||||
new Pair<Integer, String>(version, src.getPath()),
|
new Pair<Integer, String>(version, src.getPath()),
|
||||||
extendedPath), ticket, src));
|
extendedPath), ticket, src, version));
|
||||||
}
|
}
|
||||||
src = null;
|
src = null;
|
||||||
dst = null;
|
dst = null;
|
||||||
@@ -1332,7 +1340,7 @@ public class DeploymentServiceImpl implements DeploymentService
|
|||||||
String extendedPath = extendPath(dstPath, dst.getName());
|
String extendedPath = extendPath(dstPath, dst.getName());
|
||||||
|
|
||||||
Set<String>stringAspects = getAspects(fAVMService, src);
|
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
|
* Update the directory before any children
|
||||||
@@ -1401,7 +1409,7 @@ public class DeploymentServiceImpl implements DeploymentService
|
|||||||
sendQueue.add(new DeploymentWork(
|
sendQueue.add(new DeploymentWork(
|
||||||
new DeploymentEvent(DeploymentEvent.Type.CREATED,
|
new DeploymentEvent(DeploymentEvent.Type.CREATED,
|
||||||
new Pair<Integer, String>(version, src.getPath()),
|
new Pair<Integer, String>(version, src.getPath()),
|
||||||
dstPath), ticket, src));
|
dstPath), ticket, src, version));
|
||||||
|
|
||||||
if (src.isFile())
|
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
|
// Need to create directories in controlling thread since it needs to be created
|
||||||
// BEFORE any children are written
|
// BEFORE any children are written
|
||||||
Set<String>stringAspects = getAspects(fAVMService, src);
|
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);
|
service.createDirectory(ticket, dstPath, src.getGuid(), stringAspects, stringProperties);
|
||||||
|
|
||||||
@@ -1738,7 +1746,7 @@ public class DeploymentServiceImpl implements DeploymentService
|
|||||||
AVMNodeDescriptor src = work.getSrc();
|
AVMNodeDescriptor src = work.getSrc();
|
||||||
if(src.isFile())
|
if(src.isFile())
|
||||||
{
|
{
|
||||||
copyFileToFSR(src, event.getDestination(), ticket);
|
copyFileToFSR(src, work.getVersion(), event.getDestination(), ticket);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1748,7 +1756,7 @@ public class DeploymentServiceImpl implements DeploymentService
|
|||||||
}
|
}
|
||||||
else if (event.getType().equals(DeploymentEvent.Type.UPDATED))
|
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
|
// success, now put the event onto the event queue
|
||||||
eventQueue.add(event);
|
eventQueue.add(event);
|
||||||
@@ -1776,6 +1784,7 @@ public class DeploymentServiceImpl implements DeploymentService
|
|||||||
*/
|
*/
|
||||||
private void copyFileToFSR(
|
private void copyFileToFSR(
|
||||||
final AVMNodeDescriptor src,
|
final AVMNodeDescriptor src,
|
||||||
|
final int version,
|
||||||
final String dstPath,
|
final String dstPath,
|
||||||
final String ticket)
|
final String ticket)
|
||||||
{
|
{
|
||||||
@@ -1794,7 +1803,7 @@ public class DeploymentServiceImpl implements DeploymentService
|
|||||||
String mimeType = data.getMimetype();
|
String mimeType = data.getMimetype();
|
||||||
|
|
||||||
Set<String>stringAspects = getAspects(avmService, src);
|
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);
|
OutputStream out = service.send(ticket, dstPath, src.getGuid(), encoding, mimeType, stringAspects, stringProperties);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@@ -32,6 +32,7 @@ class DeploymentWork
|
|||||||
private DeploymentEvent event;
|
private DeploymentEvent event;
|
||||||
private AVMNodeDescriptor src;
|
private AVMNodeDescriptor src;
|
||||||
private String ticket;
|
private String ticket;
|
||||||
|
private int version;
|
||||||
|
|
||||||
public DeploymentWork(DeploymentEvent event, String ticket)
|
public DeploymentWork(DeploymentEvent event, String ticket)
|
||||||
{
|
{
|
||||||
@@ -39,12 +40,12 @@ class DeploymentWork
|
|||||||
this.ticket = ticket;
|
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.event = event;
|
||||||
this.ticket = ticket;
|
this.ticket = ticket;
|
||||||
this.setSrc(src);
|
this.setSrc(src);
|
||||||
|
this.version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DeploymentEvent getEvent()
|
public DeploymentEvent getEvent()
|
||||||
@@ -65,4 +66,9 @@ class DeploymentWork
|
|||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getVersion()
|
||||||
|
{
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user