mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-17 14:21:39 +00:00
The AVM repository does name validation. Changed internal representation
of AVM NodeRefs to make the Node Browser in the UI happier. Added minimal test to ensure that AVM is case insensitive. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3627 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -19,6 +19,7 @@ package org.alfresco.repo.avm;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Utility for going back and forth between the AVM world and
|
||||
@@ -27,6 +28,8 @@ import org.alfresco.service.cmr.repository.StoreRef;
|
||||
*/
|
||||
public class AVMNodeConverter
|
||||
{
|
||||
private static Logger fgLogger = Logger.getLogger(AVMNodeConverter.class);
|
||||
|
||||
/**
|
||||
* Get a NodeRef corresponding to the given path and version.
|
||||
* @param version The version id.
|
||||
@@ -42,6 +45,7 @@ public class AVMNodeConverter
|
||||
}
|
||||
StoreRef storeRef = ToStoreRef(pathParts[0]);
|
||||
String translated = version + pathParts[1];
|
||||
translated = translated.replaceAll("/+", ";");
|
||||
return new NodeRef(storeRef, translated);
|
||||
}
|
||||
|
||||
@@ -64,7 +68,13 @@ public class AVMNodeConverter
|
||||
{
|
||||
StoreRef store = nodeRef.getStoreRef();
|
||||
String translated = nodeRef.getId();
|
||||
translated = translated.replace(';', '/');
|
||||
int off = translated.indexOf("/");
|
||||
if (off == -1)
|
||||
{
|
||||
fgLogger.error(translated);
|
||||
throw new AVMException("Bad Node Reference.");
|
||||
}
|
||||
int version = Integer.parseInt(translated.substring(0, off));
|
||||
String path = translated.substring(off);
|
||||
Object [] result = new Object[2];
|
||||
|
Reference in New Issue
Block a user