use of com.epam.pipeline.manager.pipeline.documents.templates.structure.Table in project cloud-pipeline by epam.
the class PipelineDocumentTemplate method getCustomScriptsTable.
@Placeholder(regex = "Analytical Pipeline Custom Scripts", processor = TableTemplateProcessor.class)
public Table getCustomScriptsTable() {
Table table = new Table();
table.setContainsHeaderRow(true);
table.addColumn("Custom script");
table.addColumn("Version");
for (GitRepositoryEntry customScript : this.customScripts) {
TableRow row = table.addRow(customScript.getName());
table.setData(row.getIndex(), 0, customScript.getName());
table.setData(row.getIndex(), 1, "");
}
return table;
}
use of com.epam.pipeline.manager.pipeline.documents.templates.structure.Table in project cloud-pipeline by epam.
the class PipelineDocumentTemplate method getFilesGeneratedDuringPipelineProcessingTable.
@Placeholder(regex = "Files generated during pipeline processing", processor = TableTemplateProcessor.class)
public Table getFilesGeneratedDuringPipelineProcessingTable() {
Table table = new Table();
table.setContainsHeaderRow(true);
table.addColumn("File Name");
table.addColumn("Storage Fate");
for (Pair<String, String> generatedFile : this.filesGeneratedDuringPipelineProcessing) {
TableRow row = table.addRow(generatedFile.getKey());
table.setData(row.getIndex(), 0, generatedFile.getKey());
table.setData(row.getIndex(), 1, generatedFile.getValue());
}
return table;
}
use of com.epam.pipeline.manager.pipeline.documents.templates.structure.Table in project cloud-pipeline by epam.
the class TableTemplateProcessor method insertData.
@Override
boolean insertData(XWPFParagraph splittedParagraph, XWPFRun runTemplate, XmlCursor cursor, Object data) {
if (data instanceof Table) {
Table table = (Table) data;
XWPFTable xwpfTable = splittedParagraph.getDocument().insertNewTbl(cursor);
CTTblPr properties = xwpfTable.getCTTbl().getTblPr();
if (properties == null) {
properties = xwpfTable.getCTTbl().addNewTblPr();
}
CTJc jc = (properties.isSetJc() ? properties.getJc() : properties.addNewJc());
jc.setVal(STJc.CENTER);
CTTblBorders borders = properties.addNewTblBorders();
borders.addNewBottom().setVal(STBorder.SINGLE);
borders.addNewLeft().setVal(STBorder.SINGLE);
borders.addNewRight().setVal(STBorder.SINGLE);
borders.addNewTop().setVal(STBorder.SINGLE);
borders.addNewInsideH().setVal(STBorder.SINGLE);
borders.addNewInsideV().setVal(STBorder.SINGLE);
for (int rowIndex = -1; rowIndex < table.getRows().size(); rowIndex++) {
if (rowIndex == -1 && !table.isContainsHeaderRow()) {
continue;
}
XWPFTableRow xwpfTableRow = xwpfTable.insertNewTableRow(rowIndex + 1);
for (int colIndex = -1; colIndex < table.getColumns().size(); colIndex++) {
if (colIndex == -1 && !table.isContainsHeaderColumn()) {
continue;
}
String text = "";
XWPFTableCell xwpfTableCell = xwpfTableRow.addNewTableCell();
XWPFParagraph xwpfParagraph = xwpfTableCell.addParagraph();
xwpfParagraph.setAlignment(ParagraphAlignment.CENTER);
xwpfParagraph.setVerticalAlignment(TextAlignment.CENTER);
XWPFRun xwpfRun = xwpfParagraph.createRun();
this.copyRunProperties(runTemplate, xwpfRun);
if (rowIndex == -1 && colIndex >= 0) {
text = table.getColumns().get(colIndex).getName();
xwpfRun.setBold(true);
} else if (colIndex == -1 && rowIndex >= 0) {
text = table.getRows().get(rowIndex).getName();
xwpfRun.setBold(true);
} else if (rowIndex >= 0 && colIndex >= 0) {
Object cellData = table.getData(rowIndex, colIndex);
text = cellData != null ? cellData.toString() : "";
}
xwpfRun.setText(text, 0);
}
}
cursor.toNextSibling();
return true;
}
return false;
}
use of com.epam.pipeline.manager.pipeline.documents.templates.structure.Table in project cloud-pipeline by epam.
the class PipelineDocumentTemplate method getOpenSourceAlgorithmsAndSoftwareTable.
@Placeholder(regex = "Open Source Algorithms and Software", processor = TableTemplateProcessor.class)
public Table getOpenSourceAlgorithmsAndSoftwareTable() {
Table table = new Table();
table.setContainsHeaderRow(true);
table.addColumn("Algorithm or Software");
table.addColumn("Version");
Map<String, List<String>> toolsVersions = new HashMap<>();
for (Tool tool : this.openSourceSoftware) {
String[] parts = tool.getImage().split("-");
String toolName = tool.getImage();
String toolVersion = null;
if (parts.length >= 2) {
toolName = parts[0].trim();
toolVersion = parts[1].trim();
}
if (!toolsVersions.containsKey(toolName)) {
toolsVersions.put(toolName, new ArrayList<>());
}
List<String> versions = toolsVersions.get(toolName);
if (toolVersion != null && !toolVersion.equals("") && versions.indexOf(toolVersion) == -1) {
versions.add(toolVersion);
toolsVersions.put(toolName, versions);
}
}
for (String tool : toolsVersions.keySet()) {
List<String> versions = toolsVersions.get(tool);
String versionsStr = String.join(", ", versions);
TableRow row = table.addRow(tool);
table.setData(row.getIndex(), 0, tool);
table.setData(row.getIndex(), 1, versionsStr);
}
return table;
}
Aggregations