package org.onap.sdc.toscaparser.api;
+import com.google.common.base.Charsets;
import org.onap.sdc.toscaparser.api.common.JToscaValidationIssue;
import org.onap.sdc.toscaparser.api.utils.ThreadLocalsHolder;
import org.onap.sdc.toscaparser.api.utils.UrlUtils;
al[0] = al[1] = null;
return al;
}
- try (InputStream input = new FileInputStream(new File(importTemplate));) {
+ try (BufferedReader br = new BufferedReader(new FileReader(importTemplate));) {
al[0] = importTemplate;
Yaml yaml = new Yaml();
- al[1] = yaml.load(input);
+ al[1] = yaml.load(br);
return al;
}
catch(FileNotFoundException e) {
public boolean getResolveGetInput() {
return resolveGetInput;
}
+ public LinkedHashMap<String, Object> getCustomDefs() {
+ return customDefs;
+ }
}
/*python
private int nestingLoopCounter;
private LinkedHashMap<String, LinkedHashMap<String, Object>> metaProperties;
private Set<String> processedImports;
+ private LinkedHashMap<String,Object> customDefsFinal = new LinkedHashMap<>();
public ToscaTemplate(String _path,
LinkedHashMap<String,Object> _parsedParams,
* @param alImports all imports which needs to be processed
* @return the linked hash map containing all import definitions
*/
+
@SuppressWarnings("unchecked")
private LinkedHashMap<String,Object> _getAllCustomDefs(Object alImports) {
+
String types[] = {
IMPORTS, NODE_TYPES, CAPABILITY_TYPES, RELATIONSHIP_TYPES,
DATA_TYPES, INTERFACE_TYPES, POLICY_TYPES, GROUP_TYPES
};
- LinkedHashMap<String,Object> customDefsFinal = new LinkedHashMap<>();
List<Map<String, Object>> imports = (List<Map<String, Object>>) alImports;
if (imports != null && !imports.isEmpty()) {
String type = (String)ttinpinp.get("type");
Object value = DataEntity.validateDatatype(
- type, toscaTpl.getParsedParams().get(getInputName()),null,null,null);
+ type, toscaTpl.getParsedParams().get(getInputName()),null,toscaTpl.getCustomDefs(),null);
//SDC resolving Get Input
if (value instanceof ArrayList){
if(args.size() == 2 && args.get(1) instanceof Integer && ((ArrayList) value).size()> (Integer)args.get(1)){
String type = getType();
// if it's one of the basic types DON'T look in customDefs
if(Arrays.asList(PRIMITIVE_TYPES).contains(type)) {
- DataEntity.validateDatatype(getType(), value, null, (LinkedHashMap<String,Object>)datatype, null);
+ DataEntity.validateDatatype(getType(), value, null, customDefs, null);
return;
}
else if(customDefs.get(getType()) != null) {
return;
}
- DataEntity.validateDatatype(getType(), value, null, (LinkedHashMap<String,Object>)datatype, null);
+ DataEntity.validateDatatype(getType(), value, null, customDefs, null);
}
public Map<String, Annotation> getAnnotations() {