mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
CMISScope enum now consistent with all other CMIS enums
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13811 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -24,9 +24,6 @@
|
||||
*/
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* The scope for a CMIS name
|
||||
@@ -38,39 +35,34 @@ import java.util.Map;
|
||||
* @author andyh
|
||||
*
|
||||
*/
|
||||
public enum CMISScope
|
||||
public enum CMISScope implements EnumLabel
|
||||
{
|
||||
OBJECT ('O'),
|
||||
RELATIONSHIP ('R'),
|
||||
DOCUMENT ('D'),
|
||||
FOLDER ('F'),
|
||||
POLICY ('P'),
|
||||
UNKNOWN ('U');
|
||||
OBJECT ("O"),
|
||||
RELATIONSHIP ("R"),
|
||||
DOCUMENT ("D"),
|
||||
FOLDER ("F"),
|
||||
POLICY ("P"),
|
||||
UNKNOWN ("U");
|
||||
|
||||
private static Map<Character, CMISScope> discriminatorMap = new HashMap<Character, CMISScope>(10);
|
||||
static
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param label
|
||||
*/
|
||||
CMISScope(String label)
|
||||
{
|
||||
for (CMISScope scope : CMISScope.values())
|
||||
{
|
||||
discriminatorMap.put(scope.discriminator, scope);
|
||||
}
|
||||
}
|
||||
|
||||
private char discriminator;
|
||||
|
||||
CMISScope(char discriminator)
|
||||
{
|
||||
this.discriminator = discriminator;
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public char discriminator()
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.cmis.EnumLabel#label()
|
||||
*/
|
||||
public String getLabel()
|
||||
{
|
||||
return discriminator;
|
||||
return label;
|
||||
}
|
||||
|
||||
public static CMISScope toScope(char discrimator)
|
||||
{
|
||||
return discriminatorMap.get(discrimator);
|
||||
}
|
||||
|
||||
public static EnumFactory<CMISScope> FACTORY = new EnumFactory<CMISScope>(CMISScope.class);
|
||||
}
|
||||
|
@@ -234,7 +234,7 @@ public class CMISMapping implements InitializingBean
|
||||
}
|
||||
|
||||
// Alfresco type id
|
||||
CMISScope scope = CMISScope.toScope(typeId.charAt(0));
|
||||
CMISScope scope = (CMISScope)CMISScope.FACTORY.fromLabel(typeId.substring(0, 1));
|
||||
if (scope == null)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Malformed type id '" + typeId + "'; discriminator " + typeId.charAt(0) + " unknown");
|
||||
@@ -257,7 +257,7 @@ public class CMISMapping implements InitializingBean
|
||||
if (typeId == null)
|
||||
{
|
||||
StringBuilder builder = new StringBuilder(128);
|
||||
builder.append(scope.discriminator());
|
||||
builder.append(scope.getLabel());
|
||||
builder.append("/");
|
||||
builder.append(buildPrefixEncodedString(typeQName, false));
|
||||
return new CMISTypeId(scope, builder.toString(), typeQName);
|
||||
|
Reference in New Issue
Block a user