Search in sources :

Example 36 with InformationItem

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

the class AddParameterCommandTest method testGraphCommandUndoWithParameters.

@Test
public void testGraphCommandUndoWithParameters() {
    final InformationItem otherParameter = new InformationItem();
    function.getFormalParameter().add(otherParameter);
    final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
    // Add parameter and then undo
    assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
    assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce));
    assertFormalParameters(1, otherParameter);
}
Also used : GraphCommandExecutionContext(org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext) InformationItem(org.kie.workbench.common.dmn.api.definition.model.InformationItem) RuleViolation(org.kie.workbench.common.stunner.core.rule.RuleViolation) Test(org.junit.Test)

Example 37 with InformationItem

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

the class RemoveParameterCommandTest method setup.

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

Example 38 with InformationItem

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

the class SetParametersCommandTest method testGraphCommandExecuteWithParameters.

@Test
public void testGraphCommandExecuteWithParameters() {
    final InformationItem otherParameter = new InformationItem();
    function.getFormalParameter().add(otherParameter);
    setupCommand();
    final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
    assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
    assertFormalParameters(parameter1, parameter2);
    assertEquals(function, parameter1.getParent());
    assertEquals(function, parameter2.getParent());
}
Also used : GraphCommandExecutionContext(org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext) InformationItem(org.kie.workbench.common.dmn.api.definition.model.InformationItem) RuleViolation(org.kie.workbench.common.stunner.core.rule.RuleViolation) Test(org.junit.Test)

Example 39 with InformationItem

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

the class SetParametersCommandTest method setup.

@Before
public void setup() {
    this.function = new FunctionDefinition();
    this.parameter1 = new InformationItem();
    this.parameter2 = new InformationItem();
    doReturn(ruleManager).when(handler).getRuleManager();
}
Also used : FunctionDefinition(org.kie.workbench.common.dmn.api.definition.model.FunctionDefinition) InformationItem(org.kie.workbench.common.dmn.api.definition.model.InformationItem) Before(org.junit.Before)

Example 40 with InformationItem

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

the class RelationGrid method addColumn.

void addColumn(final int index) {
    getExpression().get().ifPresent(relation -> {
        final InformationItem informationItem = new InformationItem();
        informationItem.setName(new Name());
        final CommandResult<CanvasViolation> result = sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddRelationColumnCommand(relation, informationItem, model, () -> makeRelationColumn(index, informationItem), index, uiModelMapper, () -> resize(BaseExpressionGrid.RESIZE_EXISTING), () -> resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM)));
        if (!CommandUtils.isError(result)) {
            selectHeaderCell(0, index, false, false);
            CellContextUtilities.editSelectedCell(this);
        }
    });
}
Also used : CanvasViolation(org.kie.workbench.common.stunner.core.client.command.CanvasViolation) AddRelationColumnCommand(org.kie.workbench.common.dmn.client.commands.expressions.types.relation.AddRelationColumnCommand) InformationItem(org.kie.workbench.common.dmn.api.definition.model.InformationItem) HasName(org.kie.workbench.common.dmn.api.definition.HasName) Name(org.kie.workbench.common.dmn.api.property.dmn.Name)

Aggregations

InformationItem (org.kie.workbench.common.dmn.api.definition.model.InformationItem)110 Test (org.junit.Test)61 LiteralExpression (org.kie.workbench.common.dmn.api.definition.model.LiteralExpression)24 ContextEntry (org.kie.workbench.common.dmn.api.definition.model.ContextEntry)22 GraphCommandExecutionContext (org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext)22 RuleViolation (org.kie.workbench.common.stunner.core.rule.RuleViolation)20 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)19 Binding (org.kie.workbench.common.dmn.api.definition.model.Binding)13 Context (org.kie.workbench.common.dmn.api.definition.model.Context)11 Expression (org.kie.workbench.common.dmn.api.definition.model.Expression)11 Before (org.junit.Before)10 List (org.kie.workbench.common.dmn.api.definition.model.List)10 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)10 BaseGridRow (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow)10 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)9 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)9 CanvasViolation (org.kie.workbench.common.stunner.core.client.command.CanvasViolation)9 HasName (org.kie.workbench.common.dmn.api.definition.HasName)7 Relation (org.kie.workbench.common.dmn.api.definition.model.Relation)7 JSITInformationItem (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem)7