fix CapabilityStatement generation

This commit is contained in:
Grahame Grieve 2019-03-04 11:06:33 +11:00
parent 56d22bc2ee
commit cde0df1118
15 changed files with 59 additions and 26 deletions

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>3.7.6-SNAPSHOT</version>
<version>3.7.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>3.7.6-SNAPSHOT</version>
<version>3.7.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>3.7.6-SNAPSHOT</version>
<version>3.7.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>3.7.6-SNAPSHOT</version>
<version>3.7.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>3.7.6-SNAPSHOT</version>
<version>3.7.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>3.7.6-SNAPSHOT</version>
<version>3.7.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -4171,18 +4171,37 @@ public class NarrativeGenerator implements INarrativeGenerator {
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 = hasOp(r, TypeRestfulInteraction.VREAD);
hasPatch = hasOp(r, TypeRestfulInteraction.PATCH);
hasDelete = hasOp(r, TypeRestfulInteraction.DELETE);
hasHistory = hasOp(r, TypeRestfulInteraction.HISTORYTYPE);
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().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");
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();
@ -4191,13 +4210,19 @@ public class NarrativeGenerator implements INarrativeGenerator {
tr.td().ah(prefix+r.getProfile()).addText(r.getProfile());
}
tr.td().addText(showOp(r, TypeRestfulInteraction.READ));
tr.td().addText(showOp(r, TypeRestfulInteraction.VREAD));
if (hasVRead)
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));
if (hasPatch)
tr.td().addText(showOp(r, TypeRestfulInteraction.PATCH));
tr.td().addText(showOp(r, TypeRestfulInteraction.CREATE));
tr.td().addText(showOp(r, TypeRestfulInteraction.DELETE));
tr.td().addText(showOp(r, TypeRestfulInteraction.HISTORYTYPE));
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));
}
}
@ -4205,6 +4230,14 @@ public class NarrativeGenerator implements INarrativeGenerator {
return true;
}
private boolean hasOp(CapabilityStatementRestResourceComponent r, TypeRestfulInteraction on) {
for (ResourceInteractionComponent op : r.getInteraction()) {
if (op.getCode() == on)
return true;
}
return false;
}
private String showOp(CapabilityStatementRestResourceComponent r, TypeRestfulInteraction on) {
for (ResourceInteractionComponent op : r.getInteraction()) {
if (op.getCode() == on)

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>3.7.6-SNAPSHOT</version>
<version>3.7.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>3.7.6-SNAPSHOT</version>
<version>3.7.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>3.7.6-SNAPSHOT</version>
<version>3.7.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -117,7 +117,7 @@ public class DefaultEnableWhenEvaluator implements IEnableWhenEvaluator {
private boolean comparePrimitiveAnswer(PrimitiveType<?> actualAnswer, PrimitiveType<?> expectedAnswer, QuestionnaireItemOperator questionnaireItemOperator) {
if (actualAnswer.getValue() instanceof Comparable){
return compareComparable((Comparable)actualAnswer.getValue(), (Comparable) expectedAnswer.getValue(), questionnaireItemOperator);
return compareComparable((Comparable<?>)actualAnswer.getValue(), (Comparable<?>) expectedAnswer.getValue(), questionnaireItemOperator);
} else if (questionnaireItemOperator == QuestionnaireItemOperator.EQUAL){
return actualAnswer.equalsShallow(expectedAnswer);
} else if (questionnaireItemOperator == QuestionnaireItemOperator.NOT_EQUAL){

View File

@ -3366,7 +3366,7 @@ private String misplacedItemError(QuestionnaireItemComponent qItem) {
candidateResources.add(entry.getNamedChild("resource"));
}
// Find resources that are pointed to as stylesheet links
List<String> sheets = new ArrayList();
List<String> sheets = new ArrayList<>();
List<Element> links = bundle.getChildren("link");
for (Element link : links) {
if (link.getChildValue("relation").equals("stylesheet")) {

View File

@ -117,7 +117,7 @@ public class DefaultEnableWhenEvaluator implements IEnableWhenEvaluator {
private boolean comparePrimitiveAnswer(PrimitiveType<?> actualAnswer, PrimitiveType<?> expectedAnswer, QuestionnaireItemOperator questionnaireItemOperator) {
if (actualAnswer.getValue() instanceof Comparable){
return compareComparable((Comparable)actualAnswer.getValue(), (Comparable) expectedAnswer.getValue(), questionnaireItemOperator);
return compareComparable((Comparable<?>)actualAnswer.getValue(), (Comparable<?>) expectedAnswer.getValue(), questionnaireItemOperator);
} else if (questionnaireItemOperator == QuestionnaireItemOperator.EQUAL){
return actualAnswer.equalsShallow(expectedAnswer);
} else if (questionnaireItemOperator == QuestionnaireItemOperator.NOT_EQUAL){

View File

@ -3366,7 +3366,7 @@ private String misplacedItemError(QuestionnaireItemComponent qItem) {
candidateResources.add(entry.getNamedChild("resource"));
}
// Find resources that are pointed to as stylesheet links
List<String> sheets = new ArrayList();
List<String> sheets = new ArrayList<>();
List<Element> links = bundle.getChildren("link");
for (Element link : links) {
if (link.getChildValue("relation").equals("stylesheet")) {

View File

@ -13,7 +13,7 @@
each other. It is fine to bump the point version of this POM without affecting
HAPI FHIR.
-->
<version>3.7.6-SNAPSHOT</version>
<version>3.7.7-SNAPSHOT</version>
<properties>
<hapi_fhir_version>3.7.0-SNAPSHOT</hapi_fhir_version>