The plugins will perform full-string comparison actions. However there are times when performing a substring check is beneficial.
This issue requests that a substring option be added to the logic of the compareString method:
|
private String compareString(String operator, String testValue, String comparisonValue) { |
|
if (operator.equals(STRING_BEG) && testValue.startsWith(comparisonValue)) { |
|
return STRING_BEG; |
|
} else if (operator.equals(STRING_END) && testValue.endsWith(comparisonValue)) { |
|
return STRING_END; |
|
} |
|
|
|
int compare = testValue.compareTo(comparisonValue); |
|
if (operator.equals(STRING_LT) && compare < 0) { |
|
return STRING_LT; |
|
} else if (operator.equals(STRING_LE) && compare <= 0) { |
|
return STRING_LE; |
|
} else if (operator.equals(STRING_GE) && compare >= 0) { |
|
return STRING_GE; |
|
} else if (operator.equals(STRING_GT) && compare > 0) { |
|
return STRING_GT; |
|
} |
|
return ""; |
Logic could be added to check if operator.equals(STRING_SUB), and if so, enter a different block than lines 145-154, where testValue.contains(comparisonValue) is executed and the result checked for the appropriate return value.
The plugins will perform full-string comparison actions. However there are times when performing a substring check is beneficial.
This issue requests that a substring option be added to the logic of the
compareStringmethod:rundeck-conditional-logic-plugin/src/main/java/com/bioraft/rundeck/conditional/IfElse.java
Lines 138 to 155 in c403a96
Logic could be added to check if
operator.equals(STRING_SUB), and if so, enter a different block than lines 145-154, wheretestValue.contains(comparisonValue)is executed and the result checked for the appropriate return value.