Search in sources :

Example 1 with UnsupportedIPatternParserMessage

use of org.drools.workbench.models.guided.dtree.shared.model.parser.messages.UnsupportedIPatternParserMessage in project drools by kiegroup.

the class GuidedDecisionTreeModelUnmarshallingVisitor method visit.

private List<Node> visit(final IPattern p, final GuidedDecisionTree model, final PackageDataModelOracle dmo, final List<ParserMessage> messages) {
    final List<Node> nodes = new ArrayList<Node>();
    if (!(p instanceof FactPattern)) {
        messages.add(new UnsupportedIPatternParserMessage());
        return nodes;
    }
    final FactPattern fp = (FactPattern) p;
    if (fp.isNegated()) {
        messages.add(new UnsupportedIPatternParserMessage());
        return nodes;
    }
    if (fp.getWindow().getOperator() != null) {
        messages.add(new UnsupportedIPatternParserMessage());
        return nodes;
    }
    final TypeNode node = new TypeNodeImpl(fp.getFactType());
    if (fp.isBound()) {
        node.setBinding(fp.getBoundName());
    }
    nodes.add(node);
    for (FieldConstraint fc : fp.getFieldConstraints()) {
        nodes.addAll(visit(fc, model, dmo, messages));
    }
    return nodes;
}
Also used : UnsupportedIPatternParserMessage(org.drools.workbench.models.guided.dtree.shared.model.parser.messages.UnsupportedIPatternParserMessage) TypeNodeImpl(org.drools.workbench.models.guided.dtree.shared.model.nodes.impl.TypeNodeImpl) ActionRetractNode(org.drools.workbench.models.guided.dtree.shared.model.nodes.ActionRetractNode) TypeNode(org.drools.workbench.models.guided.dtree.shared.model.nodes.TypeNode) Node(org.drools.workbench.models.guided.dtree.shared.model.nodes.Node) ActionUpdateNode(org.drools.workbench.models.guided.dtree.shared.model.nodes.ActionUpdateNode) ActionInsertNode(org.drools.workbench.models.guided.dtree.shared.model.nodes.ActionInsertNode) ConstraintNode(org.drools.workbench.models.guided.dtree.shared.model.nodes.ConstraintNode) ArrayList(java.util.ArrayList) FactPattern(org.drools.workbench.models.datamodel.rule.FactPattern) TypeNode(org.drools.workbench.models.guided.dtree.shared.model.nodes.TypeNode) CompositeFieldConstraint(org.drools.workbench.models.datamodel.rule.CompositeFieldConstraint) FieldConstraint(org.drools.workbench.models.datamodel.rule.FieldConstraint) SingleFieldConstraint(org.drools.workbench.models.datamodel.rule.SingleFieldConstraint) BaseSingleFieldConstraint(org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)

Example 2 with UnsupportedIPatternParserMessage

use of org.drools.workbench.models.guided.dtree.shared.model.parser.messages.UnsupportedIPatternParserMessage in project drools-wb by kiegroup.

the class ParserMessagesPopup method getMessage.

