Package ejava.projects.edmv.blimpl
Class EDmvIngestor
- java.lang.Object
-
- ejava.projects.edmv.blimpl.EDmvIngestor
-
public class EDmvIngestor extends Object
This class provides a _sparse_ example implementation of how one can use the parser to ingest the information from the XML file to populate the database.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Map<String,Person>
dto2bo
(package private) InputStream
is
private static org.slf4j.Logger
log
(package private) EDmvParser
parser
(package private) PersonDAO
personDAO
(package private) VehicleDAO
vehicleDAO
-
Constructor Summary
Constructors Constructor Description EDmvIngestor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
createPerson(Person personDTO)
This method is called by the main ingest processing loop.private void
createRegistration(VehicleRegistration registrationDTO)
This method is called by the main ingest processing loop.void
ingest()
This method will ingest the input data by reading in external DTOs in from the parser, instantiating project business objects, and inserting into database.void
setInputStream(InputStream is)
void
setPersonDAO(PersonDAO personDAO)
void
setVehicleDAO(VehicleDAO vehicleDAO)
-
-
-
Field Detail
-
log
private static final org.slf4j.Logger log
-
is
InputStream is
-
personDAO
PersonDAO personDAO
-
vehicleDAO
VehicleDAO vehicleDAO
-
parser
EDmvParser parser
-
-
Method Detail
-
setInputStream
public void setInputStream(InputStream is)
-
setPersonDAO
public void setPersonDAO(PersonDAO personDAO)
-
setVehicleDAO
public void setVehicleDAO(VehicleDAO vehicleDAO)
-
ingest
public void ingest() throws javax.xml.bind.JAXBException, XMLStreamException, Exception
This method will ingest the input data by reading in external DTOs in from the parser, instantiating project business objects, and inserting into database. Note that the XML Schema is organized such that object references are fully resolved. Therefore, there is no specific need to process the addresses as they come in. They can be stored once we get the accounts they are related to.- Throws:
javax.xml.bind.JAXBException
XMLStreamException
DAOException
Exception
-
createPerson
private void createPerson(Person personDTO) throws DAOException
This method is called by the main ingest processing loop. The JAXB/StAX parser will already have the Person populated with internal property information.- Parameters:
personDTO
-- Throws:
DAOException
-
createRegistration
private void createRegistration(VehicleRegistration registrationDTO) throws Exception
This method is called by the main ingest processing loop. The JAXB/StAX parser will already have the VehicleRegistration populated with internal property information. The Person information for owners should also already exist.- Parameters:
registrationDTO
-- Throws:
DAOException
Exception
-
-