- @SuppressWarnings("unchecked")
- public LinkedHashMap<String, Object> getAllAsMaps() {
- Yaml yaml = new Yaml();
- Object contentFile = yaml.load(source);
- LinkedHashMap<String, LinkedHashMap<String, Object>> file =
- (LinkedHashMap<String, LinkedHashMap<String, Object>>) contentFile;
- // Get DataTypes
- LinkedHashMap<String, Object> dataTypes = file.get("data_types");
- dataTypes = (dataTypes == null) ? (new LinkedHashMap<>()) : dataTypes;
- // Get Policies : first, get topology and after extract policies from it
- LinkedHashMap<String, Object> policyTypes = file.get("policy_types");
- // Put the policies and datatypes in the same collection
- dataTypes.putAll(policyTypes);
-
- Object contentNativeFile = yaml.load(nativeComponent);
- LinkedHashMap<String, Object> dataTypesEmbedded =
- ((LinkedHashMap<String, LinkedHashMap<String, Object>>) contentNativeFile).get("data_types");
- dataTypes.putAll(dataTypesEmbedded);
-
- parseInComponent(dataTypes);
- return dataTypes;
+ private static LinkedHashMap<String, ToscaElement> searchAllToscaElements(String toscaYaml,
+ String nativeToscaYaml) {
+ LinkedHashMap<String, Object> allItemsFound = searchAllDataTypesAndPolicyTypes(toscaYaml);
+ allItemsFound.putAll(searchAllNativeToscaDataTypes(nativeToscaYaml));
+ return parseAllItemsFound(allItemsFound);