Updates to generate xls

Modified naming of statistics file
diff --git a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/GenerateCDADataHandler.java b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/GenerateCDADataHandler.java
index 9f61ac1..683a105 100644
--- a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/GenerateCDADataHandler.java
+++ b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/GenerateCDADataHandler.java
@@ -395,14 +395,14 @@
 		 * @param rollupStats
 		 */
 		public ProcessSelection(Object object, String splitOption, String filterOption, HashSet<EClass> theSections,
-				HashMap<EClass, HashSet<EClass>> theSectionCache, SXSSFWorkbook rollupStats) {
+				HashMap<EClass, HashSet<EClass>> theSectionCache) {
 			super();
 			this.object = object;
 			this.splitOption = splitOption;
 			this.filterOption = filterOption;
 			this.theSections = theSections;
 			this.theSectionCache = theSectionCache;
-			this.rollupStats = rollupStats;
+			// this.rollupStats = rollupStats;
 		}
 
 		public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
@@ -415,14 +415,44 @@
 					IFolder folder = (IFolder) object;
 					codeMetricsFile = folder.getFile("codemetrics.cfg");
 					monitor.beginTask("Generate Spreadsheet", folder.members().length);
+
+					final SXSSFWorkbook rollupStats = new SXSSFWorkbook(10);
 					processSelection(folder, null, monitor, splitOption, theSections, theSectionCache, rollupStats);
+
+					final StringBuffer fileLocation = new StringBuffer();
+					fileLocation.append(
+						folder.getParent().getLocation().toOSString() + System.getProperty("file.separator") +
+								CDAValueUtil.DATE_FORMAT3.format(new Date()) + "_" + folder.getName() + "_" +
+								"RollupStatistics.xlsx");
+
+					try (OutputStream fileOut = Files.newOutputStream(Paths.get(fileLocation.toString()))) {
+						rollupStats.write(fileOut);
+						fileOut.close();
+						rollupStats.close();
+						rollupStats.dispose();
+					}
 				}
 
 				if (object instanceof IFile) {
 					IFile zipFile = (IFile) object;
 
+					final SXSSFWorkbook rollupStats = new SXSSFWorkbook(10);
 					processSelection(null, zipFile, monitor, splitOption, theSections, theSectionCache, rollupStats);
 
+					final StringBuffer fileLocation = new StringBuffer();
+					fileLocation.append(
+						zipFile.getParent().getLocation().toOSString() + System.getProperty("file.separator") +
+								CDAValueUtil.DATE_FORMAT3.format(new Date()) + "_" +
+								FilenameUtils.getBaseName(zipFile.getName()).toUpperCase() + "_" +
+								"RollupStatistics.xlsx");
+
+					try (OutputStream fileOut = Files.newOutputStream(Paths.get(fileLocation.toString()))) {
+						rollupStats.write(fileOut);
+						fileOut.close();
+						rollupStats.close();
+						rollupStats.dispose();
+					}
+
 				}
 			} catch (Exception e) {
 				ILog log = Activator.getDefault().getLog();
@@ -457,7 +487,7 @@
 
 		final HashMap<EClass, HashSet<EClass>> theSectionCache = new HashMap<EClass, HashSet<EClass>>();
 
-		final SXSSFWorkbook rollupStats = new SXSSFWorkbook(10);
+		// final SXSSFWorkbook rollupStats = new SXSSFWorkbook(10);
 
 		if (filterOption != null) {
 
@@ -571,8 +601,8 @@
 										resource.getParent().getName() + "_" + "RollupStatistics.xlsx");
 						}
 						pd.run(
-							true, true, new ProcessSelection(
-								element, splitOption, filterOption, theSections, theSectionCache, rollupStats));
+							true, true,
+							new ProcessSelection(element, splitOption, filterOption, theSections, theSectionCache));
 					} catch (Throwable e) {
 						ILog log = Activator.getDefault().getLog();
 						log.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error generating report", e));
@@ -590,6 +620,8 @@
 
 				final IStructuredSelection iss = (IStructuredSelection) selection;
 
+				final SXSSFWorkbook rollupStats = new SXSSFWorkbook(10);
+
 				try {
 					pd.run(true, true, new IRunnableWithProgress() {
 
@@ -626,7 +658,7 @@
 												zipFile.getParent().getLocation().toOSString() +
 														System.getProperty("file.separator") +
 														CDAValueUtil.DATE_FORMAT3.format(new Date()) + "_" +
-														"RollupStatistics.xlsx");
+														zipFile.getName() + "RollupStatistics.xlsx");
 										}
 
 										processSelection(
@@ -634,6 +666,14 @@
 											rollupStats);
 
 									}
