protected IIdType fixContainedResourceId(String theValue) { IIdType retVal = (IIdType) myContext.getElementDefinition("id").newInstance(); if (StringUtils.isNotBlank(theValue) && theValue.charAt(0) == '#') { retVal.setValue(theValue.substring(1)); } else { retVal.setValue(theValue); } return retVal; }
@SuppressWarnings("unchecked") public static <T extends IIdType> T convertIdToType(IIdType value, Class<T> theIdParamType) { if (value != null && !theIdParamType.isAssignableFrom(value.getClass())) { IIdType newValue = ReflectionUtil.newInstance(theIdParamType); newValue.setValue(value.getValue()); value = newValue; } return (T) value; }
public IIdType getIdElement(FhirContext theContext) { IIdType retVal = null; if (isNotBlank(myIdElement)) { retVal = theContext.getVersion().newIdType().setValue(myIdElement); } return retVal; }
public IIdType getId(FhirContext theCtx) { IIdType retVal = null; if (myId != null) { retVal = theCtx.getVersion().newIdType().setValue(myId); } return retVal; }
public IIdType getPayloadId(FhirContext theCtx) { IIdType retVal = null; if (myPayloadId != null) { retVal = theCtx.getVersion().newIdType().setValue(myPayloadId); } return retVal; }
protected static void parseContentLocation(FhirContext theContext, MethodOutcome theOutcomeToPopulate, String theLocationHeader) { if (StringUtils.isBlank(theLocationHeader)) { return; } IIdType id = theContext.getVersion().newIdType(); id.setValue(theLocationHeader); theOutcomeToPopulate.setId(id); }
private IIdType newIdType(String theValue) { return myContext.getVersion().newIdType().setValue(theValue); }
protected static void parseContentLocation(FhirContext theContext, MethodOutcome theOutcomeToPopulate, String theLocationHeader) { if (StringUtils.isBlank(theLocationHeader)) { return; } IIdType id = theContext.getVersion().newIdType(); id.setValue(theLocationHeader); theOutcomeToPopulate.setId(id); }
@Transactional(propagation = Propagation.REQUIRED) @Override public Resource lookup(Object theAppInfo, String theType, String theId) throws FHIRException { IIdType refId = getContext().getVersion().newIdType(); refId.setValue(theType + "/" + theId); IFhirResourceDao<? extends IBaseResource> dao = getDao(theType); BaseHasResource id = dao.readEntity(refId); return (Resource) toResource(id, false); }
private IIdType newIdType(String theResourceType, String theResourceId, String theVersion) { org.hl7.fhir.r4.model.IdType id = new org.hl7.fhir.r4.model.IdType(theResourceType, theResourceId, theVersion); return myContext.getVersion().newIdType().setValue(id.getValue()); }
void incrementId(T theResource, ResourceTable theSavedEntity, IIdType theResourceId) { String newVersion; long newVersionLong; if (theResourceId == null || theResourceId.getVersionIdPart() == null) { newVersion = "1"; newVersionLong = 1; } else { newVersionLong = theResourceId.getVersionIdPartAsLong() + 1; newVersion = Long.toString(newVersionLong); } IIdType newId = theResourceId.withVersion(newVersion); theResource.getIdElement().setValue(newId.getValue()); theSavedEntity.setVersion(newVersionLong); }
@Override public void run(CommandLine theCommandLine) throws ParseException { parseFhirContext(theCommandLine); String targetServer = theCommandLine.getOptionValue("t"); if (isBlank(targetServer)) { throw new ParseException("No target server (-t) specified"); } else if (targetServer.startsWith("http") == false) { throw new ParseException("Invalid target server specified, must begin with 'http'"); } FhirContext ctx = getFhirContext(); String exclude = theCommandLine.getOptionValue("e"); if (isNotBlank(exclude)) { for (String next : exclude.split(",")) { if (isNotBlank(next)) { IIdType id = ctx.getVersion().newIdType(); id.setValue(next); myExcludes.add(id); } } } if (ctx.getVersion().getVersion() == FhirVersionEnum.DSTU2) { uploadDefinitionsDstu2(theCommandLine, ctx); } else if (ctx.getVersion().getVersion() == FhirVersionEnum.DSTU3) { uploadDefinitionsDstu3(theCommandLine, ctx); } else if (ctx.getVersion().getVersion() == FhirVersionEnum.R4) { uploadDefinitionsR4(theCommandLine, ctx); } }
if (!qualIds.contains(value) && !nextRef.getResourceReference().getReferenceElement().isLocal()) { ourLog.info("Discarding unknown reference: {}", value); nextRef.getResourceReference().getReferenceElement().setValue(null); } else { goodRefs++;
if (!qualIds.contains(value) && !nextRef.getResourceReference().getReferenceElement().isLocal()) { ourLog.info("Discarding unknown reference: {}", value); nextRef.getResourceReference().getReferenceElement().setValue(null); } else { goodRefs++;
if (!qualIds.contains(value) && !nextRef.getResourceReference().getReferenceElement().isLocal()) { ourLog.info("Discarding unknown reference: {}", value); nextRef.getResourceReference().getReferenceElement().setValue(null); } else { goodRefs++;
private DaoMethodOutcome toMethodOutcome(@Nonnull final ResourceTable theEntity, @Nonnull IBaseResource theResource) { DaoMethodOutcome outcome = new DaoMethodOutcome(); IIdType id = null; if (theResource.getIdElement().getValue() != null) { id = theResource.getIdElement(); } if (id == null) { id = theEntity.getIdDt(); if (getContext().getVersion().getVersion().isRi()) { id = getContext().getVersion().newIdType().setValue(id.getValue()); } } outcome.setId(id); outcome.setResource(theResource); outcome.setEntity(theEntity); return outcome; }
id.setValue(theResourceType + '/' + resourceId.getValue()); idSubstitutions.put(id, newId);
protected void updateResourceMetadata(IBaseResourceEntity theEntity, IBaseResource theResource) { IIdType id = theEntity.getIdDt(); if (getContext().getVersion().getVersion().isRi()) { id = getContext().getVersion().newIdType().setValue(id.getValue()); } if (id.hasResourceType() == false) { id = id.withResourceType(theEntity.getResourceType()); } theResource.setId(id); if (theResource instanceof IResource) { ResourceMetadataKeyEnum.VERSION.put((IResource) theResource, id.getVersionIdPart()); ResourceMetadataKeyEnum.UPDATED.put((IResource) theResource, theEntity.getUpdated()); } else { IBaseMetaType meta = theResource.getMeta(); meta.setVersionId(id.getVersionIdPart()); meta.setLastUpdated(theEntity.getUpdatedDate()); } }
id.setValue(entity.getIdDt().getValue()); outcome.setId(id);