private String getMessage(final ParserMessage msg) {
    if (msg instanceof AmbiguousRootParserMessage) {
        final TypeNode tn = model.getRoot();
        final AmbiguousRootParserMessage m = (AmbiguousRootParserMessage) msg;
        return GuidedDecisionTreeConstants.INSTANCE.parserMessageAmbiguousRootParserMessage(tn.getClassName(), m.getClassName());
    } else if (msg instanceof BindingNotFoundParserMessage) {
        final BindingNotFoundParserMessage m = (BindingNotFoundParserMessage) msg;
        return GuidedDecisionTreeConstants.INSTANCE.parserMessageBindingNotFoundParserMessage(m.getBinding());
    } else if (msg instanceof DataTypeConversionErrorParserMessage) {
        final DataTypeConversionErrorParserMessage m = (DataTypeConversionErrorParserMessage) msg;
        return GuidedDecisionTreeConstants.INSTANCE.parserMessageDataTypeConversionErrorParserMessage(m.getValue(), m.getDataTypeClassName());
    } else if (msg instanceof DataTypeNotFoundParserMessage) {
        final DataTypeNotFoundParserMessage m = (DataTypeNotFoundParserMessage) msg;
        return GuidedDecisionTreeConstants.INSTANCE.parserMessageDataTypeNotFoundParserMessage(m.getClassName(), m.getFieldName());
    } else if (msg instanceof DefaultParserMessage) {
        final DefaultParserMessage m = (DefaultParserMessage) msg;
        return GuidedDecisionTreeConstants.INSTANCE.parserMessageDefaultParserMessage(m.getMessage());
    } else if (msg instanceof InvalidRootParserMessage) {
        return GuidedDecisionTreeConstants.INSTANCE.parserMessageInvalidRootParserMessage();
    } else if (msg instanceof UnsupportedFieldConstraintParserMessage) {
        return GuidedDecisionTreeConstants.INSTANCE.parserMessageUnsupportedFieldConstraintParserMessage();
    } else if (msg instanceof UnsupportedFieldConstraintTypeParserMessage) {
        return GuidedDecisionTreeConstants.INSTANCE.parserMessageUnsupportedFieldConstraintTypeParserMessage();
    } else if (msg instanceof UnsupportedFieldNatureTypeParserMessage) {
        return GuidedDecisionTreeConstants.INSTANCE.parserMessageUnsupportedFieldNatureTypeParserMessage();
    } else if (msg instanceof UnsupportedIActionParserMessage) {
        return GuidedDecisionTreeConstants.INSTANCE.parserMessageUnsupportedIActionParserMessage();
    } else if (msg instanceof UnsupportedIPatternParserMessage) {
        return GuidedDecisionTreeConstants.INSTANCE.parserMessageUnsupportedIPatternParserMessage();
    } else {
        return GuidedDecisionTreeConstants.INSTANCE.parserMessageUnknownMessage();
    }
}
Also used : UnsupportedIPatternParserMessage(org.drools.workbench.models.guided.dtree.shared.model.parser.messages.UnsupportedIPatternParserMessage) DataTypeNotFoundParserMessage(org.drools.workbench.models.guided.dtree.shared.model.parser.messages.DataTypeNotFoundParserMessage) BindingNotFoundParserMessage(org.drools.workbench.models.guided.dtree.shared.model.parser.messages.BindingNotFoundParserMessage) InvalidRootParserMessage(org.drools.workbench.models.guided.dtree.shared.model.parser.messages.InvalidRootParserMessage) UnsupportedFieldConstraintParserMessage(org.drools.workbench.models.guided.dtree.shared.model.parser.messages.UnsupportedFieldConstraintParserMessage) UnsupportedFieldNatureTypeParserMessage(org.drools.workbench.models.guided.dtree.shared.model.parser.messages.UnsupportedFieldNatureTypeParserMessage) DataTypeConversionErrorParserMessage(org.drools.workbench.models.guided.dtree.shared.model.parser.messages.DataTypeConversionErrorParserMessage) DefaultParserMessage(org.drools.workbench.models.guided.dtree.shared.model.parser.messages.DefaultParserMessage) TypeNode(org.drools.workbench.models.guided.dtree.shared.model.nodes.TypeNode) UnsupportedIActionParserMessage(org.drools.workbench.models.guided.dtree.shared.model.parser.messages.UnsupportedIActionParserMessage) AmbiguousRootParserMessage(org.drools.workbench.models.guided.dtree.shared.model.parser.messages.AmbiguousRootParserMessage) UnsupportedFieldConstraintTypeParserMessage(org.drools.workbench.models.guided.dtree.shared.model.parser.messages.UnsupportedFieldConstraintTypeParserMessage)

Aggregations

TypeNode (org.drools.workbench.models.guided.dtree.shared.model.nodes.TypeNode)2 UnsupportedIPatternParserMessage (org.drools.workbench.models.guided.dtree.shared.model.parser.messages.UnsupportedIPatternParserMessage)2 ArrayList (java.util.ArrayList)1 BaseSingleFieldConstraint (org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)1 CompositeFieldConstraint (org.drools.workbench.models.datamodel.rule.CompositeFieldConstraint)1 FactPattern (org.drools.workbench.models.datamodel.rule.FactPattern)1 FieldConstraint (org.drools.workbench.models.datamodel.rule.FieldConstraint)1 SingleFieldConstraint (org.drools.workbench.models.datamodel.rule.SingleFieldConstraint)1 ActionInsertNode (org.drools.workbench.models.guided.dtree.shared.model.nodes.ActionInsertNode)1 ActionRetractNode (org.drools.workbench.models.guided.dtree.shared.model.nodes.ActionRetractNode)1 ActionUpdateNode (org.drools.workbench.models.guided.dtree.shared.model.nodes.ActionUpdateNode)1 ConstraintNode (org.drools.workbench.models.guided.dtree.shared.model.nodes.ConstraintNode)1 Node (org.drools.workbench.models.guided.dtree.shared.model.nodes.Node)1 TypeNodeImpl (org.drools.workbench.models.guided.dtree.shared.model.nodes.impl.TypeNodeImpl)1 AmbiguousRootParserMessage (org.drools.workbench.models.guided.dtree.shared.model.parser.messages.AmbiguousRootParserMessage)1 BindingNotFoundParserMessage (org.drools.workbench.models.guided.dtree.shared.model.parser.messages.BindingNotFoundParserMessage)1 DataTypeConversionErrorParserMessage (org.drools.workbench.models.guided.dtree.shared.model.parser.messages.DataTypeConversionErrorParserMessage)1 DataTypeNotFoundParserMessage (org.drools.workbench.models.guided.dtree.shared.model.parser.messages.DataTypeNotFoundParserMessage)1 DefaultParserMessage (org.drools.workbench.models.guided.dtree.shared.model.parser.messages.DefaultParserMessage)1 InvalidRootParserMessage (org.drools.workbench.models.guided.dtree.shared.model.parser.messages.InvalidRootParserMessage)1