- private static void processDictionaryElements(String dictionaryReference, JsonObject childObject,
- DictionaryService dictionaryService) {
- String[] dictionaryKeyArray =
- dictionaryReference.substring(dictionaryReference.indexOf(ToscaSchemaConstants.DICTIONARY) + 11,
- dictionaryReference.length()).split("#");
- if (dictionaryKeyArray.length > 1) {
- // We support only one # as of now.
- List<DictionaryElement> dictionaryElements = null;
- if (dictionaryKeyArray.length == 2) {
- dictionaryElements = new ArrayList<>(dictionaryService.getDictionary(dictionaryKeyArray[0])
- .getDictionaryElements());
- JsonArray subDictionaryNames = new JsonArray();
- new ArrayList<DictionaryElement>(dictionaryService.getDictionary(dictionaryKeyArray[1])
- .getDictionaryElements()).forEach(elem -> subDictionaryNames.add(elem.getShortName()));
-
- JsonArray jsonArray = new JsonArray();
-
- Optional.of(dictionaryElements).get().stream().forEach(c -> {
- JsonObject jsonObject = new JsonObject();
- jsonObject.addProperty(JsonEditorSchemaConstants.TYPE, getJsonType(c.getType()));
- if (c.getType() != null
- && c.getType().equalsIgnoreCase(ToscaSchemaConstants.TYPE_STRING)) {
- jsonObject.addProperty(JsonEditorSchemaConstants.MIN_LENGTH, 1);
+ /**
+ * For dictionary with multiple levels (defined by #).
+ *
+ * @param dictionaryKeyArray the array containing the different elements
+ * @param childObject the structure getting the new entries
+ * @param dictionaryService the dictionary service bean
+ */
+ private static void processComplexDictionaryElements(String[] dictionaryKeyArray, JsonObject childObject,
+ DictionaryService dictionaryService) {
+ // We support only one # as of now.
+ List<DictionaryElement> dictionaryElements = null;
+ if (dictionaryKeyArray.length == 2) {
+ dictionaryElements = new ArrayList<>(dictionaryService.getDictionary(dictionaryKeyArray[0])
+ .getDictionaryElements());
+ JsonArray subDictionaryNames = new JsonArray();
+ new ArrayList<DictionaryElement>(dictionaryService.getDictionary(dictionaryKeyArray[1])
+ .getDictionaryElements()).forEach(elem -> subDictionaryNames.add(elem.getShortName()));
+
+ JsonArray jsonArray = new JsonArray();
+
+ Optional.of(dictionaryElements).get().forEach(c -> {
+ JsonObject jsonObject = new JsonObject();
+ jsonObject.addProperty(JsonEditorSchemaConstants.TYPE, getJsonType(c.getType()));
+ if (c.getType() != null
+ && c.getType().equalsIgnoreCase(ToscaSchemaConstants.TYPE_STRING)) {
+ jsonObject.addProperty(JsonEditorSchemaConstants.MIN_LENGTH, 1);