Search in sources :

Example 6 with ValidationMessage

use of org.guvnor.common.services.shared.validation.model.ValidationMessage in project drools-wb by kiegroup.

the class EnumServiceImpl method makeValidationMessages.

private ValidationMessage makeValidationMessages(final Path path, final String message) {
    final ValidationMessage msg = new ValidationMessage();
    msg.setPath(path);
    msg.setLevel(Level.ERROR);
    msg.setText(message);
    return msg;
}
Also used : ValidationMessage(org.guvnor.common.services.shared.validation.model.ValidationMessage)

Example 7 with ValidationMessage

use of org.guvnor.common.services.shared.validation.model.ValidationMessage in project drools-wb by kiegroup.

the class DSLTextEditorServiceImpl method makeNewValidationMessage.

private ValidationMessage makeNewValidationMessage(final Exception e) {
    final ValidationMessage msg = new ValidationMessage();
    msg.setLevel(Level.ERROR);
    msg.setText("Exception " + e.getClass() + " " + e.getMessage() + " " + e.getCause());
    return msg;
}
Also used : ValidationMessage(org.guvnor.common.services.shared.validation.model.ValidationMessage)

Example 8 with ValidationMessage

use of org.guvnor.common.services.shared.validation.model.ValidationMessage in project drools-wb by kiegroup.

the class DSLTextEditorServiceImpl method makeNewValidationMessage.

private ValidationMessage makeNewValidationMessage(final DSLMappingParseException e) {
    final ValidationMessage msg = new ValidationMessage();
    msg.setLevel(Level.ERROR);
    msg.setLine(e.getLine());
    msg.setText(e.getMessage());
    return msg;
}
Also used : ValidationMessage(org.guvnor.common.services.shared.validation.model.ValidationMessage)

Example 9 with ValidationMessage

use of org.guvnor.common.services.shared.validation.model.ValidationMessage in project drools-wb by kiegroup.

the class DSLTextEditorServiceImpl method doValidation.

private List<ValidationMessage> doValidation(final String content) {
    final List<ValidationMessage> validationMessages = new ArrayList<ValidationMessage>();
    final DSLTokenizedMappingFile dslLoader = new DSLTokenizedMappingFile();
    try {
        if (!dslLoader.parseAndLoad(new StringReader(content))) {
            validationMessages.addAll(makeValidationMessages(dslLoader));
        }
        return validationMessages;
    } catch (IOException e) {
        throw ExceptionUtilities.handleException(e);
    }
}
Also used : ValidationMessage(org.guvnor.common.services.shared.validation.model.ValidationMessage) ArrayList(java.util.ArrayList) StringReader(java.io.StringReader) IOException(java.io.IOException) DSLTokenizedMappingFile(org.drools.compiler.lang.dsl.DSLTokenizedMappingFile)

Example 10 with ValidationMessage

use of org.guvnor.common.services.shared.validation.model.ValidationMessage in project drools-wb by kiegroup.

the class DSLTextEditorServiceImpl method makeValidationMessages.

private List<ValidationMessage> makeValidationMessages(final DSLTokenizedMappingFile dslLoader) {
    final List<ValidationMessage> messages = new ArrayList<ValidationMessage>();
    for (final Object o : dslLoader.getErrors()) {
        if (o instanceof DSLMappingParseException) {
            final DSLMappingParseException dslMappingParseException = (DSLMappingParseException) o;
            messages.add(makeNewValidationMessage(dslMappingParseException));
        } else if (o instanceof Exception) {
            final Exception e = (Exception) o;
            messages.add(makeNewValidationMessage(e));
        } else {
            messages.add(makeNewValidationMessage(o));
        }
    }
    return messages;
}
Also used : DSLMappingParseException(org.drools.compiler.lang.dsl.DSLMappingParseException) ValidationMessage(org.guvnor.common.services.shared.validation.model.ValidationMessage) ArrayList(java.util.ArrayList) DSLMappingParseException(org.drools.compiler.lang.dsl.DSLMappingParseException) IOException(java.io.IOException) FileAlreadyExistsException(org.uberfire.java.nio.file.FileAlreadyExistsException)

Aggregations

ValidationMessage (org.guvnor.common.services.shared.validation.model.ValidationMessage)19 Test (org.junit.Test)7 ArrayList (java.util.ArrayList)6 Path (org.uberfire.backend.vfs.Path)6 List (java.util.List)3 FileAlreadyExistsException (org.uberfire.java.nio.file.FileAlreadyExistsException)3 IOException (java.io.IOException)2 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)2 ObservablePath (org.uberfire.backend.vfs.ObservablePath)2 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)2 StringReader (java.io.StringReader)1 URISyntaxException (java.net.URISyntaxException)1 URL (java.net.URL)1 NotThreadSafe (javax.annotation.concurrent.NotThreadSafe)1 Assertions (org.assertj.core.api.Assertions)1 DSLMappingParseException (org.drools.compiler.lang.dsl.DSLMappingParseException)1 DSLTokenizedMappingFile (org.drools.compiler.lang.dsl.DSLTokenizedMappingFile)1 ConnectiveConstraint (org.drools.workbench.models.datamodel.rule.ConnectiveConstraint)1 FactPattern (org.drools.workbench.models.datamodel.rule.FactPattern)1 RuleModel (org.drools.workbench.models.datamodel.rule.RuleModel)1