diff --git a/dist/boda-bulkcmparser.jar b/dist/boda-bulkcmparser.jar index ea3742e..7b8adef 100644 Binary files a/dist/boda-bulkcmparser.jar and b/dist/boda-bulkcmparser.jar differ diff --git a/pom.xml b/pom.xml index 05a1c92..ff3a348 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.bodastate.boda_bulkcmparser boda-bulkcmparser jar - 2.0.3 + 2.0.4 boda-bulkcmparser http://maven.apache.org diff --git a/src/main/java/com/bodastage/boda_bulkcmparser/BodaBulkCMParser.java b/src/main/java/com/bodastage/boda_bulkcmparser/BodaBulkCMParser.java index 1bda19f..788a57a 100644 --- a/src/main/java/com/bodastage/boda_bulkcmparser/BodaBulkCMParser.java +++ b/src/main/java/com/bodastage/boda_bulkcmparser/BodaBulkCMParser.java @@ -47,7 +47,7 @@ public class BodaBulkCMParser { * * Since 1.3.0 */ - final static String VERSION = "2.0.3"; + final static String VERSION = "2.0.4"; private static final Logger LOGGER = LoggerFactory.getLogger(BodaBulkCMParser.class); @@ -335,6 +335,44 @@ public void setExtractMetaFields(Boolean bool){ extractMetaFields = bool; } + /** + * Get the date + * @param inputFilename + */ + public void getDateTime(String inputFilename){ + try{ + XMLInputFactory factory = XMLInputFactory.newInstance(); + + XMLEventReader eventReader = factory.createXMLEventReader( + new FileReader(inputFilename)); + baseFileName = bulkCMXMLFileBasename = getFileBasename(inputFilename); + + while (eventReader.hasNext()) { + XMLEvent event = eventReader.nextEvent(); + switch (event.getEventType()) { + case XMLStreamConstants.START_ELEMENT: + StartElement startElement = event.asStartElement(); + String qName = startElement.getName().getLocalPart(); + Iterator attributes = startElement.getAttributes(); + if(qName.equals("fileFooter")){ + while (attributes.hasNext()) { + Attribute attribute = attributes.next(); + if (attribute.getName().toString().equals("dateTime")) { + dateTime = attribute.getValue(); + } + } + } + + break; + } + + + } + }catch(Exception e){ + + } + } + /** * Extract parameter list from parameter file * @@ -616,7 +654,15 @@ public void processFileOrDirectory() }else{ System.out.print("Parsing " + this.baseFileName + "..."); } + + //Get date time + if(parameterFile != null){ + getDateTime(this.dataSource); + } + + //Parse file this.parseFile(this.dataSource); + if( parserState == ParserStates.EXTRACTING_PARAMETERS){ System.out.println("Done."); }else{ @@ -642,8 +688,14 @@ public void processFileOrDirectory() System.out.print("Parsing " + this.baseFileName + "..."); } - //Parse + //Get date time + if(parameterFile != null){ + getDateTime(f.getAbsolutePath()); + } + + //Parse dump file this.parseFile(f.getAbsolutePath()); + if( parserState == ParserStates.EXTRACTING_PARAMETERS){ System.out.println("Done."); }else{