@Override public String getBundleType(Bundle theRequest) { if (theRequest.getType() == null) { return null; } return theRequest.getTypeElement().getValue().toCode(); }
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); } }
@Override protected IBaseOperationOutcome createOperationOutcome(String theSeverity, String theMessage, String theCode) { OperationOutcome oo = new OperationOutcome(); OperationOutcomeIssueComponent issue = oo.addIssue(); issue.getSeverityElement().setValueAsString(theSeverity); issue.setDiagnostics(theMessage); try { issue.setCode(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.fromCode(theCode)); } catch (FHIRException e) { ourLog.error("Unknown code: {}", theCode); } return oo; }
private static <T extends Enum<?>> String extractSystem(Enumeration<T> theBoundCode) { if (theBoundCode.getValue() != null) { return theBoundCode.getEnumFactory().toSystem(theBoundCode.getValue()); } return null; }
/** * @param value The current state of the subject. */ public ResearchSubject setStatus(ResearchSubjectStatus value) { if (this.status == null) this.status = new Enumeration<ResearchSubjectStatus>(new ResearchSubjectStatusEnumFactory()); this.status.setValue(value); return this; }
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 public void addRootPropertiesToBundle(String theId, String theServerBase, String theLinkSelf, String theLinkPrev, String theLinkNext, Integer theTotalResults, BundleTypeEnum theBundleType, IPrimitiveType<Date> theLastUpdated) { ensureBundle(); myBase = theServerBase; if (myBundle.getIdElement().isEmpty()) { myBundle.setId(theId); } if (myBundle.getIdElement().isEmpty()) { myBundle.setId(UUID.randomUUID().toString()); } if (myBundle.getMeta().getLastUpdated() == null && theLastUpdated != null) { myBundle.getMeta().getLastUpdatedElement().setValueAsString(theLastUpdated.getValueAsString()); } if (!hasLink(Constants.LINK_SELF, myBundle) && isNotBlank(theLinkSelf)) { myBundle.addLink().setRelation(Constants.LINK_SELF).setUrl(theLinkSelf); } if (!hasLink(Constants.LINK_NEXT, myBundle) && isNotBlank(theLinkNext)) { myBundle.addLink().setRelation(Constants.LINK_NEXT).setUrl(theLinkNext); } if (!hasLink(Constants.LINK_PREVIOUS, myBundle) && isNotBlank(theLinkPrev)) { myBundle.addLink().setRelation(Constants.LINK_PREVIOUS).setUrl(theLinkPrev); } if (myBundle.getTypeElement().isEmpty() && theBundleType != null) { myBundle.getTypeElement().setValueAsString(theBundleType.getCode()); } if (myBundle.getTotalElement().isEmpty() && theTotalResults != null) { myBundle.getTotalElement().setValue(theTotalResults); } }
/** * @param value The type of relationship to the related artifact. */ public RelatedArtifact setType(RelatedArtifactType value) { if (this.type == null) this.type = new Enumeration<RelatedArtifactType>(new RelatedArtifactTypeEnumFactory()); this.type.setValue(value); return this; }
public String toSystem() { return getEnumFactory().toSystem(getValue()); }
@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; }
@Override public String getEntryRequestVerb(Bundle.BundleEntryComponent theEntry) { String retVal = null; Bundle.HTTPVerb value = theEntry.getRequest().getMethodElement().getValue(); if (value != null) { retVal = value.toCode(); } return retVal; }
/** * @param value {@link #dayOfWeek} (If one or more days of week is provided, then the action happens only on the specified day(s).) */ public TimingRepeatComponent addDayOfWeek(DayOfWeek value) { //1 Enumeration<DayOfWeek> t = new Enumeration<DayOfWeek>(new DayOfWeekEnumFactory()); t.setValue(value); if (this.dayOfWeek == null) this.dayOfWeek = new ArrayList<Enumeration<DayOfWeek>>(); this.dayOfWeek.add(t); return this; }
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); } }
/** * Constructor */ public Enumeration(EnumFactory<T> theEnumFactory, String theValue) { if (theEnumFactory == null) throw new IllegalArgumentException("An enumeration factory must be provided"); myEnumFactory = theEnumFactory; setValueAsString(theValue); }
public String getStatusAsString() { return getStatusElement().getValueAsString(); }
/** * @return Complete (Bill or Claim), Proposed (Pre-Authorization), Exploratory (Pre-determination). */ public Use getUse() { return this.use == null ? null : this.use.getValue(); }
/** * @param value The mode of this event declaration - whether an application is a sender or receiver. */ public CapabilityStatementMessagingEventComponent setMode(EventCapabilityMode value) { if (this.mode == null) this.mode = new Enumeration<EventCapabilityMode>(new EventCapabilityModeEnumFactory()); this.mode.setValue(value); return this; }
public INarrative setStatusAsString(String theString) { getStatusElement().setValueAsString(theString); return this; }
@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; }
/** * @return Indicates the degree of importance associated with the identified issue based on the potential impact on the patient. */ public DetectedIssueSeverity getSeverity() { return this.severity == null ? null : this.severity.getValue(); }