Skip to content

Commit

Permalink
These changes are already in commit log. They shuold be in master bra…
Browse files Browse the repository at this point in the history
…nch as well--not sure why git is saying they aren't
  • Loading branch information
Dave Varon committed Sep 29, 2018
1 parent 8b6b78e commit 9d0d76f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ public class RESTAdaptor extends Adaptor {
*/
protected final static String PARAM_SYMBOL_RX = "([\\/=:~])(\\?[idvnt])";

/**
* Constant equal to: {@code ".+"+PARAM_SYMBOL_RX+".*"}
*/
//protected final static Pattern PARAM_URL_RX = Pattern.compile(".+"+PARAM_SYMBOL_RX+".*");

/**
* Constant equal to: {@value}
* {@link JSONParams} key for delivery of {@code HTTP POST, PUT, PATCH} body content
Expand Down Expand Up @@ -159,32 +154,17 @@ public void execute(YADAQuery yq) throws YADAAdaptorExecutionException


String urlStr = yq.getUrl(row);


// for (int i=0;i<yq.getParamCount(row);i++)
// {
//Matcher m = PARAM_URL_RX.matcher(urlStr);
Matcher m = Pattern.compile(PARAM_SYMBOL_RX).matcher(urlStr);
//if(m.matches())
StringBuffer sb = new StringBuffer();
int i=0;
while(m.find())
{
String param = yq.getVals(row).get(i++);
String repl = m.group(1)+param;
m.appendReplacement(sb, repl);
// String param = yq.getVals(row).get(i);
// String repl = m.group(1)+param;
// //urlStr = urlStr.replaceFirst(PARAM_SYMBOL_RX,m.group(1)+param);
//
// sb.append(urlStr.substring(0,m.start(1)));
// sb.append(repl);
// sb.append(urlStr.substring(m.end(2)));
// urlStr = sb.toString();
}
m.appendTail(sb);
urlStr = sb.toString();
// }
Matcher m = Pattern.compile(PARAM_SYMBOL_RX).matcher(urlStr);
StringBuffer sb = new StringBuffer();
int i=0;
while(m.find())
{
String param = yq.getVals(row).get(i++);
String repl = m.group(1)+param;
m.appendReplacement(sb, repl);
}
m.appendTail(sb);
urlStr = sb.toString();

l.debug("REST url w/params: ["+urlStr+"]");
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ public String engage(YADARequest yadaReq, String result) throws YADAPluginExcept
}
// add args
cmds.addAll(args);
for (String arg : args)
{
cmds.add(arg);
}
// add results path as last argument to executable
cmds.add(tmpResult.getAbsolutePath());
// add yadaReq json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ public class QueryUtils
* A constant equal to: {@value}
*/
public static final String STANDARD_DATE_FMT = "yyyy-MM-dd";
/**
* A constant equal to: {@value}
*/
public static final String QUOTE = "\"";

/**
* Retrieves the adaptor class from the application context given the
Expand Down Expand Up @@ -1000,7 +1004,9 @@ public void setPositionalParameterValues(YADAQuery yq, int row)
colName = YADA_COLUMN + (j + 1);
else if (data.containsKey(colName.toUpperCase()))
colName = colName.toUpperCase();

else if(data.containsKey(colName.replaceAll("\"", "").toUpperCase()))
colName = colName.replaceAll("\"", "").toUpperCase();

String[] valsForColumn;

valsForColumn = data.get(colName);
Expand Down Expand Up @@ -1261,6 +1267,10 @@ else if(dataForRow.containsKey(colName.toUpperCase()))
{ // json params uppper case
colName = colName.toUpperCase();
}
else if(dataForRow.containsKey(colName.replaceAll("\"", "").toUpperCase()))
{
colName = colName.replaceAll("\"", "").toUpperCase();
}

// length of value array for inColumn
int dataLen = dataForRow.get(colName).length;
Expand Down

0 comments on commit 9d0d76f

Please sign in to comment.