use of org.kie.workbench.common.dmn.api.property.dmn.Name in project kie-wb-common by kiegroup.
the class FunctionGrid method addParameter.
@Override
public void addParameter(final Command onSuccess) {
expression.ifPresent(e -> {
final InformationItem parameter = new InformationItem();
parameter.setName(new Name("p" + e.getFormalParameter().size()));
sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddParameterCommand(e, parameter, () -> {
gridLayer.batch();
onSuccess.execute();
}));
});
}
use of org.kie.workbench.common.dmn.api.property.dmn.Name in project kie-wb-common by kiegroup.
the class JavaFunctionEditorDefinition method getModelClass.
@Override
public Optional<Context> getModelClass() {
final Context context = new Context();
final ContextEntry classEntry = new ContextEntry();
final InformationItem classEntryVariable = new InformationItem();
classEntryVariable.setName(new Name(VARIABLE_CLASS));
classEntry.setVariable(classEntryVariable);
classEntry.setExpression(new LiteralExpression());
context.getContextEntry().add(classEntry);
final ContextEntry methodSignatureEntry = new ContextEntry();
final InformationItem methodSignatureEntryVariable = new InformationItem();
methodSignatureEntryVariable.setName(new Name(VARIABLE_METHOD_SIGNATURE));
methodSignatureEntry.setVariable(methodSignatureEntryVariable);
methodSignatureEntry.setExpression(new LiteralExpression());
context.getContextEntry().add(methodSignatureEntry);
return Optional.of(context);
}
use of org.kie.workbench.common.dmn.api.property.dmn.Name 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);
}
use of org.kie.workbench.common.dmn.api.property.dmn.Name 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));
});
}
use of org.kie.workbench.common.dmn.api.property.dmn.Name 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));
}
Aggregations