use of org.kie.dmn.core.util.DefaultDMNMessagesManager in project drools by kiegroup.
the class DMNValidatorImpl method validate.
@Override
public List<DMNMessage> validate(Reader reader, Validation... options) {
DMNMessageManager results = new DefaultDMNMessagesManager();
EnumSet<Validation> flags = EnumSet.copyOf(Arrays.asList(options));
try {
String content = readContent(reader);
if (flags.contains(VALIDATE_SCHEMA)) {
results.addAll(validateSchema(new StringReader(content)));
}
if (flags.contains(VALIDATE_MODEL) || flags.contains(VALIDATE_COMPILATION)) {
Definitions dmndefs = DMNMarshallerFactory.newDefaultMarshaller().unmarshal(new StringReader(content));
Definitions.normalize(dmndefs);
validateModelCompilation(dmndefs, results, flags);
}
} catch (Throwable t) {
MsgUtil.reportMessage(LOG, DMNMessage.Severity.ERROR, null, results, t, null, Msg.FAILED_VALIDATOR);
}
return results.getMessages();
}
use of org.kie.dmn.core.util.DefaultDMNMessagesManager in project drools by kiegroup.
the class DMNValidatorImpl method validate.
@Override
public List<DMNMessage> validate(Definitions dmnModel, Validation... options) {
DMNMessageManager results = new DefaultDMNMessagesManager();
EnumSet<Validation> flags = EnumSet.copyOf(Arrays.asList(options));
if (flags.contains(VALIDATE_SCHEMA)) {
MsgUtil.reportMessage(LOG, DMNMessage.Severity.ERROR, dmnModel, results, null, null, Msg.FAILED_NO_XML_SOURCE);
}
try {
validateModelCompilation(dmnModel, results, flags);
} catch (Throwable t) {
MsgUtil.reportMessage(LOG, DMNMessage.Severity.ERROR, dmnModel, results, t, null, Msg.FAILED_VALIDATOR);
}
return results.getMessages();
}
use of org.kie.dmn.core.util.DefaultDMNMessagesManager in project drools by kiegroup.
the class DMNValidatorImpl method validate.
@Override
public List<DMNMessage> validate(File xmlFile, Validation... options) {
DMNMessageManager results = new DefaultDMNMessagesManager();
EnumSet<Validation> flags = EnumSet.copyOf(Arrays.asList(options));
if (flags.contains(VALIDATE_SCHEMA)) {
results.addAll(validateSchema(xmlFile));
}
if (flags.contains(VALIDATE_MODEL) || flags.contains(VALIDATE_COMPILATION)) {
Definitions dmndefs = null;
try {
dmndefs = DMNMarshallerFactory.newDefaultMarshaller().unmarshal(new FileReader(xmlFile));
Definitions.normalize(dmndefs);
validateModelCompilation(dmndefs, results, flags);
} catch (Throwable t) {
MsgUtil.reportMessage(LOG, DMNMessage.Severity.ERROR, null, results, t, null, Msg.FAILED_VALIDATOR);
}
}
return results.getMessages();
}
Aggregations