use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITImport in project kie-wb-common by kiegroup.
the class ImportConverter method dmnFromWb.
static JSITImport dmnFromWb(final Import wb) {
final JSITImport result = new JSITImport();
result.setImportType(wb.getImportType());
result.setLocationURI(wb.getLocationURI().getValue());
result.setNamespace(wb.getNamespace());
final Map<javax.xml.namespace.QName, String> otherAttributes = new HashMap<>();
for (Map.Entry<QName, String> entry : wb.getAdditionalAttributes().entrySet()) {
QNamePropertyConverter.dmnFromWB(entry.getKey()).ifPresent(qName -> otherAttributes.put(qName, entry.getValue()));
}
wb.getNsContext().forEach((k, v) -> {
// See https://github.com/highsource/jsonix/issues/227
if (!Objects.equals(k, DMNModelInstrumentedBase.Namespace.DEFAULT.getPrefix())) {
otherAttributes.put(new javax.xml.namespace.QName(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, k, XMLConstants.DEFAULT_NS_PREFIX), v);
}
});
otherAttributes.remove(new javax.xml.namespace.QName(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, DMNModelInstrumentedBase.Namespace.DEFAULT.getPrefix(), XMLConstants.DEFAULT_NS_PREFIX));
result.setId(wb.getId().getValue());
result.setName(wb.getName().getValue());
final Optional<String> description = Optional.ofNullable(DescriptionPropertyConverter.dmnFromWB(wb.getDescription()));
description.ifPresent(result::setDescription);
result.setOtherAttributes(otherAttributes);
return result;
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITImport in project kie-wb-common by kiegroup.
the class DMNMarshallerImportsClientHelper method getImportedDRGElements.
@Override
public List<JSITDRGElement> getImportedDRGElements(final Map<JSITImport, JSITDefinitions> importDefinitions) {
final List<JSITDRGElement> importedNodes = new ArrayList<>();
for (final Map.Entry<JSITImport, JSITDefinitions> entry : importDefinitions.entrySet()) {
final JSITImport anImport = Js.uncheckedCast(entry.getKey());
final JSITDefinitions definitions = Js.uncheckedCast(entry.getValue());
importedNodes.addAll(getDrgElementsWithNamespace(definitions, anImport));
}
return importedNodes;
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITImport 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;
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITImport in project kie-wb-common by kiegroup.
the class DMNMarshallerImportsClientHelper method getImportedItemDefinitions.
@Override
public List<JSITItemDefinition> getImportedItemDefinitions(final Map<JSITImport, JSITDefinitions> importDefinitions) {
final List<JSITItemDefinition> itemDefinitions = new ArrayList<>();
for (final Map.Entry<JSITImport, JSITDefinitions> entry : importDefinitions.entrySet()) {
final JSITImport anImport = Js.uncheckedCast(entry.getKey());
final JSITDefinitions definitions = Js.uncheckedCast(entry.getValue());
final List<JSITItemDefinition> items = getItemDefinitionsWithNamespace(definitions, anImport);
itemDefinitions.addAll(items);
}
return itemDefinitions;
}
Aggregations