String errorMessage = String.format("Cannot instantiate case definition %s: %s", caseDefinitionId, e.getMessage());
throw new RestException(Status.INTERNAL_SERVER_ERROR, e, errorMessage);
}
CaseInstanceDto result = CaseInstanceDto.fromCaseInstance(instance);
URI uri = context.getBaseUriBuilder()
.path(rootResourcePath)
.path(CaseInstanceRestService.PATH)
.path(instance.getId())
.build();
result.addReflexiveLink(uri, HttpMethod.GET, "self");
return result;
}