Skip to content

Commit

Permalink
Merge branch 'aiccra-staging' into AICCRA
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjitm committed Jul 23, 2024
2 parents 72f04e6 + fed4627 commit 03080bf
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 53 deletions.
2 changes: 1 addition & 1 deletion marlo-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<mysql.version>8.0.28</mysql.version>
<servlet-api.version>3.0.1</servlet-api.version>
<jsp-api.version>2.2.1</jsp-api.version>
<poi.version>3.13</poi.version>
<poi.version>5.3.0</poi.version>
<ooxml-schemas.version>1.0</ooxml-schemas.version>
<flyway.version>4.0.1</flyway.version>
<org.json.version>20231013</org.json.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;

import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.DataValidation;
import org.apache.poi.ss.usermodel.DataValidationConstraint;
Expand Down Expand Up @@ -236,7 +234,7 @@ public String preLoadExcelFile() {
input.close();


} catch (IOException | EncryptedDocumentException | InvalidFormatException e) {
} catch (Exception e) {
e.printStackTrace();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,26 +180,23 @@ public Object getCellData(Cell cell) {

if (cell != null) {
switch (cell.getCellType()) {
case Cell.CELL_TYPE_STRING:
case STRING:
cellData = cell.getStringCellValue();
break;
case Cell.CELL_TYPE_NUMERIC:
case NUMERIC:
cellData = cell.getNumericCellValue();
break;
case Cell.CELL_TYPE_BOOLEAN:
case BOOLEAN:
cellData = cell.getBooleanCellValue();
break;
case Cell.CELL_TYPE_BLANK:
cellData = cell.getStringCellValue();
case BLANK:
cellData = "";
break;


default:
break;
}
}


return cellData;

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.math.BigInteger;
Expand Down Expand Up @@ -120,13 +119,13 @@
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPr;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPrGeneral;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPageSz;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSectPr;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSimpleField;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTString;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTStyle;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STOnOff;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STPageOrientation;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STStyleType;
import org.slf4j.Logger;
Expand Down Expand Up @@ -161,7 +160,7 @@ private static void addCustomHeadingStyle(XWPFDocument docxDocument, String strS
ctStyle.setQFormat(onoffnull);

// style defines a heading of the given level
CTPPr ppr = CTPPr.Factory.newInstance();
CTPPrGeneral ppr = CTPPrGeneral.Factory.newInstance();
ppr.setOutlineLvl(indentNumber);
ctStyle.setPPr(ppr);

Expand Down Expand Up @@ -689,7 +688,7 @@ public void createPageFooter() {
try {
XWPFHeaderFooterPolicy headerFooterPolicy = new XWPFHeaderFooterPolicy(document, sectPr);
headerFooterPolicy.createFooter(STHdrFtr.DEFAULT, paragraphs);
} catch (IOException e) {
} catch (Exception e) {
LOG.error("Failed to createFooter. Exception: " + e.getMessage());
}
}
Expand Down Expand Up @@ -2183,7 +2182,7 @@ public String execute() throws Exception {
CTP ctP = paragraph.getCTP();
CTSimpleField toc = ctP.addNewFldSimple();
toc.setInstr("TOC \\h");
toc.setDirty(STOnOff.TRUE);
toc.setDirty(true);
XWPFRun run = paragraph.createRun();

// First page
Expand Down Expand Up @@ -2668,7 +2667,7 @@ public String execute() throws Exception {
CTP ctP = paragraph.getCTP();
CTSimpleField toc = ctP.addNewFldSimple();
toc.setInstr("TOC \\h");
toc.setDirty(STOnOff.TRUE);
toc.setDirty(true);
XWPFRun run = paragraph.createRun();

// First page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.math.BigInteger;
Expand Down Expand Up @@ -571,7 +570,7 @@ public void createPageFooter() {
try {
XWPFHeaderFooterPolicy headerFooterPolicy = new XWPFHeaderFooterPolicy(document, sectPr);
headerFooterPolicy.createFooter(STHdrFtr.DEFAULT, paragraphs);
} catch (IOException e) {
} catch (Exception e) {
LOG.error("Failed to createFooter. Exception: " + e.getMessage());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.math.BigInteger;
Expand Down Expand Up @@ -571,7 +570,7 @@ public void createPageFooter() {
try {
XWPFHeaderFooterPolicy headerFooterPolicy = new XWPFHeaderFooterPolicy(document, sectPr);
headerFooterPolicy.createFooter(STHdrFtr.DEFAULT, paragraphs);
} catch (IOException e) {
} catch (Exception e) {
LOG.error("Failed to createFooter. Exception: " + e.getMessage());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.math.BigInteger;
Expand Down Expand Up @@ -108,6 +107,7 @@
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPr;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPrGeneral;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPageSz;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSectPr;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTString;
Expand All @@ -133,22 +133,25 @@ private static void addCustomHeadingStyle(XWPFDocument docxDocument, String strS
styleName.setVal(strStyleId);
ctStyle.setName(styleName);

// Assuming headingLevel is an integer representing the level of the heading
CTDecimalNumber indentNumber = CTDecimalNumber.Factory.newInstance();
indentNumber.setVal(BigInteger.valueOf(headingLevel));
indentNumber.setVal(BigInteger.valueOf(headingLevel)); // Set the UI priority

// lower number > style is more prominent in the formats bar
// Set the style's UI priority (using an integer value)
ctStyle.setUiPriority(indentNumber);

CTOnOff onoffnull = CTOnOff.Factory.newInstance();
ctStyle.setUnhideWhenUsed(onoffnull);
ctStyle.setUnhideWhenUsed(onoffnull); // Set the style to unhide when used

// style shows up in the formats bar
// Style shows up in the formats bar
ctStyle.setQFormat(onoffnull);

// style defines a heading of the given level
CTPPr ppr = CTPPr.Factory.newInstance();
ppr.setOutlineLvl(indentNumber);
ctStyle.setPPr(ppr);
// Define a heading of the given level
CTPPrGeneral pprGeneral = CTPPrGeneral.Factory.newInstance(); // Create a new instance of CTPPrGeneral
CTDecimalNumber outlineLvl = CTDecimalNumber.Factory.newInstance(); // Create a new instance of CTDecimalNumber
outlineLvl.setVal(BigInteger.valueOf(headingLevel)); // Set the outline level value
pprGeneral.setOutlineLvl(outlineLvl); // Set the outline level in the paragraph properties
ctStyle.setPPr(pprGeneral); // Apply the paragraph properties to the style

XWPFStyle style = new XWPFStyle(ctStyle);

Expand Down Expand Up @@ -326,7 +329,7 @@ public void createPageFooter() {
try {
XWPFHeaderFooterPolicy headerFooterPolicy = new XWPFHeaderFooterPolicy(document, sectPr);
headerFooterPolicy.createFooter(STHdrFtr.DEFAULT, paragraphs);
} catch (IOException e) {
} catch (Exception e) {
LOG.error("Failed to createFooter. Exception: " + e.getMessage());
}

Expand Down Expand Up @@ -1053,7 +1056,7 @@ public String execute() throws Exception {
* CTP ctP = paragraph.getCTP();
* CTSimpleField toc = ctP.addNewFldSimple();
* toc.setInstr("TOC \\h");
* toc.setDirty(STOnOff.TRUE);
* toc.setDirty(true);
*/
XWPFRun run = paragraph.createRun();
// run.addBreak(BreakType.PAGE);
Expand Down Expand Up @@ -1327,7 +1330,7 @@ public String execute() throws Exception {
* CTP ctP = paragraph.getCTP();
* CTSimpleField toc = ctP.addNewFldSimple();
* toc.setInstr("TOC \\h");
* toc.setDirty(STOnOff.TRUE);
* toc.setDirty(true);
*/
XWPFRun run = paragraph.createRun();
// run.addBreak(BreakType.PAGE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.math.BigInteger;
Expand Down Expand Up @@ -113,13 +112,12 @@
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocument1;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPr;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPrGeneral;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSectPr;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSimpleField;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTString;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTStyle;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STOnOff;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STStyleType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -154,7 +152,7 @@ private static void addCustomHeadingStyle(XWPFDocument docxDocument, String strS
ctStyle.setQFormat(onoffnull);

// style defines a heading of the given level
CTPPr ppr = CTPPr.Factory.newInstance();
CTPPrGeneral ppr = CTPPrGeneral.Factory.newInstance();
ppr.setOutlineLvl(indentNumber);
ctStyle.setPPr(ppr);

Expand Down Expand Up @@ -616,7 +614,7 @@ public void createPageFooter() {
try {
XWPFHeaderFooterPolicy headerFooterPolicy = new XWPFHeaderFooterPolicy(document, sectPr);
headerFooterPolicy.createFooter(STHdrFtr.DEFAULT, paragraphs);
} catch (IOException e) {
} catch (Exception e) {
LOG.error("Failed to createFooter. Exception: " + e.getMessage());
}

Expand Down Expand Up @@ -822,6 +820,7 @@ public String execute() throws Exception {
&& c.getCrpProgramOutcome().getComposedName().contains("PDO Indicator 1"))
.collect(Collectors.toList()));
} catch (Exception e) {
LOG.error("Error generating Progress Summary " + e.getMessage());
}

// PDO 2
Expand All @@ -832,6 +831,7 @@ public String execute() throws Exception {
&& c.getCrpProgramOutcome().getComposedName().contains("PDO Indicator 2"))
.collect(Collectors.toList()));
} catch (Exception e) {
LOG.error("Error generating Progress Summary " + e.getMessage());
}

// PDO 3
Expand All @@ -842,6 +842,7 @@ public String execute() throws Exception {
&& c.getCrpProgramOutcome().getComposedName().contains("PDO Indicator 3"))
.collect(Collectors.toList()));
} catch (Exception e) {
LOG.error("Error generating Progress Summary " + e.getMessage());
}
// PDO 4
try {
Expand All @@ -851,6 +852,7 @@ public String execute() throws Exception {
&& c.getCrpProgramOutcome().getComposedName().contains("PDO Indicator 4"))
.collect(Collectors.toList()));
} catch (Exception e) {
LOG.error("Error generating Progress Summary " + e.getMessage());
}

// IPI 1.1
Expand All @@ -861,6 +863,7 @@ public String execute() throws Exception {
&& c.getCrpProgramOutcome().getComposedName().contains("IPI 1.1"))
.collect(Collectors.toList()));
} catch (Exception e) {
LOG.error("Error generating Progress Summary " + e.getMessage());
}

// IPI 1.2
Expand All @@ -871,6 +874,7 @@ public String execute() throws Exception {
&& c.getCrpProgramOutcome().getComposedName().contains("IPI 1.2"))
.collect(Collectors.toList()));
} catch (Exception e) {
LOG.error("Error generating Progress Summary " + e.getMessage());
}

// IPI 1.3
Expand Down Expand Up @@ -1057,7 +1061,7 @@ public String execute() throws Exception {
CTP ctP = paragraph.getCTP();
CTSimpleField toc = ctP.addNewFldSimple();
toc.setInstr("TOC \\h");
toc.setDirty(STOnOff.TRUE);
toc.setDirty(true);
XWPFRun run = paragraph.createRun();
document.createParagraph().setPageBreak(true);
}
Expand Down Expand Up @@ -1107,7 +1111,7 @@ public String execute() throws Exception {
run.addBreak();
run.addPicture(new FileInputStream(imageFile), imgFormat, imgFile, Units.toEMU(width), Units.toEMU(height));
} catch (Exception e) {
// System.out.println(e);
LOG.error("Error generating Progress Summary " + e.getMessage());
}

// Project Title
Expand Down Expand Up @@ -1601,7 +1605,7 @@ public void loadProvider(Map<String, Object> session) {
try {
ServletActionContext.getContext().setLocale(locale);
} catch (Exception e) {

LOG.error("Error generating Progress Summary " + e.getMessage());
}

if (session.containsKey(APConstants.SESSION_CRP)) {
Expand Down
Loading

0 comments on commit 03080bf

Please sign in to comment.