# OpenECOMP JTOSCA
-\r
+
---
---
*** to be completed on rrelease ***
+# Release notes for versions
+
+1.1.0-SNAPSHOT
+
+Initial after separating into separate repo
+
+-------------------------------
+
+1.1.1-SNAPSHOT
+
+Added toString of Function (GetInput, etc.)
+
+Allowed two arguments for GetInput - name of list input and index in list
<groupId>org.openecomp.sdc.jtosca</groupId>
<artifactId>jtosca</artifactId>
- <version>1.1.0-SNAPSHOT</version>\r
+ <version>1.1.1-SNAPSHOT</version>\r
\r
<properties>\r
\r
}
else if(funcType.equals("GetAttribute")) {
return new GetAttribute(ttpl,context,funcName,funcArgs);
- }
+ }
else if(funcType.equals("GetProperty")) {
return new GetProperty(ttpl,context,funcName,funcArgs);
- }
+ }
else if(funcType.equals("GetOperationOutput")) {
return new GetOperationOutput(ttpl,context,funcName,funcArgs);
- }
+ }
else if(funcType.equals("Concat")) {
return new Concat(ttpl,context,funcName,funcArgs);
- }
+ }
else if(funcType.equals("Token")) {
return new Token(ttpl,context,funcName,funcArgs);
- }
+ }
}
}
}
return rawFunctionObj;
}
+
+ @Override
+ public String toString() {
+ return name + ":" + args.toString();
+ }
}
/*python
@Override
void validate() {
- if(args.size() != 1) {
- //PA - changed to WARNING from CRITICAL after talking to Renana, 22/05/2017
- ThreadLocalsHolder.getCollector().appendWarning(String.format(
- "ValueError: Expected one argument for function \"get_input\" but received \"%s\"",
- args.toString()));
- }
+// if(args.size() != 1) {
+// //PA - changed to WARNING from CRITICAL after talking to Renana, 22/05/2017
+// ThreadLocalsHolder.getCollector().appendWarning(String.format(
+// "ValueError: Expected one argument for function \"get_input\" but received \"%s\"",
+// args.toString()));
+// }
+ if(args.size() > 2) {
+ ThreadLocalsHolder.getCollector().appendWarning(String.format(
+ "ValueError: Expected max 2 arguments for function \"get_input\" but received \"%s\"",
+ args.size()));
+ }
boolean bFound = false;
for(Input inp: toscaTpl.getInputs()) {
if(inp.getName().equals(args.get(0))) {
}
}
if(inputDef != null) {
+ if (args.size() == 2 && args.get(1) instanceof Integer) {
+ if (inputDef.getDefault() != null && inputDef.getDefault() instanceof ArrayList) {
+ return ((ArrayList) inputDef.getDefault()).get(((Integer)args.get(1)).intValue());
+ }
+ }
return inputDef.getDefault();
}
return null;