Search in sources :

Example 1 with CapabilityStatementRestComponent

use of org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent in project org.hl7.fhir.core by hapifhir.

the class Conformance14_40 method convertConformance.

public static org.hl7.fhir.dstu2016may.model.Conformance convertConformance(org.hl7.fhir.r4.model.CapabilityStatement src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu2016may.model.Conformance tgt = new org.hl7.fhir.dstu2016may.model.Conformance();
    ConversionContext14_40.INSTANCE.getVersionConvertor_14_40().copyDomainResource(src, tgt);
    if (src.hasUrl())
        tgt.setUrlElement(Uri14_40.convertUri(src.getUrlElement()));
    if (src.hasVersion())
        tgt.setVersionElement(String14_40.convertString(src.getVersionElement()));
    if (src.hasName())
        tgt.setNameElement(String14_40.convertString(src.getNameElement()));
    if (src.hasStatus())
        tgt.setStatusElement(Enumerations14_40.convertConformanceResourceStatus(src.getStatusElement()));
    if (src.hasExperimental())
        tgt.setExperimentalElement(Boolean14_40.convertBoolean(src.getExperimentalElement()));
    if (src.hasDate())
        tgt.setDateElement(DateTime14_40.convertDateTime(src.getDateElement()));
    if (src.hasPublisher())
        tgt.setPublisherElement(String14_40.convertString(src.getPublisherElement()));
    for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertConformanceContactComponent(t));
    if (src.hasDescription())
        tgt.setDescription(src.getDescription());
    for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept())
        tgt.addUseContext(CodeableConcept14_40.convertCodeableConcept(t.getValueCodeableConcept()));
    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(CodeableConcept14_40.convertCodeableConcept(t));
    if (src.hasPurpose())
        tgt.setRequirements(src.getPurpose());
    if (src.hasCopyright())
        tgt.setCopyright(src.getCopyright());
    if (src.hasKind())
        tgt.setKindElement(convertConformanceStatementKind(src.getKindElement()));
    if (src.hasSoftware())
        tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware()));
    if (src.hasImplementation())
        tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation()));
    tgt.setFhirVersion(src.getFhirVersion().toCode());
    if (src.hasExtension("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"))
        tgt.setAcceptUnknown(org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown").getValue().primitiveValue()));
    for (org.hl7.fhir.r4.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue());
    for (CapabilityStatementRestComponent r : src.getRest()) for (CapabilityStatementRestResourceComponent rr : r.getResource()) for (org.hl7.fhir.r4.model.CanonicalType t : rr.getSupportedProfile()) tgt.addProfile(Reference14_40.convertCanonicalToReference(t));
    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) tgt.addRest(convertConformanceRestComponent(t));
    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) tgt.addMessaging(convertConformanceMessagingComponent(t));
    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) tgt.addDocument(convertConformanceDocumentComponent(t));
    return tgt;
}
Also used : CapabilityStatementRestComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent) CapabilityStatementRestComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent) CapabilityStatementRestResourceComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent)

Example 2 with CapabilityStatementRestComponent

use of org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent in project org.hl7.fhir.core by hapifhir.

the class Conformance10_40 method convertConformance.

