Skip to content

Commit

Permalink
kie-issue#1740: adjusted as suggest by pr review
Browse files Browse the repository at this point in the history
  • Loading branch information
porcelli committed Jan 8, 2025
1 parent ae0a0a7 commit 1dc5093
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,12 @@ private ObjectCreationExpr makeDecisionModelMetadata(DMNResource resource) {
}

private String extractModelVersion(DMNResource resource) {
Set<String> definitions = new HashSet<>(resource.getDmnModel().getDefinitions().getNsContext().values());
definitions.retainAll(Arrays.asList(org.kie.dmn.model.v1_1.KieDMNModelInstrumentedBase.URI_DMN,
org.kie.dmn.model.v1_2.KieDMNModelInstrumentedBase.URI_DMN,
org.kie.dmn.model.v1_3.KieDMNModelInstrumentedBase.URI_DMN,
org.kie.dmn.model.v1_4.KieDMNModelInstrumentedBase.URI_DMN,
org.kie.dmn.model.v1_5.KieDMNModelInstrumentedBase.URI_DMN));

if (definitions.size() != 1) {
String toReturn = resource.getDmnModel().getDefinitions().getTypeLanguage();
if (toReturn == null || toReturn.isEmpty()) {
LOGGER.error("Could not extract DMN version from DMN model {}", resource.getDmnModel().getName());
throw new IllegalStateException("The DMN model does not contain a unique model version in the metadata.");
}
return definitions.iterator().next();
return toReturn;
}

}

0 comments on commit 1dc5093

Please sign in to comment.