singletons.add(new IDResource());
- // FIXME: Temporary for CSPACE-5271
+ // FIXME: Temporary for CSPACE-5271 - please remove once
+ // that issue is resolved
uriTemplateRegistry.dump();
/*
private void addResourceToMapAndSingletons(ResourceBase resource) {
singletons.add(resource);
resourceMap.put(resource.getServiceName(), resource);
- uriTemplateRegistry.putAll(resource.getUriTemplateMap());
+ // Contacts itself should not have an entry in the URI template registry;
+ // there should be a Contacts entry in that registry only for use in
+ // building URIs for resources that have contacts as a sub-resource
+ //
+ // FIXME: There may be a more elegant way to filter this out; or it may
+ // fall out during implementation of CSPACE-2698
+ if (! (resource instanceof ContactResource)) {
+ uriTemplateRegistry.putAll(resource.getUriTemplateMap());
+ }
}
@Override
\r
public String getDocType(String serviceName) {\r
String docType = "";\r
- String arbitraryTenantId = "";\r
+ String anyTenantId = "";\r
TenantBindingConfigReaderImpl reader = ServiceMain.getInstance().getTenantBindingConfigReader();\r
// FIXME: Makes the likely unsupportable assumption that the list of service names and associated\r
// document types is materially identical across tenants\r
- arbitraryTenantId = getArbitraryTenantId(reader);\r
- if (Tools.notBlank(arbitraryTenantId)) {\r
- ServiceBindingType sb = reader.getServiceBinding(arbitraryTenantId, serviceName);\r
+ anyTenantId = getAnyTenantId(reader);\r
+ if (Tools.notBlank(anyTenantId)) {\r
+ ServiceBindingType sb = reader.getServiceBinding(anyTenantId, serviceName);\r
docType = sb.getObject().getName(); // reads the Nuxeo Document Type from tenant bindings configuration\r
}\r
return docType;\r
return template;\r
}\r
\r
- public String getArbitraryTenantId(TenantBindingConfigReaderImpl reader) {\r
- String arbitraryTenantId = "";\r
+ public String getAnyTenantId(TenantBindingConfigReaderImpl reader) {\r
+ String anyTenantId = "";\r
Hashtable<String, TenantBindingType> tenantBindings = reader.getTenantBindings();\r
if (tenantBindings != null && !tenantBindings.isEmpty()) {\r
Enumeration keys = tenantBindings.keys();\r
while (keys.hasMoreElements()) {\r
- arbitraryTenantId = (String) keys.nextElement();\r
- if (Tools.notBlank(arbitraryTenantId)) {\r
+ anyTenantId = (String) keys.nextElement();\r
+ if (Tools.notBlank(anyTenantId)) {\r
break;\r
}\r
}\r
}\r
- return arbitraryTenantId;\r
+ return anyTenantId;\r
}\r
\r
}\r
return ContactConstants.NUXEO_DOCTYPE;
}
- // FIXME: This currently populates only one entry in the UriTemplateRegistry
+ // This currently populates only one entry in the UriTemplateRegistry
// for the Contacts docType, even though contacts can be a sub-resource of
- // multiple authority item resources. (This method is called more than once,
+ // multiple authority item resources. (This method may be called more than once,
// but each time the existing item with the same key in the map is overwritten.)
@Override
public Map<String,StoredValuesUriTemplate> getUriTemplateMap() {
if (contactUriTemplate == null) {
return uriTemplateMap; // return map as obtained from superclass
}
+ // Remove any service name value stored in the template, as the service name
+ // for contact resources will vary, and must be provided at URI build time
+ contactUriTemplate.getStoredValuesMap().put(UriTemplateFactory.SERVICENAME_VAR, "");
uriTemplateMap.put(contactDocType, contactUriTemplate);
return uriTemplateMap;
}