public static org.hl7.fhir.dstu2.model.Conformance convertConformance(org.hl7.fhir.r4.model.CapabilityStatement src, BaseAdvisor_10_40 advisor) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu2.model.Conformance tgt = new org.hl7.fhir.dstu2.model.Conformance();
    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyDomainResource(src, tgt);
    if (src.hasUrlElement())
        tgt.setUrlElement(Uri10_40.convertUri(src.getUrlElement()));
    if (src.hasVersionElement())
        tgt.setVersionElement(String10_40.convertString(src.getVersionElement()));
    if (src.hasNameElement())
        tgt.setNameElement(String10_40.convertString(src.getNameElement()));
    if (src.hasStatus())
        tgt.setStatusElement(Enumerations10_40.convertConformanceResourceStatus(src.getStatusElement()));
    if (src.hasExperimental())
        tgt.setExperimentalElement(Boolean10_40.convertBoolean(src.getExperimentalElement()));
    if (src.hasDate())
        tgt.setDateElement(DateTime10_40.convertDateTime(src.getDateElement()));
    if (src.hasPublisherElement())
        tgt.setPublisherElement(String10_40.convertString(src.getPublisherElement()));
    for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertConformanceContactComponent(t));
    if (src.hasDescription())
        tgt.setDescription(src.getDescription());
    if (src.hasPurpose())
        tgt.setRequirements(src.getPurpose());
    if (src.hasCopyright())
        tgt.setCopyright(src.getCopyright());
    if (src.hasKind())
        tgt.setKindElement(convertConformanceStatementKind(src.getKindElement()));
    if (src.hasSoftware())
        tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware()));
    if (src.hasImplementation())
        tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation()));
    if (src.hasFhirVersion())
        tgt.setFhirVersion(src.getFhirVersion().toCode());
    if (src.hasExtension("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"))
        tgt.setAcceptUnknown(org.hl7.fhir.dstu2.model.Conformance.UnknownContentCode.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown").getValue().primitiveValue()));
    for (org.hl7.fhir.r4.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue());
    for (CapabilityStatementRestComponent r : src.getRest()) for (CapabilityStatementRestResourceComponent rr : r.getResource()) for (org.hl7.fhir.r4.model.CanonicalType t : rr.getSupportedProfile()) tgt.addProfile(Canonical10_40.convertCanonicalToReference(t));
    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) tgt.addRest(convertConformanceRestComponent(t));
    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) tgt.addMessaging(convertConformanceMessagingComponent(t));
    for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) tgt.addDocument(convertConformanceDocumentComponent(t));
    return tgt;
}
Also used : CapabilityStatementRestComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent) CapabilityStatementRestComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent) CapabilityStatementRestResourceComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent)

Example 3 with CapabilityStatementRestComponent

use of org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent in project org.hl7.fhir.core by hapifhir.

the class Conformance14_50 method convertConformance.

public static org.hl7.fhir.dstu2016may.model.Conformance convertConformance(org.hl7.fhir.r5.model.CapabilityStatement src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu2016may.model.Conformance tgt = new org.hl7.fhir.dstu2016may.model.Conformance();
    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyDomainResource(src, tgt);
    if (src.hasUrl())
        tgt.setUrlElement(Uri14_50.convertUri(src.getUrlElement()));
    if (src.hasVersion())
        tgt.setVersionElement(String14_50.convertString(src.getVersionElement()));
    if (src.hasName())
        tgt.setNameElement(String14_50.convertString(src.getNameElement()));
    if (src.hasStatus())
        tgt.setStatusElement(Enumerations14_50.convertConformanceResourceStatus(src.getStatusElement()));
    if (src.hasExperimental())
        tgt.setExperimentalElement(Boolean14_50.convertBoolean(src.getExperimentalElement()));
    if (src.hasDate())
        tgt.setDateElement(DateTime14_50.convertDateTime(src.getDateElement()));
    if (src.hasPublisher())
        tgt.setPublisherElement(String14_50.convertString(src.getPublisherElement()));
    for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact()) tgt.addContact(convertConformanceContactComponent(t));
    if (src.hasDescription())
        tgt.setDescription(src.getDescription());
    for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext()) if (t.hasValueCodeableConcept())
        tgt.addUseContext(CodeableConcept14_50.convertCodeableConcept(t.getValueCodeableConcept()));
    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) tgt.addUseContext(CodeableConcept14_50.convertCodeableConcept(t));
    if (src.hasPurpose())
        tgt.setRequirements(src.getPurpose());
    if (src.hasCopyright())
        tgt.setCopyright(src.getCopyright());
    if (src.hasKind())
        tgt.setKindElement(convertConformanceStatementKind(src.getKindElement()));
    if (src.hasSoftware())
        tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware()));
    if (src.hasImplementation())
        tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation()));
    tgt.setFhirVersion(src.getFhirVersion().toCode());
    if (src.hasExtension("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"))
        tgt.setAcceptUnknown(org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown").getValue().primitiveValue()));
    for (org.hl7.fhir.r5.model.CodeType t : src.getFormat()) tgt.addFormat(t.getValue());
    for (CapabilityStatementRestComponent r : src.getRest()) for (CapabilityStatementRestResourceComponent rr : r.getResource()) for (org.hl7.fhir.r5.model.CanonicalType t : rr.getSupportedProfile()) tgt.addProfile(Reference14_50.convertCanonicalToReference(t));
    for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) tgt.addRest(convertConformanceRestComponent(t));
    for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) tgt.addMessaging(convertConformanceMessagingComponent(t));
    for (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) tgt.addDocument(convertConformanceDocumentComponent(t));
    return tgt;
}
Also used : CapabilityStatementRestComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent) CapabilityStatementRestComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent) CapabilityStatementRestResourceComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent)

