diff --git a/source/java/org/alfresco/repo/cmis/reference/AVMPathReference.java b/source/java/org/alfresco/repo/cmis/reference/AVMPathReference.java index 676c0c8ed7..06d369546d 100644 --- a/source/java/org/alfresco/repo/cmis/reference/AVMPathReference.java +++ b/source/java/org/alfresco/repo/cmis/reference/AVMPathReference.java @@ -28,18 +28,27 @@ import org.alfresco.service.cmr.repository.NodeRef; * * @author davidc */ -public class AVMPathReference extends ObjectPathReference +public class AVMPathReference extends AbstractObjectReference { + protected String path; + protected String[] reference; + /** * Construct * * @param cmisServices * @param repo - * @param path + * @param path (note: AVM store relative path) */ public AVMPathReference(CMISServices cmisServices, CMISRepositoryReference repo, String path) { - super(cmisServices, repo, path); + super(cmisServices, repo); + String[] splitPath = path.split("/"); + this.reference = new String[1 + splitPath.length]; + String avmStoreName = repo.getStoreRef().getIdentifier(); + reference[0] = avmStoreName; + this.path = avmStoreName + ":/" + path; + System.arraycopy(splitPath, 0, reference, 1, splitPath.length); } /* @@ -51,10 +60,18 @@ public class AVMPathReference extends ObjectPathReference return cmisServices.getNode("avmpath", reference); } + /** + * @return AVM path (eg. avmstorename:/my/path/to/a/file) + */ + public String getPath() + { + return path; + } + @Override public String toString() { - return "AVMPathReference[storeRef=" + repo.getStoreRef() + ",path=" + path + "]"; + return "AVMPathReference[avmpath=" + path + "]"; } } diff --git a/source/java/org/alfresco/repo/cmis/reference/ReferenceFactory.java b/source/java/org/alfresco/repo/cmis/reference/ReferenceFactory.java index 0ac5391774..42a7d94f28 100644 --- a/source/java/org/alfresco/repo/cmis/reference/ReferenceFactory.java +++ b/source/java/org/alfresco/repo/cmis/reference/ReferenceFactory.java @@ -24,6 +24,7 @@ import org.alfresco.cmis.CMISObjectReference; import org.alfresco.cmis.CMISRelationshipReference; import org.alfresco.cmis.CMISRepositoryReference; import org.alfresco.cmis.CMISServices; +import org.alfresco.service.cmr.repository.StoreRef; /** @@ -64,7 +65,13 @@ public class ReferenceFactory { return new StoreRepositoryReference(cmisService, store); } - + + String avmPath = templateArgs.get("avmpath"); + if (avmPath != null && store_id != null) + { + return new StoreRepositoryReference(cmisService, StoreRef.PROTOCOL_AVM + ":" + store_id); + } + // TODO: repository id // String repoId = templateArgs.get("repo"); // else if (repoId != null)