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:
dotasek 2022-12-05 17:32:16 -05:00 committed by GitHub
parent 86e5fce758
commit a67ca99786
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1221 additions and 1028 deletions

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -559,7 +559,8 @@ public class SnapShotGenerationTests {
if (dst.exists())
dst.delete();
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();
t1.setText(null);
StructureDefinition t2 = test.output.copy();