entry.getSearch().getModeElement().setValue(searchMode.getCode());
@Override public void setValueAsQueryToken(FhirContext theContext, String theParamName, String theQualifier, String theValue) { getComparatorElement().setValue(null); setCode( null); setSystem(null); if (parts[0].startsWith("le")) { getComparatorElement().setValue(ParamPrefixEnum.LESSTHAN_OR_EQUALS.getValue()); setValue(new BigDecimal(parts[0].substring(2))); } else if (parts[0].startsWith("lt")) { getComparatorElement().setValue(ParamPrefixEnum.LESSTHAN.getValue()); setValue(new BigDecimal(parts[0].substring(1))); } else if (parts[0].startsWith("ge")) { getComparatorElement().setValue(ParamPrefixEnum.GREATERTHAN_OR_EQUALS.getValue()); setValue(new BigDecimal(parts[0].substring(2))); } else if (parts[0].startsWith("gt")) { getComparatorElement().setValue(ParamPrefixEnum.GREATERTHAN.getValue()); setValue(new BigDecimal(parts[0].substring(1))); } else {
entry.getSearch().getModeElement().setValue(searchMode.getCode());
@Override protected IBaseOperationOutcome createOperationOutcome(String theSeverity, String theMessage, String theCode) { OperationOutcome oo = new OperationOutcome(); oo.getIssueFirstRep().getSeverityElement().setValue(theSeverity); oo.getIssueFirstRep().getDiagnosticsElement().setValue(theMessage); oo.getIssueFirstRep().getCodeElement().setValue(theCode); return oo; }
@SuppressWarnings("unused") public static void codes() { // START SNIPPET: codes Patient patient = new Patient(); // You can set this code using a String if you want. Note that // for "closed" valuesets (such as the one used for Patient.gender) // you must use one of the strings defined by the FHIR specification. // You must not define your own. patient.getGenderElement().setValue("male"); // HAPI also provides Java enumerated types which make it easier to // deal with coded values. This code achieves the exact same result // as the code above. patient.setGender(AdministrativeGenderEnum.MALE); // You can also retrieve coded values the same way String genderString = patient.getGenderElement().getValueAsString(); AdministrativeGenderEnum genderEnum = patient.getGenderElement().getValueAsEnum(); // The following is a shortcut to create patient.setMaritalStatus(MaritalStatusCodesEnum.M); // END SNIPPET: codes }
@Override protected IBaseOperationOutcome createOperationOutcome(String theSeverity, String theMessage, String theCode) { OperationOutcome oo = new OperationOutcome(); oo.getIssueFirstRep().getSeverityElement().setValue(theSeverity); oo.getIssueFirstRep().getDiagnosticsElement().setValue(theMessage); oo.getIssueFirstRep().getCodeElement().setValue(theCode); return oo; }
@Override public void setValueAsQueryToken(FhirContext theContext, String theParamName, String theQualifier, String theValue) { getComparatorElement().setValue(null); setCode( null); setSystem(null); if (parts[0].startsWith("le")) { getComparatorElement().setValue(ParamPrefixEnum.LESSTHAN_OR_EQUALS.getValue()); setValue(new BigDecimal(parts[0].substring(2))); } else if (parts[0].startsWith("lt")) { getComparatorElement().setValue(ParamPrefixEnum.LESSTHAN.getValue()); setValue(new BigDecimal(parts[0].substring(1))); } else if (parts[0].startsWith("ge")) { getComparatorElement().setValue(ParamPrefixEnum.GREATERTHAN_OR_EQUALS.getValue()); setValue(new BigDecimal(parts[0].substring(2))); } else if (parts[0].startsWith("gt")) { getComparatorElement().setValue(ParamPrefixEnum.GREATERTHAN.getValue()); setValue(new BigDecimal(parts[0].substring(1))); } else {
param.getTypeElement().setValue(nextParameter.getParamType().getCode());
@Override public IResource generateProfile(RuntimeResourceDefinition theRuntimeResourceDefinition, String theServerBase) { Profile retVal = new Profile(); RuntimeResourceDefinition def = theRuntimeResourceDefinition; myId = def.getId(); if (StringUtils.isBlank(myId)) { myId = theRuntimeResourceDefinition.getName().toLowerCase(); } retVal.setId(new IdDt(myId)); // Scan for extensions scanForExtensions(retVal, def, new HashMap<RuntimeChildDeclaredExtensionDefinition, String>()); Collections.sort(retVal.getExtensionDefn(), new Comparator<ExtensionDefn>() { @Override public int compare(ExtensionDefn theO1, ExtensionDefn theO2) { return theO1.getCode().compareTo(theO2.getCode()); } }); // Scan for children retVal.setName(def.getName()); Structure struct = retVal.addStructure(); LinkedList<String> path = new LinkedList<String>(); StructureElement element = struct.addElement(); element.getDefinition().setMin(1); element.getDefinition().setMax("1"); fillProfile(struct, element, def, path, null, theServerBase); retVal.getStructure().get(0).getElement().get(0).getDefinition().addType().getCode().setValue("Resource"); return retVal; }
contained.setName("contained"); contained.setPath(join(path, '.') + ".contained"); contained.getDefinition().addType().getCode().setValue("Resource"); contained.getDefinition().setIsModifier(false); contained.getDefinition().setMin(0);
param.getTypeElement().setValue(nextParameter.getParamType().getCode()); for (Class<? extends IBaseResource> nextTarget : nextParameter.getDeclaredTypes()) { RuntimeResourceDefinition targetDef = myServerConfiguration.getFhirContext().getResourceDefinition(nextTarget);
String resourceName = nextEntry.getKey(); RuntimeResourceDefinition def = getServerConfiguration().getFhirContext().getResourceDefinition(resourceName); resource.getTypeElement().setValue(def.getName()); resource.getProfile().setReference(new IdDt(def.getResourceProfile(serverBase)));
resource.getType().setValue(def.getName()); ServletContext servletContext = (ServletContext) (theRequest == null ? null : theRequest.getAttribute(RestfulServer.SERVLET_CONTEXT_ATTRIBUTE)); String serverBase = myServerConfiguration.getServerAddressStrategy().determineServerBase(servletContext, theRequest);
op.addType().setValue(sharedDescription.getResourceName());