Example 4 with CapabilityStatementRestComponent

use of org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent in project org.hl7.fhir.core by hapifhir.

the class NarrativeGenerator method generate.

public boolean generate(ResourceContext rcontext, CapabilityStatement conf) throws FHIRFormatError, DefinitionException, IOException {
    XhtmlNode x = new XhtmlNode(NodeType.Element, "div");
    x.h2().addText(conf.getName());
    addMarkdown(x, conf.getDescription());
    if (conf.getRest().size() > 0) {
        CapabilityStatementRestComponent rest = conf.getRest().get(0);
        XhtmlNode t = x.table(null);
        addTableRow(t, "Mode", rest.getMode().toString());
        addTableRow(t, "Description", rest.getDocumentation());
        addTableRow(t, "Transaction", showOp(rest, SystemRestfulInteraction.TRANSACTION));
        addTableRow(t, "System History", showOp(rest, SystemRestfulInteraction.HISTORYSYSTEM));
        addTableRow(t, "System Search", showOp(rest, SystemRestfulInteraction.SEARCHSYSTEM));
        t = x.table(null);
        XhtmlNode tr = t.tr();
        tr.th().b().tx("Resource Type");
        tr.th().b().tx("Profile");
        tr.th().b().tx("Read");
        tr.th().b().tx("V-Read");
        tr.th().b().tx("Search");
        tr.th().b().tx("Update");
        tr.th().b().tx("Updates");
        tr.th().b().tx("Create");
        tr.th().b().tx("Delete");
        tr.th().b().tx("History");
        for (CapabilityStatementRestResourceComponent r : rest.getResource()) {
            tr = t.tr();
            tr.td().addText(r.getType());
            if (r.hasProfile()) {
                tr.td().ah(prefix + r.getProfile().getReference()).addText(r.getProfile().getReference());
            }
            tr.td().addText(showOp(r, TypeRestfulInteraction.READ));
            tr.td().addText(showOp(r, TypeRestfulInteraction.VREAD));
            tr.td().addText(showOp(r, TypeRestfulInteraction.SEARCHTYPE));
            tr.td().addText(showOp(r, TypeRestfulInteraction.UPDATE));
            tr.td().addText(showOp(r, TypeRestfulInteraction.HISTORYINSTANCE));
            tr.td().addText(showOp(r, TypeRestfulInteraction.CREATE));
            tr.td().addText(showOp(r, TypeRestfulInteraction.DELETE));
            tr.td().addText(showOp(r, TypeRestfulInteraction.HISTORYTYPE));
        }
    }
    inject(conf, x, NarrativeStatus.GENERATED);
    return true;
}
Also used : CapabilityStatementRestComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent) CapabilityStatementRestResourceComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Example 5 with CapabilityStatementRestComponent

use of org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent in project org.hl7.fhir.core by hapifhir.

the class NarrativeGenerator method generate.

