in taverna-reference-impl/src/main/java/org/apache/taverna/reference/impl/ReferenceServiceImpl.java [370:427]
public Identified resolveIdentifier(T2Reference id,
Set<Class<ExternalReferenceSPI>> ensureTypes,
ReferenceContext context) throws ReferenceServiceException {
checkServices();
if (context == null)
context = new EmptyReferenceContext();
switch (id.getReferenceType()) {
case ReferenceSet:
try {
ReferenceSet rs;
if (ensureTypes == null)
rs = referenceSetService.getReferenceSet(id);
else
rs = referenceSetService.getReferenceSetWithAugmentation(
id, ensureTypes, context);
if (rs == null)
throw new ReferenceServiceException(
"Could not find ReferenceSet " + id);
return rs;
} catch (ReferenceSetServiceException rsse) {
throw new ReferenceServiceException(rsse);
}
case ErrorDocument:
try {
ErrorDocument ed = errorDocumentService.getError(id);
if (ed == null)
throw new ReferenceServiceException(
"Could not find ErrorDocument " + id);
return ed;
} catch (ErrorDocumentServiceException edse) {
throw new ReferenceServiceException(edse);
}
case IdentifiedList:
try {
IdentifiedList<T2Reference> idList = listService.getList(id);
if (idList == null)
throw new ReferenceServiceException(
"Could not find IdentifiedList " + id);
/*
* Construct a new list, and populate with the result of
* resolving each ID in turn
*/
IdentifiedArrayList<Identified> newList = new IdentifiedArrayList<>();
for (T2Reference item : idList)
newList.add(resolveIdentifier(item, ensureTypes, context));
newList.setTypedId(getAsImpl(id));
return newList;
} catch (ListServiceException lse) {
throw new ReferenceServiceException(lse);
}
default:
throw new ReferenceServiceException("Unsupported ID type : "
+ id.getReferenceType());
}
}