/** * Utility method to ensure any QName references contained inside the ItemDefinitions have the namespace correctly valorized, also accordingly to the prefix. * (Even in the case of {@link XMLConstants.DEFAULT_NS_PREFIX} it will take the DMN model namespace for the no-prefix accordingly.) */ public void normalize() { for (ItemDefinition itemDefinition : this.getItemDefinition()) { processQNameURIs(itemDefinition); } }
@Override public String toString() { return "Definitions{" + "name=" + getName() + ", _import=" + _import + ", itemDefinition=" + itemDefinition + ", drgElement=" + drgElement + ", decisionService=" + decisionService + ", artifact=" + artifact + ", elementCollection=" + elementCollection + ", businessContextElement=" + businessContextElement + ", expressionLanguage='" + expressionLanguage + '\'' + ", typeLanguage='" + typeLanguage + '\'' + ", namespace='" + namespace + '\'' + ", exporter='" + exporter + '\'' + ", exporterVersion='" + exporterVersion + '\'' + '}'; }
@Override public List<DecisionService> getDecisionService() { if ( decisionService == null ) { decisionService = new ArrayList<>(); // as DMN1.1 xsd is broken to allow proper persistence of DecisionService, do fetch them from extensions. if ( getExtensionElements() != null ) { List<DecisionService> collectDS = getExtensionElements().getAny().stream() .filter(DecisionServices.class::isInstance).map(DecisionServices.class::cast) .flatMap(dss -> dss.getDecisionService().stream()) .collect(Collectors.toList()); decisionService.addAll(collectDS); } } return this.decisionService; }
private static void processQNameURIs(ItemDefinition iDef) { final QName typeRef = iDef.getTypeRef(); if (typeRef != null && XMLConstants.NULL_NS_URI.equals(typeRef.getNamespaceURI())) { final String namespace = iDef.getNamespaceURI(typeRef.getPrefix()); iDef.setTypeRef(new QName(namespace, typeRef.getLocalPart(), typeRef.getPrefix())); } for (ItemDefinition comp : iDef.getItemComponent()) { processQNameURIs(comp); } }
private Definitions buildSimplifiedDefinitions(final String namespace, final String... decisions) { final Definitions def = new TDefinitions(); def.setNamespace(namespace); for (final String d : decisions) { final Decision dec = new TDecision(); dec.setName(d); def.getDrgElement().add(dec); def.addChildren(dec); dec.setParent(def); } return def; }