Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #324 - RiaH export highlight required and unmapped fields #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,15 @@ private static void addTargetTableSection(CustomXWPFDocument document, ETL etl,
int rowNr = 1;
for (MappableItem targetField : fieldtoFieldMapping.getTargetItems()) {
XWPFTableRow row = table.getRow(rowNr++);
row.getCell(0).setText(targetField.getName());

// Check if the field is non-nullable and prepend an asterisk if true
String fieldName = targetField.getName();
for (Field field : targetTable.getFields()) {
if (field.getName().equals(fieldName) && !field.isNullable()) {
fieldName = "*" + fieldName;
break;
}
}

StringBuilder source = new StringBuilder();
StringBuilder logic = new StringBuilder();
Expand Down Expand Up @@ -177,6 +185,15 @@ private static void addTargetTableSection(CustomXWPFDocument document, ETL etl,
comment.append(field.getComment().trim());
}
}

// Grey out the font if source field, logic, and comment are all empty
if (source.toString().trim().isEmpty() && logic.toString().trim().isEmpty() && comment.toString().trim().isEmpty()) {
XWPFRun runGrey = row.getCell(0).getParagraphs().get(0).createRun();
runGrey.setColor("999999");
runGrey.setText(fieldName);
} else {
row.getCell(0).setText(fieldName);
}

createCellParagraph(row.getCell(1), source.toString());
createCellParagraph(row.getCell(2), logic.toString());
Expand Down
Loading