use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem in project kie-wb-common by kiegroup.
the class RelationPropertyConverter method dmnFromWB.
public static JSITRelation dmnFromWB(final Relation wb, final Consumer<JSITComponentWidths> componentWidthsConsumer) {
final JSITRelation result = new JSITRelation();
result.setId(wb.getId().getValue());
final Optional<String> description = Optional.ofNullable(DescriptionPropertyConverter.dmnFromWB(wb.getDescription()));
description.ifPresent(result::setDescription);
QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef);
for (InformationItem iitem : wb.getColumn()) {
final JSITInformationItem iitemConverted = InformationItemPropertyConverter.dmnFromWB(iitem);
result.addColumn(iitemConverted);
}
for (org.kie.workbench.common.dmn.api.definition.model.List list : wb.getRow()) {
final JSITList listConverted = ListPropertyConverter.dmnFromWB(list, componentWidthsConsumer);
result.addRow(listConverted);
}
return result;
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem in project kie-wb-common by kiegroup.
the class RelationPropertyConverter method wbFromDMN.
public static Relation wbFromDMN(final JSITRelation dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) {
final Id id = IdPropertyConverter.wbFromDMN(dmn.getId());
final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
final List<InformationItem> convertedColumns = new ArrayList<>();
final List<JSITInformationItem> jsiColumns = dmn.getColumn();
for (int i = 0; i < jsiColumns.size(); i++) {
final JSITInformationItem jsiColumn = Js.uncheckedCast(jsiColumns.get(i));
convertedColumns.add(InformationItemPropertyConverter.wbFromDMN(jsiColumn));
}
final List<org.kie.workbench.common.dmn.api.definition.model.List> convertedRows = new ArrayList<>();
final List<JSITList> jsiRows = dmn.getRow();
for (int i = 0; i < jsiRows.size(); i++) {
final JSITList jsiRow = Js.uncheckedCast(jsiRows.get(i));
convertedRows.add(ListPropertyConverter.wbFromDMN(jsiRow, hasComponentWidthsConsumer));
}
final Relation result = new Relation(id, description, typeRef, convertedColumns, convertedRows);
for (InformationItem column : convertedColumns) {
if (Objects.nonNull(column)) {
column.setParent(result);
}
}
for (org.kie.workbench.common.dmn.api.definition.model.List row : convertedRows) {
if (Objects.nonNull(row)) {
row.setParent(result);
}
}
return result;
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem in project kie-wb-common by kiegroup.
the class BindingPropertyConverter method dmnFromWB.
public static JSITBinding dmnFromWB(final Binding wb, final Consumer<JSITComponentWidths> componentWidthsConsumer) {
if (Objects.isNull(wb)) {
return null;
}
final JSITBinding result = new JSITBinding();
final JSITInformationItem convertedParameter = InformationItemPropertyConverter.dmnFromWB(wb.getParameter());
final JSITExpression convertedExpression = ExpressionPropertyConverter.dmnFromWB(wb.getExpression(), componentWidthsConsumer);
result.setParameter(convertedParameter);
result.setExpression(convertedExpression);
return result;
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem in project kie-wb-common by kiegroup.
the class InformationItemPrimaryPropertyConverter method dmnFromWB.
public static JSITInformationItem dmnFromWB(final InformationItemPrimary wb, final DMNModelInstrumentedBase parent) {
if (Objects.isNull(wb)) {
return null;
}
final JSITInformationItem result = new JSITInformationItem();
result.setId(wb.getId().getValue());
result.setName(getParentName(parent));
final QName typeRef = wb.getTypeRef();
QNamePropertyConverter.setDMNfromWB(typeRef, result::setTypeRef);
return result;
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem in project kie-wb-common by kiegroup.
the class DMNMarshallerImportsClientHelper method setInformationItem.
private void setInformationItem(final JSITDRGElement drgElement, final JSITInformationItem informationItem) {
if (JSITDecision.instanceOf(drgElement)) {
final JSITDecision decision = Js.uncheckedCast(drgElement);
decision.setVariable(informationItem);
} else if (JSITInputData.instanceOf(drgElement)) {
final JSITInputData inputData = Js.uncheckedCast(drgElement);
inputData.setVariable(informationItem);
} else if (JSITInvocable.instanceOf(drgElement)) {
final JSITInvocable invocable = Js.uncheckedCast(drgElement);
invocable.setVariable(informationItem);
}
}
Aggregations