Commit a4c59aad authored by R.W.Majeed's avatar R.W.Majeed

JAXBObservationSupplier renamed to GroupedXMLReader

parent 137f0b2c
......@@ -27,7 +27,7 @@ import de.sekmi.histream.impl.Meta;
import de.sekmi.histream.impl.ObservationFactoryImpl;
import de.sekmi.histream.impl.ObservationImpl;
public class JAXBObservationSupplier implements ObservationSupplier {
public class GroupedXMLReader implements ObservationSupplier {
static final String DOCUMENT_ROOT = "eav-data";
static final String PATIENT_ELEMENT = "patient";
static final String ENCOUNTER_ELEMENT = "encounter";
......@@ -55,10 +55,10 @@ public class JAXBObservationSupplier implements ObservationSupplier {
public JAXBObservationSupplier(ObservationFactory factory, InputStream input)throws JAXBException, XMLStreamException, FactoryConfigurationError{
public GroupedXMLReader(ObservationFactory factory, InputStream input)throws JAXBException, XMLStreamException, FactoryConfigurationError{
this(factory, XMLInputFactory.newInstance().createXMLStreamReader(input));
}
public JAXBObservationSupplier(ObservationFactory factory, XMLStreamReader reader) throws JAXBException, XMLStreamException{
public GroupedXMLReader(ObservationFactory factory, XMLStreamReader reader) throws JAXBException, XMLStreamException{
super();
this.factory = factory;
this.patientData = new HashMap<>();
......
......@@ -100,7 +100,7 @@ public class GroupedXMLWriter extends GroupedObservationHandler{
try {
//writer.setPrefix(XMLConstants.DEFAULT_NS_PREFIX, NAMESPACE);
writer.writeStartDocument();
writer.writeStartElement(XMLConstants.DEFAULT_NS_PREFIX,JAXBObservationSupplier.DOCUMENT_ROOT,NAMESPACE);
writer.writeStartElement(XMLConstants.DEFAULT_NS_PREFIX,GroupedXMLReader.DOCUMENT_ROOT,NAMESPACE);
writer.setDefaultNamespace(NAMESPACE);
writer.writeDefaultNamespace(NAMESPACE);
writer.setPrefix("xsi", XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
......@@ -139,7 +139,7 @@ public class GroupedXMLWriter extends GroupedObservationHandler{
protected void beginEncounter(Visit visit)throws ObservationException{
try {
formatIndent();
writer.writeStartElement(JAXBObservationSupplier.ENCOUNTER_ELEMENT);
writer.writeStartElement(GroupedXMLReader.ENCOUNTER_ELEMENT);
writer.writeAttribute("id", visit.getId());
formatNewline();
formatPush();
......@@ -169,7 +169,7 @@ public class GroupedXMLWriter extends GroupedObservationHandler{
// TODO more data
formatIndent();
writer.writeStartElement(JAXBObservationSupplier.FACT_WRAPPER);
writer.writeStartElement(GroupedXMLReader.FACT_WRAPPER);
formatNewline();
formatPush();
} catch (XMLStreamException e) {
......@@ -206,7 +206,7 @@ public class GroupedXMLWriter extends GroupedObservationHandler{
protected void beginPatient(Patient patient) throws ObservationException{
try{
formatIndent();
writer.writeStartElement(JAXBObservationSupplier.PATIENT_ELEMENT);
writer.writeStartElement(GroupedXMLReader.PATIENT_ELEMENT);
writer.writeAttribute("id", patient.getId());
formatNewline();
formatPush();
......
......@@ -199,7 +199,7 @@ public class FileObservationProviderTest {
public ObservationSupplier getExampleSupplier(String path) throws IOException{
try {
return new JAXBObservationSupplier(factory, new FileInputStream(path));
return new GroupedXMLReader(factory, new FileInputStream(path));
} catch (XMLStreamException | FactoryConfigurationError | JAXBException e) {
throw new IOException(e);
}
......@@ -223,7 +223,7 @@ public class FileObservationProviderTest {
@Test
public void testJAXBReader() throws FileNotFoundException, XMLStreamException, FactoryConfigurationError, JAXBException {
JAXBObservationSupplier xos = new JAXBObservationSupplier(factory, new FileInputStream("examples/dwh-jaxb.xml"));
GroupedXMLReader xos = new GroupedXMLReader(factory, new FileInputStream("examples/dwh-jaxb.xml"));
validateExample(xos);
xos.close();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment