Skip to content
Snippets Groups Projects
Commit 884d9856 authored by Jonas Blatt's avatar Jonas Blatt :ant:
Browse files

#32 Action for Missing Missing Input Data: Rename Column Name, if there is a connection

parent 3adf53fe
No related branches found
No related tags found
No related merge requests found
......@@ -92,6 +92,8 @@ public class MissingInputDataVerifier extends AbstractVerifier {
// Actions for creating output columns in connected decisions
searchPossibleConnectedDecisions(inputColumn);
}
// Actions for renaming column
searchPossibleNames(inputColumn);
vreFactory
// Action for deleting column
.addVerificationFix(
......@@ -184,4 +186,58 @@ public class MissingInputDataVerifier extends AbstractVerifier {
}
}
}
private void searchPossibleNames(VDmnInputColumn inputColumn) {
List<Name> otherInputNames =
inputColumn.getVDmnDecisionTable().getVDmnInputColumns().stream()
.filter(c -> c.getName().isPresent())
.map(c -> c.getName().get())
.collect(Collectors.toList());
if (!inputColumn.getName().isPresent()) {
for (VDmnNode node : inputColumn.getVDmnDecision().getVDmnInformationRequirements()) {
if (node.isInputData()) {
if (!otherInputNames.contains(node.getName().get())) {
vreFactory.addVerificationFix(
VerificationFix.getBuilder()
.withFixName("Name column \"" + node.getName().get().getValue() + "\"")
.addAction(
Action.getBuilder()
.withActionType(UPDATE)
.withActionScope(INPUT_COLUMN)
.addIdValue(inputColumn.getVDmnDecision().getDecisionId())
.addIdValue(inputColumn.getInputId())
.addValue("name", node.getName().get().getValue())
.build())
.build());
}
} else {
for (VDmnOutputColumn outputColumn :
((VDmnDecision) node).getVDmnDecisionTable().getVDmnOutputColumns()) {
if (outputColumn.getName().isPresent()) {
if (!otherInputNames.contains(outputColumn.getName().get())) {
if (outputColumn.getTypeRef().equals(inputColumn.getTypeRef())
|| inputColumn.getValues().stream()
.allMatch(c -> c.getText().getValue().isEmpty())) {
vreFactory.addVerificationFix(
VerificationFix.getBuilder()
.withFixName(
"Name column \"" + outputColumn.getName().get().getValue() + "\"")
.addAction(
Action.getBuilder()
.withActionType(UPDATE)
.withActionScope(INPUT_COLUMN)
.addIdValue(inputColumn.getVDmnDecision().getDecisionId())
.addIdValue(inputColumn.getInputId())
.addValue("name", outputColumn.getName().get().getValue())
.addValue("typeRef", outputColumn.getTypeRef().getName())
.build())
.build());
}
}
}
}
}
}
}
}
}
......@@ -424,6 +424,14 @@ function updateColumn(verificationEntry, fixAction, idName) {
column.businessObject.inputExpression.text = fixAction.actionValues['name'];
}
}
if (fixAction.actionValues['typeRef']) {
if (idName === 'outputId') {
column.businessObject.typeRef = fixAction.actionValues['typeRef'].toLowerCase();
} else {
column.businessObject.inputExpression.typeRef = fixAction.actionValues['typeRef'].toLowerCase();
}
}
if (fixAction.actionValues['addPredVal']
|| fixAction.actionValues['delPredVal']) {
let inputVals = [];
......@@ -456,6 +464,7 @@ function updateColumn(verificationEntry, fixAction, idName) {
getCurrentModeler().editAllowedValues(column.businessObject, inputVals);
}
}
openViewWithId(fixAction.actionValues['decisionId']);
}
// get a rule:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment