@Override public String toString() { return value.getValueAsString(); } };
/** * Joins a list of strings with a single space (' ') between each string */ public static String joinStringsSpaceSeparated(List<? extends IPrimitiveType<String>> theStrings) { StringBuilder b = new StringBuilder(); for (IPrimitiveType<String> next : theStrings) { if (next.isEmpty()) { continue; } if (b.length() > 0) { b.append(' '); } b.append(next.getValue()); } return b.toString(); }
@Override protected IPrimitiveType<?> doParse(String theString) { IPrimitiveType<?> instance = ReflectionUtil.newInstance(myType); instance.setValueAsString(theString); return instance; }
/** * Convert a list of FHIR String objects to a set of native java Strings */ public static Set<String> toStringSet(List<? extends IPrimitiveType<?>> theStringList) { HashSet<String> retVal = new HashSet<>(); if (theStringList != null) { for (IPrimitiveType<?> string : theStringList) { if (string != null && string.getValue() != null) { retVal.add(string.getValueAsString()); } } } return retVal; }
if (theSince != null && !theSince.isEmpty()) { haveParam = true; b.append('?').append(Constants.PARAM_SINCE).append('=').append(theSince.getValueAsString());
public QuantityParam setSystem(IPrimitiveType<String> theSystem) { mySystem = null; if (theSystem != null) { mySystem = theSystem.getValue(); } return this; }
continue; // No substitution on the resource ID itself! IIdType nextUriString = newIdType(nextRef.getValueAsString()); if (theIdSubstitutions.containsKey(nextUriString)) { IIdType newId = theIdSubstitutions.get(nextUriString); ourLog.debug(" * Replacing resource ref {} with {}", nextUriString, newId); nextRef.setValueAsString(newId.getValue()); } else { ourLog.debug(" * Reference [{}] does not exist in bundle", nextUriString); Date deletedTimestampOrNull = deletedInstantOrNull != null ? deletedInstantOrNull.getValue() : null;
((IPrimitiveType<?>) theTarget).setValueAsString(((IPrimitiveType<?>) theSource).getValueAsString()); return theSource;
@SuppressWarnings("unchecked") private void addParam(String theName, IBase theValue) { BaseRuntimeChildDefinition parameterChild = myParametersDef.getChildByName("parameter"); BaseRuntimeElementCompositeDefinition<?> parameterElem = (BaseRuntimeElementCompositeDefinition<?>) parameterChild.getChildByName("parameter"); IBase parameter = parameterElem.newInstance(); parameterChild.getMutator().addValue(myParameters, parameter); IPrimitiveType<String> name = (IPrimitiveType<String>) myContext.getElementDefinition("string").newInstance(); name.setValue(theName); parameterElem.getChildByName("name").getMutator().setValue(parameter, name); if (theValue instanceof IBaseDatatype) { BaseRuntimeElementDefinition<?> datatypeDef = myContext.getElementDefinition(theValue.getClass()); if (datatypeDef instanceof IRuntimeDatatypeDefinition) { Class<? extends IBaseDatatype> profileOf = ((IRuntimeDatatypeDefinition) datatypeDef).getProfileOf(); if (profileOf != null) { datatypeDef = myContext.getElementDefinition(profileOf); } } String childElementName = "value" + StringUtils.capitalize(datatypeDef.getName()); BaseRuntimeChildDefinition childByName = parameterElem.getChildByName(childElementName); childByName.getMutator().setValue(parameter, theValue); } else if (theValue instanceof IBaseResource) { parameterElem.getChildByName("resource").getMutator().setValue(parameter, theValue); } else { throw new IllegalArgumentException("Don't know how to handle parameter of type " + theValue.getClass()); } }
for (Object nextParameter : parameters) { IPrimitiveType<?> nextNameDt = (IPrimitiveType<?>) t.getSingleValueOrNull((IBase) nextParameter, "name"); if (nextNameDt == null || nextNameDt.isEmpty()) { ourLog.warn("Ignoring input parameter with no value in Parameters.parameter.name in operation client invocation"); continue; String nextName = nextNameDt.getValueAsString(); if (!params.containsKey(nextName)) { params.put(nextName, new ArrayList<String>()); params.get(nextName).add(primitive.getValueAsString());
private DateTimeType conformanceDate() { IPrimitiveType<Date> buildDate = getServerConfiguration().getConformanceDate(); if (buildDate != null && buildDate.getValue() != null) { try { return new DateTimeType(buildDate.getValueAsString()); } catch (DataFormatException e) { // fall through } } return DateTimeType.now(); }
public QuantityParam setValue(IPrimitiveType<BigDecimal> theValue) { myValue = null; if (theValue != null) { myValue = theValue.getValue(); } return this; }
continue; // No substitution on the resource ID itself! IIdType nextUriString = newIdType(nextRef.getValueAsString()); if (theIdSubstitutions.containsKey(nextUriString)) { IIdType newId = theIdSubstitutions.get(nextUriString); ourLog.debug(" * Replacing resource ref {} with {}", nextUriString, newId); nextRef.setValueAsString(newId.getValue()); } else { ourLog.debug(" * Reference [{}] does not exist in bundle", nextUriString); Date deletedTimestampOrNull = deletedInstantOrNull != null ? deletedInstantOrNull.getValue() : null;
((IPrimitiveType<?>) theTarget).setValueAsString(((IPrimitiveType<?>) theSource).getValueAsString()); return theSource;
@SuppressWarnings("unchecked") private void addParam(String theName, IBase theValue) { BaseRuntimeChildDefinition parameterChild = myParametersDef.getChildByName("parameter"); BaseRuntimeElementCompositeDefinition<?> parameterElem = (BaseRuntimeElementCompositeDefinition<?>) parameterChild.getChildByName("parameter"); IBase parameter = parameterElem.newInstance(); parameterChild.getMutator().addValue(myParameters, parameter); IPrimitiveType<String> name = (IPrimitiveType<String>) myContext.getElementDefinition("string").newInstance(); name.setValue(theName); parameterElem.getChildByName("name").getMutator().setValue(parameter, name); if (theValue instanceof IBaseDatatype) { BaseRuntimeElementDefinition<?> datatypeDef = myContext.getElementDefinition(theValue.getClass()); if (datatypeDef instanceof IRuntimeDatatypeDefinition) { Class<? extends IBaseDatatype> profileOf = ((IRuntimeDatatypeDefinition) datatypeDef).getProfileOf(); if (profileOf != null) { datatypeDef = myContext.getElementDefinition(profileOf); } } String childElementName = "value" + StringUtils.capitalize(datatypeDef.getName()); BaseRuntimeChildDefinition childByName = parameterElem.getChildByName(childElementName); childByName.getMutator().setValue(parameter, theValue); } else if (theValue instanceof IBaseResource) { parameterElem.getChildByName("resource").getMutator().setValue(parameter, theValue); } else { throw new IllegalArgumentException("Don't know how to handle parameter of type " + theValue.getClass()); } }
/** * Joins a list of strings with a single space (' ') between each string * * TODO: replace with call to ca.uhn.fhir.util.DatatypeUtil.joinStringsSpaceSeparated when HAPI upgrades to 1.4 */ private static String joinStringsSpaceSeparated(List<? extends IPrimitiveType<String>> theStrings) { StringBuilder b = new StringBuilder(); for (IPrimitiveType<String> next : theStrings) { if (next.isEmpty()) { continue; } if (b.length() > 0) { b.append(' '); } b.append(next.getValue()); } return b.toString(); }
@Override protected String doEncode(IPrimitiveType<?> theString) { return theString.getValueAsString(); }
if (nextValue.isEmpty()) { continue; systems.add(null); codes.add(nextValue.getValueAsString()); } else if (nextObject instanceof Coding) { Coding nextValue = (Coding) nextObject;