Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

populate instance_id_ endpoint variables to eval context #1327

Draft
wants to merge 1 commit into
base: formplayer
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions src/main/java/org/commcare/suite/model/Endpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,29 @@ public static void populateEndpointArgumentsToEvaluationContext(Endpoint endpoin
}
}

Vector<String> unexpectedArguments = new Vector<>();
for (String argumentId : argumentIds) {
if(!isValidArgumentId(endpointArguments, argumentId)){
unexpectedArguments.add(argumentId);
}
}
// Vector<String> unexpectedArguments = new Vector<>();
// for (String argumentId : argumentIds) {
// if(!isValidArgumentId(endpointArguments, argumentId)){
// unexpectedArguments.add(argumentId);
// }
// }

if (missingArguments.size() > 0 || unexpectedArguments.size() > 0) {
throw new InvalidEndpointArgumentsException(missingArguments, unexpectedArguments);
}
// if (missingArguments.size() > 0 || unexpectedArguments.size() > 0) {
// throw new InvalidEndpointArgumentsException(missingArguments, unexpectedArguments);
// }

for (int i = 0; i < endpointArguments.size(); i++) {
String argumentName = endpointArguments.elementAt(i).getId();
EndpointArgument argument = endpointArguments.elementAt(i);
String argumentName = argument.getId();
if (args.containsKey(argumentName)) {
evaluationContext.setVariable(argumentName, args.get(argumentName));
}
if (argument.isInstanceArgument()) {
argumentName = "instance_id_" + argumentName;
if (args.containsKey(argumentName)) {
evaluationContext.setVariable(argumentName, args.get(argumentName));
}
}
}
}

Expand Down