Updates to spreadsheet generation

Fixed issue with document caching
Fixed the header for immunization
Serialize ADDR to components
diff --git a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/CDAValueUtil.java b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/CDAValueUtil.java
index 4d0e273..64e8ec1 100644
--- a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/CDAValueUtil.java
+++ b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/CDAValueUtil.java
@@ -558,6 +558,17 @@
 		return sb.toString();
 	}
 
+	public static String getValues(List<ADXP> values) {
+		StringBuffer b = new StringBuffer();
+		for (ADXP a : values) {
+			if (b.length() > 0) {
+				b.append(" ");
+			}
+			b.append(a.getText());
+		}
+		return b.toString();
+	}
+
 	public static String getValues(AD ad) {
 		StringBuffer b = new StringBuffer();
 		for (ADXP a : ad.getStreetAddressLines()) {
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 837093f..155a1a4 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
@@ -3297,6 +3297,9 @@
 			HashSet<EClass> sectionFilter, IFolder folder, String folderName, int documentCounter)
 			throws Exception, Exception {
 
+		// Clear the section cache
+		sheets.clear();
+
 		for (Integer eClass : workbooks.keySet()) {
 
 			HashMap<String, ArrayList<IFile>> sectionbyfile = documentsbysectionbyfile.get(eClass);
diff --git a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SheetHeaderUtil.java b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SheetHeaderUtil.java
index 97f94cb..c7d0c54 100644
--- a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SheetHeaderUtil.java
+++ b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SheetHeaderUtil.java
@@ -42,6 +42,9 @@
 	static int createDemographicsHeader(Row row1, Row row2, int offset) {
 		row2.createCell(offset++).setCellValue(replaceSpace("Name"));
 		row2.createCell(offset++).setCellValue(replaceSpace("Address"));
+		row2.createCell(offset++).setCellValue(replaceSpace("City"));
+		row2.createCell(offset++).setCellValue(replaceSpace("State"));
+		row2.createCell(offset++).setCellValue(replaceSpace("Postal"));
 		offset = addCodeHeader(row2, offset, "Race");
 		offset = addCodeHeader(row2, offset, "Ethnicity");
 		offset = addCodeHeader(row2, offset, "Gender");
@@ -230,7 +233,7 @@
 		row2.createCell(offset++).setCellValue(replaceSpace("Quantity"));
 		row2.createCell(offset++).setCellValue(replaceSpace("Location"));
 		row2.getSheet().setColumnHidden(offset - 1, hideColumns);
-		row2.createCell(offset++).setCellValue(replaceSpace("Expiration"));
+		row2.createCell(offset++).setCellValue(replaceSpace("Administration"));
 		row2.createCell(offset++).setCellValue(replaceSpace("Location"));
 		row2.getSheet().setColumnHidden(offset - 1, hideColumns);
 		row2.createCell(offset++).setCellValue(replaceSpace("Prescription"));
diff --git a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SpreadsheetSerializer.java b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SpreadsheetSerializer.java
index f763fc9..76dd8b4 100644
--- a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SpreadsheetSerializer.java
+++ b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/SpreadsheetSerializer.java
@@ -722,7 +722,7 @@
 	 * @param fileName
 	 */
 
-	static int appendCode(Row row, int offset, Section setion, CD cd, ED ed) {
+	static int appendCode(Row row, int offset, Section section, CD cd, ED ed) {
 
 		;
 
@@ -732,14 +732,14 @@
 					? cd.getOriginalText()
 					: ed);
 
-			if (setion != null || ed != null) {
-				row.createCell(offset++).setCellValue(CDAValueUtil.getValue(setion, theED));
+			if (section != null || ed != null) {
+				row.createCell(offset++).setCellValue(CDAValueUtil.getValue(section, theED));
 			} else {
 				row.createCell(offset++).setCellValue("");
 			}
 
 			// Display Name
-			row.createCell(offset++).setCellValue(CDAValueUtil.getValueAsString(setion, cd));
+			row.createCell(offset++).setCellValue(CDAValueUtil.getValueAsString(section, cd));
 			// Code
 			row.createCell(offset++).setCellValue(cd.getCode());
 			// Code System
@@ -751,7 +751,7 @@
 			row.createCell(offset++).setCellValue(CDAUtil.getDomainPath(cd));
 
 		} else {
-			if (setion != null || ed != null) {
+			if (section != null || ed != null) {
 				row.createCell(offset++).setCellValue("");
 			}
 			row.createCell(offset++).setCellValue("");
@@ -765,6 +765,27 @@
 		return offset;
 	}
 
+	static int appendAddr(Row row, int offset, AD ad) {
+
+		;
+
+		if (ad != null) {
+			row.createCell(offset++).setCellValue(CDAValueUtil.getValues(ad.getStreetAddressLines()));
+			row.createCell(offset++).setCellValue(CDAValueUtil.getValues(ad.getCities()));
+			row.createCell(offset++).setCellValue(CDAValueUtil.getValues(ad.getStates()));
+			row.createCell(offset++).setCellValue(CDAValueUtil.getValues(ad.getPostalCodes()));
+
+		} else {
+			row.createCell(offset++).setCellValue("");
+			row.createCell(offset++).setCellValue("");
+			row.createCell(offset++).setCellValue("");
+			row.createCell(offset++).setCellValue("");
+
+		}
+
+		return offset;
+	}
+
 	/**
 	 * @param query
 	 * @param sheet
@@ -1554,9 +1575,9 @@
 					cell.setCellValue(CDAValueUtil.getValues(patientRole.getPatient().getNames().get(0)));
 				}
 
-				cell = row.createCell(offset++);
+				// cell = row.createCell(offset++);
 				if (!patientRole.getAddrs().isEmpty()) {
-					cell.setCellValue(CDAValueUtil.getValues(patientRole.getAddrs().get(0)));
+					offset = SpreadsheetSerializer.appendAddr(row, offset, patientRole.getAddrs().get(0));
 				}
 
 				if (patientRole.getPatient().getRaceCode() != null) {
@@ -2337,7 +2358,7 @@
 	 * @param object
 	 * @return
 	 */
-	public static int appendCodeShowNullFlavor(Row row, int offset, Section setion, CD cd, ED ed) {
+	public static int appendCodeShowNullFlavor(Row row, int offset, Section section, CD cd, ED ed) {
 
 		if (cd != null) {
 			// If original text is not supplied - see if the ed was supplied
@@ -2345,14 +2366,14 @@
 					? cd.getOriginalText()
 					: ed);
 
-			if (setion != null || ed != null) {
-				row.createCell(offset++).setCellValue(CDAValueUtil.getValue(setion, theED));
+			if (section != null || ed != null) {
+				row.createCell(offset++).setCellValue(CDAValueUtil.getValue(section, theED));
 			} else {
 				row.createCell(offset++).setCellValue("");
 			}
 
 			// Display Name
-			row.createCell(offset++).setCellValue(CDAValueUtil.getValueAsString(setion, cd));
+			row.createCell(offset++).setCellValue(CDAValueUtil.getValueAsString(section, cd));
 			// Code
 
 			if (cd.isNullFlavorDefined() && StringUtils.isEmpty(cd.getCode())) {
@@ -2369,7 +2390,7 @@
 			row.createCell(offset++).setCellValue(CDAUtil.getDomainPath(cd));
 
 		} else {
-			if (setion != null || ed != null) {
+			if (section != null || ed != null) {
 				row.createCell(offset++).setCellValue("");
 			}
 			row.createCell(offset++).setCellValue("");