Profile Utilities refactor (#1027)
* Refactor 1 rename and starter comments * Refactor 2 more renaming make method for match * Make final what can be final * Wrap root call to processPaths * WIP Create ProfilePathProcessor * Redo method scoop, move internal classes * Use profileUtilities instance * Finish scoop. Tests pass. * Finish scoop for real this time. * Encapsulate cursors * Delete unused params * Split path processing into two branches Co-authored-by: dotasek <david.otasek@smilecdr.com>
This commit is contained in:
parent
86e5fce758
commit
a67ca99786
|
@ -0,0 +1,43 @@
|
||||||
|
package org.hl7.fhir.r5.conformance;
|
||||||
|
|
||||||
|
import org.hl7.fhir.r5.model.ElementDefinition;
|
||||||
|
|
||||||
|
public class BaseTypeSlice {
|
||||||
|
private ElementDefinition defn;
|
||||||
|
private String type;
|
||||||
|
private int start;
|
||||||
|
private int end;
|
||||||
|
private boolean handled;
|
||||||
|
|
||||||
|
public BaseTypeSlice(ElementDefinition defn, String type, int start, int end) {
|
||||||
|
super();
|
||||||
|
this.defn = defn;
|
||||||
|
this.type = type;
|
||||||
|
this.start = start;
|
||||||
|
this.end = end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ElementDefinition getDefn() {
|
||||||
|
return defn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStart() {
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEnd() {
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isHandled() {
|
||||||
|
return handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHandled(boolean handled) {
|
||||||
|
this.handled = handled;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package org.hl7.fhir.r5.conformance;
|
||||||
|
|
||||||
|
import org.hl7.fhir.r5.model.ElementDefinition;
|
||||||
|
|
||||||
|
public class ElementRedirection {
|
||||||
|
|
||||||
|
private String path;
|
||||||
|
private ElementDefinition element;
|
||||||
|
|
||||||
|
public ElementRedirection(ElementDefinition element, String path) {
|
||||||
|
this.path = path;
|
||||||
|
this.element = element;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ElementDefinition getElement() {
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return element.toString() + " : " + path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPath() {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,23 @@
|
||||||
|
package org.hl7.fhir.r5.conformance;
|
||||||
|
|
||||||
|
import org.hl7.fhir.r5.model.ElementDefinition;
|
||||||
|
|
||||||
|
public class TypeSlice {
|
||||||
|
protected ElementDefinition defn;
|
||||||
|
protected String type;
|
||||||
|
|
||||||
|
public TypeSlice(ElementDefinition defn, String type) {
|
||||||
|
super();
|
||||||
|
this.defn = defn;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ElementDefinition getDefn() {
|
||||||
|
return defn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -559,7 +559,8 @@ public class SnapShotGenerationTests {
|
||||||
if (dst.exists())
|
if (dst.exists())
|
||||||
dst.delete();
|
dst.delete();
|
||||||
IOUtils.copy(TestingUtilities.loadTestResourceStream("r5", "snapshot-generation", test.getId() + "-expected.xml"), new FileOutputStream(dst));
|
IOUtils.copy(TestingUtilities.loadTestResourceStream("r5", "snapshot-generation", test.getId() + "-expected.xml"), new FileOutputStream(dst));
|
||||||
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(TestingUtilities.tempFile("snapshot", test.getId() + "-actual.xml")), output);
|
String actualFilePath = TestingUtilities.tempFile("snapshot", test.getId() + "-actual.xml");
|
||||||
|
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(actualFilePath), output);
|
||||||
StructureDefinition t1 = test.expected.copy();
|
StructureDefinition t1 = test.expected.copy();
|
||||||
t1.setText(null);
|
t1.setText(null);
|
||||||
StructureDefinition t2 = test.output.copy();
|
StructureDefinition t2 = test.output.copy();
|
||||||
|
|
Loading…
Reference in New Issue