@Override public int compare(RuntimeResourceDefinition theO1, RuntimeResourceDefinition theO2) { int cmp = theO1.getName().compareTo(theO2.getName()); if (cmp==0) { cmp=theO1.getResourceProfile(serverBase).compareTo(theO2.getResourceProfile(serverBase)); } return cmp; }}); ArrayList<StructureDefinition> retVal = new ArrayList<>();
@SuppressWarnings("unchecked") @Override public <T extends IBaseParameters> IOperationUntypedWithInputAndPartialOutput<T> withNoParameters(Class<T> theOutputParameterType) { Validate.notNull(theOutputParameterType, "theOutputParameterType may not be null"); RuntimeResourceDefinition def = myContext.getResourceDefinition(theOutputParameterType); if (def == null) { throw new IllegalArgumentException("theOutputParameterType must refer to a HAPI FHIR Resource type: " + theOutputParameterType.getName()); } if (!"Parameters".equals(def.getName())) { throw new IllegalArgumentException("theOutputParameterType must refer to a HAPI FHIR Resource type for a resource named " + "Parameters" + " - " + theOutputParameterType.getName() + " is a resource named: " + def.getName()); } myParameters = (IBaseParameters) def.newInstance(); return this; }
/** * Express {@link #getImplementingClass()} as theClass (to prevent casting warnings) */ @SuppressWarnings("unchecked") public <T> Class<T> getImplementingClass(Class<T> theClass) { if (!theClass.isAssignableFrom(getImplementingClass())) { throw new ConfigurationException("Unable to convert " + getImplementingClass() + " to " + theClass); } return (Class<T>) getImplementingClass(); }
@Override public StructureDefinition generateProfile(RuntimeResourceDefinition theRuntimeResourceDefinition, String theServerBase) { StructureDefinition retVal = new StructureDefinition(); RuntimeResourceDefinition def = theRuntimeResourceDefinition; myId = def.getId(); if (StringUtils.isBlank(myId)) { myId = theRuntimeResourceDefinition.getName().toLowerCase(); } retVal.setId(myId); return retVal; }
@Override public IDeleteWithQuery resourceConditionalByType(Class<? extends IBaseResource> theResourceType) { Validate.notNull(theResourceType, "theResourceType can not be null"); myConditional = true; myResourceType = myContext.getResourceDefinition(theResourceType).getName(); return this; }
public static IBaseParameters newInstance(FhirContext theContext) { Validate.notNull(theContext, "theContext must not be null"); return (IBaseParameters) theContext.getResourceDefinition("Parameters").newInstance(); }
RuntimeSearchParam paramDef = def.getSearchParam(nextParamUnchainedName); if (paramDef != null) { nextParamDescription = paramDef.getDescription(); ResourceType code; try { code = ResourceType.fromCode(targetDef.getName()); } catch (FHIRException e) { code = null; param.addTarget(targetDef.getName());
String version; if (myType != null) { resourceName = myContext.getResourceDefinition(myType).getName(); id = null; version = null; if (myContext.getResourceDefinition((IBaseResource) retVal).getName().equals("Parameters")) { return retVal; IBaseResource parameters = def.newInstance(); BaseRuntimeChildDefinition paramChild = def.getChildByName("parameter"); BaseRuntimeElementCompositeDefinition<?> paramChildElem = (BaseRuntimeElementCompositeDefinition<?>) paramChild.getChildByName("parameter"); IBase parameter = paramChildElem.newInstance();
@Search() public List<StructureDefinition> getAllProfiles(ServletRequestDetails theRequest) { final String serverBase = getServerBase(theRequest); List<RuntimeResourceDefinition> defs = new ArrayList<>(myContext.getResourceDefinitionsWithExplicitId()); Collections.sort(defs, new Comparator<RuntimeResourceDefinition>() { @Override public int compare(RuntimeResourceDefinition theO1, RuntimeResourceDefinition theO2) { int cmp = theO1.getName().compareTo(theO2.getName()); if (cmp==0) { cmp=theO1.getResourceProfile(serverBase).compareTo(theO2.getResourceProfile(serverBase)); } return cmp; }}); ArrayList<StructureDefinition> retVal = new ArrayList<>(); for (RuntimeResourceDefinition next : defs) { retVal.add((StructureDefinition) next.toProfile(serverBase)); } return retVal; }
@SuppressWarnings("unchecked") private T readHtmlResponse(InputStream theResponseInputStream) { RuntimeResourceDefinition resDef = getFhirContext().getResourceDefinition(myReturnType); IBaseResource instance = resDef.newInstance(); BaseRuntimeChildDefinition textChild = resDef.getChildByName("text"); BaseRuntimeElementCompositeDefinition<?> textElement = (BaseRuntimeElementCompositeDefinition<?>) textChild.getChildByName("text"); IBase textInstance = textElement.newInstance(); textChild.getMutator().addValue(instance, textInstance); BaseRuntimeChildDefinition divChild = textElement.getChildByName("div"); BaseRuntimeElementDefinition<?> divElement = divChild.getChildByName("div"); IPrimitiveType<?> divInstance = (IPrimitiveType<?>) divElement.newInstance(); try { divInstance.setValueAsString(IOUtils.toString(theResponseInputStream, Charsets.UTF_8)); } catch (Exception e) { throw new InvalidResponseException(400, "Failed to process HTML response from server: " + e.getMessage(), e); } divChild.getMutator().addValue(textInstance, divInstance); return (T) instance; }
case ONLY_FOR_CUSTOM: RuntimeResourceDefinition resDef = myContext.getResourceDefinition(theResource); if (resDef.isStandardType()) { return theProfiles; String profile = nextDef.getResourceProfile(myServerBaseUrl); if (isNotBlank(profile)) { for (T next : theProfiles) {
private ISchematronResource getSchematron(IValidationContext<IBaseResource> theCtx) { Class<? extends IBaseResource> resource = theCtx.getResource().getClass(); Class<? extends IBaseResource> baseResourceClass = theCtx.getFhirContext().getResourceDefinition(resource).getBaseDefinition().getImplementingClass(); return getSchematronAndCache(theCtx, baseResourceClass); }
public boolean matchesInclude(Include theInclude) { if (theInclude.getValue().equals("*")) { return true; } int colonIndex = theInclude.getValue().indexOf(':'); if (colonIndex != -1) { // DSTU2+ style String resourceName = theInclude.getValue().substring(0, colonIndex); String paramName = theInclude.getValue().substring(colonIndex + 1); RuntimeResourceDefinition resourceDef = myContext.getResourceDefinition(resourceName); if (resourceDef != null) { RuntimeSearchParam searchParamDef = resourceDef.getSearchParam(paramName); if (searchParamDef!=null) { final String completeName = myOwningResource + "." + myName; boolean matched = false; for (String s : searchParamDef.getPathsSplit()) { if (s.equals(completeName) || s.startsWith(completeName + ".")) { matched = true; break; } } return matched; } } return false; } // DSTU1 style return (theInclude.getValue().equals(myOwningResource + '.' + myName)); } }
@Override public IBaseResource generateProfile(RuntimeResourceDefinition theRuntimeResourceDefinition, String theServerBase) { StructureDefinition retVal = new StructureDefinition(); RuntimeResourceDefinition def = theRuntimeResourceDefinition; myId = def.getId(); if (StringUtils.isBlank(myId)) { myId = theRuntimeResourceDefinition.getName().toLowerCase(); } retVal.setId(new IdDt(myId)); return retVal; }
@Override public IReadExecutable withIdAndVersion(String theId, String theVersion) { Validate.notBlank(theId, "The ID can not be blank"); myId = new IdDt(myType.getName(), theId, theVersion); return this; }
public static IBaseBinary newBinary(FhirContext theCtx) { return (IBaseBinary) theCtx.getResourceDefinition("Binary").newInstance(); }
RuntimeSearchParam paramDef = def.getSearchParam(nextParamUnchainedName); if (paramDef != null) { nextParamDescription = paramDef.getDescription(); ResourceType code; try { code = ResourceType.fromCode(targetDef.getName()); } catch (FHIRException e) { code = null;
@Search() public List<StructureDefinition> getAllProfiles(ServletRequestDetails theRequest) { final String serverBase = getServerBase(theRequest); List<RuntimeResourceDefinition> defs = new ArrayList<RuntimeResourceDefinition>(myContext.getResourceDefinitionsWithExplicitId()); Collections.sort(defs, new Comparator<RuntimeResourceDefinition>() { @Override public int compare(RuntimeResourceDefinition theO1, RuntimeResourceDefinition theO2) { int cmp = theO1.getName().compareTo(theO2.getName()); if (cmp==0) { cmp=theO1.getResourceProfile(serverBase).compareTo(theO2.getResourceProfile(serverBase)); } return cmp; }}); ArrayList<StructureDefinition> retVal = new ArrayList<StructureDefinition>(); for (RuntimeResourceDefinition next : defs) { retVal.add((StructureDefinition) next.toProfile(serverBase)); } return retVal; }
if (def.isStandardType() == false) { String profile = def.getResourceProfile(""); if (isNotBlank(profile)) { TagDefinition profileDef = getTagOrNull(TagTypeEnum.PROFILE, NS_JPA_PROFILE, profile, null);
@Override public int compare(RuntimeResourceDefinition theO1, RuntimeResourceDefinition theO2) { int cmp = theO1.getName().compareTo(theO2.getName()); if (cmp==0) { cmp=theO1.getResourceProfile(serverBase).compareTo(theO2.getResourceProfile(serverBase)); } return cmp; }}); ArrayList<StructureDefinition> retVal = new ArrayList<>();