public boolean generate(ResourceContext rcontext, CapabilityStatement conf) throws FHIRFormatError, DefinitionException, IOException {
    XhtmlNode x = new XhtmlNode(NodeType.Element, "div");
    x.h2().addText(conf.getName());
    addMarkdown(x, conf.getDescription());
    if (conf.getRest().size() > 0) {
        CapabilityStatementRestComponent rest = conf.getRest().get(0);
        XhtmlNode t = x.table(null);
        addTableRow(t, "Mode", rest.getMode().toString());
        addTableRow(t, "Description", rest.getDocumentation());
        addTableRow(t, "Transaction", showOp(rest, SystemRestfulInteraction.TRANSACTION));
        addTableRow(t, "System History", showOp(rest, SystemRestfulInteraction.HISTORYSYSTEM));
        addTableRow(t, "System Search", showOp(rest, SystemRestfulInteraction.SEARCHSYSTEM));
        boolean hasVRead = false;
        boolean hasPatch = false;
        boolean hasDelete = false;
        boolean hasHistory = false;
        boolean hasUpdates = false;
        for (CapabilityStatementRestResourceComponent r : rest.getResource()) {
            hasVRead = hasVRead || hasOp(r, TypeRestfulInteraction.VREAD);
            hasPatch = hasPatch || hasOp(r, TypeRestfulInteraction.PATCH);
            hasDelete = hasDelete || hasOp(r, TypeRestfulInteraction.DELETE);
            hasHistory = hasHistory || hasOp(r, TypeRestfulInteraction.HISTORYTYPE);
            hasUpdates = hasUpdates || hasOp(r, TypeRestfulInteraction.HISTORYINSTANCE);
        }
        t = x.table(null);
        XhtmlNode tr = t.tr();
        tr.th().b().tx("Resource Type");
        tr.th().b().tx("Profile");
        tr.th().b().attribute("title", "GET a resource (read interaction)").tx("Read");
        if (hasVRead)
            tr.th().b().attribute("title", "GET past versions of resources (vread interaction)").tx("V-Read");
        tr.th().b().attribute("title", "GET all set of resources of the type (search interaction)").tx("Search");
        tr.th().b().attribute("title", "PUT a new resource version (update interaction)").tx("Update");
        if (hasPatch)
            tr.th().b().attribute("title", "PATCH a new resource version (patch interaction)").tx("Patch");
        tr.th().b().attribute("title", "POST a new resource (create interaction)").tx("Create");
        if (hasDelete)
            tr.th().b().attribute("title", "DELETE a resource (delete interaction)").tx("Delete");
        if (hasUpdates)
            tr.th().b().attribute("title", "GET changes to a resource (history interaction on instance)").tx("Updates");
        if (hasHistory)
            tr.th().b().attribute("title", "GET changes for all resources of the type (history interaction on type)").tx("History");
        for (CapabilityStatementRestResourceComponent r : rest.getResource()) {
            tr = t.tr();
            tr.td().addText(r.getType());
            if (r.hasProfile()) {
                tr.td().ah(prefix + r.getProfile()).addText(r.getProfile());
            }
            tr.td().addText(showOp(r, TypeRestfulInteraction.READ));
            if (hasVRead)
                tr.td().addText(showOp(r, TypeRestfulInteraction.VREAD));
            tr.td().addText(showOp(r, TypeRestfulInteraction.SEARCHTYPE));
            tr.td().addText(showOp(r, TypeRestfulInteraction.UPDATE));
            if (hasPatch)
                tr.td().addText(showOp(r, TypeRestfulInteraction.PATCH));
            tr.td().addText(showOp(r, TypeRestfulInteraction.CREATE));
            if (hasDelete)
                tr.td().addText(showOp(r, TypeRestfulInteraction.DELETE));
            if (hasUpdates)
                tr.td().addText(showOp(r, TypeRestfulInteraction.HISTORYINSTANCE));
            if (hasHistory)
                tr.td().addText(showOp(r, TypeRestfulInteraction.HISTORYTYPE));
        }
    }
    inject(conf, x, NarrativeStatus.GENERATED);
    return true;
}
Also used : XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Aggregations

CapabilityStatementRestComponent (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent)7 ArrayList (java.util.ArrayList)5 CapabilityStatementRestResourceComponent (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent)5 CapabilityStatementRestComponent (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent)4 CapabilityStatementRestComponent (org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestComponent)4 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)4 CapabilityStatementRestResourceComponent (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent)3 BackboneElement (org.hl7.fhir.r4b.model.BackboneElement)3 Element (org.hl7.fhir.r4b.model.Element)3 BackboneElement (org.hl7.fhir.r5.model.BackboneElement)3 Element (org.hl7.fhir.r5.model.Element)3 HashSet (java.util.HashSet)2 CapabilityStatementRestComponent (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent)2 CapabilityStatementRestResourceComponent (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent)2 CapabilityStatementRestResourceComponent (org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestResourceComponent)2 CapabilityStatementRestSecurityComponent (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestSecurityComponent)2 Cell (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell)2 Row (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row)2 IGenericClient (ca.uhn.fhir.rest.client.api.IGenericClient)1 VersionUtil (ca.uhn.fhir.util.VersionUtil)1