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

Create api for selecting multiple verifier types for the verifications

parent 7a8f6466
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
Root path: <code>/api</code> Root path: <code>/api</code>
<h3>Verifications</h3> <h3>Verifications</h3>
<h4>Get all verifications from all verifiers with the given dmn table</h4> <h4>Get all verifications from all verifiers with the given dmn table</h4>
<ul> <ul>
<li>POST</li> <li>POST</li>
...@@ -12,39 +13,45 @@ Root path: <code>/api</code> ...@@ -12,39 +13,45 @@ Root path: <code>/api</code>
</ul> </ul>
<h3>Verification classifications</h3> <h3>Verification classifications</h3>
<h4>Get a list of all verification classifications</h4> <h4>Get a list of all verification classifications</h4>
<ul> <ul>
<li>GET</li> <li>GET</li>
<li><code><a href="/api/dmn/verification/classification" target="_blank">/api/dmn/verification/classification</a></code> <li><code><a href="/api/dmn/verification/classifications" target="_blank">/api/dmn/verification/classifications</a></code>
</li> </li>
<li>Produces: application/json</li> <li>Produces: application/json</li>
</ul> </ul>
<h4>Get all verifications for the given verification classification</h4> <h4>Get all verifications for the given verification classification</h4>
<ul> <ul>
<li>POST</li> <li>POST</li>
<li><code>/api/dmn/verification/classification/{classificationName}</code></li> <li><code>/api/dmn/verification/classifications/{classificationName}</code></li>
<li>Consumes: text/xml - the dmn table as xml string</li> <li>Consumes: text/xml - the dmn table as xml string</li>
<li>Produces: application/json</li> <li>Produces: application/json</li>
</ul> </ul>
<h3>Verification types</h3> <h3>Verification types</h3>
<h4>Get a list of all verification types</h4> <h4>Get a list of all verification types</h4>
<ul> <ul>
<li>GET</li> <li>GET</li>
<li> <li>
<code><a href="/api/dmn/verification/type" <code><a href="/api/dmn/verification/types"
target="_blank">/api/dmn/verification/type</a></code> target="_blank">/api/dmn/verification/types</a></code>
</li> </li>
<li>Produces: application/json</li> <li>Produces: application/json</li>
</ul> </ul>
<h4>Get all verifications for the given verification type</h4>
<h4>Get all verifications for the given verification types a and b</h4>
<ul> <ul>
<li>POST</li> <li>POST</li>
<li><code>/api/dmn/verification/classification/{classificationName}</code></li> <li><code>/api/dmn/verification/types?typeName={a}&typeName={b}</code></li>
<li>Consumes: text/xml - the dmn table as xml string</li> <li>Consumes: text/xml - the dmn table as xml string</li>
<li>Produces: application/json</li> <li>Produces: application/json</li>
</ul> </ul>
<h3>Metrics</h3> <h3>Metrics</h3>
<h4>Get some statistics about execution times</h4> <h4>Get some statistics about execution times</h4>
<ul> <ul>
<li>GET</li> <li>GET</li>
......
...@@ -7,6 +7,7 @@ import de.unikoblenz.fgbks.core.dmn.verification.metrics.DmnVerificationMetricsS ...@@ -7,6 +7,7 @@ import de.unikoblenz.fgbks.core.dmn.verification.metrics.DmnVerificationMetricsS
import de.unikoblenz.fgbks.core.dmn.verification.result.VerifierResultSet; import de.unikoblenz.fgbks.core.dmn.verification.result.VerifierResultSet;
import de.unikoblenz.fgbks.core.dmn.verification.verifier.classification.ClassificationType; import de.unikoblenz.fgbks.core.dmn.verification.verifier.classification.ClassificationType;
import de.unikoblenz.fgbks.core.dmn.verification.verifier.types.VerificationType; import de.unikoblenz.fgbks.core.dmn.verification.verifier.types.VerificationType;
import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import javax.ws.rs.GET; import javax.ws.rs.GET;
...@@ -14,6 +15,7 @@ import javax.ws.rs.POST; ...@@ -14,6 +15,7 @@ import javax.ws.rs.POST;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.PathParam; import javax.ws.rs.PathParam;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
...@@ -47,26 +49,27 @@ public class Verification { ...@@ -47,26 +49,27 @@ public class Verification {
* @return a list of {@link VerificationType} as a JSON String. * @return a list of {@link VerificationType} as a JSON String.
*/ */
@GET @GET
@Path("/type") @Path("/types")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public Response verifyType() { public Response verifyType() {
return Response.accepted(dmnVerificationService.getVerificationTypes()).build(); return Response.accepted(dmnVerificationService.getVerificationTypes()).build();
} }
/** /**
* Method to generate all verifications for a dmn with the given name of a {@link * Method to generate all verifications for a dmn with the given names of {@link
* VerificationType}. * VerificationType}. The types are listed in the query param "typeName". Multiple typeNames can
* be requested.
* *
* @param typeName the name of a {@link VerificationType} * @param typeNames the "typeName"(s) of a {@link VerificationType}
* @param payload the dmn as XML format as * @param payload the dmn as XML format as
* @return a JSON String, which represents a {@link VerifierResultSet} * @return a JSON String, which represents a {@link VerifierResultSet}
*/ */
@POST @POST
@Path("/type/{typeName}") @Path("/types")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.TEXT_XML) @Consumes(MediaType.TEXT_XML)
public Response verifyType(@PathParam("typeName") String typeName, String payload) { public Response verifyTypes(@QueryParam("typeName") List<String> typeNames, String payload) {
return checkResult(dmnVerificationService.generateFromType(typeName, payload)); return checkResult(dmnVerificationService.generateFromTypes(typeNames, payload));
} }
/** /**
...@@ -75,7 +78,7 @@ public class Verification { ...@@ -75,7 +78,7 @@ public class Verification {
* @return a list of {@link ClassificationType} as a JSON String. * @return a list of {@link ClassificationType} as a JSON String.
*/ */
@GET @GET
@Path("/classification") @Path("/classifications")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public Response verifyClassification() { public Response verifyClassification() {
return Response.accepted(dmnVerificationService.getVerificationClassificationTypes()).build(); return Response.accepted(dmnVerificationService.getVerificationClassificationTypes()).build();
...@@ -90,7 +93,7 @@ public class Verification { ...@@ -90,7 +93,7 @@ public class Verification {
* @return a JSON String, which represents a {@link VerifierResultSet} * @return a JSON String, which represents a {@link VerifierResultSet}
*/ */
@POST @POST
@Path("/classification/{classificationName}") @Path("/classifications/{classificationName}")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.TEXT_XML) @Consumes(MediaType.TEXT_XML)
public Response verifyClassification( public Response verifyClassification(
......
...@@ -84,12 +84,12 @@ public class DmnVerificationService { ...@@ -84,12 +84,12 @@ public class DmnVerificationService {
* Create a {@link VerifierResultSet} by executing the verifiers, which is registered in the * Create a {@link VerifierResultSet} by executing the verifiers, which is registered in the
* current deployment and has the name of the {@code type} parameter. * current deployment and has the name of the {@code type} parameter.
* *
* @param type the type as String. Should be the name of a {@link VerificationType}. * @param types the type as string list. Should be the name of a {@link VerificationType}.
* @param dmnXml the XML of the DMN as String * @param dmnXml the XML of the DMN as String
* @return a {@link VerifierResultSet} containing all verifications of the selected verifier. * @return a {@link VerifierResultSet} containing all verifications of the selected verifier.
*/ */
public VerifierResultSet generateFromType(String type, String dmnXml) { public VerifierResultSet generateFromTypes(List<String> types, String dmnXml) {
return generateWithFilter(dmnXml, type, null); return generateWithFilter(dmnXml, types, null);
} }
/** /**
...@@ -188,7 +188,7 @@ public class DmnVerificationService { ...@@ -188,7 +188,7 @@ public class DmnVerificationService {
} }
private VerifierResultSet generateWithFilter( private VerifierResultSet generateWithFilter(
String dmnXml, String typeName, String classificationName) { String dmnXml, List<String> typeNames, String classificationName) {
long verificationProcessId = UniqueIdGenerator.getNextId(); long verificationProcessId = UniqueIdGenerator.getNextId();
LOGGER.info("Start verification process. Id: " + verificationProcessId); LOGGER.info("Start verification process. Id: " + verificationProcessId);
LOGGER.info("Parsing dmn. Id: " + verificationProcessId); LOGGER.info("Parsing dmn. Id: " + verificationProcessId);
...@@ -214,7 +214,8 @@ public class DmnVerificationService { ...@@ -214,7 +214,8 @@ public class DmnVerificationService {
LOGGER.error(e.getMessage()); LOGGER.error(e.getMessage());
} }
if (av != null if (av != null
&& (typeName == null || av.getVerificationType().getName().getValue().equals(typeName)) && (typeNames == null
|| typeNames.contains(av.getVerificationType().getName().getValue()))
&& (classificationName == null && (classificationName == null
|| av.getVerificationType() || av.getVerificationType()
.getClassification() .getClassification()
......
...@@ -121,6 +121,7 @@ ...@@ -121,6 +121,7 @@
Root path: <code>/api</code> Root path: <code>/api</code>
<h3>Verifications</h3> <h3>Verifications</h3>
<h4>Get all verifications from all verifiers with the given dmn table</h4> <h4>Get all verifications from all verifiers with the given dmn table</h4>
<ul> <ul>
<li>POST</li> <li>POST</li>
...@@ -130,39 +131,45 @@ ...@@ -130,39 +131,45 @@
</ul> </ul>
<h3>Verification classifications</h3> <h3>Verification classifications</h3>
<h4>Get a list of all verification classifications</h4> <h4>Get a list of all verification classifications</h4>
<ul> <ul>
<li>GET</li> <li>GET</li>
<li><code><a href="/api/dmn/verification/classification" target="_blank">/api/dmn/verification/classification</a></code> <li><code><a href="/api/dmn/verification/classifications" target="_blank">/api/dmn/verification/classifications</a></code>
</li> </li>
<li>Produces: application/json</li> <li>Produces: application/json</li>
</ul> </ul>
<h4>Get all verifications for the given verification classification</h4> <h4>Get all verifications for the given verification classification</h4>
<ul> <ul>
<li>POST</li> <li>POST</li>
<li><code>/api/dmn/verification/classification/{classificationName}</code></li> <li><code>/api/dmn/verification/classifications/{classificationName}</code></li>
<li>Consumes: text/xml - the dmn table as xml string</li> <li>Consumes: text/xml - the dmn table as xml string</li>
<li>Produces: application/json</li> <li>Produces: application/json</li>
</ul> </ul>
<h3>Verification types</h3> <h3>Verification types</h3>
<h4>Get a list of all verification types</h4> <h4>Get a list of all verification types</h4>
<ul> <ul>
<li>GET</li> <li>GET</li>
<li> <li>
<code><a href="/api/dmn/verification/type" <code><a href="/api/dmn/verification/types"
target="_blank">/api/dmn/verification/type</a></code> target="_blank">/api/dmn/verification/types</a></code>
</li> </li>
<li>Produces: application/json</li> <li>Produces: application/json</li>
</ul> </ul>
<h4>Get all verifications for the given verification type</h4>
<h4>Get all verifications for the given verification types a and b</h4>
<ul> <ul>
<li>POST</li> <li>POST</li>
<li><code>/api/dmn/verification/classification/{classificationName}</code></li> <li><code>/api/dmn/verification/types?typeName={a}&typeName={b}</code></li>
<li>Consumes: text/xml - the dmn table as xml string</li> <li>Consumes: text/xml - the dmn table as xml string</li>
<li>Produces: application/json</li> <li>Produces: application/json</li>
</ul> </ul>
<h3>Metrics</h3> <h3>Metrics</h3>
<h4>Get some statistics about execution times</h4> <h4>Get some statistics about execution times</h4>
<ul> <ul>
<li>GET</li> <li>GET</li>
...@@ -188,16 +195,8 @@ ...@@ -188,16 +195,8 @@
</li> </li>
</ul> </ul>
</div> </div>
<div class="right-section">
<h3>Contribute</h3>
<ul>
<li><a href="https://gitlab.uni-koblenz.de/jonasblatt/ma-jonasblatt-thesis" target="_blank">
GitLab Project </a></li>
</ul>
</div>
</div> </div>
</div> </div>
</body> </body>
</html> </html>
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