@Test public void testGetCustomWithItemComponentDMNTypes() { final JSITItemDefinition tPeople = mock(JSITItemDefinition.class); final String tPeopleType = "tPeopleType"; final String addressFieldName = "address"; final String countryFieldName = "country"; when(tPeople.getName()).thenReturn(tPeopleType); final JSITItemDefinition address = mock(JSITItemDefinition.class); when(address.getName()).thenReturn(addressFieldName); final List<JSITItemDefinition> tPeopleFields = Arrays.asList(address); final JSITItemDefinition country = mock(JSITItemDefinition.class); when(country.getName()).thenReturn(countryFieldName); when(country.getTypeRef()).thenReturn(BuiltInType.STRING.getName()); final List<JSITItemDefinition> tAddressFields = Arrays.asList(country); when(tPeople.getItemComponent()).thenReturn(tPeopleFields); when(address.getItemComponent()).thenReturn(tAddressFields); final List<JSITItemDefinition> definitions = Arrays.asList(tPeople); final Map<String, ClientDMNType> dmnTypesMap = abstractKogitoDMNServiceSpy.getDMNDataTypesMap(definitions, "namespace"); assertTrue(dmnTypesMap.containsKey(tPeopleType)); final ClientDMNType dmnPeopleType = dmnTypesMap.get(tPeopleType); assertEquals(1, dmnPeopleType.getFields().size()); assertTrue(dmnPeopleType.getFields().containsKey(addressFieldName)); assertNull(dmnPeopleType.getFeelType()); assertFalse(dmnPeopleType.isCollection()); assertTrue(dmnPeopleType.isComposite()); ClientDMNType addressType = dmnPeopleType.getFields().get(addressFieldName); assertNotNull(addressType); assertEquals(1, addressType.getFields().size()); assertTrue(addressType.getFields().containsKey(countryFieldName)); assertNull(addressType.getFeelType()); assertFalse(addressType.isCollection()); assertTrue(addressType.isComposite()); ClientDMNType countryType = addressType.getFields().get(countryFieldName); assertEquals(0, countryType.getFields().size()); assertEquals(BuiltInType.STRING, countryType.getFeelType()); assertFalse(countryType.isCollection()); assertFalse(countryType.isComposite()); assertTrue(dmnTypesMap.size() == 15); for (BuiltInType builtInType : BuiltInType.values()) { Arrays.stream(builtInType.getNames()).forEach(name -> assertNotNull(dmnTypesMap.get(name))); } }
protected Map<String, ClientDMNType> getDMNDataTypesMap(final List<JSITItemDefinition> jsitItemDefinitions, final String nameSpace) { Map<String, ClientDMNType> dmnDataTypesMap = new HashMap<>(); for (BuiltInType type : BuiltInType.values()) { for (String name : type.getNames()) { ClientDMNType feelPrimitiveType; if (type == BuiltInType.CONTEXT) { feelPrimitiveType = new ClientDMNType(URI_FEEL, name, null, false, true, Collections.emptyMap(), type); } else { feelPrimitiveType = new ClientDMNType(URI_FEEL, name, null, false, type); } dmnDataTypesMap.put(name, feelPrimitiveType); } } final Map<String, JSITItemDefinition> itemDefinitionMap = indexDefinitionsByName(jsitItemDefinitions); for (int i = 0; i < jsitItemDefinitions.size(); i++) { final JSITItemDefinition jsitItemDefinition = Js.uncheckedCast(jsitItemDefinitions.get(i)); getOrCreateDMNType(itemDefinitionMap, jsitItemDefinition.getName(), nameSpace, dmnDataTypesMap); } return Collections.unmodifiableMap(dmnDataTypesMap); }
AbstractKogitoDMNService implements KogitoDMNService { protected Map<String, ClientDMNType> getDMNDataTypesMap(final List<JSITItemDefinition> jsitItemDefinitions, final String nameSpace) { Map<String, ClientDMNType> dmnDataTypesMap = new HashMap<>(); for (BuiltInType type : BuiltInType.values()) { for (String name : type.getNames()) { ClientDMNType feelPrimitiveType; if (type == BuiltInType.CONTEXT) { feelPrimitiveType = new ClientDMNType(URI_FEEL, name, null, false, true, Collections.emptyMap(), type); } else { feelPrimitiveType = new ClientDMNType(URI_FEEL, name, null, false, type); } dmnDataTypesMap.put(name, feelPrimitiveType); } } final Map<String, JSITItemDefinition> itemDefinitionMap = indexDefinitionsByName(jsitItemDefinitions); for (int i = 0; i < jsitItemDefinitions.size(); i++) { final JSITItemDefinition jsitItemDefinition = Js.uncheckedCast(jsitItemDefinitions.get(i)); getOrCreateDMNType(itemDefinitionMap, jsitItemDefinition.getName(), nameSpace, dmnDataTypesMap); } return Collections.unmodifiableMap(dmnDataTypesMap); } }
AbstractKogitoDMNService implements KogitoDMNService { protected Map<String, ClientDMNType> getDMNDataTypesMap(final List<JSITItemDefinition> jsitItemDefinitions, final String nameSpace) { Map<String, ClientDMNType> dmnDataTypesMap = new HashMap<>(); for (BuiltInType type : BuiltInType.values()) { for (String name : type.getNames()) { ClientDMNType feelPrimitiveType; if (type == BuiltInType.CONTEXT) { feelPrimitiveType = new ClientDMNType(URI_FEEL, name, null, false, true, Collections.emptyMap(), type); } else { feelPrimitiveType = new ClientDMNType(URI_FEEL, name, null, false, type); } dmnDataTypesMap.put(name, feelPrimitiveType); } } final Map<String, JSITItemDefinition> itemDefinitionMap = indexDefinitionsByName(jsitItemDefinitions); for (int i = 0; i < jsitItemDefinitions.size(); i++) { final JSITItemDefinition jsitItemDefinition = Js.uncheckedCast(jsitItemDefinitions.get(i)); getOrCreateDMNType(itemDefinitionMap, jsitItemDefinition.getName(), nameSpace, dmnDataTypesMap); } return Collections.unmodifiableMap(dmnDataTypesMap); }  }
AbstractKogitoDMNService implements KogitoDMNService { protected Map<String, ClientDMNType> getDMNDataTypesMap(final List<JSITItemDefinition> jsitItemDefinitions, final String nameSpace) { Map<String, ClientDMNType> dmnDataTypesMap = new HashMap<>(); for (BuiltInType type : BuiltInType.values()) { for (String name : type.getNames()) { ClientDMNType feelPrimitiveType; if (type == BuiltInType.CONTEXT) { feelPrimitiveType = new ClientDMNType(URI_FEEL, name, null, false, true, Collections.emptyMap(), type); } else { feelPrimitiveType = new ClientDMNType(URI_FEEL, name, null, false, type); } dmnDataTypesMap.put(name, feelPrimitiveType); } } final Map<String, JSITItemDefinition> itemDefinitionMap = indexDefinitionsByName(jsitItemDefinitions); for (int i = 0; i < jsitItemDefinitions.size(); i++) { final JSITItemDefinition jsitItemDefinition = Js.uncheckedCast(jsitItemDefinitions.get(i)); getOrCreateDMNType(itemDefinitionMap, jsitItemDefinition.getName(), nameSpace, dmnDataTypesMap); } return Collections.unmodifiableMap(dmnDataTypesMap); }  @Override FactModelTuple getFactModelTuple(final JSITDefinitions jsitDefinitions); boolean isJSITInputData(JSITDRGElement jsitdrgElement); boolean isJSITDecision(JSITDRGElement jsitdrgElement); Map<QName, String> getOtherAttributesMap(JSITDMNElement jsitInputDataVariable); }
AbstractKogitoDMNService implements KogitoDMNService { protected Map<String, ClientDMNType> getDMNDataTypesMap(final List<JSITItemDefinition> jsitItemDefinitions, final String nameSpace) { Map<String, ClientDMNType> dmnDataTypesMap = new HashMap<>(); for (BuiltInType type : BuiltInType.values()) { for (String name : type.getNames()) { ClientDMNType feelPrimitiveType; if (type == BuiltInType.CONTEXT) { feelPrimitiveType = new ClientDMNType(URI_FEEL, name, null, false, true, Collections.emptyMap(), type); } else { feelPrimitiveType = new ClientDMNType(URI_FEEL, name, null, false, type); } dmnDataTypesMap.put(name, feelPrimitiveType); } } final Map<String, JSITItemDefinition> itemDefinitionMap = indexDefinitionsByName(jsitItemDefinitions); for (int i = 0; i < jsitItemDefinitions.size(); i++) { final JSITItemDefinition jsitItemDefinition = Js.uncheckedCast(jsitItemDefinitions.get(i)); getOrCreateDMNType(itemDefinitionMap, jsitItemDefinition.getName(), nameSpace, dmnDataTypesMap); } return Collections.unmodifiableMap(dmnDataTypesMap); }  @Override FactModelTuple getFactModelTuple(final JSITDefinitions jsitDefinitions); boolean isJSITInputData(JSITDRGElement jsitdrgElement); boolean isJSITDecision(JSITDRGElement jsitdrgElement); Map<QName, String> getOtherAttributesMap(JSITDMNElement jsitInputDataVariable); static final String URI_FEEL; static final String WRONG_DMN_MESSAGE; }