+
+									try (OutputStream fileOut = Files.newOutputStream(
+										Paths.get(fileLocation.toString()))) {
+										rollupStats.write(fileOut);
+										fileOut.close();
+										rollupStats.close();
+										rollupStats.dispose();
+									}
 								}
 							} catch (Throwable e) {
 								ILog log = Activator.getDefault().getLog();
@@ -691,12 +731,12 @@
 				//
 				// console.println("Start Saving " + currentProcessingTime);
 
-				try (OutputStream fileOut = Files.newOutputStream(Paths.get(fileLocation.toString()))) {
-					rollupStats.write(fileOut);
-					fileOut.close();
-					rollupStats.close();
-					rollupStats.dispose();
-				}
+				// try (OutputStream fileOut = Files.newOutputStream(Paths.get(fileLocation.toString()))) {
+				// rollupStats.write(fileOut);
+				// fileOut.close();
+				// rollupStats.close();
+				// rollupStats.dispose();
+				// }
 
 				for (
 
@@ -1415,20 +1455,31 @@
 		validation.write("File,Rule,XPath");
 		validation.newLine();
 
+		final int STATSFILENAME = 0;
+		final int STATSTOTAL = 1;
+		final int STATSCONSOLIDATED = 2;
+		final int STATSCONTINUITYOFCARE = 3;
+		final int STATSPROGRESSNOTE = 4;
+		final int STATSDISCHARGESUMMARY = 5;
+		final int STATSOTHER = 6;
+		final int STATSC32 = 7;
+		final int STATSNONXML = 8;
+		final int STATSERRORS = 9;
+
 		SXSSFSheet statsheet = rollupStats.getSheet("File Statistics");
 		if (statsheet == null) {
 			statsheet = rollupStats.createSheet("File Statistics");
 			Row hrow = statsheet.createRow(statsheet.getPhysicalNumberOfRows());
-			hrow.createCell(0).setCellValue("File Name");
-
-			hrow.createCell(1).setCellValue("Totals");
-			hrow.createCell(2).setCellValue("Consolidated");
-			hrow.createCell(3).setCellValue("Outpatient Progress note");
-			hrow.createCell(4).setCellValue("Summary of episode note");
-			hrow.createCell(5).setCellValue("Other");
-			hrow.createCell(6).setCellValue("C32");
-			hrow.createCell(7).setCellValue("NonXML");
-			hrow.createCell(8).setCellValue("Errors");
+			hrow.createCell(STATSFILENAME).setCellValue("File Name");
+			hrow.createCell(STATSTOTAL).setCellValue("Totals");
+			hrow.createCell(STATSCONSOLIDATED).setCellValue("Consolidated");
+			hrow.createCell(STATSCONTINUITYOFCARE).setCellValue("Summarization of episode note");
+			hrow.createCell(STATSPROGRESSNOTE).setCellValue("Outpatient Progress note");
+			hrow.createCell(STATSDISCHARGESUMMARY).setCellValue("Discharge Summary");
+			hrow.createCell(STATSOTHER).setCellValue("Other");
+			hrow.createCell(STATSC32).setCellValue("C32");
+			hrow.createCell(STATSNONXML).setCellValue("NonXML");
+			hrow.createCell(STATSERRORS).setCellValue("Errors");
 			;
 
 		}
@@ -1736,15 +1787,27 @@
 				nonxmldocuments++;
 			}
 
-			statrow.createCell(1).setCellValue(statfilectr);
-			statrow.createCell(2).setCellValue(consoldocumentsprocessed);
-			statrow.createCell(3).setCellValue(continuityofcareprocessed);
-			statrow.createCell(4).setCellValue(outpatientprogressnoteprocessed);
-			statrow.createCell(5).setCellValue(dischargesummaryprocessed);
-			statrow.createCell(6).setCellValue(otherdocumentprocessed);
-			statrow.createCell(7).setCellValue(c32documentsprocessed);
-			statrow.createCell(8).setCellValue(nonxmldocuments);
-			statrow.createCell(9).setCellValue(documenterrors);
+			// final int STATSFILENAME = 0;
+			// final int STATSTOTAL = 1;
+			// final int STATSCONSOLIDATED = 2;
+			// final int STATSCONTINUITYOFCARE = 3;
+			// final int STATSPROGRESSNOTE = 4;
+			// final int STATSEPISODENOTE = 5;
+			// final int STATSDISCHARGESUMMARY = 6;
+			// final int STATSOTHER = 7;
+			// final int STATSC32 = 8;
+			// final int STATSNONXML = 9;
+			// final int STATSERRORS = 10;
+
+			statrow.createCell(STATSTOTAL).setCellValue(statfilectr);
+			statrow.createCell(STATSCONSOLIDATED).setCellValue(consoldocumentsprocessed);
+			statrow.createCell(STATSCONTINUITYOFCARE).setCellValue(continuityofcareprocessed);
+			statrow.createCell(STATSPROGRESSNOTE).setCellValue(outpatientprogressnoteprocessed);
+			statrow.createCell(STATSDISCHARGESUMMARY).setCellValue(dischargesummaryprocessed);
+			statrow.createCell(STATSOTHER).setCellValue(otherdocumentprocessed);
+			statrow.createCell(STATSC32).setCellValue(c32documentsprocessed);
+			statrow.createCell(STATSNONXML).setCellValue(nonxmldocuments);
+			statrow.createCell(STATSERRORS).setCellValue(documenterrors);
 
 			stopwatch.stop();
 		}