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

Refactoring

parent ff2d81b9
No related branches found
No related tags found
No related merge requests found
Showing
with 78 additions and 53 deletions
......@@ -2,6 +2,7 @@ package de.unikoblenz.fgbks.core.dmn.utils;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnColumn;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnDefinition;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnOutputColumn;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VTypeRef;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.parser.SimpleVDmnParser;
import java.nio.charset.Charset;
......@@ -56,4 +57,10 @@ public class DmnService {
.collect(Collectors.toList()));
return columns;
}
public static List<VDmnOutputColumn> getOutputColumns(VDmnDefinition dmnDefinition) {
return Validate.notNull(dmnDefinition).getDmnDecisions().stream()
.flatMap(v -> v.getDmnDecisionTable().getOutputColumns().stream())
.collect(Collectors.toList());
}
}
......@@ -39,6 +39,10 @@ public class VerificationService {
@Inject private DmnService dmnService;
protected VerificationService() {
initVerifier();
}
private void initVerifier() {
Config config = ConfigProvider.getConfig();
int maxThreads =
config.getOptionalValue(CONF_VERIFIER_THREADS, Integer.class).orElse(DEFAULT_MAX_THREADS);
......
package de.unikoblenz.fgbks.core.dmn.verification.verifier;
import static de.unikoblenz.fgbks.core.dmn.verification.result.VerificationResultEntry.VerificationClassification.ERROR;
import de.unikoblenz.fgbks.core.dmn.domain.ids.InputEntryId;
import de.unikoblenz.fgbks.core.dmn.domain.ids.OutputEntryId;
import de.unikoblenz.fgbks.core.dmn.domain.ids.RuleId;
import de.unikoblenz.fgbks.core.dmn.verification.result.VerificationResultEntryElement;
public class SampleVerifier1 extends AbstractVerifier {
@Override
protected void doVerification() {
vref.addElement(
VerificationResultEntryElement.create()
.withIdentifier(new InputEntryId("asdasda"))
.withIdentifier(new OutputEntryId("test"))
.withIdentifier(new RuleId("asdasd")));
vref.addElement(
VerificationResultEntryElement.create()
.withIdentifier(new InputEntryId("asdasda"))
.withIdentifier(new OutputEntryId("test"))
.withIdentifier(new RuleId("asdasd")));
vref.addToEntry(ERROR, "My sample message");
vref.addElement(
VerificationResultEntryElement.create()
.withIdentifier(new InputEntryId("asdasda"))
.withIdentifier(new OutputEntryId("test"))
.withIdentifier(new RuleId("asdasd")));
vref.addElement(
VerificationResultEntryElement.create()
.withIdentifier(new InputEntryId("asdasda"))
.withIdentifier(new OutputEntryId("test"))
.withIdentifier(new RuleId("asdasd")));
vref.addElement(
VerificationResultEntryElement.create()
.withIdentifier(new InputEntryId("asdasda"))
.withIdentifier(new OutputEntryId("test"))
.withIdentifier(new RuleId("asdasd")));
vref.addToEntry(ERROR, "My sample message");
}
}
......@@ -25,9 +25,9 @@ public class DateVerifier extends AbstractVerifier {
@Override
protected void doVerification() {
List<VDmnColumn> dateColums =
List<VDmnColumn> dateColumns =
DmnService.getColumnsByTypeRef(dmnObjectContainer.getvDmnDefinition(), VTypeRef.DATE);
for (VDmnColumn dateColumn : dateColums) {
for (VDmnColumn dateColumn : dateColumns) {
checkDateColumn(dateColumn);
}
}
......
package de.unikoblenz.fgbks.core.dmn.verification.verifier.impl;
public class EmptyOutputVerifer {}
package de.unikoblenz.fgbks.core.dmn.verification.verifier.impl;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnOutputColumn;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnOutputValue;
import de.unikoblenz.fgbks.core.dmn.utils.DmnService;
import de.unikoblenz.fgbks.core.dmn.verification.result.VerificationResultEntry.VerificationClassification;
import de.unikoblenz.fgbks.core.dmn.verification.result.VerificationResultEntryElement;
import de.unikoblenz.fgbks.core.dmn.verification.verifier.AbstractVerifier;
import de.unikoblenz.fgbks.core.dmn.verification.verifier.DmnVerifier;
import de.unikoblenz.fgbks.core.dmn.verification.verifier.config.DefaultConfiguration;
import de.unikoblenz.fgbks.core.dmn.verification.verifier.types.EmptyOutputVerification;
@DmnVerifier(
verifierType = EmptyOutputVerification.class,
verifierConfig = DefaultConfiguration.class)
public class EmptyOutputVerifier extends AbstractVerifier {
@Override
protected void doVerification() {
for (VDmnOutputColumn outputColumn :
DmnService.getOutputColumns(dmnObjectContainer.getvDmnDefinition())) {
checkOutputColumn(outputColumn);
}
}
private void checkOutputColumn(VDmnOutputColumn outputColumn) {
for (VDmnOutputValue outputValue : outputColumn.getDmnOutputValues()) {
checkEmptyOutputValue(outputValue);
}
}
private void checkEmptyOutputValue(VDmnOutputValue outputValue) {
if (outputValue.getText().isEmpty()) {
vref.addElement(VerificationResultEntryElement.create(outputValue));
vref.addToEntry(VerificationClassification.WARNING, "Output value is empty.'");
}
}
}
package de.unikoblenz.fgbks.core.dmn.verification.verifier.types;
import de.unikoblenz.fgbks.base.domain.Description;
import de.unikoblenz.fgbks.base.domain.Name;
import javax.validation.constraints.NotNull;
public class EmptyOutputVerification extends AbstractVerificationType {
@Override
public @NotNull VerificationTypeClassification getClassification() {
return VerificationTypeClassification.SYNTAX_LEVEL_VERIFICATION;
}
@Override
public @NotNull Name getName() {
return new Name("Empty output check");
}
@Override
public @NotNull Description getDescription() {
return new Description("Test");
}
}
# Configuration file
%dev.hello=hello my
hello=hello world
# Quarkus cors settings
quarkus.http.cors=true
quarkus.http.cors.origins=http://localhost:8081
quarkus.http.cors.headers=accept, authorization, content-type, x-requested-with
quarkus.http.cors.methods=GET, OPTIONS
quarkus.http.cors.methods=GET, POST, OPTIONS
# Amount of threads for calculating the verifications
verifier.threads=8
%dev.verifier.threads=4
# No parallel execution in dev mode
%dev.verifier.threads=1
# Scan dir for verifier
verifier.package=de.unikoblenz.fgbks.core.dmn.verification.verifier
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment