Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Verification for Decision Model and Notation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Container registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Blatt
Verification for Decision Model and Notation
Commits
11ad4465
Commit
11ad4465
authored
5 years ago
by
Jonas Blatt
Browse files
Options
Downloads
Patches
Plain Diff
Add documentation for Verification Service class
parent
70e1c28d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dmnverifierapi/src/main/java/de/unikoblenz/fgbks/core/dmn/verification/DmnVerificationService.java
+79
-34
79 additions, 34 deletions
...z/fgbks/core/dmn/verification/DmnVerificationService.java
with
79 additions
and
34 deletions
dmnverifierapi/src/main/java/de/unikoblenz/fgbks/core/dmn/verification/DmnVerificationService.java
+
79
−
34
View file @
11ad4465
...
...
@@ -31,6 +31,12 @@ import org.reflections.Reflections;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* Service class for generating verifications of DMNs. This class scans for verifier, witch are
* annotated with {@link DmnVerifier}. The verifier can be executed by calling {@link
* DmnVerificationService#generate} or by filtering the {@link VerificationType} (and annotated with
* {@link Type}) or {@link ClassificationType} (and annotated with {@link Classification}).
*/
@ApplicationScoped
public
class
DmnVerificationService
{
...
...
@@ -56,6 +62,63 @@ public class DmnVerificationService {
super
();
}
/**
* Create a {@link VerifierResultSet} by executing all verifiers, which are registered in the
* current deployment.
*
* @param dmnXml the XML of the DMN as String
* @return a {@link VerifierResultSet} containing all verifications of known verifiers.
*/
public
VerifierResultSet
generate
(
String
dmnXml
)
{
return
generateWithFilter
(
dmnXml
,
null
,
null
);
}
/**
* Create a {@link VerifierResultSet} by executing the verifiers, which is registered in the
* 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 dmnXml the XML of the DMN as String
* @return a {@link VerifierResultSet} containing all verifications of the selected verifier.
*/
public
VerifierResultSet
generateFromType
(
String
type
,
String
dmnXml
)
{
return
generateWithFilter
(
dmnXml
,
type
,
null
);
}
/**
* Create a {@link VerifierResultSet} by executing the verifiers, which is registered in the
* current deployment and has the name of the {@code type} parameter.
*
* @param classification the type as String. Should be the name of a {@link ClassificationType}.
* @param dmnXml the XML of the DMN as String
* @return a {@link VerifierResultSet} containing all verifications of the selected verifier.
*/
public
VerifierResultSet
generateFromClassification
(
String
classification
,
String
dmnXml
)
{
return
generateWithFilter
(
dmnXml
,
null
,
classification
);
}
/**
* This function returns all currently registered {@link VerificationType}s as {@link
* Collections#unmodifiableList}.
*
* @return a list of {@link VerificationType}s
*/
public
List
<
VerificationType
>
getVerificationTypes
()
{
initVerifier
();
return
Collections
.
unmodifiableList
(
verificationTypes
);
}
/**
* This function returns all currently registered {@link ClassificationType}s as {@link
* Collections#unmodifiableList}.
*
* @return a list of {@link ClassificationType}s
*/
public
List
<
ClassificationType
>
getVerificationClassificationTypes
()
{
initVerifier
();
return
Collections
.
unmodifiableList
(
verificationClassificationTypes
);
}
private
void
initVerifier
()
{
if
(
executor
==
null
||
verifierClasses
==
null
)
{
LOGGER
.
info
(
"Init verification."
);
...
...
@@ -70,8 +133,12 @@ public class DmnVerificationService {
try
{
VerificationType
verificationType
=
(
VerificationType
)
clVt
.
getMethod
(
"getInstance"
).
invoke
(
null
,
null
);
LOGGER
.
info
(
"Verifier found: "
+
verificationType
.
getName
()
+
" ("
+
verificationType
.
getClassification
().
getName
()
+
")"
);
LOGGER
.
info
(
"Verifier found: "
+
verificationType
.
getName
()
+
" ("
+
verificationType
.
getClassification
().
getName
()
+
")"
);
verificationTypes
.
add
(
verificationType
);
}
catch
(
IllegalAccessException
|
NoSuchMethodException
|
InvocationTargetException
e
)
{
e
.
printStackTrace
();
...
...
@@ -91,16 +158,16 @@ public class DmnVerificationService {
}
}
p
ublic
VerifierResultSet
generate
(
String
dmnXml
)
{
return
generateWithFilter
(
dmnXml
,
null
,
null
);
}
public
VerifierResultSet
generateFromType
(
String
type
,
String
dmnXml
)
{
return
generateWithFilter
(
dmnXml
,
type
,
null
);
}
public
VerifierResultSet
generateFromClassification
(
String
classification
,
String
dmnXml
)
{
return
generateWithFilter
(
dmnXml
,
null
,
classification
)
;
p
rivate
Map
<
Class
<?
extends
AbstractDmnVerifierConfig
>,
AbstractDmnVerifierConfig
>
getConfigs
(
String
dmnXml
)
{
Map
<
Class
<?
extends
AbstractDmnVerifierConfig
>,
AbstractDmnVerifierConfig
>
map
=
new
ConcurrentHashMap
<>();
map
.
put
(
DefaultConfiguration
.
class
,
DefaultConfiguration
.
getBuilder
()
.
withDmnObjectContainer
(
dmnService
.
getDmnServiceFromXml
(
dmnXml
))
.
build
());
return
map
;
}
private
VerifierResultSet
generateWithFilter
(
...
...
@@ -148,26 +215,4 @@ public class DmnVerificationService {
return
resultBuilder
.
build
();
}
private
Map
<
Class
<?
extends
AbstractDmnVerifierConfig
>,
AbstractDmnVerifierConfig
>
getConfigs
(
String
dmnXml
)
{
Map
<
Class
<?
extends
AbstractDmnVerifierConfig
>,
AbstractDmnVerifierConfig
>
map
=
new
ConcurrentHashMap
<>();
map
.
put
(
DefaultConfiguration
.
class
,
DefaultConfiguration
.
getBuilder
()
.
withDmnObjectContainer
(
dmnService
.
getDmnServiceFromXml
(
dmnXml
))
.
build
());
return
map
;
}
public
List
<
VerificationType
>
getVerificationTypes
()
{
initVerifier
();
return
Collections
.
unmodifiableList
(
verificationTypes
);
}
public
List
<
ClassificationType
>
getVerificationClassificationTypes
()
{
initVerifier
();
return
Collections
.
unmodifiableList
(
verificationClassificationTypes
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment