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

Add default show verifications fixes to existing verifier

parent 2dce147a
No related branches found
No related tags found
No related merge requests found
Showing
with 35 additions and 6 deletions
......@@ -83,7 +83,7 @@ public class VerificationResultEntry extends AbstractResultObject {
return this;
}
public Builder addAction(VerificationFix verificationFix) {
public Builder addVerificationFix(VerificationFix verificationFix) {
value.verificationFixes.add(Validate.notNull(verificationFix));
return this;
}
......
......@@ -3,6 +3,7 @@ package de.unikoblenz.fgbks.core.dmn.verification.result;
import de.unikoblenz.fgbks.base.domain.Message;
import de.unikoblenz.fgbks.core.dmn.verification.result.VerificationResultEntry.VerificationClassification;
import de.unikoblenz.fgbks.core.dmn.verification.result.VerifierResult.Builder;
import de.unikoblenz.fgbks.core.dmn.verification.result.actions.VerificationFix;
import org.apache.commons.lang3.Validate;
public class VerificationResultEntryFactory {
......@@ -26,6 +27,11 @@ public class VerificationResultEntryFactory {
return verificationResultEntryBuilder;
}
public VerificationResultEntryFactory addVerificationFix(VerificationFix verificationFix) {
getCurrentOrCreate().addVerificationFix(verificationFix);
return this;
}
public VerificationResultEntryFactory addElement(
VerificationResultEntryElement verificationResultEntryElement) {
getCurrentOrCreate().addVerificationResultEntryElement(verificationResultEntryElement);
......
......@@ -2,6 +2,8 @@ package de.unikoblenz.fgbks.core.dmn.verification.verifier.impl;
import static de.unikoblenz.fgbks.base.utils.boundary.impl.DateBoundary.dateGroupName;
import static de.unikoblenz.fgbks.base.utils.boundary.impl.DateBoundary.datePattern;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.VerificationFix.SHOW_INPUT_ENTRIES;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.VerificationFix.SHOW_OUTPUT_ENTRIES;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnColumn;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnValue;
......@@ -69,6 +71,8 @@ public class DateVerifier extends AbstractVerifier {
LocalDateTime.parse(dateTime);
} catch (DateTimeParseException e) {
vreFactory.addElement(VerificationResultEntryElement.create(dateValue));
vreFactory.addVerificationFix(
dateValue.isInputValue() ? SHOW_INPUT_ENTRIES : SHOW_OUTPUT_ENTRIES);
vreFactory.addToEntry(
VerificationClassification.FATAL_ERROR, "Date value '%s' is no valid date.", dateTime);
}
......
package de.unikoblenz.fgbks.core.dmn.verification.verifier.impl;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.VerificationFix.SHOW_OUTPUT_ENTRIES;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnOutputColumn;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnOutputValue;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.utils.VDmnFunctions;
......@@ -32,6 +34,7 @@ public class EmptyOutputVerifier extends AbstractVerifier {
private void checkEmptyOutputValue(VDmnOutputValue outputValue) {
if (outputValue.getText().isEmpty()) {
vreFactory.addElement(VerificationResultEntryElement.create(outputValue));
vreFactory.addVerificationFix(SHOW_OUTPUT_ENTRIES);
vreFactory.addToEntry(VerificationClassification.WARNING, "Output value is empty.'");
}
}
......
package de.unikoblenz.fgbks.core.dmn.verification.verifier.impl;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.VerificationFix.SHOW_INPUT_ENTRIES;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.VerificationFix.SHOW_OUTPUT_ENTRIES;
import de.unikoblenz.fgbks.base.utils.boundary.impl.StringBoundary;
import de.unikoblenz.fgbks.base.wordnet.WordnetService;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnColumn;
......@@ -70,6 +73,8 @@ public class EquivalentVerifier extends AbstractVerifier {
if (wordnetService.areNounsSynonyms(stringVals.get(i), stringValsInner.get(u))) {
vreFactory.addElement(VerificationResultEntryElement.create(v1));
vreFactory.addElement(VerificationResultEntryElement.create(v2));
vreFactory.addVerificationFix(
v1.isInputValue() ? SHOW_INPUT_ENTRIES : SHOW_OUTPUT_ENTRIES);
vreFactory.addToEntry(
VerificationClassification.WARNING,
"String values %s and %s might be equivalent.",
......
package de.unikoblenz.fgbks.core.dmn.verification.verifier.impl;
import static de.unikoblenz.fgbks.base.utils.boundary.checker.BoundaryCheckType.IS_EQUAL;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.VerificationFix.SHOW_RULES;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnDecision;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnDecisionTable;
......@@ -48,6 +49,7 @@ public class IdenticalVerifier extends AbstractVerifier {
vreFactory.addElement(
VerificationResultEntryElement.create(dmnDecisionTable)
.withIdentifier(rule.getRuleId())));
vreFactory.addVerificationFix(SHOW_RULES);
vreFactory.addToEntry(VerificationClassification.WARNING, "identical");
} else {
List<VDmnInputValue> curInVals = new ArrayList<>();
......
package de.unikoblenz.fgbks.core.dmn.verification.verifier.impl;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.VerificationFix.SHOW_INPUT_ENTRIES;
import de.unikoblenz.fgbks.base.utils.boundary.impl.InvalidBoundary;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnInputValue;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VTypeRef;
......@@ -29,10 +31,12 @@ public class InputValueSyntaxVerifier extends AbstractVerifier {
// no Date, because of extra DateVerifier
if (inputValue.getDmnColumn().getTypeRef() != VTypeRef.DATE
&& inputValue.getBoundary() instanceof InvalidBoundary) {
vreFactory.addElement(VerificationResultEntryElement.create(inputValue));
vreFactory.addToEntry(
VerificationClassification.FATAL_ERROR,
"Input value is not valid: " + inputValue.getText());
vreFactory
.addElement(VerificationResultEntryElement.create(inputValue))
.addVerificationFix(SHOW_INPUT_ENTRIES)
.addToEntry(
VerificationClassification.FATAL_ERROR,
"Input value is not valid: " + inputValue.getText());
System.out.println(inputValue.getText() + " IS INVALID SYNTAX");
}
}
......
......@@ -3,6 +3,7 @@ package de.unikoblenz.fgbks.core.dmn.verification.verifier.impl;
import static de.unikoblenz.fgbks.base.utils.boundary.checker.BoundaryCheckType.IS_NOT_IN_CONTACT;
import static de.unikoblenz.fgbks.base.utils.boundary.checker.BoundaryCheckType.IS_OVERLAPPING;
import static de.unikoblenz.fgbks.base.utils.boundary.checker.BoundaryCheckType.SUBSUMES;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.VerificationFix.SHOW_RULES;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnDecision;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnDecisionTable;
......@@ -55,12 +56,12 @@ public class OverlappingVerifier extends AbstractVerifier {
// do nothing, if there was no real overlap found prev..
if (hasOverlap) {
// add to rules to result
// TODO
currentRuleIds.forEach(
rule ->
vreFactory.addElement(
VerificationResultEntryElement.create(inColumns.get(0).getDmnDecisionTable())
.withIdentifier(rule.getRuleId())));
vreFactory.addVerificationFix(SHOW_RULES);
vreFactory.addToEntry(VerificationClassification.WARNING, "overlapping");
}
} else {
......
......@@ -2,6 +2,7 @@ package de.unikoblenz.fgbks.core.dmn.verification.verifier.impl;
import static de.unikoblenz.fgbks.base.utils.boundary.bicreater.BoundaryBiCreaterType.COMBINE;
import static de.unikoblenz.fgbks.base.utils.boundary.checker.BoundaryCheckType.IS_EQUAL;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.VerificationFix.SHOW_RULES;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnDecision;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnDecisionTable;
......@@ -47,6 +48,7 @@ public class PartialReductionVerifier extends AbstractVerifier {
vreFactory.addElement(
VerificationResultEntryElement.create(inColumns.get(0).getDmnDecisionTable())
.withIdentifier(rule.getRuleId())));
vreFactory.addVerificationFix(SHOW_RULES);
vreFactory.addToEntry(VerificationClassification.WARNING, "PartialReduction");
}
} else {
......
......@@ -2,6 +2,7 @@ package de.unikoblenz.fgbks.core.dmn.verification.verifier.impl;
import static de.unikoblenz.fgbks.base.utils.boundary.checker.BoundaryCheckType.IS_EQUAL;
import static de.unikoblenz.fgbks.base.utils.boundary.checker.BoundaryCheckType.SUBSUMES;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.VerificationFix.SHOW_RULES;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnDecision;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnDecisionTable;
......@@ -57,6 +58,7 @@ public class SubsumptionVerifier extends AbstractVerifier {
vreFactory.addElement(
VerificationResultEntryElement.create(inColumns.get(0).getDmnDecisionTable())
.withIdentifier(rule.getRuleId())));
vreFactory.addVerificationFix(SHOW_RULES);
vreFactory.addToEntry(VerificationClassification.WARNING, "subsumption");
}
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment