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

Merge branch 'develop' into 'master'

Develop

See merge request jonasblatt/ma-jonasblatt-dmn-verifier!12
parents 8f60489a ca34e6ae
No related branches found
Tags v0.9.1
No related merge requests found
Showing
with 350 additions and 89 deletions
---
# Build JAVA applications using Apache Maven (http://maven.apache.org)
stages:
- build
- test
- deploy
variables:
MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
# Backend
MAVEN_CLI_OPTS_1: "-f dmnverifierapi/pom.xml --batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
# Frontend
MAVEN_CLI_OPTS_2: "-f dmnverifierfrontend/pom.xml --batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
# Cache downloaded dependencies and plugins between builds.
# To keep cache across branches add 'key: "$CI_JOB_NAME"'
cache:
paths:
- .m2/repository
# Remove trash after builds
default:
after_script:
- sudo rm -rf *
.validate: &validate
stage: build
script:
- 'sudo mvn $MAVEN_CLI_OPTS_1 test-compile'
- 'sudo mvn $MAVEN_CLI_OPTS_2 test-compile'
# For merge requests do not `install` but only run `verify`.
# See https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
.verify: &verify
stage: test
script:
- 'sudo mvn $MAVEN_CLI_OPTS_1 verify'
- 'sudo mvn $MAVEN_CLI_OPTS_2 verify'
except:
- master
# Validate merge requests using JDK8
validate:jdk8:
<<: *validate
image: maven:3.6.0-jdk-8
# Verify merge requests using JDK8
verify:jdk8:
<<: *verify
image: maven:3.6.0-jdk-8
deploy:
image: busybox:latest
stage: deploy
script:
- sudo systemctl stop dmn-verifier-backend
- sudo systemctl stop dmn-verifier-frontend
- 'sudo mvn $MAVEN_CLI_OPTS_1 clean install -DskipTests'
- sudo cp dmnverifierapi/target/*-runner.jar /opt/dmn/dmn-backend-runner.jar
- 'sudo mvn $MAVEN_CLI_OPTS_2 clean install -DskipTests'
- sudo cp dmnverifierfrontend/target/*-runner.jar /opt/dmn/dmn-frontend-runner.jar
- sudo systemctl start dmn-verifier-backend
- sudo systemctl start dmn-verifier-frontend
only:
- master
\ No newline at end of file
......@@ -7,6 +7,11 @@ This project contains all source files of the implementation, created for the ma
- [Frontend Project](../dmnverifierfrontend)
## Backend
[Api Documentation](docApi.md)
Based on
- [Quarkus](https://quarkus.io/)
- [Camunda DMN](https://github.com/camunda/camunda-dmn-model/)
## Verifier
- [Overview verifier](verifier.md)
# Documentation API
Root path: <code>/api</code>
<h3>Verifications</h3>
<h4>Get all verifications from all verifiers with the given dmn table</h4>
<ul>
<li>POST</li>
<li><code>/api/dmn/verification/</code></li>
<li>Consumes: text/xml - the dmn table as xml string</li>
<li>Produces: application/json</li>
</ul>
<h3>Verification classifications</h3>
<h4>Get a list of all verification classifications</h4>
<ul>
<li>GET</li>
<li><code><a href="/api/dmn/verification/classification" target="_blank">/api/dmn/verification/classification</a></code>
</li>
<li>Produces: application/json</li>
</ul>
<h4>Get all verifications for the given verification classification</h4>
<ul>
<li>POST</li>
<li><code>/api/dmn/verification/classification/{classificationName}</code></li>
<li>Consumes: text/xml - the dmn table as xml string</li>
<li>Produces: application/json</li>
</ul>
<h3>Verification types</h3>
<h4>Get a list of all verification types</h4>
<ul>
<li>GET</li>
<li>
<code><a href="/api/dmn/verification/type"
target="_blank">/api/dmn/verification/type</a></code>
</li>
<li>Produces: application/json</li>
</ul>
<h4>Get all verifications for the given verification type</h4>
<ul>
<li>POST</li>
<li><code>/api/dmn/verification/classification/{classificationName}</code></li>
<li>Consumes: text/xml - the dmn table as xml string</li>
<li>Produces: application/json</li>
</ul>
<h3>Metrics</h3>
<h4>Get some statistics about execution times</h4>
<ul>
<li>GET</li>
<li>
<code><a href="/api/dmn/verification/metrics"
target="_blank">/api/dmn/verification/metrics</a></code>
</li>
<li>Produces: application/json</li>
</ul>
......@@ -5,7 +5,7 @@
<parent>
<artifactId>dmn-verifier-parent</artifactId>
<groupId>de.unikoblenz.fgbks</groupId>
<version>1.0-SNAPSHOT</version>
<version>0.9.1</version>
<relativePath>../dmnverifierparent/pom.xml</relativePath>
</parent>
......
package de.unikoblenz.fgbks.api;
import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
import de.unikoblenz.fgbks.core.dmn.verification.DmnVerificationService;
import de.unikoblenz.fgbks.core.dmn.verification.metrics.DmnVerificationMetricsService;
import de.unikoblenz.fgbks.core.dmn.verification.result.VerifierResultSet;
......@@ -36,7 +38,7 @@ public class Verification {
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.TEXT_XML)
public Response verifyAll(String payload) {
return Response.accepted(dmnVerificationService.generate(payload)).build();
return checkResult(dmnVerificationService.generate(payload));
}
/**
......@@ -64,7 +66,7 @@ public class Verification {
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.TEXT_XML)
public Response verifyType(@PathParam("typeName") String typeName, String payload) {
return Response.accepted(dmnVerificationService.generateFromType(typeName, payload)).build();
return checkResult(dmnVerificationService.generateFromType(typeName, payload));
}
/**
......@@ -93,9 +95,8 @@ public class Verification {
@Consumes(MediaType.TEXT_XML)
public Response verifyClassification(
@PathParam("classificationName") String classificationName, String payload) {
return Response.accepted(
dmnVerificationService.generateFromClassification(classificationName, payload))
.build();
return checkResult(
dmnVerificationService.generateFromClassification(classificationName, payload));
}
/**
......@@ -109,4 +110,15 @@ public class Verification {
public Response metrics() {
return Response.accepted(dmnVerificationMetricsService.getMetrics()).build();
}
private Response checkResult(VerifierResultSet resultSet) {
if (resultSet.getAmountOfVerifier() == 0) {
return Response.status(
BAD_REQUEST.getStatusCode(),
"The dmn syntax is not correct. The dmn can not be parsed.")
.build();
} else {
return Response.accepted(resultSet).build();
}
}
}
......@@ -15,7 +15,8 @@ public class PrivateVisibilityStrategy implements PropertyVisibilityStrategy {
@Override
public boolean isVisible(Field field) {
return !field.isAnnotationPresent(JsonbTransient.class);
return !field.isAnnotationPresent(JsonbTransient.class)
&& Modifier.isPublic(field.getModifiers());
}
@Override
......
......@@ -31,4 +31,22 @@ public interface VDmnNode extends VDmnElement {
* @return an optional {@link Name}
*/
Optional<Name> getName();
/**
* Check, if the node is a {@link VDmnDecision} node.
*
* @return true, if the node is a {@link VDmnDecision}
*/
default boolean isDecision() {
return this instanceof VDmnDecision;
}
/**
* Check, if the node is a {@link VDmnInputData} node.
*
* @return true, if the node is a {@link VDmnInputData}
*/
default boolean isInputData() {
return this instanceof VDmnInputData;
}
}
......@@ -99,7 +99,7 @@ public class SimpleVDmnParser implements DmnModelInstanceWrapper {
VDmnDecisionImpl.Builder decisionBuilder = VDmnDecisionImpl.getBuilder().withDecisionId(id);
decisionBuilderMap.put(id, decisionBuilder);
// Add name, if present
if (decision.getName() != null) {
if (decision.getName() != null && !decision.getName().isEmpty()) {
decisionBuilder.withName(decision.getName());
}
// Add DmnDecisionBuilder to definitionBuilder
......@@ -132,11 +132,12 @@ public class SimpleVDmnParser implements DmnModelInstanceWrapper {
.withInputExpressionId(new InputExpressionId(inputCol.getInputExpression().getId()))
.withTypeRef(type);
// name
if (inputCol.getInputExpression().getText() != null) {
if (inputCol.getInputExpression().getText() != null
&& !inputCol.getInputExpression().getText().getTextContent().isEmpty()) {
builder.withName(inputCol.getInputExpression().getText().getTextContent());
}
// label
if (inputCol.getLabel() != null) {
if (inputCol.getLabel() != null && !inputCol.getLabel().isEmpty()) {
builder.withLabel(inputCol.getLabel());
}
// Add Builder to builder list
......@@ -162,11 +163,11 @@ public class SimpleVDmnParser implements DmnModelInstanceWrapper {
.withOutputId(new OutputId(outputCol.getId()))
.withTypeRef(VTypeRef.getTypeRefFromName(outputCol.getTypeRef()));
// name
if (outputCol.getName() != null) {
if (outputCol.getName() != null && !outputCol.getName().isEmpty()) {
builder.withName(outputCol.getName());
}
// label
if (outputCol.getLabel() != null) {
if (outputCol.getLabel() != null && !outputCol.getLabel().isEmpty()) {
builder.withLabel(outputCol.getLabel());
}
// Add Builder to builder list
......
......@@ -161,11 +161,11 @@ public class VDmnFunctions {
return true;
}
for (int i = 0; i < oneRule.getDmnOutputValues().size(); i++) {
if (oneRule
if (!oneRule
.getDmnOutputValues()
.get(i)
.getText()
.equals(otherRule.getDmnOutputValues().get(0).getText())) {
.equals(otherRule.getDmnOutputValues().get(i).getText())) {
return true;
}
}
......
......@@ -4,6 +4,7 @@ import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnDefinition;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.parser.SimpleVDmnParser;
import java.nio.charset.Charset;
import java.util.List;
import java.util.Optional;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import org.apache.commons.io.IOUtils;
......@@ -14,8 +15,8 @@ import org.camunda.bpm.model.dmn.impl.DmnParser;
/**
* Application scoped service, which creates a {@link DmnObjectContainer} with the method {@link
* DmnService#getDmnServiceFromXml(String)}. This container contained the different model types of a
* dmn table.
* DmnService#getDmnObjectContainerFromXml(String)}. This container contained the different model
* types of a dmn table.
*/
@ApplicationScoped
public class DmnService {
......@@ -23,20 +24,25 @@ public class DmnService {
@Inject SimpleVDmnParser simpleDmnParser;
/**
* Get the {@link DmnObjectContainer} with the given xml string of a dmn table.
* Get an optional of {@link DmnObjectContainer} from the given xml string of a dmn table. The
* optional is empty, if the dmn xml can not be parsed.
*
* @param dmnXmlString the xml of a dmn table
* @return a new {@link DmnObjectContainer}
* @return a optional of a new {@link DmnObjectContainer}
*/
public DmnObjectContainer getDmnServiceFromXml(String dmnXmlString) {
List<DmnDecision> dmnDecisions =
DmnEngineConfiguration.createDefaultDmnEngineConfiguration()
.buildEngine()
.parseDecisions(IOUtils.toInputStream(dmnXmlString, Charset.defaultCharset()));
DmnModelInstance dmnModel =
new DmnParser()
.parseModelFromStream(IOUtils.toInputStream(dmnXmlString, Charset.defaultCharset()));
VDmnDefinition vDmnDefinition = simpleDmnParser.getVDmnDefinition(dmnModel);
return new DmnObjectContainer(dmnDecisions, dmnModel, vDmnDefinition);
public Optional<DmnObjectContainer> getDmnObjectContainerFromXml(String dmnXmlString) {
try {
List<DmnDecision> dmnDecisions =
DmnEngineConfiguration.createDefaultDmnEngineConfiguration()
.buildEngine()
.parseDecisions(IOUtils.toInputStream(dmnXmlString, Charset.defaultCharset()));
DmnModelInstance dmnModel =
new DmnParser()
.parseModelFromStream(IOUtils.toInputStream(dmnXmlString, Charset.defaultCharset()));
VDmnDefinition vDmnDefinition = simpleDmnParser.getVDmnDefinition(dmnModel);
return Optional.of(new DmnObjectContainer(dmnDecisions, dmnModel, vDmnDefinition));
} catch (Exception e) {
return Optional.empty();
}
}
}
package de.unikoblenz.fgbks.core.dmn.verification;
import de.unikoblenz.fgbks.base.utils.UniqueIdGenerator;
import de.unikoblenz.fgbks.core.dmn.utils.DmnObjectContainer;
import de.unikoblenz.fgbks.core.dmn.utils.DmnService;
import de.unikoblenz.fgbks.core.dmn.verification.metrics.DmnVerificationMetricsService;
import de.unikoblenz.fgbks.core.dmn.verification.result.VerifierResult;
......@@ -20,6 +21,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
......@@ -170,13 +172,19 @@ public class DmnVerificationService {
String dmnXml, long verificationProcessId) {
Map<Class<? extends AbstractDmnVerifierConfig>, AbstractDmnVerifierConfig> map =
new ConcurrentHashMap<>();
map.put(
DefaultConfiguration.class,
DefaultConfiguration.getBuilder()
.withVerificationProcessId(verificationProcessId)
.withDmnObjectContainer(dmnService.getDmnServiceFromXml(dmnXml))
.build());
return map;
Optional<DmnObjectContainer> dmnObjectContainerFromXml =
dmnService.getDmnObjectContainerFromXml(dmnXml);
if (!dmnObjectContainerFromXml.isPresent()) {
throw new IllegalArgumentException("Dmn table can not be parsed.");
} else {
map.put(
DefaultConfiguration.class,
DefaultConfiguration.getBuilder()
.withVerificationProcessId(verificationProcessId)
.withDmnObjectContainer(dmnObjectContainerFromXml.get())
.build());
return map;
}
}
private VerifierResultSet generateWithFilter(
......@@ -186,9 +194,14 @@ public class DmnVerificationService {
LOGGER.info("Parsing dmn. Id: " + verificationProcessId);
Validate.notNull(dmnXml);
LOGGER.debug(dmnXml);
Map<Class<? extends AbstractDmnVerifierConfig>, AbstractDmnVerifierConfig> configs =
getConfigs(dmnXml, verificationProcessId);
Builder resultBuilder = VerifierResultSet.getBuilder();
Map<Class<? extends AbstractDmnVerifierConfig>, AbstractDmnVerifierConfig> configs;
try {
configs = getConfigs(dmnXml, verificationProcessId);
} catch (IllegalArgumentException e) {
LOGGER.warn("Parsing dmn failed. Id: " + verificationProcessId);
return resultBuilder.build();
}
LOGGER.info("Looking for verifiers. Id: " + verificationProcessId);
List<Future<VerifierResult>> results = new ArrayList<>(verifierClasses.size());
......
......@@ -55,14 +55,22 @@ public class Metric implements Serializable {
/ NANO_SECONDS_PER_SECOND;
}
/**
* Get the total execution time in ns.
*/
/** Get the total execution time in ns. */
@JsonProperty("totalExecutionTime")
public long getTotalExecutionTime() {
return executionTimes.stream().mapToLong(Long::longValue).sum();
}
/**
* Get the {@link VerificationType}.
*
* @return the {@link VerificationType}
*/
@JsonProperty("type")
public VerificationType getType() {
return type;
}
/**
* Get the total execution time in ms.
*
......
......@@ -21,26 +21,14 @@ import org.apache.commons.lang3.Validate;
*/
public class VerificationResultEntry extends AbstractResultObject {
/**
* Enum to classify one {@link VerificationResultEntry}.
*/
public enum VerificationClassification {
/**
* Only information.
*/
INFO,
/**
* Warning. No action needed.
*/
WARNING,
/**
* Error. Action needed.
*/
ERROR,
/**
* Fatal error. Must be fixed, so that the dmn is executable.
*/
FATAL_ERROR
private List<VerificationFix> verificationFixes;
private Set<VerificationResultEntryElement> verificationResultEntryElements;
private Message message;
private VerificationClassification verificationClassification;
protected VerificationResultEntry() {
this.verificationResultEntryElements = ConcurrentHashMap.newKeySet();
verificationFixes = new ArrayList<>();
}
/**
......@@ -53,16 +41,6 @@ public class VerificationResultEntry extends AbstractResultObject {
return Collections.unmodifiableList(verificationFixes);
}
private List<VerificationFix> verificationFixes;
private Set<VerificationResultEntryElement> verificationResultEntryElements;
private Message message;
private VerificationClassification verificationClassification;
protected VerificationResultEntry() {
this.verificationResultEntryElements = ConcurrentHashMap.newKeySet();
verificationFixes = new ArrayList<>();
}
/**
* Get the amount of verification result entry elements.
*
......@@ -73,6 +51,16 @@ public class VerificationResultEntry extends AbstractResultObject {
return verificationResultEntryElements.size();
}
/**
* Get the {@link VerificationClassification}.
*
* @return the {@link VerificationClassification}
*/
@JsonbProperty("verificationClassification")
public VerificationClassification getVerificationClassification() {
return verificationClassification;
}
/**
* Get the set of {@link VerificationResultEntryElement}s.
*
......@@ -84,13 +72,17 @@ public class VerificationResultEntry extends AbstractResultObject {
}
/**
* Get the {@link VerificationClassification}.
*
* @return the {@link VerificationClassification}
* Enum to classify one {@link VerificationResultEntry}.
*/
@JsonbProperty("verificationClassification")
public VerificationClassification getVerificationClassification() {
return verificationClassification;
public enum VerificationClassification {
/** Only information. */
INFO,
/** Warning. No action needed. */
WARNING,
/** Error. Action needed. */
ERROR,
/** Fatal error. Must be fixed, so that the dmn is executable. */
FATAL_ERROR
}
/**
......
......@@ -3,7 +3,10 @@ package de.unikoblenz.fgbks.core.dmn.verification.result;
import de.unikoblenz.fgbks.core.dmn.domain.ids.AbstractId;
import de.unikoblenz.fgbks.core.dmn.domain.ids.JsonIdentifier;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnColumn;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnDecision;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnDecisionTable;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnInputData;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnNode;
import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnValue;
import java.util.HashMap;
import java.util.Map;
......@@ -82,6 +85,34 @@ public class VerificationResultEntryElement extends AbstractResultObject {
.withIdentifier(column.getColumnId());
}
/**
* Create a new {@link VerificationResultEntryElement} with the initial identifier from a {@link
* VDmnInputData}. Call {@link VerificationResultEntryElement#withIdentifier(AbstractId)} to add
* further identifier.
*
* @param inputData the {@link VDmnInputData}
* @return the new {@link VerificationResultEntryElement}
*/
public static VerificationResultEntryElement create(VDmnInputData inputData) {
return new VerificationResultEntryElement()
.withIdentifier(inputData.getDmnDefinition().getDefinitionId())
.withIdentifier(inputData.getInputDataId());
}
/**
* Create a new {@link VerificationResultEntryElement} with the initial identifier from a {@link
* VDmnNode}. Call {@link VerificationResultEntryElement#withIdentifier(AbstractId)} to add
* further identifier.
*
* @param vDmnNode the {@link VDmnInputData} or {@link VDmnDecision} node
* @return the new {@link VerificationResultEntryElement}
*/
public static VerificationResultEntryElement create(VDmnNode vDmnNode) {
return new VerificationResultEntryElement()
.withIdentifier(vDmnNode.getDmnDefinition().getDefinitionId())
.withIdentifier(vDmnNode.getId());
}
/**
* Get all required ids ({@link AbstractId}) of the {@link VerificationResultEntryElement}.
*
......
package de.unikoblenz.fgbks.core.dmn.verification.result.actions;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.ActionScope.DECISION;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.ActionScope.INPUT_COLUMN;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.ActionScope.INPUT_DATA;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.ActionScope.INPUT_ENTRY;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.ActionScope.OUTPUT_COLUMN;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.ActionScope.OUTPUT_ENTRY;
......@@ -15,6 +17,8 @@ import org.apache.commons.lang3.Validate;
public class Action extends AbstractResultObject {
public static Action ACTION_SHOW_INPUT_DATA;
public static Action ACTION_SHOW_DECISION;
public static Action ACTION_SHOW_RULES;
public static Action ACTION_SHOW_INPUT_ENTRIES;
public static Action ACTION_SHOW_OUTPUT_ENTRIES;
......@@ -22,6 +26,8 @@ public class Action extends AbstractResultObject {
public static Action ACTION_SHOW_OUTPUT_COLUMNS;
static {
ACTION_SHOW_INPUT_DATA = getBuilder().withActionType(SHOW).withActionScope(INPUT_DATA).build();
ACTION_SHOW_DECISION = getBuilder().withActionType(SHOW).withActionScope(DECISION).build();
ACTION_SHOW_RULES = getBuilder().withActionType(SHOW).withActionScope(RULE).build();
ACTION_SHOW_INPUT_ENTRIES =
getBuilder().withActionType(SHOW).withActionScope(INPUT_ENTRY).build();
......
......@@ -4,7 +4,9 @@ public enum ActionScope {
RULE,
INPUT_ENTRY,
OUTPUT_ENTRY,
INPUT_NODE,
INPUT_DATA,
INPUT_COLUMN,
OUTPUT_COLUMN
OUTPUT_COLUMN,
DECISION_TABLE,
DECISION
}
package de.unikoblenz.fgbks.core.dmn.verification.result.actions;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.Action.ACTION_SHOW_DECISION;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.Action.ACTION_SHOW_INPUT_COLUMNS;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.Action.ACTION_SHOW_INPUT_DATA;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.Action.ACTION_SHOW_INPUT_ENTRIES;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.Action.ACTION_SHOW_OUTPUT_COLUMNS;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.Action.ACTION_SHOW_OUTPUT_ENTRIES;
import static de.unikoblenz.fgbks.core.dmn.verification.result.actions.Action.ACTION_SHOW_RULES;
import com.fasterxml.jackson.annotation.JsonProperty;
import de.unikoblenz.fgbks.base.builder.DefaultBuilder;
import de.unikoblenz.fgbks.base.domain.Name;
import java.util.ArrayList;
......@@ -14,9 +17,11 @@ import org.apache.commons.lang3.Validate;
public class VerificationFix {
private static final Name DEFAULT_FIX_NAME = new Name("Fix");
private static final Name DEFAULT_SHOW_NAME = new Name("Show");
public static final Name DEFAULT_FIX_NAME = new Name("Fix");
public static final Name DEFAULT_SHOW_NAME = new Name("Show");
public static VerificationFix SHOW_INPUT_DATA;
public static VerificationFix SHOW_DECISION;
public static VerificationFix SHOW_RULES;
public static VerificationFix SHOW_INPUT_ENTRIES;
public static VerificationFix SHOW_OUTPUT_ENTRIES;
......@@ -24,6 +29,16 @@ public class VerificationFix {
public static VerificationFix SHOW_OUTPUT_COLUMNS;
static {
SHOW_INPUT_DATA =
VerificationFix.getBuilder()
.withFixName(DEFAULT_SHOW_NAME)
.addAction(ACTION_SHOW_INPUT_DATA)
.build();
SHOW_DECISION =
VerificationFix.getBuilder()
.withFixName(DEFAULT_SHOW_NAME)
.addAction(ACTION_SHOW_DECISION)
.build();
SHOW_RULES =
VerificationFix.getBuilder()
.withFixName(DEFAULT_SHOW_NAME)
......@@ -54,16 +69,26 @@ public class VerificationFix {
private Name fixName;
private List<Action> actions;
@JsonProperty("fixName")
public Name getFixName() {
return fixName;
}
@JsonProperty("actions")
public List<Action> getActions() {
return actions;
}
private VerificationFix() {
fixName = DEFAULT_FIX_NAME;
actions = new ArrayList<>();
}
private static Builder getBuilder() {
public static Builder getBuilder() {
return new VerificationFix().new Builder();
}
private class Builder extends DefaultBuilder<VerificationFix> {
public class Builder extends DefaultBuilder<VerificationFix> {
public Builder withFixName(Name fixName) {
value.fixName = fixName;
......
......@@ -27,14 +27,16 @@ public abstract class AbstractVerifier implements Verifier {
protected VerificationType verificationType;
protected AbstractDmnVerifierConfig verifierConfig;
protected VerifierResult.Builder resultBuilder;
/**
* The {@link VerificationResultEntryFactory} for adding result entries.
*/
protected VerificationResultEntryFactory vreFactory;
protected DmnObjectContainer dmnObjectContainer;
private long executionTime = -1;
/**
* {@inheritDoc}
*/
/** {@inheritDoc} */
@Override
public VerificationType getVerificationType() {
return verificationType;
......@@ -94,14 +96,16 @@ public abstract class AbstractVerifier implements Verifier {
+ " finished. Id: "
+ this.verifierConfig.getVerificationProcessId()
+ " Time Elapsed: "
+ +executionTime
+ " nano seconds");
+ executionTime
+ " nano seconds; Or "
+ executionTime / 1000000
+ " ms");
return resultBuilder.withExecutionTime(executionTime).build();
}
/**
* This method must be implemented by the finial verifiers and should contain the calculation of
* the verifier.
* the verifier. The {@link AbstractVerifier#vreFactory} can be used for adding result entries.
*/
protected abstract void doVerification();
......
......@@ -6,18 +6,29 @@ import de.unikoblenz.fgbks.base.domain.Name;
public abstract class AbstractClassificationType implements ClassificationType {
protected Name name;
protected Name niceName;
protected Description description;
protected AbstractClassificationType(Name name, Description description) {
protected AbstractClassificationType(Name name, Name niceName, Description description) {
this.name = name;
this.niceName = niceName;
this.description = description;
}
protected AbstractClassificationType(Name name, Description description) {
this(name, new Name(name), description);
}
@Override
public Name getName() {
return name;
}
@Override
public Name getNiceName() {
return niceName;
}
@Override
public Description getDescription() {
return description;
......
......@@ -12,6 +12,10 @@ public interface ClassificationType extends Serializable {
@JsonbProperty("name")
Name getName();
@NotNull
@JsonbProperty("niceName")
Name getNiceName();
@NotNull
@JsonbProperty("description")
Description getDescription();
......
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