continue; systems.add(nextValue.getSystemElement().getValueAsString()); codes.add(nextValue.getValueElement().getValue()); } else if (nextObject instanceof Enumeration<?>) { Enumeration<?> obj = (Enumeration<?>) nextObject; String system = extractSystem(obj); String code = obj.getValueAsString(); if (isNotBlank(code)) { systems.add(system);
@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; }
private void verifyStatusOk(RestOperationTypeEnum theOperation, IBaseResource theOldResourceOrNull, IBaseResource theResource) { Subscription subscription = (Subscription) theResource; SubscriptionStatus newStatus = subscription.getStatusElement().getValue(); if (newStatus == SubscriptionStatus.REQUESTED || newStatus == SubscriptionStatus.OFF) { return; } if (newStatus == null) { String actualCode = subscription.getStatusElement().getValueAsString(); throw new UnprocessableEntityException("Can not " + theOperation.getCode() + " resource: Subscription.status must be populated on this server" + ((isNotBlank(actualCode)) ? " (invalid value " + actualCode + ")" : "")); } if (theOldResourceOrNull != null) { try { Subscription existing = (Subscription) theOldResourceOrNull; SubscriptionStatus existingStatus = existing.getStatusElement().getValue(); if (existingStatus != newStatus) { verifyActiveStatus(theOperation, subscription, newStatus, existingStatus); } } catch (ResourceNotFoundException e) { verifyActiveStatus(theOperation, subscription, newStatus, null); } } else { verifyActiveStatus(theOperation, subscription, newStatus, null); } }
public String getStatusAsString() { return getStatusElement().getValueAsString(); }
@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; }
private void verifyStatusOk(RestOperationTypeEnum theOperation, IBaseResource theOldResourceOrNull, IBaseResource theResource) { Subscription subscription = (Subscription) theResource; SubscriptionStatus newStatus = subscription.getStatusElement().getValue(); if (newStatus == SubscriptionStatus.REQUESTED || newStatus == SubscriptionStatus.OFF) { return; } if (newStatus == null) { String actualCode = subscription.getStatusElement().getValueAsString(); throw new UnprocessableEntityException("Can not " + theOperation.getCode() + " resource: Subscription.status must be populated on this server" + ((isNotBlank(actualCode)) ? " (invalid value " + actualCode + ")" : "")); } if (theOldResourceOrNull != null) { try { Subscription existing = (Subscription) theOldResourceOrNull; SubscriptionStatus existingStatus = existing.getStatusElement().getValue(); if (existingStatus != newStatus) { verifyActiveStatus(theOperation, subscription, newStatus, existingStatus); } } catch (ResourceNotFoundException e) { verifyActiveStatus(theOperation, subscription, newStatus, null); } } else { verifyActiveStatus(theOperation, subscription, newStatus, null); } }