26
26
import java .util .stream .Collectors ;
27
27
28
28
import de .kosit .validationtool .api .*;
29
+ import de .kosit .validationtool .model .reportInput .ValidationResultsSchematron ;
29
30
import lombok .Getter ;
30
31
import lombok .extern .slf4j .Slf4j ;
31
32
35
36
import de .kosit .validationtool .impl .tasks .ComputeAcceptanceAction ;
36
37
import de .kosit .validationtool .impl .tasks .CreateDocumentIdentificationAction ;
37
38
import de .kosit .validationtool .impl .tasks .CreateReportAction ;
38
- import de .kosit .validationtool .impl .tasks .CreateXVRLReportAction ;
39
39
import de .kosit .validationtool .impl .tasks .DocumentParseAction ;
40
40
import de .kosit .validationtool .impl .tasks .ScenarioSelectionAction ;
41
41
import de .kosit .validationtool .impl .tasks .SchemaValidationAction ;
42
42
import de .kosit .validationtool .impl .tasks .SchematronValidationAction ;
43
- import de .kosit .validationtool .impl .tasks .ValidateReportInputAction ;
44
43
import de .kosit .validationtool .impl .xml .ProcessorProvider ;
45
- import de .kosit .validationtool .impl .xvrl .XmlErrorImpl ;
46
44
import de .kosit .validationtool .model .reportInput .CreateReportInput ;
47
45
import de .kosit .validationtool .model .reportInput .EngineType ;
48
46
import de .kosit .validationtool .model .reportInput .XMLSyntaxError ;
49
47
import de .kosit .validationtool .model .xvrl .Timestamp ;
50
48
import de .kosit .validationtool .model .xvrl .Validator ;
51
- import de .kosit .validationtool .model .xvrl .XVRLDetection ;
52
49
import de .kosit .validationtool .model .xvrl .XVRLMetadata ;
53
- import de .kosit .validationtool .model .xvrl .XVRLReport ;
54
50
55
51
import net .sf .saxon .s9api .Processor ;
56
52
import net .sf .saxon .s9api .XdmNode ;
@@ -96,9 +92,7 @@ public DefaultCheck(final Processor processor, final Configuration... configurat
96
92
this .checkSteps .add (new ScenarioSelectionAction (new ScenarioRepository (configuration )));
97
93
this .checkSteps .add (new SchemaValidationAction (processor ));
98
94
this .checkSteps .add (new SchematronValidationAction (this .conversionService ));
99
- this .checkSteps .add (new ValidateReportInputAction (this .conversionService , SchemaProvider .getReportInputSchema ()));
100
95
this .checkSteps .add (new CreateReportAction (processor , this .conversionService ));
101
- this .checkSteps .add (new CreateXVRLReportAction (processor , this .conversionService ));
102
96
this .checkSteps .add (new ComputeAcceptanceAction ());
103
97
}
104
98
@@ -133,7 +127,7 @@ protected boolean isSuccessful(final Map<String, Result> results) {
133
127
134
128
@ Override
135
129
public Result checkInput (final Input input ) {
136
- final Process checkProcess = new Process (input , createReport (), createXVRLMetadata ());
130
+ final Process checkProcess = new Process (input , createXVRLMetadata ());
137
131
return runCheckInternal (checkProcess );
138
132
}
139
133
@@ -150,45 +144,34 @@ protected Result runCheckInternal(final Process checkProcess) {
150
144
}
151
145
checkProcess .setFinished (true );
152
146
log .info ("Finished check of {} in {}ms\n " , checkProcess .getInput ().getName (), System .currentTimeMillis () - started );
153
- final Result result = createResult (checkProcess );
154
- // createXVRLResult(checkProcess);
155
- return result ;
147
+ return createResult (checkProcess );
156
148
}
157
149
158
150
private Result createResult (final Process process ) {
159
- final de .kosit .validationtool .impl .model .Result <XdmNode , XMLSyntaxError > report = process .getResult (CreateReportAction .class );
160
- de .kosit .validationtool .impl .model .Result <AcceptRecommendation , Object > acceptStatusResult = process
161
- .getResult (ComputeAcceptanceAction .class );
162
-
163
- final DefaultResult result = new DefaultResult (report .getObject (), acceptStatusResult .getObject (),
164
- new HtmlExtractor (this .processor ));
165
- result .setWellformed (process .getResult (DocumentParseAction .class ).isValid ());
166
- result .setReportInput (process .getReportInput ());
167
- final de .kosit .validationtool .impl .model .Result <Boolean , XMLSyntaxError > schemaValidationResult = process
168
- .getResult (SchemaValidationAction .class );
169
- if (schemaValidationResult != null ) {
170
- result .setSchemaViolations (convertErrors (schemaValidationResult .getErrors ()));
171
- }
172
- result .setProcessingSuccessful (!process .isStopped () && process .isFinished ());
173
- result .setSchematronResult (process .getReportInput ().getValidationResultsSchematron ().stream ().filter (e -> e .getResults () != null )
174
- .map (e -> e .getResults ().getSchematronOutput ()).collect (Collectors .toList ()));
175
- return result ;
176
- }
177
-
178
- private Result createXVRLResult (final Process process ) {
179
151
152
+ de .kosit .validationtool .impl .model .Result <XdmNode , Object > createReportResult = process .getResult (CreateReportAction .class );
180
153
de .kosit .validationtool .impl .model .Result <AcceptRecommendation , Object > acceptStatusResult = process
181
154
.getResult (ComputeAcceptanceAction .class );
182
- de .kosit .validationtool .impl .model .Result <XdmNode , Object > createReportResult = process .getResult (CreateReportAction .class );
183
155
final XVRLResult xvrlResult = new XVRLResult (createReportResult .getObject (), acceptStatusResult .getObject (),
184
156
new HtmlExtractor (this .processor ));
185
157
186
- final XVRLReport parserReport = process .getReport (DocumentParseAction .class );
187
- xvrlResult .setWellformed ("true" .equals (parserReport .getDigest ().getValid ()));
158
+ xvrlResult .setWellformed (process .getResult (DocumentParseAction .class ).isValid ());
188
159
189
160
xvrlResult .setReportSummary (process .getXvrlReportSummary ());
190
- xvrlResult .setSchemaViolations (convertErrorsFromXVRLDetections (process .getXvrlReportSummary ().getAllErrorDetections ()));
191
161
162
+ final de .kosit .validationtool .impl .model .Result <Boolean , XMLSyntaxError > schemaValidationResult = process
163
+ .getResult (SchemaValidationAction .class );
164
+ if (schemaValidationResult != null ) {
165
+ xvrlResult .setSchemaViolations (convertErrors (schemaValidationResult .getErrors ()));
166
+ }
167
+
168
+ de .kosit .validationtool .impl .model .Result <List <ValidationResultsSchematron >, Object > schematronValidationResult = process
169
+ .getResult (SchematronValidationAction .class );
170
+ if (schematronValidationResult != null ) {
171
+ xvrlResult .setSchematronResult (schematronValidationResult .getObject ().stream ()
172
+ .map (schematronResult -> schematronResult .getResults ().getSchematronOutput ())
173
+ .collect (Collectors .toList ()));
174
+ }
192
175
xvrlResult .setProcessingSuccessful (!process .isStopped () && process .isFinished ());
193
176
194
177
return xvrlResult ;
@@ -198,14 +181,4 @@ private static List<XmlError> convertErrors(final Collection<XMLSyntaxError> err
198
181
// noinspection unchecked
199
182
return (List <XmlError >) (List <?>) errors ;
200
183
}
201
-
202
- private static List <XmlError > convertErrorsFromXVRLDetections (final Collection <XVRLDetection > errors ) {
203
- final List <XmlError > xmlErrorList = new ArrayList <>();
204
- errors .forEach (xvrlDetection -> {
205
- final XmlError xmlError = new XmlErrorImpl (xvrlDetection );
206
- xmlErrorList .add (xmlError );
207
- });
208
- return xmlErrorList ;
209
- }
210
-
211
184
}
0 commit comments