use of org.kie.workbench.common.dmn.api.definition.v1_1.ItemDefinition in project kie-wb-common by kiegroup.
the class CustomInput method typedefInput.
private ItemDefinition typedefInput(String name, String type) {
ItemDefinition typeDef = bpmn2.createItemDefinition();
typeDef.setId(Ids.dataInputItem(element.getId(), name));
typeDef.setStructureRef(type);
return typeDef;
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.ItemDefinition in project kie-wb-common by kiegroup.
the class OutputAssignmentWriter method typedefOutput.
private ItemDefinition typedefOutput(VariableDeclaration decl) {
ItemDefinition typeDef = bpmn2.createItemDefinition();
typeDef.setId(Ids.dataOutputItem(parentId, decl.getIdentifier()));
typeDef.setStructureRef(decl.getType());
return typeDef;
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.ItemDefinition in project kie-wb-common by kiegroup.
the class DefinitionsConverter method dmnFromWB.
public static org.kie.dmn.model.v1_1.Definitions dmnFromWB(final Definitions wb) {
if (wb == null) {
return null;
}
org.kie.dmn.model.v1_1.Definitions result = new org.kie.dmn.model.v1_1.Definitions();
// TODO currently DMN wb UI does not offer feature to set these required DMN properties, setting some hardcoded defaults for now.
String defaultId = (wb.getId() != null) ? wb.getId().getValue() : UUID.uuid();
String defaulName = (wb.getName() != null) ? wb.getName().getValue() : UUID.uuid(8);
String defaultNamespace = (wb.getNamespace() != null) ? wb.getNamespace() : "https://github.com/kiegroup/drools/kie-dmn";
result.setId(defaultId);
result.setName(defaulName);
result.setNamespace(defaultNamespace);
result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription()));
result.getNsContext().putAll(wb.getNsContext());
for (ItemDefinition itemDef : wb.getItemDefinition()) {
org.kie.dmn.model.v1_1.ItemDefinition itemDefConvered = ItemDefinitionPropertyConverter.dmnFromWB(itemDef);
result.getItemDefinition().add(itemDefConvered);
}
// Need manually setup custom namespace URI if the diagram was created from the UI.
if (!result.getPrefixForNamespaceURI(DMNDiagram.DMNV11_DD).isPresent()) {
result.getNsContext().put("dmndi", DMNDiagram.DMNV11_DD);
}
if (!result.getPrefixForNamespaceURI(DMNDiagram.DMNV11_DC).isPresent()) {
result.getNsContext().put("dc", DMNDiagram.DMNV11_DC);
}
if (!result.getPrefixForNamespaceURI(DMNDiagram.DMNV11_DI).isPresent()) {
result.getNsContext().put("di", DMNDiagram.DMNV11_DI);
}
return result;
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.ItemDefinition in project kie-wb-common by kiegroup.
the class ItemDefinitionPropertyConverter method wbFromDMN.
public static ItemDefinition wbFromDMN(final org.kie.dmn.model.v1_1.ItemDefinition dmn) {
if (dmn == null) {
return null;
}
Id id = new Id(dmn.getId());
Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
Name name = new Name(dmn.getName());
ItemDefinition result = new ItemDefinition();
result.setId(id);
result.setName(name);
result.setDescription(description);
result.setTypeRef(typeRef);
result.setTypeLanguage(dmn.getTypeLanguage());
result.setIsCollection(dmn.isIsCollection());
UnaryTests utConverted = UnaryTestsPropertyConverter.wbFromDMN(dmn.getAllowedValues());
result.setAllowedValues(utConverted);
for (org.kie.dmn.model.v1_1.ItemDefinition child : dmn.getItemComponent()) {
ItemDefinition convertedChild = ItemDefinitionPropertyConverter.wbFromDMN(child);
result.getItemComponent().add(convertedChild);
}
return result;
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.ItemDefinition in project drools by kiegroup.
the class ItemDefinitionConverter method writeAttributes.
@Override
protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) {
super.writeAttributes(writer, parent);
ItemDefinition id = (ItemDefinition) parent;
if (id.getTypeLanguage() != null)
writer.addAttribute(TYPE_LANGUAGE, id.getTypeLanguage());
writer.addAttribute(IS_COLLECTION, Boolean.valueOf(id.isIsCollection()).toString());
}
Aggregations