private Date getLastModified(IBaseResource theRes) { return theRes.getMeta().getLastUpdated(); }
if (isBlank(metaValue.getVersionId())) { if (theResource.getIdElement().hasVersionIdPart()) { metaValue.setVersionId(theResource.getIdElement().getVersionIdPart()); filterCodingsWithNoCodeOrSystem(metaValue.getTag()); filterCodingsWithNoCodeOrSystem(metaValue.getSecurity()); List<? extends IPrimitiveType<String>> newProfileList = getProfileTagsForEncoding(theResource, metaValue.getProfile()); List<? extends IPrimitiveType<String>> oldProfileList = metaValue.getProfile(); if (oldProfileList != newProfileList) { oldProfileList.clear(); for (IPrimitiveType<String> next : newProfileList) { if (isNotBlank(next.getValue())) { metaValue.addProfile(next.getValue()); IBaseCoding coding = metaValue.addTag(); coding.setCode(Constants.TAG_SUBSETTED_CODE); coding.setSystem(getSubsettedCodeSystem());
if (anyResource.getMeta().getLastUpdated() == null) { anyResource.getMeta().setLastUpdated(headerDateValue);
private ArrayList<TagDefinition> toTagList(IBaseMetaType theMeta) { ArrayList<TagDefinition> retVal = new ArrayList<TagDefinition>(); for (IBaseCoding next : theMeta.getTag()) { retVal.add(new TagDefinition(TagTypeEnum.TAG, next.getSystem(), next.getCode(), next.getDisplay())); } for (IBaseCoding next : theMeta.getSecurity()) { retVal.add(new TagDefinition(TagTypeEnum.SECURITY_LABEL, next.getSystem(), next.getCode(), next.getDisplay())); } for (IPrimitiveType<String> next : theMeta.getProfile()) { retVal.add(new TagDefinition(TagTypeEnum.PROFILE, BaseHapiFhirDao.NS_JPA_PROFILE, next.getValue(), null)); } return retVal; }
@Override public <MT extends IBaseMetaType> MT metaGetOperation(Class<MT> theType, IIdType theId, RequestDetails theRequestDetails) { // Notify interceptors if (theRequestDetails != null) { ActionRequestDetails requestDetails = new ActionRequestDetails(theRequestDetails, getResourceName(), theId); notifyInterceptors(RestOperationTypeEnum.META, requestDetails); } Set<TagDefinition> tagDefs = new HashSet<>(); BaseHasResource entity = readEntity(theId); for (BaseTag next : entity.getTags()) { tagDefs.add(next.getTag()); } MT retVal = toMetaDt(theType, tagDefs); retVal.setLastUpdated(entity.getUpdatedDate()); retVal.setVersionId(Long.toString(entity.getVersion())); return retVal; }
res.getMeta().getTag().clear(); res.getMeta().getProfile().clear(); res.getMeta().getSecurity().clear(); res.getMeta().setLastUpdated(null); res.getMeta().setVersionId(null); res.getMeta().setLastUpdated(theEntity.getUpdatedDate()); IDao.RESOURCE_PID.put(res, theEntity.getId()); switch (next.getTag().getTagType()) { case PROFILE: res.getMeta().addProfile(next.getTag().getCode()); break; case SECURITY_LABEL: IBaseCoding sec = res.getMeta().addSecurity(); sec.setSystem(next.getTag().getSystem()); sec.setCode(next.getTag().getCode()); break; case TAG: IBaseCoding tag = res.getMeta().addTag(); tag.setSystem(next.getTag().getSystem()); tag.setCode(next.getTag().getCode());
protected <MT extends IBaseMetaType> MT toMetaDt(Class<MT> theType, Collection<TagDefinition> tagDefinitions) { MT retVal; try { retVal = theType.newInstance(); } catch (Exception e) { throw new InternalErrorException("Failed to instantiate " + theType.getName(), e); } for (TagDefinition next : tagDefinitions) { switch (next.getTagType()) { case PROFILE: retVal.addProfile(next.getCode()); break; case SECURITY_LABEL: retVal.addSecurity().setSystem(next.getSystem()).setCode(next.getCode()).setDisplay(next.getDisplay()); break; case TAG: retVal.addTag().setSystem(next.getSystem()).setCode(next.getCode()).setDisplay(next.getDisplay()); break; } } return retVal; }
private void addResourceData(GenericFhirAuditDataset auditDataset, T resource) { auditDataset.setResourceId(resource.getIdElement()); if (resource.getIdElement().hasResourceType()) { auditDataset.setAffectedResourceType(resource.getIdElement().getResourceType()); } patientIdExtractor.apply(resource).ifPresent(patient -> auditDataset.getPatientIds().add(patient.getResource() != null ? patient.getResource().getIdElement().toUnqualifiedVersionless().getValue() : patient.getReference())); List<? extends IBaseCoding> securityLabels = resource.getMeta().getSecurity(); if (!securityLabels.isEmpty()) { auditDataset.setSecurityLabel(securityLabels.get(0).getCode()); } } }
public void setMatchingStrategyTag(FhirContext theFhirContext, IBaseResource theSubscription, SubscriptionMatchingStrategy theStrategy) { IBaseMetaType meta = theSubscription.getMeta(); String value = theStrategy.toString(); String display; if (theStrategy == SubscriptionMatchingStrategy.DATABASE) { display = "Database"; } else if (theStrategy == SubscriptionMatchingStrategy.IN_MEMORY) { display = "In-memory"; } else { throw new IllegalStateException("Unknown " + SubscriptionMatchingStrategy.class.getSimpleName() + ": "+theStrategy); } meta.addTag().setSystem(SubscriptionConstants.EXT_SUBSCRIPTION_MATCHING_STRATEGY).setCode(value).setDisplay(display); } }
String versionIdPart = fullId.getVersionIdPart(); response.addHeader(Constants.HEADER_ETAG, createEtag(versionIdPart)); } else if (theResource != null && theResource.getMeta() != null && isNotBlank(theResource.getMeta().getVersionId())) { String versionId = theResource.getMeta().getVersionId(); response.addHeader(Constants.HEADER_ETAG, createEtag(versionId));
res.getMeta().getTag().clear(); res.getMeta().getProfile().clear(); res.getMeta().getSecurity().clear(); res.getMeta().setLastUpdated(null); res.getMeta().setVersionId(null); res.getMeta().setLastUpdated(theEntity.getUpdatedDate()); IDao.RESOURCE_PID.put(res, theEntity.getId()); switch (next.getTag().getTagType()) { case PROFILE: res.getMeta().addProfile(next.getTag().getCode()); break; case SECURITY_LABEL: IBaseCoding sec = res.getMeta().addSecurity(); sec.setSystem(next.getTag().getSystem()); sec.setCode(next.getTag().getCode()); break; case TAG: IBaseCoding tag = res.getMeta().addTag(); tag.setSystem(next.getTag().getSystem()); tag.setCode(next.getTag().getCode());
tag = res.getMeta().getTag(Constants.TAG_SUBSETTED_SYSTEM_DSTU3, Constants.TAG_SUBSETTED_CODE); totalMetaCount += res.getMeta().getTag().size(); totalMetaCount += res.getMeta().getProfile().size(); totalMetaCount += res.getMeta().getSecurity().size();
protected <MT extends IBaseMetaType> MT toMetaDt(Class<MT> theType, Collection<TagDefinition> tagDefinitions) { MT retVal; try { retVal = theType.newInstance(); } catch (Exception e) { throw new InternalErrorException("Failed to instantiate " + theType.getName(), e); } for (TagDefinition next : tagDefinitions) { switch (next.getTagType()) { case PROFILE: retVal.addProfile(next.getCode()); break; case SECURITY_LABEL: retVal.addSecurity().setSystem(next.getSystem()).setCode(next.getCode()).setDisplay(next.getDisplay()); break; case TAG: retVal.addTag().setSystem(next.getSystem()).setCode(next.getCode()).setDisplay(next.getDisplay()); break; } } return retVal; }
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()); } }
private void addResourceData(GenericFhirAuditDataset auditDataset, T resource) { auditDataset.setResourceId(resource.getIdElement()); if (resource.getIdElement().hasResourceType()) { auditDataset.setAffectedResourceType(resource.getIdElement().getResourceType()); } patientIdExtractor.apply(resource).ifPresent(patient -> auditDataset.getPatientIds().add(patient.getResource() != null ? patient.getResource().getIdElement().toUnqualifiedVersionless().getValue() : patient.getReference())); List<? extends IBaseCoding> securityLabels = resource.getMeta().getSecurity(); if (!securityLabels.isEmpty()) { auditDataset.setSecurityLabel(securityLabels.get(0).getCode()); } } }
String versionIdPart = fullId.getVersionIdPart(); response.addHeader(Constants.HEADER_ETAG, createEtag(versionIdPart)); } else if (theResource != null && theResource.getMeta() != null && isNotBlank(theResource.getMeta().getVersionId())) { String versionId = theResource.getMeta().getVersionId(); response.addHeader(Constants.HEADER_ETAG, createEtag(versionId));
if (isBlank(metaValue.getVersionId())) { if (theResource.getIdElement().hasVersionIdPart()) { metaValue.setVersionId(theResource.getIdElement().getVersionIdPart()); filterCodingsWithNoCodeOrSystem(metaValue.getTag()); filterCodingsWithNoCodeOrSystem(metaValue.getSecurity()); List<? extends IPrimitiveType<String>> newProfileList = getProfileTagsForEncoding(theResource, metaValue.getProfile()); List<? extends IPrimitiveType<String>> oldProfileList = metaValue.getProfile(); if (oldProfileList != newProfileList) { oldProfileList.clear(); for (IPrimitiveType<String> next : newProfileList) { if (isNotBlank(next.getValue())) { metaValue.addProfile(next.getValue()); IBaseCoding coding = metaValue.addTag(); coding.setCode(Constants.TAG_SUBSETTED_CODE); coding.setSystem(getSubsettedCodeSystem());
private void extractTagsRi(IAnyResource theResource, ResourceTable theEntity, Set<ResourceTag> theAllTags) { List<? extends IBaseCoding> tagList = theResource.getMeta().getTag(); if (tagList != null) { for (IBaseCoding next : tagList) { List<? extends IBaseCoding> securityLabels = theResource.getMeta().getSecurity(); if (securityLabels != null) { for (IBaseCoding next : securityLabels) { List<? extends IPrimitiveType<String>> profiles = theResource.getMeta().getProfile(); if (profiles != null) { for (IPrimitiveType<String> next : profiles) {
public static InstantType getTimestamp(IBaseResource resource) { return new InstantType(new Date(resource.getMeta().getLastUpdated().getTime())); }
if (anyResource.getMeta().getLastUpdated() == null) { anyResource.getMeta().setLastUpdated(headerDateValue);