* $LastChangedDate: $\r
*/\r
public class RefName {\r
+ public static final String HACK_VOCABULARIES = "Vocabularies"; //TODO: get rid of these.\r
+ public static final String HACK_ORGANIZATIONS = "Organizations"; //TODO: get rid of these.\r
+ public static final String HACK_ORGAUTHORITIES = "Orgauthorities"; //TODO: get rid of these.\r
+ public static final String HACK_PERSONAUTHORITIES = "Personauthorities"; //TODO: get rid of these.\r
+ public static final String HACK_LOCATIONAUTHORITIES = "Locationauthorities"; //TODO: get rid of these.\r
\r
- public static final String URN_PREFIX = "urn:cspace:";\r
+ public static final String URN_PREFIX = "urn:cspace:";\r
+ public static final String URN_NAME_PREFIX = "urn:cspace:name";\r
\r
- public static final String AUTHORITY_REGEX = "urn:cspace:(.*):(.*)\\((.*)\\)\\'?([^\\']*)\\'?";\r
+ public static final String REFNAME = "refName";\r
+\r
+ public static final String AUTHORITY_REGEX = "urn:cspace:(.*):(.*)\\((.*)\\)\\'?([^\\']*)\\'?";\r
public static final String AUTHORITY_ITEM_REGEX = "urn:cspace:(.*):(.*)\\((.*)\\):items\\((.*)\\)\\'?([^\\']*)\\'?";\r
\r
public static final String AUTHORITY_EXAMPLE = "urn:cspace:collectionspace.org:Loansin(shortID)'displayName'";\r
}\r
return null;\r
}\r
- public String toString() {\r
- String displaySuffix = (displayName != null && (!displayName.isEmpty())) ? '\'' + displayName + '\'' : "";\r
- return URN_PREFIX + tenantName + ':' + resource + "(" + shortIdentifier + ")" + displaySuffix;\r
- }\r
public boolean equals(Object other){\r
if (other == null){\r
return false;\r
return false;\r
}\r
}\r
+ public String getRelativeUri() {\r
+ return "/"+resource+"/"+URN_NAME_PREFIX+"("+shortIdentifier+")";\r
+ }\r
+ public String toString() {\r
+ String displaySuffix = (displayName != null && (!displayName.isEmpty())) ? '\'' + displayName + '\'' : "";\r
+ return URN_PREFIX + tenantName + ':' + resource + "(" + shortIdentifier + ")" + displaySuffix;\r
+ }\r
+\r
}\r
\r
public static class AuthorityItem {\r
return false;\r
}\r
}\r
+ public String getRelativeUri() {\r
+ return inAuthority.getRelativeUri()+"/items/"+URN_NAME_PREFIX+"("+shortIdentifier+")";\r
+ }\r
public String toString() {\r
String displaySuffix = (displayName != null && (!displayName.isEmpty())) ? '\'' + displayName + '\'' : "";\r
Authority ai = inAuthority;\r
return authority;\r
}\r
\r
- public static String buildRefNameForAuthorityItem(String tenantName, String serviceName, String authorityShortIdentifier,\r
- String itemShortIdentifier, String itemDisplayName) {\r
- AuthorityItem item = buildAuthorityItem(tenantName, serviceName, authorityShortIdentifier, itemShortIdentifier, itemDisplayName);\r
- return item.toString();\r
- }\r
-\r
public static AuthorityItem buildAuthorityItem(String tenantName, String serviceName, String authorityShortIdentifier,\r
String itemShortIdentifier, String itemDisplayName) {\r
Authority authority = buildAuthority(tenantName, serviceName, authorityShortIdentifier, "");\r
return item;\r
}\r
\r
+ /** Use this method to avoid formatting any urn's outside of this unit;\r
+ * Caller passes in a shortId, such as "TestAuthority", and method returns\r
+ * the correct urn path element, without any path delimiters such as '/'\r
+ * so that calling shortIdToPath("TestAuthority") returns "urn:cspace:name(TestAuthority)", and\r
+ * then this value may be put into a path, such as "/personauthorities/urn:cspace:name(TestAuthority)/items".\r
+ */\r
+ public static String shortIdToPath(String shortId){\r
+ return URN_NAME_PREFIX+'('+shortId+')';\r
+ }\r
+\r
\r
/*\r
public static String buildRefName(String tenantName, String serviceName, String shortIdentifier, String displayName, String authorityRefBaseName) {\r