Merged BRANCHES/V3.4 to HEAD:

23595: Merged BRANCHES/DEV/V3.3-BUG-FIX to BRANCHES/V3.4:
        23594: Merged BRANCHES/V3.3 to BRANCHES/DEV/V3.3-BUG-FIX:
             23593: AVM: fix ALF-4877 for "/api/avmpath/..." (note: ALF-4522 already includes fix for "/api/path/content/avm/...")


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@24893 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2011-01-18 10:49:18 +00:00
parent ee6510a627
commit 086e0d242a
2 changed files with 29 additions and 5 deletions

View File

@@ -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 + "]";
}
}

View File

@@ -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)