Search in sources :

Example 56 with InformationItem

use of org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem in project kie-wb-common by kiegroup.

the class InvocationEditorDefinition method getModelClass.

@Override
public Optional<Invocation> getModelClass() {
    final Invocation invocation = new Invocation();
    invocation.setExpression(new LiteralExpression());
    final InformationItem parameter = new InformationItem();
    parameter.setName(new Name("p0"));
    final Binding binding = new Binding();
    binding.setParameter(parameter);
    invocation.getBinding().add(binding);
    return Optional.of(invocation);
}
Also used : Binding(org.kie.workbench.common.dmn.api.definition.v1_1.Binding) Invocation(org.kie.workbench.common.dmn.api.definition.v1_1.Invocation) LiteralExpression(org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) HasName(org.kie.workbench.common.dmn.api.definition.HasName)

Example 57 with InformationItem

use of org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem in project kie-wb-common by kiegroup.

the class InvocationGrid method addParameterBinding.

void addParameterBinding(final int index) {
    expression.ifPresent(invocation -> {
        final Binding binding = new Binding();
        final InformationItem parameter = new InformationItem();
        parameter.setName(new Name("p" + invocation.getBinding().size()));
        binding.setParameter(parameter);
        sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddParameterBindingCommand(invocation, binding, model, new DMNGridRow(), index, uiModelMapper, this::synchroniseView));
    });
}
Also used : Binding(org.kie.workbench.common.dmn.api.definition.v1_1.Binding) AddParameterBindingCommand(org.kie.workbench.common.dmn.client.commands.expressions.types.invocation.AddParameterBindingCommand) DMNGridRow(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) HasName(org.kie.workbench.common.dmn.api.definition.HasName)

Example 58 with InformationItem

use of org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem in project kie-wb-common by kiegroup.

the class AddContextEntryCommandTest method testGraphCommandExecuteMultipleEntriesPresent.

@Test
public void testGraphCommandExecuteMultipleEntriesPresent() {
    final ContextEntry firstEntry = new ContextEntry() {

        {
            setVariable(new InformationItem() {

                {
                    setName(new Name("old one"));
                }
            });
        }
    };
    context.getContextEntry().add(0, firstEntry);
    makeCommand();
    final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
    assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
    assertEquals(3, context.getContextEntry().size());
    assertEquals(firstEntry, context.getContextEntry().get(0));
    assertEquals(contextEntry, context.getContextEntry().get(1));
    assertEquals(defaultResultContextEntry, context.getContextEntry().get(2));
}
Also used : GraphCommandExecutionContext(org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) RuleViolation(org.kie.workbench.common.stunner.core.rule.RuleViolation) ContextEntry(org.kie.workbench.common.dmn.api.definition.v1_1.ContextEntry) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) Test(org.junit.Test)

Example 59 with InformationItem

use of org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem in project kie-wb-common by kiegroup.

the class AddContextEntryCommandTest method testGraphCommandUndoMultipleEntriesPresent.

@Test
public void testGraphCommandUndoMultipleEntriesPresent() {
    final ContextEntry firstEntry = new ContextEntry() {

        {
            setVariable(new InformationItem() {

                {
                    setName(new Name("old one"));
                }
            });
        }
    };
    context.getContextEntry().add(0, firstEntry);
    makeCommand();
    final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
    // Add column and then undo
    assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
    assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce));
    assertEquals(2, context.getContextEntry().size());
    assertEquals(firstEntry, context.getContextEntry().get(0));
    assertEquals(defaultResultContextEntry, context.getContextEntry().get(1));
}
Also used : GraphCommandExecutionContext(org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) RuleViolation(org.kie.workbench.common.stunner.core.rule.RuleViolation) ContextEntry(org.kie.workbench.common.dmn.api.definition.v1_1.ContextEntry) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) Test(org.junit.Test)

Example 60 with InformationItem

use of org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem in project kie-wb-common by kiegroup.

the class AddParameterCommandTest method setup.

@Before
public void setup() {
    this.function = new FunctionDefinition();
    this.parameter = new InformationItem();
    this.command = new AddParameterCommand(function, parameter, canvasOperation);
    doReturn(ruleManager).when(handler).getRuleManager();
}
Also used : FunctionDefinition(org.kie.workbench.common.dmn.api.definition.v1_1.FunctionDefinition) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) Before(org.junit.Before)

Aggregations

InformationItem (org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem)66 Test (org.junit.Test)33 LiteralExpression (org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression)20 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)20 GraphCommandExecutionContext (org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext)19 RuleViolation (org.kie.workbench.common.stunner.core.rule.RuleViolation)18 DMNGridRow (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow)12 Before (org.junit.Before)11 ContextEntry (org.kie.workbench.common.dmn.api.definition.v1_1.ContextEntry)11 List (org.kie.workbench.common.dmn.api.definition.v1_1.List)10 Binding (org.kie.workbench.common.dmn.api.definition.v1_1.Binding)8 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)7 Optional (java.util.Optional)6 InformationItem (org.kie.dmn.model.v1_1.InformationItem)6 HasName (org.kie.workbench.common.dmn.api.definition.HasName)6 Relation (org.kie.workbench.common.dmn.api.definition.v1_1.Relation)6 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)6 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)6 Context (org.kie.workbench.common.dmn.api.definition.v1_1.Context)5 Expression (org.kie.workbench.common.dmn.api.definition.v1_1.Expression)5