private String sourceName;
private ToscaGetFunctionType functionType;
private List<String> propertyPathFromSource = new ArrayList<>();
- private Object toscaIndex;
+ private List<Object> toscaIndexList;
public ToscaGetFunctionDataDefinition() {
//necessary for JSON conversions
);
}
if (propertySource == PropertySource.SELF) {
- if (toscaIndex != null) {
- Object toscaIndexValue = StringUtils.isNumeric(toscaIndex.toString()) ? Integer.parseInt(toscaIndex.toString()) : toscaIndex;
+ if (toscaIndexList.size() > 0) {
+ List<Object> parsedIndexList = new ArrayList<Object>();
+ toscaIndexList.forEach((obj) -> {
+ parsedIndexList.add(StringUtils.isNumeric(obj.toString()) ? Integer.parseInt(obj.toString()) : obj);
+ });
return Map.of(functionType.getFunctionName(),
- Stream.concat(Stream.of(PropertySource.SELF.getName()), Stream.concat(propertyPathFromSource.stream(),Stream.of(toscaIndexValue))).collect(Collectors.toList())
+ Stream.concat(Stream.of(PropertySource.SELF.getName()), Stream.concat(propertyPathFromSource.stream(),parsedIndexList.stream())).collect(Collectors.toList())
);
}
return Map.of(functionType.getFunctionName(),
String.format("sourceName is required in order to generate the %s from INSTANCE value", functionType.getFunctionName())
);
}
- if (toscaIndex != null) {
- Object toscaIndexValue = StringUtils.isNumeric(toscaIndex.toString()) ? Integer.parseInt(toscaIndex.toString()) : toscaIndex;
+ if (toscaIndexList.size() > 0) {
+ List<Object> parsedIndexList = new ArrayList<Object>();
+ toscaIndexList.forEach((obj) -> {
+ parsedIndexList.add(StringUtils.isNumeric(obj.toString()) ? Integer.parseInt(obj.toString()) : obj);
+ });
return Map.of(functionType.getFunctionName(),
- Stream.concat(Stream.of(sourceName), Stream.concat(propertyPathFromSource.stream(),Stream.of(toscaIndexValue))).collect(Collectors.toList())
+ Stream.concat(Stream.of(sourceName), Stream.concat(propertyPathFromSource.stream(),parsedIndexList.stream())).collect(Collectors.toList())
);
}
return Map.of(functionType.getFunctionName(),
List<Object> propertySourceCopy = new ArrayList<Object>(this.propertyPathFromSource);
List<Object> propertySourceOneCopy = new ArrayList<>();
propertySourceOneCopy.add(this.propertyPathFromSource.get(0));
- if (toscaIndex != null) {
- Object toscaIndexValue = StringUtils.isNumeric(toscaIndex.toString()) ? Integer.parseInt(toscaIndex.toString()) : toscaIndex;
- propertySourceCopy.add(toscaIndexValue);
- propertySourceOneCopy.add(toscaIndexValue);
+ if (toscaIndexList.size() > 0) {
+ propertySourceCopy.addAll(toscaIndexList);
+ propertySourceOneCopy.addAll(toscaIndexList);
}
if (this.propertyPathFromSource.size() == 1) {
return Map.of(this.functionType.getFunctionName(), propertySourceOneCopy);