UriTemplateRegistry registry = ServiceMain.getInstance().getUriTemplateRegistry();\r
UriTemplateRegistryKey key = new UriTemplateRegistryKey(tenantId, docType);\r
StoredValuesUriTemplate template = registry.get(key);\r
- // FIXME: Need to check here for any failure to retrieve a URI Template\r
- // from the registry, given a tenant ID and docType\r
- Map<String, String> additionalValues = new HashMap<String, String>();\r
- if (template.getUriTemplateType() == UriTemplateFactory.ITEM) {\r
- try {\r
- String inAuthorityCsid = (String) docModel.getPropertyValue("inAuthority"); // AuthorityItemJAXBSchema.IN_AUTHORITY\r
- additionalValues.put(UriTemplateFactory.IDENTIFIER_VAR, inAuthorityCsid);\r
- additionalValues.put(UriTemplateFactory.ITEM_IDENTIFIER_VAR, csid);\r
+ if (template != null) {\r
+ Map<String, String> additionalValues = new HashMap<String, String>();\r
+ if (template.getUriTemplateType() == UriTemplateFactory.RESOURCE) {\r
+ additionalValues.put(UriTemplateFactory.IDENTIFIER_VAR, csid);\r
uri = template.buildUri(additionalValues);\r
- } catch (Exception e) {\r
- logger.warn("Could not extract inAuthority property from authority item record: " + e.getMessage());\r
+ } else if (template.getUriTemplateType() == UriTemplateFactory.ITEM) {\r
+ try {\r
+ String inAuthorityCsid = (String) docModel.getPropertyValue("inAuthority"); // AuthorityItemJAXBSchema.IN_AUTHORITY\r
+ additionalValues.put(UriTemplateFactory.IDENTIFIER_VAR, inAuthorityCsid);\r
+ additionalValues.put(UriTemplateFactory.ITEM_IDENTIFIER_VAR, csid);\r
+ uri = template.buildUri(additionalValues);\r
+ } catch (Exception e) {\r
+ logger.warn("Could not extract inAuthority property from authority item record: " + e.getMessage());\r
+ }\r
+ } else if (template.getUriTemplateType() == UriTemplateFactory.CONTACT) {\r
+ // FIXME: Generating contact sub-resource URIs requires additional work,\r
+ // as a follow-on to CSPACE-5271 - ADR 2012-08-16\r
+ // Sets the default (empty string) value for uri, for now\r
+ } else {\r
+ logger.warn("Unrecognized URI template type = " + template.getUriTemplateType());\r
+ // Sets the default (empty string) value for uri\r
}\r
- // FIXME: Generating contact sub-resource URIs requires additional work,\r
- // beyond CSPACE-5271 - ADR 2012-08-16\r
- } else if (template.getUriTemplateType() == UriTemplateFactory.CONTACT) {\r
- // Return the default (empty string) value for URI, for now.\r
- } else {\r
- additionalValues.put(UriTemplateFactory.IDENTIFIER_VAR, csid);\r
- uri = template.buildUri(additionalValues);\r
+ } else { // (if template == null)\r
+ logger.warn("Could not retrieve URI template from registry via tenant ID "\r
+ + tenantId + " and docType " + docType);\r
+ // Sets the default (empty string) value for uri\r
}\r
ilistItem.setUri(uri);\r
try {\r
UriTemplateRegistry registry = ServiceMain.getInstance().getUriTemplateRegistry();
UriTemplateRegistryKey key = new UriTemplateRegistryKey(tenantId, docType);
StoredValuesUriTemplate template = registry.get(key);
- // FIXME: Need to check here for any failure to retrieve a URI Template
- // from the registry, given a tenant ID and docType
- Map<String, String> additionalValues = new HashMap<String, String>();
- if (template.getUriTemplateType() == UriTemplateFactory.ITEM) {
- try {
- String inAuthorityCsid = getInAuthorityValue(partTmpl);
- additionalValues.put(UriTemplateFactory.IDENTIFIER_VAR, inAuthorityCsid);
- additionalValues.put(UriTemplateFactory.ITEM_IDENTIFIER_VAR, docID);
+ if (template != null) {
+ Map<String, String> additionalValues = new HashMap<String, String>();
+ if (template.getUriTemplateType() == UriTemplateFactory.RESOURCE) {
+ additionalValues.put(UriTemplateFactory.IDENTIFIER_VAR, docID);
uri = template.buildUri(additionalValues);
-
- } catch (Exception e) {
- logger.warn("Could not extract inAuthority property from authority item record: " + e.getMessage());
+ } else if (template.getUriTemplateType() == UriTemplateFactory.ITEM) {
+ try {
+ String inAuthorityCsid = getInAuthorityValue(partTmpl);
+ additionalValues.put(UriTemplateFactory.IDENTIFIER_VAR, inAuthorityCsid);
+ additionalValues.put(UriTemplateFactory.ITEM_IDENTIFIER_VAR, docID);
+ uri = template.buildUri(additionalValues);
+ } catch (Exception e) {
+ logger.warn("Could not extract inAuthority property from authority item record: " + e.getMessage());
+ // Returns the default (empty string) value for uri
+ }
+ } else if (template.getUriTemplateType() == UriTemplateFactory.CONTACT) {
+ // FIXME: Generating contact sub-resource URIs requires additional work,
+ // as a follow-on to CSPACE-5271 - ADR 2012-08-16
+ // Returns the default (empty string) value for uri, for now
+ } else {
+ logger.warn("Unrecognized URI template type = " + template.getUriTemplateType());
+ // Returns the default (empty string) value for uri
}
- // FIXME: Generating contact sub-resource URIs requires additional work,
- // beyond CSPACE-5271 - ADR 2012-08-16
- } else if (template.getUriTemplateType() == UriTemplateFactory.CONTACT) {
- return uri;
- } else {
- additionalValues.put(UriTemplateFactory.IDENTIFIER_VAR, docID);
- uri = template.buildUri(additionalValues);
+ } else { // (if template == null)
+ logger.warn("Could not retrieve URI template from registry via tenant ID "
+ + tenantId + " and docType " + docType);
+ // Returns the default (empty string) value for uri
}
return uri;
}