@Override public IndexingOverride onAdd(ResourceTable entity) { if (entity.getDeleted() == null) { if (entity.getIndexStatus() != null) { return IndexingOverride.APPLY_DEFAULT; } } return IndexingOverride.SKIP; }
@Override public IndexingOverride onUpdate(ResourceTable entity) { if (entity.getIndexStatus() == null) { return IndexingOverride.SKIP; } if (entity.getDeleted() == null) { return IndexingOverride.UPDATE; } return IndexingOverride.REMOVE; }
@Override public IBaseResource readByPid(Long thePid) { StopWatch w = new StopWatch(); Optional<ResourceTable> entity = myResourceTableDao.findById(thePid); if (!entity.isPresent()) { throw new ResourceNotFoundException("No resource found with PID " + thePid); } if (entity.get().getDeleted() != null) { throw new ResourceGoneException("Resource was deleted at " + new InstantType(entity.get().getDeleted()).getValueAsString()); } T retVal = toResource(myResourceType, entity.get(), null, false); ourLog.debug("Processed read on {} in {}ms", thePid, w.getMillis()); return retVal; }
@Override protected ResourceTable updateEntity(RequestDetails theRequestDetails, IBaseResource theResource, ResourceTable theEntity, Date theDeletedTimestampOrNull, boolean thePerformIndexing, boolean theUpdateVersion, Date theUpdateTime, boolean theForceUpdate, boolean theCreateNewHistoryEntry) { ResourceTable retVal = super.updateEntity(theRequestDetails, theResource, theEntity, theDeletedTimestampOrNull, thePerformIndexing, theUpdateVersion, theUpdateTime, theForceUpdate, theCreateNewHistoryEntry); if (retVal.getDeleted() == null) { ConceptMap conceptMap = (ConceptMap) theResource; myHapiTerminologySvc.storeTermConceptMapAndChildren(retVal, conceptMap); } else { myHapiTerminologySvc.deleteConceptMapAndChildren(retVal); } return retVal; } }
@Override public void reindex(T theResource, ResourceTable theEntity) { ourLog.debug("Indexing resource {} - PID {}", theEntity.getIdDt().getValue(), theEntity.getId()); if (theResource != null) { CURRENTLY_REINDEXING.put(theResource, Boolean.TRUE); } updateEntity(null, theResource, theEntity, theEntity.getDeleted(), true, false, theEntity.getUpdatedDate(), true, false); if (theResource != null) { CURRENTLY_REINDEXING.put(theResource, null); } }
public static void populateFullTextFields(final FhirContext theContext, final IBaseResource theResource, ResourceTable theEntity) { if (theEntity.getDeleted() != null) { theEntity.setNarrativeTextParsedIntoWords(null); theEntity.setContentTextParsedIntoWords(null); } else { theEntity.setNarrativeTextParsedIntoWords(parseNarrativeTextIntoWords(theResource)); theEntity.setContentTextParsedIntoWords(parseContentTextIntoWords(theContext, theResource)); } }
@Override protected ResourceTable updateEntity(RequestDetails theRequestDetails, IBaseResource theResource, ResourceTable theEntity, Date theDeletedTimestampOrNull, boolean thePerformIndexing, boolean theUpdateVersion, Date theUpdateTime, boolean theForceUpdate, boolean theCreateNewHistoryEntry) { ResourceTable retVal = super.updateEntity(theRequestDetails, theResource, theEntity, theDeletedTimestampOrNull, thePerformIndexing, theUpdateVersion, theUpdateTime, theForceUpdate, theCreateNewHistoryEntry); if (retVal.getDeleted() == null) { try { ConceptMap conceptMap = (ConceptMap) theResource; org.hl7.fhir.r4.model.ConceptMap converted = VersionConvertor_30_40.convertConceptMap(conceptMap); myHapiTerminologySvc.storeTermConceptMapAndChildren(retVal, converted); } catch (FHIRException fe) { throw new InternalErrorException(fe); } } else { myHapiTerminologySvc.deleteConceptMapAndChildren(retVal); } return retVal; } }
@Override protected ResourceTable updateEntity(RequestDetails theRequest, IBaseResource theResource, ResourceTable theEntity, Date theDeletedTimestampOrNull, boolean thePerformIndexing, boolean theUpdateVersion, Date theUpdateTime, boolean theForceUpdate, boolean theCreateNewHistoryEntry) { ResourceTable retVal = super.updateEntity(theRequest, theResource, theEntity, theDeletedTimestampOrNull, thePerformIndexing, theUpdateVersion, theUpdateTime, theForceUpdate, theCreateNewHistoryEntry); CodeSystem cs = (CodeSystem) theResource; if (cs != null && isNotBlank(cs.getUrl())) { String codeSystemUrl = cs.getUrl(); Long codeSystemResourcePid = retVal.getId(); if (retVal.getDeleted() != null) { // deleting } else if (cs.getContent() == CodeSystemContentMode.COMPLETE || cs.getContent() == null) { ourLog.info("CodeSystem {} has a status of {}, going to store concepts in terminology tables", retVal.getIdDt().getValue(), cs.getContentElement().getValueAsString()); TermCodeSystemVersion persCs = new TermCodeSystemVersion(); persCs.setResource(retVal); persCs.getConcepts().addAll(toPersistedConcepts(cs.getConcept(), persCs)); ourLog.info("Code system has {} concepts", persCs.getConcepts().size()); myTerminologySvc.storeNewCodeSystemVersion(codeSystemResourcePid, codeSystemUrl, cs.getName(), persCs); } } return retVal; }
if (target.getDeleted() != null) { String resName = targetResourceDef.getName(); throw new InvalidRequestException("Resource " + resName + "/" + theId + " is deleted, specified in path: " + theNextPathsUnsplit);
boolean changed = false; if (theEntity.getDeleted() == null) {
} else if (theEntity.getDeleted() != null) { theEntity = myEntityManager.merge(theEntity);
public ResourceHistoryTable toHistory() { ResourceHistoryTable retVal = new ResourceHistoryTable(); retVal.setResourceId(myId); retVal.setResourceType(myResourceType); retVal.setVersion(myVersion); retVal.setPublished(getPublished()); retVal.setUpdated(getUpdated()); retVal.setFhirVersion(getFhirVersion()); retVal.setDeleted(getDeleted()); retVal.setForcedId(getForcedId()); retVal.getTags().clear(); retVal.setHasTags(isHasTags()); if (isHasTags()) { for (ResourceTag next : getTags()) { retVal.addTag(next); } } return retVal; }
@Override public IBaseResource readByPid(Long thePid) { StopWatch w = new StopWatch(); Optional<ResourceTable> entity = myResourceTableDao.findById(thePid); if (!entity.isPresent()) { throw new ResourceNotFoundException("No resource found with PID " + thePid); } if (entity.get().getDeleted() != null) { throw new ResourceGoneException("Resource was deleted at " + new InstantType(entity.get().getDeleted()).getValueAsString()); } T retVal = toResource(myResourceType, entity.get(), null, false); ourLog.debug("Processed read on {} in {}ms", thePid, w.getMillis()); return retVal; }
@Override protected ResourceTable updateEntity(RequestDetails theRequestDetails, IBaseResource theResource, ResourceTable theEntity, Date theDeletedTimestampOrNull, boolean thePerformIndexing, boolean theUpdateVersion, Date theUpdateTime, boolean theForceUpdate, boolean theCreateNewHistoryEntry) { ResourceTable retVal = super.updateEntity(theRequestDetails, theResource, theEntity, theDeletedTimestampOrNull, thePerformIndexing, theUpdateVersion, theUpdateTime, theForceUpdate, theCreateNewHistoryEntry); if (retVal.getDeleted() == null) { ConceptMap conceptMap = (ConceptMap) theResource; myHapiTerminologySvc.storeTermConceptMapAndChildren(retVal, conceptMap); } else { myHapiTerminologySvc.deleteConceptMapAndChildren(retVal); } return retVal; } }
if (entity.getDeleted() != null) { DaoMethodOutcome outcome = new DaoMethodOutcome(); outcome.setEntity(entity);
@Override public void reindex(T theResource, ResourceTable theEntity) { ourLog.debug("Indexing resource {} - PID {}", theEntity.getIdDt().getValue(), theEntity.getId()); if (theResource != null) { CURRENTLY_REINDEXING.put(theResource, Boolean.TRUE); } updateEntity(null, theResource, theEntity, theEntity.getDeleted(), true, false, theEntity.getUpdatedDate(), true, false); if (theResource != null) { CURRENTLY_REINDEXING.put(theResource, null); } }
@Override protected ResourceTable updateEntity(RequestDetails theRequestDetails, IBaseResource theResource, ResourceTable theEntity, Date theDeletedTimestampOrNull, boolean thePerformIndexing, boolean theUpdateVersion, Date theUpdateTime, boolean theForceUpdate, boolean theCreateNewHistoryEntry) { ResourceTable retVal = super.updateEntity(theRequestDetails, theResource, theEntity, theDeletedTimestampOrNull, thePerformIndexing, theUpdateVersion, theUpdateTime, theForceUpdate, theCreateNewHistoryEntry); if (retVal.getDeleted() == null) { try { ConceptMap conceptMap = (ConceptMap) theResource; org.hl7.fhir.r4.model.ConceptMap converted = VersionConvertor_30_40.convertConceptMap(conceptMap); myHapiTerminologySvc.storeTermConceptMapAndChildren(retVal, converted); } catch (FHIRException fe) { throw new InternalErrorException(fe); } } else { myHapiTerminologySvc.deleteConceptMapAndChildren(retVal); } return retVal; } }
public static void populateFullTextFields(final FhirContext theContext, final IBaseResource theResource, ResourceTable theEntity) { if (theEntity.getDeleted() != null) { theEntity.setNarrativeTextParsedIntoWords(null); theEntity.setContentTextParsedIntoWords(null); } else { theEntity.setNarrativeTextParsedIntoWords(parseNarrativeTextIntoWords(theResource)); theEntity.setContentTextParsedIntoWords(parseContentTextIntoWords(theContext, theResource)); } }
@Override protected ResourceTable updateEntity(RequestDetails theRequest, IBaseResource theResource, ResourceTable theEntity, Date theDeletedTimestampOrNull, boolean thePerformIndexing, boolean theUpdateVersion, Date theUpdateTime, boolean theForceUpdate, boolean theCreateNewHistoryEntry) { ResourceTable retVal = super.updateEntity(theRequest, theResource, theEntity, theDeletedTimestampOrNull, thePerformIndexing, theUpdateVersion, theUpdateTime, theForceUpdate, theCreateNewHistoryEntry); CodeSystem cs = (CodeSystem) theResource; if (cs != null && isNotBlank(cs.getUrl())) { String codeSystemUrl = cs.getUrl(); Long codeSystemResourcePid = retVal.getId(); if (retVal.getDeleted() != null) { // deleting } else if (cs.getContent() == CodeSystemContentMode.COMPLETE || cs.getContent() == null) { ourLog.info("CodeSystem {} has a status of {}, going to store concepts in terminology tables", retVal.getIdDt().getValue(), cs.getContentElement().getValueAsString()); TermCodeSystemVersion persCs = new TermCodeSystemVersion(); persCs.setResource(retVal); persCs.getConcepts().addAll(toPersistedConcepts(cs.getConcept(), persCs)); ourLog.info("Code system has {} concepts", persCs.getConcepts().size()); myTerminologySvc.storeNewCodeSystemVersion(codeSystemResourcePid, codeSystemUrl, cs.getName(), persCs); } } return retVal; }
if (target.getDeleted() != null) { String resName = targetResourceDef.getName(); throw new InvalidRequestException("Resource " + resName + "/" + theId + " is deleted, specified in path: " + theNextPathsUnsplit);