use of org.kie.workbench.common.dmn.api.definition.model.InformationItem in project kie-wb-common by kiegroup.
the class ContextEditorDefinition method enrich.
@Override
public void enrich(final Optional<String> nodeUUID, final HasExpression hasExpression, final Optional<Context> expression) {
expression.ifPresent(context -> {
final ContextEntry contextEntry = new ContextEntry();
final InformationItem informationItem = new InformationItem();
informationItem.getName().setValue(ContextEntryDefaultValueUtilities.getNewContextEntryName(context));
contextEntry.setVariable(informationItem);
context.getContextEntry().add(contextEntry);
// Add (default) "result" entry
final ContextEntry resultEntry = new ContextEntry();
context.getContextEntry().add(resultEntry);
// Setup parent relationships
contextEntry.setParent(context);
informationItem.setParent(contextEntry);
resultEntry.setParent(context);
});
}
use of org.kie.workbench.common.dmn.api.definition.model.InformationItem in project kie-wb-common by kiegroup.
the class ContextGrid method addContextEntry.
void addContextEntry(final int index) {
getExpression().get().ifPresent(c -> {
final ContextEntry ce = new ContextEntry();
final InformationItem informationItem = new InformationItem();
informationItem.setName(new Name());
ce.setVariable(informationItem);
final CommandResult<CanvasViolation> result = sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddContextEntryCommand(c, ce, model, new ExpressionEditorGridRow(), index, uiModelMapper, () -> resize(BaseExpressionGrid.RESIZE_EXISTING)));
if (!CommandUtils.isError(result)) {
selectCell(index, ContextUIModelMapperHelper.NAME_COLUMN_INDEX, false, false);
startEditingCell(index, ContextUIModelMapperHelper.NAME_COLUMN_INDEX);
}
});
}
use of org.kie.workbench.common.dmn.api.definition.model.InformationItem in project kie-wb-common by kiegroup.
the class BindingPropertyConverter method wbFromDMN.
public static Binding wbFromDMN(final org.kie.dmn.model.api.Binding dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) {
if (dmn == null) {
return null;
}
final InformationItem convertedParameter = InformationItemPropertyConverter.wbFromDMN(dmn.getParameter());
final Expression convertedExpression = ExpressionPropertyConverter.wbFromDMN(dmn.getExpression(), hasComponentWidthsConsumer);
final Binding result = new Binding();
if (convertedParameter != null) {
convertedParameter.setParent(result);
}
result.setParameter(convertedParameter);
if (convertedExpression != null) {
convertedExpression.setParent(result);
}
result.setExpression(convertedExpression);
return result;
}
use of org.kie.workbench.common.dmn.api.definition.model.InformationItem in project kie-wb-common by kiegroup.
the class RelationPropertyConverter method wbFromDMN.
public static Relation wbFromDMN(final org.kie.dmn.model.api.Relation dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) {
final Id id = new Id(dmn.getId());
final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef(), dmn);
final List<org.kie.dmn.model.api.InformationItem> column = dmn.getColumn();
final List<org.kie.dmn.model.api.List> row = dmn.getRow();
final List<InformationItem> convertedColumn = column.stream().map(InformationItemPropertyConverter::wbFromDMN).collect(Collectors.toList());
final List<org.kie.workbench.common.dmn.api.definition.model.List> convertedRow = row.stream().map(r -> ListPropertyConverter.wbFromDMN(r, hasComponentWidthsConsumer)).collect(Collectors.toList());
final Relation result = new Relation(id, description, typeRef, convertedColumn, convertedRow);
for (InformationItem c : convertedColumn) {
if (c != null) {
c.setParent(result);
}
}
for (org.kie.workbench.common.dmn.api.definition.model.List r : convertedRow) {
if (r != null) {
r.setParent(result);
}
}
return result;
}
use of org.kie.workbench.common.dmn.api.definition.model.InformationItem in project kie-wb-common by kiegroup.
the class InformationItemPropertyConverter method wbFromDMN.
public static InformationItem wbFromDMN(final org.kie.dmn.model.api.InformationItem dmn) {
if (dmn == null) {
return null;
}
final Id id = new Id(dmn.getId());
final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
final Name name = new Name(dmn.getName());
final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef(), dmn);
final InformationItem result = new InformationItem(id, description, name, typeRef);
return result;
}
Aggregations