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) InputStreamisprivate static org.slf4j.Loggerlog(package private) EDmvParserparser(package private) PersonDAOpersonDAO(package private) VehicleDAOvehicleDAO
-
Constructor Summary
Constructors Constructor Description EDmvIngestor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcreatePerson(Person personDTO)This method is called by the main ingest processing loop.private voidcreateRegistration(VehicleRegistration registrationDTO)This method is called by the main ingest processing loop.voidingest()This method will ingest the input data by reading in external DTOs in from the parser, instantiating project business objects, and inserting into database.voidsetInputStream(InputStream is)voidsetPersonDAO(PersonDAO personDAO)voidsetVehicleDAO(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, ExceptionThis 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.JAXBExceptionXMLStreamExceptionDAOExceptionException
-
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:
DAOExceptionException
-
-