use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITItemDefinition in project kie-wb-common by kiegroup.
the class ItemDefinitionPropertyConverter method setUnaryTests.
static void setUnaryTests(final ItemDefinition wb, final JSITItemDefinition dmn) {
final JSITUnaryTests dmnAllowedValues = dmn.getAllowedValues();
final Optional<UnaryTests> wbUnaryTests = ofNullable(UnaryTestsPropertyConverter.wbFromDMN(dmnAllowedValues));
wbUnaryTests.ifPresent(unaryTests -> {
wb.setAllowedValues(unaryTests);
unaryTests.setParent(wb);
});
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITItemDefinition in project kie-wb-common by kiegroup.
the class ItemDefinitionPropertyConverter method setItemComponent.
static void setItemComponent(final ItemDefinition wb, final JSITItemDefinition dmn) {
final List<JSITItemDefinition> jsiItemDefinitions = dmn.getItemComponent();
if (Objects.nonNull(jsiItemDefinitions)) {
for (int i = 0; i < jsiItemDefinitions.size(); i++) {
final JSITItemDefinition jsiItemDefinition = Js.uncheckedCast(jsiItemDefinitions.get(i));
wb.getItemComponent().add(wbChildFromDMN(wb, jsiItemDefinition));
}
}
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITItemDefinition in project kie-wb-common by kiegroup.
the class ItemDefinitionPropertyConverter method dmnFromWB.
public static JSITItemDefinition dmnFromWB(final ItemDefinition wb) {
if (Objects.isNull(wb)) {
return null;
}
final JSITItemDefinition result = new JSITItemDefinition();
result.setId(wb.getId().getValue());
final Optional<String> description = Optional.ofNullable(DescriptionPropertyConverter.dmnFromWB(wb.getDescription()));
description.ifPresent(result::setDescription);
result.setName(wb.getName().getValue());
QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef);
result.setTypeLanguage(wb.getTypeLanguage());
result.setIsCollection(wb.isIsCollection());
final JSITUnaryTests utConverted = UnaryTestsPropertyConverter.dmnFromWB(wb.getAllowedValues());
result.setAllowedValues(utConverted);
for (ItemDefinition child : wb.getItemComponent()) {
final JSITItemDefinition convertedChild = ItemDefinitionPropertyConverter.dmnFromWB(child);
result.addItemComponent(convertedChild);
}
return result;
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITItemDefinition in project kie-wb-common by kiegroup.
the class DMNUnmarshaller method getWbImportedItemDefinitions.
private List<ItemDefinition> getWbImportedItemDefinitions(final Map<JSITImport, JSITDefinitions> importDefinitions) {
final List<ItemDefinition> definitions = new ArrayList<>();
final List<JSITItemDefinition> importedDefinitions = dmnMarshallerImportsHelper.getImportedItemDefinitions(importDefinitions);
for (int i = 0; i < importedDefinitions.size(); i++) {
final JSITItemDefinition definition = Js.uncheckedCast(importedDefinitions.get(i));
final ItemDefinition converted = ItemDefinitionPropertyConverter.wbFromDMN(definition);
if (converted != null) {
converted.setAllowOnlyVisualChange(true);
definitions.add(converted);
}
}
return definitions;
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITItemDefinition in project kie-wb-common by kiegroup.
the class DMNMarshallerImportsClientHelper method getItemDefinitionsWithNamespace.
private List<JSITItemDefinition> getItemDefinitionsWithNamespace(final JSITDefinitions definitions, final JSITImport anImport) {
final List<JSITItemDefinition> itemDefinitions = definitions.getItemDefinition();
final String prefix = anImport.getName();
final List<JSITItemDefinition> result = new ArrayList<>();
for (int i = 0; i < itemDefinitions.size(); i++) {
final JSITItemDefinition itemDefinition = Js.uncheckedCast(itemDefinitions.get(i));
final JSITItemDefinition item = Js.uncheckedCast(withNamespace(itemDefinition, prefix));
result.add(item);
}
return result;
}
Aggregations