if (super.getValue() == null && myHaveComponentParts) { if (isLocal() || isUrn()) { return myUnqualifiedId;
/** * Creates a new instance of this ID which is identical, but refers to the specific version of this resource ID noted by theVersion. * * @param theVersion The actual version string, e.g. "1". If theVersion is blank or null, returns the same as {@link #toVersionless()}} * @return A new instance of IdDt which is identical, but refers to the specific version of this resource ID noted by theVersion. */ @Override public IdDt withVersion(String theVersion) { if (isBlank(theVersion)) { return toVersionless(); } if (isLocal() || isUrn()) { return new IdDt(getValueAsString()); } String existingValue = getValue(); int i = existingValue.indexOf(Constants.PARAM_HISTORY); String value; if (i > 1) { value = existingValue.substring(0, i - 1); } else { value = existingValue; } return new IdDt(value + '/' + Constants.PARAM_HISTORY + '/' + theVersion); }
@Override public IdDt withResourceType(String theResourceName) { if (isLocal() || isUrn()) { return new IdDt(getValueAsString()); } return new IdDt(theResourceName, getIdPart(), getVersionIdPart()); }
@Override public IdDt toUnqualifiedVersionless() { if (isLocal() || isUrn()) { return new IdDt(getValueAsString()); } return new IdDt(getResourceType(), getIdPart()); }
/** * Returns a view of this ID as a fully qualified URL, given a server base and resource name (which will only be used if the ID does not already contain those respective parts). Essentially, * because IdDt can contain either a complete URL or a partial one (or even jut a simple ID), this method may be used to translate into a complete URL. * * @param theServerBase The server base (e.g. "http://example.com/fhir") * @param theResourceType The resource name (e.g. "Patient") * @return A fully qualified URL for this ID (e.g. "http://example.com/fhir/Patient/1") */ @Override public IdDt withServerBase(String theServerBase, String theResourceType) { if (isLocal() || isUrn()) { return new IdDt(getValueAsString()); } return new IdDt(theServerBase, theResourceType, getIdPart(), getVersionIdPart()); }
/** * Returns a new IdDt containing this IdDt's values but with no server base URL if one is present in this IdDt. For example, if this IdDt contains the ID "http://foo/Patient/1", this method will * return a new IdDt containing ID "Patient/1". */ @Override public IdDt toUnqualified() { if (isLocal() || isUrn()) { return new IdDt(getValueAsString()); } return new IdDt(getResourceType(), getIdPart(), getVersionIdPart()); }
@Override public IdDt toVersionless() { if (isLocal() || isUrn()) { return new IdDt(getValueAsString()); } return new IdDt(getBaseUrl(), getResourceType(), getIdPart(), null); }
if (super.getValue() == null && myHaveComponentParts) { if (isLocal() || isUrn()) { return myUnqualifiedId;
/** * Creates a new instance of this ID which is identical, but refers to the specific version of this resource ID noted by theVersion. * * @param theVersion The actual version string, e.g. "1". If theVersion is blank or null, returns the same as {@link #toVersionless()}} * @return A new instance of IdDt which is identical, but refers to the specific version of this resource ID noted by theVersion. */ @Override public IdDt withVersion(String theVersion) { if (isBlank(theVersion)) { return toVersionless(); } if (isLocal() || isUrn()) { return new IdDt(getValueAsString()); } String existingValue = getValue(); int i = existingValue.indexOf(Constants.PARAM_HISTORY); String value; if (i > 1) { value = existingValue.substring(0, i - 1); } else { value = existingValue; } return new IdDt(value + '/' + Constants.PARAM_HISTORY + '/' + theVersion); }
@Override public IdDt toUnqualifiedVersionless() { if (isLocal() || isUrn()) { return new IdDt(getValueAsString()); } return new IdDt(getResourceType(), getIdPart()); }
@Override public IdDt withResourceType(String theResourceName) { if (isLocal() || isUrn()) { return new IdDt(getValueAsString()); } return new IdDt(theResourceName, getIdPart(), getVersionIdPart()); }
/** * Returns a view of this ID as a fully qualified URL, given a server base and resource name (which will only be used if the ID does not already contain those respective parts). Essentially, * because IdDt can contain either a complete URL or a partial one (or even jut a simple ID), this method may be used to translate into a complete URL. * * @param theServerBase The server base (e.g. "http://example.com/fhir") * @param theResourceType The resource name (e.g. "Patient") * @return A fully qualified URL for this ID (e.g. "http://example.com/fhir/Patient/1") */ @Override public IdDt withServerBase(String theServerBase, String theResourceType) { if (isLocal() || isUrn()) { return new IdDt(getValueAsString()); } return new IdDt(theServerBase, theResourceType, getIdPart(), getVersionIdPart()); }
/** * Returns a new IdDt containing this IdDt's values but with no server base URL if one is present in this IdDt. For example, if this IdDt contains the ID "http://foo/Patient/1", this method will * return a new IdDt containing ID "Patient/1". */ @Override public IdDt toUnqualified() { if (isLocal() || isUrn()) { return new IdDt(getValueAsString()); } return new IdDt(getResourceType(), getIdPart(), getVersionIdPart()); }
@Override public IdDt toVersionless() { if (isLocal() || isUrn()) { return new IdDt(getValueAsString()); } return new IdDt(getBaseUrl(), getResourceType(), getIdPart(), null); }