Remove all instances of the deprecated `ParseField.match` method (elastic/x-pack-elasticsearch#3874)
* Remove all instances of the deprecated `ParseField.match` method This removes all the server references to the deprecated `ParseField.match` method in favor of the method that passes in the deprecation logger. Relates to https://github.com/elastic/elasticsearch/issues/28504 * Fix line-length Original commit: elastic/x-pack-elasticsearch@e7cb2611f7
This commit is contained in:
parent
98e9365aa1
commit
dc833f2448
|
@ -86,7 +86,8 @@ public class CategorizationAnalyzerConfig implements ToXContentFragment, Writeab
|
|||
if (parser.nextToken() != XContentParser.Token.START_OBJECT) {
|
||||
throw new IllegalArgumentException("Expected start object but got [" + parser.currentToken() + "]");
|
||||
}
|
||||
if (parser.nextToken() != XContentParser.Token.FIELD_NAME || CATEGORIZATION_ANALYZER.match(parser.currentName()) == false) {
|
||||
if (parser.nextToken() != XContentParser.Token.FIELD_NAME
|
||||
|| CATEGORIZATION_ANALYZER.match(parser.currentName(), parser.getDeprecationHandler()) == false) {
|
||||
throw new IllegalArgumentException("Expected [" + CATEGORIZATION_ANALYZER + "] field but got [" + parser.currentToken() + "]");
|
||||
}
|
||||
parser.nextToken();
|
||||
|
@ -116,7 +117,8 @@ public class CategorizationAnalyzerConfig implements ToXContentFragment, Writeab
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (CHAR_FILTERS.match(currentFieldName) && token == XContentParser.Token.START_ARRAY) {
|
||||
} else if (CHAR_FILTERS.match(currentFieldName, parser.getDeprecationHandler())
|
||||
&& token == XContentParser.Token.START_ARRAY) {
|
||||
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
builder.addCharFilter(parser.text());
|
||||
|
@ -127,7 +129,7 @@ public class CategorizationAnalyzerConfig implements ToXContentFragment, Writeab
|
|||
"] array element should contain char_filter's name or settings [" + token + "]");
|
||||
}
|
||||
}
|
||||
} else if (TOKENIZER.match(currentFieldName)) {
|
||||
} else if (TOKENIZER.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
builder.setTokenizer(parser.text());
|
||||
} else if (token == XContentParser.Token.START_OBJECT) {
|
||||
|
@ -136,7 +138,8 @@ public class CategorizationAnalyzerConfig implements ToXContentFragment, Writeab
|
|||
throw new IllegalArgumentException("[" + currentFieldName + "] in [" + CATEGORIZATION_ANALYZER +
|
||||
"] should be tokenizer's name or settings [" + token + "]");
|
||||
}
|
||||
} else if (TOKEN_FILTERS.match(currentFieldName) && token == XContentParser.Token.START_ARRAY) {
|
||||
} else if (TOKEN_FILTERS.match(currentFieldName, parser.getDeprecationHandler())
|
||||
&& token == XContentParser.Token.START_ARRAY) {
|
||||
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
builder.addTokenFilter(parser.text());
|
||||
|
|
|
@ -72,7 +72,7 @@ public class ChangePasswordRequestBuilder
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (User.Fields.PASSWORD.match(currentFieldName)) {
|
||||
} else if (User.Fields.PASSWORD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
String password = parser.text();
|
||||
final char[] passwordChars = password.toCharArray();
|
||||
|
|
|
@ -105,7 +105,7 @@ public class PutUserRequestBuilder extends ActionRequestBuilder<PutUserRequest,
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (User.Fields.PASSWORD.match(currentFieldName)) {
|
||||
} else if (User.Fields.PASSWORD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
String password = parser.text();
|
||||
char[] passwordChars = password.toCharArray();
|
||||
|
@ -115,7 +115,7 @@ public class PutUserRequestBuilder extends ActionRequestBuilder<PutUserRequest,
|
|||
throw new ElasticsearchParseException(
|
||||
"expected field [{}] to be of type string, but found [{}] instead", currentFieldName, token);
|
||||
}
|
||||
} else if (User.Fields.PASSWORD_HASH.match(currentFieldName)) {
|
||||
} else if (User.Fields.PASSWORD_HASH.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
char[] passwordChars = parser.text().toCharArray();
|
||||
passwordHash(passwordChars);
|
||||
|
@ -123,41 +123,41 @@ public class PutUserRequestBuilder extends ActionRequestBuilder<PutUserRequest,
|
|||
throw new ElasticsearchParseException(
|
||||
"expected field [{}] to be of type string, but found [{}] instead", currentFieldName, token);
|
||||
}
|
||||
} else if (User.Fields.ROLES.match(currentFieldName)) {
|
||||
} else if (User.Fields.ROLES.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
roles(Strings.commaDelimitedListToStringArray(parser.text()));
|
||||
} else {
|
||||
roles(XContentUtils.readStringArray(parser, false));
|
||||
}
|
||||
} else if (User.Fields.FULL_NAME.match(currentFieldName)) {
|
||||
} else if (User.Fields.FULL_NAME.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
fullName(parser.text());
|
||||
} else if (token != XContentParser.Token.VALUE_NULL) {
|
||||
throw new ElasticsearchParseException(
|
||||
"expected field [{}] to be of type string, but found [{}] instead", currentFieldName, token);
|
||||
}
|
||||
} else if (User.Fields.EMAIL.match(currentFieldName)) {
|
||||
} else if (User.Fields.EMAIL.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
email(parser.text());
|
||||
} else if (token != XContentParser.Token.VALUE_NULL) {
|
||||
throw new ElasticsearchParseException(
|
||||
"expected field [{}] to be of type string, but found [{}] instead", currentFieldName, token);
|
||||
}
|
||||
} else if (User.Fields.METADATA.match(currentFieldName)) {
|
||||
} else if (User.Fields.METADATA.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.START_OBJECT) {
|
||||
metadata(parser.map());
|
||||
} else {
|
||||
throw new ElasticsearchParseException(
|
||||
"expected field [{}] to be of type object, but found [{}] instead", currentFieldName, token);
|
||||
}
|
||||
} else if (User.Fields.ENABLED.match(currentFieldName)) {
|
||||
} else if (User.Fields.ENABLED.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.VALUE_BOOLEAN) {
|
||||
enabled(parser.booleanValue());
|
||||
} else {
|
||||
throw new ElasticsearchParseException(
|
||||
"expected field [{}] to be of type boolean, but found [{}] instead", currentFieldName, token);
|
||||
}
|
||||
} else if (User.Fields.USERNAME.match(currentFieldName)) {
|
||||
} else if (User.Fields.USERNAME.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == Token.VALUE_STRING) {
|
||||
if (username.equals(parser.text()) == false) {
|
||||
throw new IllegalArgumentException("[username] in source does not match the username provided [" +
|
||||
|
|
|
@ -92,13 +92,13 @@ public final class ExpressionParser {
|
|||
private RoleMapperExpression parseExpression(XContentParser parser, String field, boolean allowExcept, String objectName)
|
||||
throws IOException {
|
||||
|
||||
if (Fields.ANY.match(field)) {
|
||||
if (Fields.ANY.match(field, parser.getDeprecationHandler())) {
|
||||
return new AnyExpression(parseExpressionArray(Fields.ANY, parser, false));
|
||||
} else if (Fields.ALL.match(field)) {
|
||||
} else if (Fields.ALL.match(field, parser.getDeprecationHandler())) {
|
||||
return new AllExpression(parseExpressionArray(Fields.ALL, parser, true));
|
||||
} else if (Fields.FIELD.match(field)) {
|
||||
} else if (Fields.FIELD.match(field, parser.getDeprecationHandler())) {
|
||||
return parseFieldExpression(parser);
|
||||
} else if (Fields.EXCEPT.match(field)) {
|
||||
} else if (Fields.EXCEPT.match(field, parser.getDeprecationHandler())) {
|
||||
if (allowExcept) {
|
||||
return parseExceptExpression(parser);
|
||||
} else {
|
||||
|
|
|
@ -245,19 +245,20 @@ public class RoleDescriptor implements ToXContentObject {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Fields.INDEX.match(currentFieldName) || Fields.INDICES.match(currentFieldName)) {
|
||||
} else if (Fields.INDEX.match(currentFieldName, parser.getDeprecationHandler())
|
||||
|| Fields.INDICES.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
indicesPrivileges = parseIndices(name, parser, allow2xFormat);
|
||||
} else if (Fields.RUN_AS.match(currentFieldName)) {
|
||||
} else if (Fields.RUN_AS.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
runAsUsers = readStringArray(name, parser, true);
|
||||
} else if (Fields.CLUSTER.match(currentFieldName)) {
|
||||
} else if (Fields.CLUSTER.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
clusterPrivileges = readStringArray(name, parser, true);
|
||||
} else if (Fields.METADATA.match(currentFieldName)) {
|
||||
} else if (Fields.METADATA.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token != XContentParser.Token.START_OBJECT) {
|
||||
throw new ElasticsearchParseException(
|
||||
"expected field [{}] to be of type object, but found [{}] instead", currentFieldName, token);
|
||||
}
|
||||
metadata = parser.map();
|
||||
} else if (Fields.TRANSIENT_METADATA.match(currentFieldName)) {
|
||||
} else if (Fields.TRANSIENT_METADATA.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.START_OBJECT) {
|
||||
// consume object but just drop
|
||||
parser.map();
|
||||
|
@ -265,7 +266,7 @@ public class RoleDescriptor implements ToXContentObject {
|
|||
throw new ElasticsearchParseException("expected field [{}] to be an object, but found [{}] instead",
|
||||
currentFieldName, token);
|
||||
}
|
||||
} else if (Fields.TYPE.match(currentFieldName)) {
|
||||
} else if (Fields.TYPE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
// don't need it
|
||||
} else {
|
||||
throw new ElasticsearchParseException("failed to parse role [{}]. unexpected field [{}]", name, currentFieldName);
|
||||
|
@ -298,9 +299,9 @@ public class RoleDescriptor implements ToXContentObject {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Fields.INDEX.match(currentFieldName)) {
|
||||
} else if (Fields.INDEX.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
indexPrivileges = parseIndices(description, parser, false);
|
||||
} else if (Fields.CLUSTER.match(currentFieldName)) {
|
||||
} else if (Fields.CLUSTER.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
clusterPrivileges = readStringArray(description, parser, true);
|
||||
} else {
|
||||
throw new ElasticsearchParseException("failed to parse privileges check [{}]. unexpected field [{}]",
|
||||
|
@ -353,7 +354,7 @@ public class RoleDescriptor implements ToXContentObject {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Fields.NAMES.match(currentFieldName)) {
|
||||
} else if (Fields.NAMES.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
names = new String[] { parser.text() };
|
||||
} else if (token == XContentParser.Token.START_ARRAY) {
|
||||
|
@ -366,7 +367,7 @@ public class RoleDescriptor implements ToXContentObject {
|
|||
throw new ElasticsearchParseException("failed to parse indices privileges for role [{}]. expected field [{}] " +
|
||||
"value to be a string or an array of strings, but found [{}] instead", roleName, currentFieldName, token);
|
||||
}
|
||||
} else if (Fields.QUERY.match(currentFieldName)) {
|
||||
} else if (Fields.QUERY.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.START_OBJECT) {
|
||||
XContentBuilder builder = JsonXContent.contentBuilder();
|
||||
XContentHelper.copyCurrentStructure(builder.generator(), parser);
|
||||
|
@ -381,20 +382,20 @@ public class RoleDescriptor implements ToXContentObject {
|
|||
"value to be null, a string, an array, or an object, but found [{}] instead", roleName, currentFieldName,
|
||||
token);
|
||||
}
|
||||
} else if (Fields.FIELD_PERMISSIONS.match(currentFieldName)) {
|
||||
} else if (Fields.FIELD_PERMISSIONS.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.START_OBJECT) {
|
||||
token = parser.nextToken();
|
||||
do {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
if (Fields.GRANT_FIELDS.match(currentFieldName)) {
|
||||
if (Fields.GRANT_FIELDS.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
parser.nextToken();
|
||||
grantedFields = readStringArray(roleName, parser, true);
|
||||
if (grantedFields == null) {
|
||||
throw new ElasticsearchParseException("failed to parse indices privileges for role [{}]. {} must not " +
|
||||
"be null.", roleName, Fields.GRANT_FIELDS);
|
||||
}
|
||||
} else if (Fields.EXCEPT_FIELDS.match(currentFieldName)) {
|
||||
} else if (Fields.EXCEPT_FIELDS.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
parser.nextToken();
|
||||
deniedFields = readStringArray(roleName, parser, true);
|
||||
if (deniedFields == null) {
|
||||
|
@ -423,9 +424,9 @@ public class RoleDescriptor implements ToXContentObject {
|
|||
" in \"{}\".", roleName, XContentParser.Token.START_OBJECT,
|
||||
XContentParser.Token.START_ARRAY, token, Fields.FIELD_PERMISSIONS);
|
||||
}
|
||||
} else if (Fields.PRIVILEGES.match(currentFieldName)) {
|
||||
} else if (Fields.PRIVILEGES.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
privileges = readStringArray(roleName, parser, true);
|
||||
} else if (Fields.FIELD_PERMISSIONS_2X.match(currentFieldName)) {
|
||||
} else if (Fields.FIELD_PERMISSIONS_2X.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (allow2xFormat) {
|
||||
grantedFields = readStringArray(roleName, parser, true);
|
||||
} else {
|
||||
|
@ -433,7 +434,7 @@ public class RoleDescriptor implements ToXContentObject {
|
|||
" permissions in role [{}], use [\"{}\": {\"{}\":[...]," + "\"{}\":[...]}] instead",
|
||||
roleName, Fields.FIELD_PERMISSIONS, Fields.GRANT_FIELDS, Fields.EXCEPT_FIELDS, roleName);
|
||||
}
|
||||
} else if (Fields.TRANSIENT_METADATA.match(currentFieldName)) {
|
||||
} else if (Fields.TRANSIENT_METADATA.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.START_OBJECT) {
|
||||
while (parser.nextToken() != XContentParser.Token.END_OBJECT) {
|
||||
// it is transient metadata, skip it
|
||||
|
|
|
@ -85,7 +85,7 @@ public class WatcherMetaData extends AbstractNamedDiffable<MetaData.Custom> impl
|
|||
currentFieldName = parser.currentName();
|
||||
break;
|
||||
case VALUE_BOOLEAN:
|
||||
if (Field.MANUALLY_STOPPED.match(currentFieldName)) {
|
||||
if (Field.MANUALLY_STOPPED.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
manuallyStopped = parser.booleanValue();
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -166,13 +166,13 @@ public class ActionStatus implements ToXContentObject {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Field.ACK_STATUS.match(currentFieldName)) {
|
||||
} else if (Field.ACK_STATUS.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
ackStatus = AckStatus.parse(watchId, actionId, parser);
|
||||
} else if (Field.LAST_EXECUTION.match(currentFieldName)) {
|
||||
} else if (Field.LAST_EXECUTION.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
lastExecution = Execution.parse(watchId, actionId, parser);
|
||||
} else if (Field.LAST_SUCCESSFUL_EXECUTION.match(currentFieldName)) {
|
||||
} else if (Field.LAST_SUCCESSFUL_EXECUTION.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
lastSuccessfulExecution = Execution.parse(watchId, actionId, parser);
|
||||
} else if (Field.LAST_THROTTLE.match(currentFieldName)) {
|
||||
} else if (Field.LAST_THROTTLE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
lastThrottle = Throttle.parse(watchId, actionId, parser);
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse action status for [{}/{}]. unexpected field [{}]", watchId,
|
||||
|
@ -258,9 +258,9 @@ public class ActionStatus implements ToXContentObject {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Field.TIMESTAMP.match(currentFieldName)) {
|
||||
} else if (Field.TIMESTAMP.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
timestamp = dateTimeFormatter.parser().parseDateTime(parser.text());
|
||||
} else if (Field.ACK_STATUS_STATE.match(currentFieldName)) {
|
||||
} else if (Field.ACK_STATUS_STATE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
state = State.valueOf(parser.text().toUpperCase(Locale.ROOT));
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse action status for [{}/{}]. unexpected field [{}.{}]", watchId,
|
||||
|
@ -360,11 +360,11 @@ public class ActionStatus implements ToXContentObject {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Field.TIMESTAMP.match(currentFieldName)) {
|
||||
} else if (Field.TIMESTAMP.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
timestamp = dateTimeFormatter.parser().parseDateTime(parser.text());
|
||||
} else if (Field.EXECUTION_SUCCESSFUL.match(currentFieldName)) {
|
||||
} else if (Field.EXECUTION_SUCCESSFUL.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
successful = parser.booleanValue();
|
||||
} else if (Field.REASON.match(currentFieldName)) {
|
||||
} else if (Field.REASON.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
reason = parser.text();
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse action status for [{}/{}]. unexpected field [{}.{}]", watchId,
|
||||
|
@ -456,9 +456,9 @@ public class ActionStatus implements ToXContentObject {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Field.TIMESTAMP.match(currentFieldName)) {
|
||||
} else if (Field.TIMESTAMP.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
timestamp = dateTimeFormatter.parser().parseDateTime(parser.text());
|
||||
} else if (Field.REASON.match(currentFieldName)) {
|
||||
} else if (Field.REASON.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
reason = parser.text();
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse action status for [{}/{}]. unexpected field [{}.{}]", watchId,
|
||||
|
|
|
@ -206,13 +206,13 @@ public class ActionWrapper implements ToXContentObject {
|
|||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else {
|
||||
if (WatchField.CONDITION.match(currentFieldName)) {
|
||||
if (WatchField.CONDITION.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
condition = actionRegistry.getConditionRegistry().parseExecutable(watchId, parser);
|
||||
} else if (Transform.TRANSFORM.match(currentFieldName)) {
|
||||
} else if (Transform.TRANSFORM.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
transform = actionRegistry.getTransformRegistry().parse(watchId, parser);
|
||||
} else if (ThrottlerField.THROTTLE_PERIOD.match(currentFieldName)) {
|
||||
} else if (ThrottlerField.THROTTLE_PERIOD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
throttlePeriod = timeValueMillis(parser.longValue());
|
||||
} else if (ThrottlerField.THROTTLE_PERIOD_HUMAN.match(currentFieldName)) {
|
||||
} else if (ThrottlerField.THROTTLE_PERIOD_HUMAN.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
throttlePeriod = WatcherDateTimeUtils.parseTimeValue(parser, ThrottlerField.THROTTLE_PERIOD_HUMAN.toString());
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
|
|
|
@ -286,42 +286,42 @@ public class WatchStatus implements ToXContentObject, Streamable {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Field.STATE.match(currentFieldName)) {
|
||||
} else if (Field.STATE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
state = State.parse(parser);
|
||||
} catch (ElasticsearchParseException e) {
|
||||
throw new ElasticsearchParseException("could not parse watch status for [{}]. failed to parse field [{}]",
|
||||
e, watchId, currentFieldName);
|
||||
}
|
||||
} else if (Field.VERSION.match(currentFieldName)) {
|
||||
} else if (Field.VERSION.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token.isValue()) {
|
||||
version = parser.longValue();
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse watch status for [{}]. expecting field [{}] to hold a long " +
|
||||
"value, found [{}] instead", watchId, currentFieldName, token);
|
||||
}
|
||||
} else if (Field.LAST_CHECKED.match(currentFieldName)) {
|
||||
} else if (Field.LAST_CHECKED.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token.isValue()) {
|
||||
lastChecked = parseDate(currentFieldName, parser, UTC);
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse watch status for [{}]. expecting field [{}] to hold a date " +
|
||||
"value, found [{}] instead", watchId, currentFieldName, token);
|
||||
}
|
||||
} else if (Field.LAST_MET_CONDITION.match(currentFieldName)) {
|
||||
} else if (Field.LAST_MET_CONDITION.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token.isValue()) {
|
||||
lastMetCondition = parseDate(currentFieldName, parser, UTC);
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse watch status for [{}]. expecting field [{}] to hold a date " +
|
||||
"value, found [{}] instead", watchId, currentFieldName, token);
|
||||
}
|
||||
} else if (Field.EXECUTION_STATE.match(currentFieldName)) {
|
||||
} else if (Field.EXECUTION_STATE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token.isValue()) {
|
||||
executionState = ExecutionState.resolve(parser.text());
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse watch status for [{}]. expecting field [{}] to hold a string " +
|
||||
"value, found [{}] instead", watchId, currentFieldName, token);
|
||||
}
|
||||
} else if (Field.ACTIONS.match(currentFieldName)) {
|
||||
} else if (Field.ACTIONS.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
actions = new HashMap<>();
|
||||
if (token == XContentParser.Token.START_OBJECT) {
|
||||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
|
@ -336,7 +336,7 @@ public class WatchStatus implements ToXContentObject, Streamable {
|
|||
throw new ElasticsearchParseException("could not parse watch status for [{}]. expecting field [{}] to be an object, " +
|
||||
"found [{}] instead", watchId, currentFieldName, token);
|
||||
}
|
||||
} else if (Field.HEADERS.match(currentFieldName)) {
|
||||
} else if (Field.HEADERS.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.START_OBJECT) {
|
||||
headers = parser.mapStrings();
|
||||
}
|
||||
|
@ -391,9 +391,9 @@ public class WatchStatus implements ToXContentObject, Streamable {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Field.ACTIVE.match(currentFieldName)) {
|
||||
} else if (Field.ACTIVE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
active = parser.booleanValue();
|
||||
} else if (Field.TIMESTAMP.match(currentFieldName)) {
|
||||
} else if (Field.TIMESTAMP.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
timestamp = parseDate(currentFieldName, parser, UTC);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,15 +113,15 @@ public class RestGraphAction extends XPackRestHandler {
|
|||
}
|
||||
|
||||
if (token == XContentParser.Token.START_ARRAY) {
|
||||
if (VERTICES_FIELD.match(fieldName)) {
|
||||
if (VERTICES_FIELD.match(fieldName, parser.getDeprecationHandler())) {
|
||||
parseVertices(parser, currentHop);
|
||||
}
|
||||
} else if (token == XContentParser.Token.START_OBJECT) {
|
||||
if (QUERY_FIELD.match(fieldName)) {
|
||||
if (QUERY_FIELD.match(fieldName, parser.getDeprecationHandler())) {
|
||||
currentHop.guidingQuery(parseInnerQueryBuilder(parser));
|
||||
} else if (CONNECTIONS_FIELD.match(fieldName)) {
|
||||
} else if (CONNECTIONS_FIELD.match(fieldName, parser.getDeprecationHandler())) {
|
||||
parseHop(parser, graphRequest.createNextHop(null), graphRequest);
|
||||
} else if (CONTROLS_FIELD.match(fieldName)) {
|
||||
} else if (CONTROLS_FIELD.match(fieldName, parser.getDeprecationHandler())) {
|
||||
if (currentHop.getParentHop() != null) {
|
||||
throw new ElasticsearchParseException(
|
||||
"Controls are a global setting that can only be set in the root " + fieldName, token.name());
|
||||
|
@ -157,7 +157,7 @@ public class RestGraphAction extends XPackRestHandler {
|
|||
token = parser.nextToken();
|
||||
}
|
||||
if (token == XContentParser.Token.START_ARRAY) {
|
||||
if (INCLUDE_FIELD.match(fieldName)) {
|
||||
if (INCLUDE_FIELD.match(fieldName, parser.getDeprecationHandler())) {
|
||||
if (excludes != null) {
|
||||
throw new ElasticsearchParseException(
|
||||
"Graph vertices definition cannot contain both "+INCLUDE_FIELD.getPreferredName()+" and "
|
||||
|
@ -173,7 +173,7 @@ public class RestGraphAction extends XPackRestHandler {
|
|||
fieldName = parser.currentName();
|
||||
} else {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
if (TERM_FIELD.match(fieldName)) {
|
||||
if (TERM_FIELD.match(fieldName, parser.getDeprecationHandler())) {
|
||||
includeTerm = parser.text();
|
||||
} else {
|
||||
throw new ElasticsearchParseException(
|
||||
|
@ -181,7 +181,7 @@ public class RestGraphAction extends XPackRestHandler {
|
|||
" clause has invalid property:" + fieldName);
|
||||
}
|
||||
} else if (token == XContentParser.Token.VALUE_NUMBER) {
|
||||
if (BOOST_FIELD.match(fieldName)) {
|
||||
if (BOOST_FIELD.match(fieldName, parser.getDeprecationHandler())) {
|
||||
boost = parser.floatValue();
|
||||
} else {
|
||||
throw new ElasticsearchParseException(
|
||||
|
@ -212,7 +212,7 @@ public class RestGraphAction extends XPackRestHandler {
|
|||
+ token.name());
|
||||
}
|
||||
}
|
||||
} else if (EXCLUDE_FIELD.match(fieldName)) {
|
||||
} else if (EXCLUDE_FIELD.match(fieldName, parser.getDeprecationHandler())) {
|
||||
if (includes != null) {
|
||||
throw new ElasticsearchParseException(
|
||||
"Graph vertices definition cannot contain both "+ INCLUDE_FIELD.getPreferredName()+
|
||||
|
@ -228,18 +228,18 @@ public class RestGraphAction extends XPackRestHandler {
|
|||
}
|
||||
}
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
if (FIELD_NAME_FIELD.match(fieldName)) {
|
||||
if (FIELD_NAME_FIELD.match(fieldName, parser.getDeprecationHandler())) {
|
||||
field = parser.text();
|
||||
} else {
|
||||
throw new ElasticsearchParseException("Unknown string property: [" + fieldName + "]");
|
||||
}
|
||||
}
|
||||
if (token == XContentParser.Token.VALUE_NUMBER) {
|
||||
if (SIZE_FIELD.match(fieldName)) {
|
||||
if (SIZE_FIELD.match(fieldName, parser.getDeprecationHandler())) {
|
||||
size = parser.intValue();
|
||||
} else if (MIN_DOC_COUNT_FIELD.match(fieldName)) {
|
||||
} else if (MIN_DOC_COUNT_FIELD.match(fieldName, parser.getDeprecationHandler())) {
|
||||
minDocCount = parser.intValue();
|
||||
} else if (SHARD_MIN_DOC_COUNT_FIELD.match(fieldName)) {
|
||||
} else if (SHARD_MIN_DOC_COUNT_FIELD.match(fieldName, parser.getDeprecationHandler())) {
|
||||
shardMinDocCount = parser.intValue();
|
||||
} else {
|
||||
throw new ElasticsearchParseException("Unknown numeric property: [" + fieldName + "]");
|
||||
|
@ -279,37 +279,37 @@ public class RestGraphAction extends XPackRestHandler {
|
|||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
fieldName = parser.currentName();
|
||||
} else if (token == XContentParser.Token.VALUE_NUMBER) {
|
||||
if (SAMPLE_SIZE_FIELD.match(fieldName)) {
|
||||
if (SAMPLE_SIZE_FIELD.match(fieldName, parser.getDeprecationHandler())) {
|
||||
graphRequest.sampleSize(parser.intValue());
|
||||
} else if (TIMEOUT_FIELD.match(fieldName)) {
|
||||
} else if (TIMEOUT_FIELD.match(fieldName, parser.getDeprecationHandler())) {
|
||||
graphRequest.timeout(TimeValue.timeValueMillis(parser.longValue()));
|
||||
} else {
|
||||
throw new ElasticsearchParseException("Unknown numeric property: [" + fieldName + "]");
|
||||
}
|
||||
} else if (token == XContentParser.Token.VALUE_BOOLEAN) {
|
||||
if (SIGNIFICANCE_FIELD.match(fieldName)) {
|
||||
if (SIGNIFICANCE_FIELD.match(fieldName, parser.getDeprecationHandler())) {
|
||||
graphRequest.useSignificance(parser.booleanValue());
|
||||
} else if (RETURN_DETAILED_INFO.match(fieldName)) {
|
||||
} else if (RETURN_DETAILED_INFO.match(fieldName, parser.getDeprecationHandler())) {
|
||||
graphRequest.returnDetailedInfo(parser.booleanValue());
|
||||
} else{
|
||||
throw new ElasticsearchParseException("Unknown boolean property: [" + fieldName + "]");
|
||||
}
|
||||
} else if (token == XContentParser.Token.VALUE_STRING) {
|
||||
if (TIMEOUT_FIELD.match(fieldName)) {
|
||||
if (TIMEOUT_FIELD.match(fieldName, parser.getDeprecationHandler())) {
|
||||
graphRequest.timeout(TimeValue.parseTimeValue(parser.text(), null, "timeout"));
|
||||
} else {
|
||||
throw new ElasticsearchParseException("Unknown numeric property: [" + fieldName + "]");
|
||||
}
|
||||
} else if (token == XContentParser.Token.START_OBJECT) {
|
||||
if (SAMPLE_DIVERSITY_FIELD.match(fieldName)) {
|
||||
if (SAMPLE_DIVERSITY_FIELD.match(fieldName, parser.getDeprecationHandler())) {
|
||||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
fieldName = parser.currentName();
|
||||
token = parser.nextToken();
|
||||
}
|
||||
if (FIELD_NAME_FIELD.match(fieldName)) {
|
||||
if (FIELD_NAME_FIELD.match(fieldName, parser.getDeprecationHandler())) {
|
||||
graphRequest.sampleDiversityField(parser.text());
|
||||
} else if (MAX_DOCS_PER_VALUE_FIELD.match(fieldName)) {
|
||||
} else if (MAX_DOCS_PER_VALUE_FIELD.match(fieldName, parser.getDeprecationHandler())) {
|
||||
graphRequest.maxDocsPerDiversityValue(parser.intValue());
|
||||
} else {
|
||||
throw new ElasticsearchParseException("Unknown property: [" + fieldName + "]");
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
package org.elasticsearch.xpack.sql.querydsl.query;
|
||||
|
||||
import org.elasticsearch.common.Booleans;
|
||||
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
|
||||
import org.elasticsearch.index.query.MultiMatchQueryBuilder;
|
||||
import org.elasticsearch.index.query.Operator;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
|
@ -52,7 +53,7 @@ public class QueryStringQuery extends LeafQuery {
|
|||
appliers.put("time_zone", (qb, s) -> qb.timeZone(s));
|
||||
appliers.put("split_on_whitespace", (qb, s) -> qb.splitOnWhitespace(Booleans.parseBoolean(s)));
|
||||
appliers.put("all_fields", (qb, s) -> qb.useAllFields(Booleans.parseBoolean(s)));
|
||||
appliers.put("type", (qb, s) -> qb.type(MultiMatchQueryBuilder.Type.parse(s)));
|
||||
appliers.put("type", (qb, s) -> qb.type(MultiMatchQueryBuilder.Type.parse(s, LoggingDeprecationHandler.INSTANCE)));
|
||||
appliers.put("auto_generate_synonyms_phrase_query", (qb, s) -> qb.autoGenerateSynonymsPhraseQuery(Booleans.parseBoolean(s)));
|
||||
appliers.put("fuzzy_transpositions", (qb, s) -> qb.fuzzyTranspositions(Booleans.parseBoolean(s)));
|
||||
BUILDER_APPLIERS = Collections.unmodifiableMap(appliers);
|
||||
|
|
|
@ -136,24 +136,24 @@ public class EmailAction implements Action {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Field.ATTACH_DATA.match(currentFieldName)) {
|
||||
} else if (Field.ATTACH_DATA.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
dataAttachment = DataAttachment.parse(parser);
|
||||
} catch (IOException ioe) {
|
||||
throw new ElasticsearchParseException("could not parse [{}] action [{}/{}]. failed to parse data attachment field " +
|
||||
"[{}]", ioe, TYPE, watchId, actionId, currentFieldName);
|
||||
}
|
||||
} else if (Field.ATTACHMENTS.match(currentFieldName)) {
|
||||
} else if (Field.ATTACHMENTS.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
attachments = emailAttachmentsParser.parse(parser);
|
||||
} else if (!emailParser.handle(currentFieldName, parser)) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
if (Field.ACCOUNT.match(currentFieldName)) {
|
||||
if (Field.ACCOUNT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
account = parser.text();
|
||||
} else if (Field.USER.match(currentFieldName)) {
|
||||
} else if (Field.USER.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
user = parser.text();
|
||||
} else if (Field.PASSWORD.match(currentFieldName)) {
|
||||
} else if (Field.PASSWORD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
password = WatcherXContentParser.secretOrNull(parser);
|
||||
} else if (Field.PROFILE.match(currentFieldName)) {
|
||||
} else if (Field.PROFILE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
profile = Profile.resolve(parser.text());
|
||||
} catch (IllegalArgumentException iae) {
|
||||
|
|
|
@ -79,16 +79,16 @@ public class HipChatAction implements Action {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Field.ACCOUNT.match(currentFieldName)) {
|
||||
} else if (Field.ACCOUNT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
account = parser.text();
|
||||
} else {
|
||||
throw new ElasticsearchParseException("failed to parse [{}] action [{}/{}]. expected [{}] to be of type string, but " +
|
||||
"found [{}] instead", TYPE, watchId, actionId, Field.ACCOUNT.getPreferredName(), token);
|
||||
}
|
||||
} else if (Field.PROXY.match(currentFieldName)) {
|
||||
} else if (Field.PROXY.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
proxy = HttpProxy.parse(parser);
|
||||
} else if (Field.MESSAGE.match(currentFieldName)) {
|
||||
} else if (Field.MESSAGE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
message = HipChatMessage.Template.parse(parser);
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -135,7 +135,7 @@ public class IndexAction implements Action {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Field.INDEX.match(currentFieldName)) {
|
||||
} else if (Field.INDEX.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
index = parser.text();
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
|
@ -143,30 +143,30 @@ public class IndexAction implements Action {
|
|||
"field [{}]", pe, TYPE, watchId, actionId, currentFieldName);
|
||||
}
|
||||
} else if (token == XContentParser.Token.VALUE_NUMBER) {
|
||||
if (Field.TIMEOUT.match(currentFieldName)) {
|
||||
if (Field.TIMEOUT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
timeout = timeValueMillis(parser.longValue());
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse [{}] action [{}/{}]. unexpected number field [{}]", TYPE,
|
||||
watchId, actionId, currentFieldName);
|
||||
}
|
||||
} else if (token == XContentParser.Token.VALUE_STRING) {
|
||||
if (Field.DOC_TYPE.match(currentFieldName)) {
|
||||
if (Field.DOC_TYPE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
docType = parser.text();
|
||||
} else if (Field.DOC_ID.match(currentFieldName)) {
|
||||
} else if (Field.DOC_ID.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
docId = parser.text();
|
||||
} else if (Field.EXECUTION_TIME_FIELD.match(currentFieldName)) {
|
||||
} else if (Field.EXECUTION_TIME_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
executionTimeField = parser.text();
|
||||
} else if (Field.TIMEOUT_HUMAN.match(currentFieldName)) {
|
||||
} else if (Field.TIMEOUT_HUMAN.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
// Parser for human specified timeouts and 2.x compatibility
|
||||
timeout = WatcherDateTimeUtils.parseTimeValue(parser, Field.TIMEOUT_HUMAN.toString());
|
||||
} else if (Field.DYNAMIC_NAME_TIMEZONE.match(currentFieldName)) {
|
||||
} else if (Field.DYNAMIC_NAME_TIMEZONE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
dynamicNameTimeZone = DateTimeZone.forID(parser.text());
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse [{}] action for watch [{}]. failed to parse [{}]. must be " +
|
||||
"a string value (e.g. 'UTC' or '+01:00').", TYPE, watchId, currentFieldName);
|
||||
}
|
||||
} else if (Field.REFRESH.match(currentFieldName)) {
|
||||
} else if (Field.REFRESH.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
refreshPolicy = RefreshPolicy.parse(parser.text());
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse [{}] action [{}/{}]. unexpected string field [{}]", TYPE,
|
||||
|
|
|
@ -82,16 +82,16 @@ public class JiraAction implements Action {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Field.ACCOUNT.match(currentFieldName)) {
|
||||
} else if (Field.ACCOUNT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
account = parser.text();
|
||||
} else {
|
||||
throw new ElasticsearchParseException("failed to parse [{}] action [{}/{}]. expected [{}] to be of type string, but " +
|
||||
"found [{}] instead", TYPE, watchId, actionId, Field.ACCOUNT.getPreferredName(), token);
|
||||
}
|
||||
} else if (Field.PROXY.match(currentFieldName)) {
|
||||
} else if (Field.PROXY.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
proxy = HttpProxy.parse(parser);
|
||||
} else if (Field.FIELDS.match(currentFieldName)) {
|
||||
} else if (Field.FIELDS.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
fields = parser.map();
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -76,7 +76,7 @@ public class LoggingAction implements Action {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Field.TEXT.match(currentFieldName)) {
|
||||
} else if (Field.TEXT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
text = TextTemplate.parse(parser);
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
|
@ -84,9 +84,9 @@ public class LoggingAction implements Action {
|
|||
watchId, actionId, Field.TEXT.getPreferredName());
|
||||
}
|
||||
} else if (token == XContentParser.Token.VALUE_STRING) {
|
||||
if (Field.CATEGORY.match(currentFieldName)) {
|
||||
if (Field.CATEGORY.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
category = parser.text();
|
||||
} else if (Field.LEVEL.match(currentFieldName)) {
|
||||
} else if (Field.LEVEL.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
level = LoggingLevel.valueOf(parser.text().toUpperCase(Locale.ROOT));
|
||||
} catch (IllegalArgumentException iae) {
|
||||
|
|
|
@ -78,16 +78,16 @@ public class SlackAction implements Action {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Field.ACCOUNT.match(currentFieldName)) {
|
||||
} else if (Field.ACCOUNT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
account = parser.text();
|
||||
} else {
|
||||
throw new ElasticsearchParseException("failed to parse [{}] action [{}/{}]. expected [{}] to be of type string, but " +
|
||||
"found [{}] instead", TYPE, watchId, actionId, Field.ACCOUNT.getPreferredName(), token);
|
||||
}
|
||||
} else if (Field.PROXY.match(currentFieldName)) {
|
||||
} else if (Field.PROXY.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
proxy = HttpProxy.parse(parser);
|
||||
} else if (Field.MESSAGE.match(currentFieldName)) {
|
||||
} else if (Field.MESSAGE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
message = SlackMessage.Template.parse(parser);
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -95,11 +95,11 @@ public class HttpProxy implements ToXContentFragment {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (HOST.match(currentFieldName)) {
|
||||
} else if (HOST.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
host = parser.text();
|
||||
} else if (SCHEME.match(currentFieldName)) {
|
||||
} else if (SCHEME.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
scheme = Scheme.parse(parser.text());
|
||||
} else if (PORT.match(currentFieldName)) {
|
||||
} else if (PORT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
port = parser.intValue();
|
||||
if (port <= 0 || port >= 65535) {
|
||||
throw new ElasticsearchParseException("Proxy port must be between 1 and 65534, but was " + port);
|
||||
|
|
|
@ -255,17 +255,17 @@ public class HttpRequest implements ToXContentObject {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Field.PROXY.match(currentFieldName)) {
|
||||
} else if (Field.PROXY.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
builder.proxy(HttpProxy.parse(parser));
|
||||
} catch (Exception e) {
|
||||
throw new ElasticsearchParseException("could not parse http request. could not parse [{}] field", currentFieldName);
|
||||
}
|
||||
} else if (Field.AUTH.match(currentFieldName)) {
|
||||
} else if (Field.AUTH.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.auth(httpAuthRegistry.parse(parser));
|
||||
} else if (HttpRequest.Field.CONNECTION_TIMEOUT.match(currentFieldName)) {
|
||||
} else if (HttpRequest.Field.CONNECTION_TIMEOUT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.connectionTimeout(TimeValue.timeValueMillis(parser.longValue()));
|
||||
} else if (HttpRequest.Field.CONNECTION_TIMEOUT_HUMAN.match(currentFieldName)) {
|
||||
} else if (HttpRequest.Field.CONNECTION_TIMEOUT_HUMAN.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
// Users and 2.x specify the timeout this way
|
||||
try {
|
||||
builder.connectionTimeout(WatcherDateTimeUtils.parseTimeValue(parser,
|
||||
|
@ -274,9 +274,9 @@ public class HttpRequest implements ToXContentObject {
|
|||
throw new ElasticsearchParseException("could not parse http request template. invalid time value for [{}] field",
|
||||
pe, currentFieldName);
|
||||
}
|
||||
} else if (HttpRequest.Field.READ_TIMEOUT.match(currentFieldName)) {
|
||||
} else if (HttpRequest.Field.READ_TIMEOUT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.readTimeout(TimeValue.timeValueMillis(parser.longValue()));
|
||||
} else if (HttpRequest.Field.READ_TIMEOUT_HUMAN.match(currentFieldName)) {
|
||||
} else if (HttpRequest.Field.READ_TIMEOUT_HUMAN.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
// Users and 2.x specify the timeout this way
|
||||
try {
|
||||
builder.readTimeout(WatcherDateTimeUtils.parseTimeValue(parser, HttpRequest.Field.READ_TIMEOUT.toString()));
|
||||
|
@ -285,35 +285,35 @@ public class HttpRequest implements ToXContentObject {
|
|||
pe, currentFieldName);
|
||||
}
|
||||
} else if (token == XContentParser.Token.START_OBJECT) {
|
||||
if (Field.HEADERS.match(currentFieldName)) {
|
||||
if (Field.HEADERS.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.setHeaders((Map) WatcherUtils.flattenModel(parser.map()));
|
||||
} else if (Field.PARAMS.match(currentFieldName)) {
|
||||
} else if (Field.PARAMS.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.setParams((Map) WatcherUtils.flattenModel(parser.map()));
|
||||
} else if (Field.BODY.match(currentFieldName)) {
|
||||
} else if (Field.BODY.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.body(parser.text());
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse http request. unexpected object field [{}]",
|
||||
currentFieldName);
|
||||
}
|
||||
} else if (token == XContentParser.Token.VALUE_STRING) {
|
||||
if (Field.SCHEME.match(currentFieldName)) {
|
||||
if (Field.SCHEME.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.scheme(Scheme.parse(parser.text()));
|
||||
} else if (Field.METHOD.match(currentFieldName)) {
|
||||
} else if (Field.METHOD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.method(HttpMethod.parse(parser.text()));
|
||||
} else if (Field.HOST.match(currentFieldName)) {
|
||||
} else if (Field.HOST.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.host = parser.text();
|
||||
} else if (Field.PATH.match(currentFieldName)) {
|
||||
} else if (Field.PATH.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.path(parser.text());
|
||||
} else if (Field.BODY.match(currentFieldName)) {
|
||||
} else if (Field.BODY.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.body(parser.text());
|
||||
} else if (Field.URL.match(currentFieldName)) {
|
||||
} else if (Field.URL.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.fromUrl(parser.text());
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse http request. unexpected string field [{}]",
|
||||
currentFieldName);
|
||||
}
|
||||
} else if (token == XContentParser.Token.VALUE_NUMBER) {
|
||||
if (Field.PORT.match(currentFieldName)) {
|
||||
if (Field.PORT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.port = parser.intValue();
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse http request. unexpected numeric field [{}]",
|
||||
|
|
|
@ -277,21 +277,21 @@ public class HttpRequestTemplate implements ToXContentObject {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (HttpRequest.Field.PROXY.match(currentFieldName)) {
|
||||
} else if (HttpRequest.Field.PROXY.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.proxy(HttpProxy.parse(parser));
|
||||
} else if (HttpRequest.Field.PATH.match(currentFieldName)) {
|
||||
} else if (HttpRequest.Field.PATH.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.path(parseFieldTemplate(currentFieldName, parser));
|
||||
} else if (HttpRequest.Field.HEADERS.match(currentFieldName)) {
|
||||
} else if (HttpRequest.Field.HEADERS.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.putHeaders(parseFieldTemplates(currentFieldName, parser));
|
||||
} else if (HttpRequest.Field.PARAMS.match(currentFieldName)) {
|
||||
} else if (HttpRequest.Field.PARAMS.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.putParams(parseFieldTemplates(currentFieldName, parser));
|
||||
} else if (HttpRequest.Field.BODY.match(currentFieldName)) {
|
||||
} else if (HttpRequest.Field.BODY.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.body(parseFieldTemplate(currentFieldName, parser));
|
||||
} else if (HttpRequest.Field.URL.match(currentFieldName)) {
|
||||
} else if (HttpRequest.Field.URL.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.fromUrl(parser.text());
|
||||
} else if (HttpRequest.Field.CONNECTION_TIMEOUT.match(currentFieldName)) {
|
||||
} else if (HttpRequest.Field.CONNECTION_TIMEOUT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.connectionTimeout(TimeValue.timeValueMillis(parser.longValue()));
|
||||
} else if (HttpRequest.Field.CONNECTION_TIMEOUT_HUMAN.match(currentFieldName)) {
|
||||
} else if (HttpRequest.Field.CONNECTION_TIMEOUT_HUMAN.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
// Users and 2.x specify the timeout this way
|
||||
try {
|
||||
builder.connectionTimeout(WatcherDateTimeUtils.parseTimeValue(parser,
|
||||
|
@ -300,9 +300,9 @@ public class HttpRequestTemplate implements ToXContentObject {
|
|||
throw new ElasticsearchParseException("could not parse http request template. invalid time value for [{}] field",
|
||||
pe, currentFieldName);
|
||||
}
|
||||
} else if (HttpRequest.Field.READ_TIMEOUT.match(currentFieldName)) {
|
||||
} else if (HttpRequest.Field.READ_TIMEOUT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.readTimeout(TimeValue.timeValueMillis(parser.longValue()));
|
||||
} else if (HttpRequest.Field.READ_TIMEOUT_HUMAN.match(currentFieldName)) {
|
||||
} else if (HttpRequest.Field.READ_TIMEOUT_HUMAN.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
// Users and 2.x specify the timeout this way
|
||||
try {
|
||||
builder.readTimeout(WatcherDateTimeUtils.parseTimeValue(parser, HttpRequest.Field.READ_TIMEOUT.toString()));
|
||||
|
@ -311,25 +311,25 @@ public class HttpRequestTemplate implements ToXContentObject {
|
|||
pe, currentFieldName);
|
||||
}
|
||||
} else if (token == XContentParser.Token.START_OBJECT) {
|
||||
if (HttpRequest.Field.AUTH.match(currentFieldName)) {
|
||||
if (HttpRequest.Field.AUTH.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.auth(httpAuthRegistry.parse(parser));
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse http request template. unexpected object field [{}]",
|
||||
currentFieldName);
|
||||
}
|
||||
} else if (token == XContentParser.Token.VALUE_STRING) {
|
||||
if (HttpRequest.Field.SCHEME.match(currentFieldName)) {
|
||||
if (HttpRequest.Field.SCHEME.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.scheme(Scheme.parse(parser.text()));
|
||||
} else if (HttpRequest.Field.METHOD.match(currentFieldName)) {
|
||||
} else if (HttpRequest.Field.METHOD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.method(HttpMethod.parse(parser.text()));
|
||||
} else if (HttpRequest.Field.HOST.match(currentFieldName)) {
|
||||
} else if (HttpRequest.Field.HOST.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.host = parser.text();
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse http request template. unexpected string field [{}]",
|
||||
currentFieldName);
|
||||
}
|
||||
} else if (token == XContentParser.Token.VALUE_NUMBER) {
|
||||
if (HttpRequest.Field.PORT.match(currentFieldName)) {
|
||||
if (HttpRequest.Field.PORT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.port = parser.intValue();
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse http request template. unexpected numeric field [{}]",
|
||||
|
|
|
@ -188,13 +188,13 @@ public class HttpResponse implements ToXContentObject {
|
|||
} else if (currentFieldName == null) {
|
||||
throw new ElasticsearchParseException("could not parse http response. expected a field name but found [{}] instead", token);
|
||||
} else if (token == XContentParser.Token.VALUE_NUMBER) {
|
||||
if (Field.STATUS.match(currentFieldName)) {
|
||||
if (Field.STATUS.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
status = parser.intValue();
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse http response. unknown numeric field [{}]", currentFieldName);
|
||||
}
|
||||
} else if (token == XContentParser.Token.VALUE_STRING) {
|
||||
if (Field.BODY.match(currentFieldName)) {
|
||||
if (Field.BODY.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
body = parser.text();
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse http response. unknown string field [{}]", currentFieldName);
|
||||
|
|
|
@ -78,7 +78,7 @@ public class TriggeredWatch implements ToXContentObject {
|
|||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (token == XContentParser.Token.START_OBJECT) {
|
||||
if (Field.TRIGGER_EVENT.match(currentFieldName)) {
|
||||
if (Field.TRIGGER_EVENT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
triggerEvent = triggerService.parseTriggerEvent(wid.watchId(), id, parser);
|
||||
} else {
|
||||
parser.skipChildren();
|
||||
|
|
|
@ -80,7 +80,7 @@ public class HttpInput implements Input {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Field.REQUEST.match(currentFieldName)) {
|
||||
} else if (Field.REQUEST.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
request = requestParser.parse(parser);
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
|
@ -103,7 +103,7 @@ public class HttpInput implements Input {
|
|||
watchId, currentFieldName);
|
||||
}
|
||||
} else if (token == XContentParser.Token.VALUE_STRING) {
|
||||
if (Field.RESPONSE_CONTENT_TYPE.match(currentFieldName)) {
|
||||
if (Field.RESPONSE_CONTENT_TYPE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
expectedResponseBodyType = HttpContentType.resolve(parser.text());
|
||||
if (expectedResponseBodyType == null) {
|
||||
throw new ElasticsearchParseException("could not parse [{}] input for watch [{}]. unknown content type [{}]",
|
||||
|
|
|
@ -116,7 +116,7 @@ public class SearchInput implements Input {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Field.REQUEST.match(currentFieldName)) {
|
||||
} else if (Field.REQUEST.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
request = WatcherSearchTemplateRequest.fromXContent(parser, ExecutableSearchInput.DEFAULT_SEARCH_TYPE);
|
||||
} catch (ElasticsearchParseException srpe) {
|
||||
|
@ -124,7 +124,7 @@ public class SearchInput implements Input {
|
|||
watchId, currentFieldName);
|
||||
}
|
||||
} else if (token == XContentParser.Token.START_ARRAY) {
|
||||
if (Field.EXTRACT.match(currentFieldName)) {
|
||||
if (Field.EXTRACT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
extract = new HashSet<>();
|
||||
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
|
@ -138,12 +138,12 @@ public class SearchInput implements Input {
|
|||
throw new ElasticsearchParseException("could not parse [{}] input for watch [{}]. unexpected array field [{}]", TYPE,
|
||||
watchId, currentFieldName);
|
||||
}
|
||||
} else if (Field.TIMEOUT.match(currentFieldName)) {
|
||||
} else if (Field.TIMEOUT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
timeout = timeValueMillis(parser.longValue());
|
||||
} else if (Field.TIMEOUT_HUMAN.match(currentFieldName)) {
|
||||
} else if (Field.TIMEOUT_HUMAN.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
// Parser for human specified timeouts and 2.x compatibility
|
||||
timeout = WatcherDateTimeUtils.parseTimeValue(parser, Field.TIMEOUT_HUMAN.toString());
|
||||
} else if (Field.DYNAMIC_NAME_TIMEZONE.match(currentFieldName)) {
|
||||
} else if (Field.DYNAMIC_NAME_TIMEZONE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
dynamicNameTimeZone = DateTimeZone.forID(parser.text());
|
||||
} else {
|
||||
|
|
|
@ -92,7 +92,7 @@ public enum DataAttachment implements ToXContentObject {
|
|||
} else if (currentFieldName == null) {
|
||||
throw new ElasticsearchParseException("could not parse data attachment. expected [{}] field but found [{}] instead",
|
||||
Field.FORMAT.getPreferredName(), token);
|
||||
} else if (Field.FORMAT.match(currentFieldName)) {
|
||||
} else if (Field.FORMAT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
dataAttachment = resolve(parser.text());
|
||||
} else {
|
||||
|
|
|
@ -180,25 +180,25 @@ public class Email implements ToXContentObject {
|
|||
currentFieldName = parser.currentName();
|
||||
} else if ((token.isValue() || token == XContentParser.Token.START_OBJECT || token == XContentParser.Token.START_ARRAY) &&
|
||||
currentFieldName != null) {
|
||||
if (Field.ID.match(currentFieldName)) {
|
||||
if (Field.ID.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
email.id(parser.text());
|
||||
} else if (Field.FROM.match(currentFieldName)) {
|
||||
} else if (Field.FROM.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
email.from(Address.parse(currentFieldName, token, parser));
|
||||
} else if (Field.REPLY_TO.match(currentFieldName)) {
|
||||
} else if (Field.REPLY_TO.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
email.replyTo(AddressList.parse(currentFieldName, token, parser));
|
||||
} else if (Field.TO.match(currentFieldName)) {
|
||||
} else if (Field.TO.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
email.to(AddressList.parse(currentFieldName, token, parser));
|
||||
} else if (Field.CC.match(currentFieldName)) {
|
||||
} else if (Field.CC.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
email.cc(AddressList.parse(currentFieldName, token, parser));
|
||||
} else if (Field.BCC.match(currentFieldName)) {
|
||||
} else if (Field.BCC.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
email.bcc(AddressList.parse(currentFieldName, token, parser));
|
||||
} else if (Field.PRIORITY.match(currentFieldName)) {
|
||||
} else if (Field.PRIORITY.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
email.priority(Email.Priority.resolve(parser.text()));
|
||||
} else if (Field.SENT_DATE.match(currentFieldName)) {
|
||||
} else if (Field.SENT_DATE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
email.sentDate(new DateTime(parser.text(), DateTimeZone.UTC));
|
||||
} else if (Field.SUBJECT.match(currentFieldName)) {
|
||||
} else if (Field.SUBJECT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
email.subject(parser.text());
|
||||
} else if (Field.BODY.match(currentFieldName)) {
|
||||
} else if (Field.BODY.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
String bodyField = currentFieldName;
|
||||
if (parser.currentToken() == XContentParser.Token.VALUE_STRING) {
|
||||
email.textBody(parser.text());
|
||||
|
@ -208,9 +208,9 @@ public class Email implements ToXContentObject {
|
|||
currentFieldName = parser.currentName();
|
||||
} else if (currentFieldName == null) {
|
||||
throw new ElasticsearchParseException("could not parse email. empty [{}] field", bodyField);
|
||||
} else if (Email.Field.BODY_TEXT.match(currentFieldName)) {
|
||||
} else if (Email.Field.BODY_TEXT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
email.textBody(parser.text());
|
||||
} else if (Email.Field.BODY_HTML.match(currentFieldName)) {
|
||||
} else if (Email.Field.BODY_HTML.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
email.htmlBody(parser.text());
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse email. unexpected field [{}.{}] field", bodyField,
|
||||
|
@ -449,9 +449,9 @@ public class Email implements ToXContentObject {
|
|||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (token == XContentParser.Token.VALUE_STRING) {
|
||||
if (ADDRESS_EMAIL_FIELD.match(currentFieldName)) {
|
||||
if (ADDRESS_EMAIL_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
email = parser.text();
|
||||
} else if (ADDRESS_NAME_FIELD.match(currentFieldName)) {
|
||||
} else if (ADDRESS_NAME_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
name = parser.text();
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse [" + field + "] object as address. unknown address " +
|
||||
|
|
|
@ -340,9 +340,9 @@ public class EmailTemplate implements ToXContentObject {
|
|||
private final EmailTemplate.Builder builder = builder();
|
||||
|
||||
public boolean handle(String fieldName, XContentParser parser) throws IOException {
|
||||
if (Email.Field.FROM.match(fieldName)) {
|
||||
if (Email.Field.FROM.match(fieldName, parser.getDeprecationHandler())) {
|
||||
builder.from(TextTemplate.parse(parser));
|
||||
} else if (Email.Field.REPLY_TO.match(fieldName)) {
|
||||
} else if (Email.Field.REPLY_TO.match(fieldName, parser.getDeprecationHandler())) {
|
||||
if (parser.currentToken() == XContentParser.Token.START_ARRAY) {
|
||||
List<TextTemplate> templates = new ArrayList<>();
|
||||
while (parser.nextToken() != XContentParser.Token.END_ARRAY) {
|
||||
|
@ -352,7 +352,7 @@ public class EmailTemplate implements ToXContentObject {
|
|||
} else {
|
||||
builder.replyTo(TextTemplate.parse(parser));
|
||||
}
|
||||
} else if (Email.Field.TO.match(fieldName)) {
|
||||
} else if (Email.Field.TO.match(fieldName, parser.getDeprecationHandler())) {
|
||||
if (parser.currentToken() == XContentParser.Token.START_ARRAY) {
|
||||
List<TextTemplate> templates = new ArrayList<>();
|
||||
while (parser.nextToken() != XContentParser.Token.END_ARRAY) {
|
||||
|
@ -362,7 +362,7 @@ public class EmailTemplate implements ToXContentObject {
|
|||
} else {
|
||||
builder.to(TextTemplate.parse(parser));
|
||||
}
|
||||
} else if (Email.Field.CC.match(fieldName)) {
|
||||
} else if (Email.Field.CC.match(fieldName, parser.getDeprecationHandler())) {
|
||||
if (parser.currentToken() == XContentParser.Token.START_ARRAY) {
|
||||
List<TextTemplate> templates = new ArrayList<>();
|
||||
while (parser.nextToken() != XContentParser.Token.END_ARRAY) {
|
||||
|
@ -372,7 +372,7 @@ public class EmailTemplate implements ToXContentObject {
|
|||
} else {
|
||||
builder.cc(TextTemplate.parse(parser));
|
||||
}
|
||||
} else if (Email.Field.BCC.match(fieldName)) {
|
||||
} else if (Email.Field.BCC.match(fieldName, parser.getDeprecationHandler())) {
|
||||
if (parser.currentToken() == XContentParser.Token.START_ARRAY) {
|
||||
List<TextTemplate> templates = new ArrayList<>();
|
||||
while (parser.nextToken() != XContentParser.Token.END_ARRAY) {
|
||||
|
@ -382,11 +382,11 @@ public class EmailTemplate implements ToXContentObject {
|
|||
} else {
|
||||
builder.bcc(TextTemplate.parse(parser));
|
||||
}
|
||||
} else if (Email.Field.PRIORITY.match(fieldName)) {
|
||||
} else if (Email.Field.PRIORITY.match(fieldName, parser.getDeprecationHandler())) {
|
||||
builder.priority(TextTemplate.parse(parser));
|
||||
} else if (Email.Field.SUBJECT.match(fieldName)) {
|
||||
} else if (Email.Field.SUBJECT.match(fieldName, parser.getDeprecationHandler())) {
|
||||
builder.subject(TextTemplate.parse(parser));
|
||||
} else if (Email.Field.BODY.match(fieldName)) {
|
||||
} else if (Email.Field.BODY.match(fieldName, parser.getDeprecationHandler())) {
|
||||
if (parser.currentToken() == XContentParser.Token.VALUE_STRING) {
|
||||
builder.textBody(TextTemplate.parse(parser));
|
||||
} else if (parser.currentToken() == XContentParser.Token.START_OBJECT) {
|
||||
|
@ -397,9 +397,9 @@ public class EmailTemplate implements ToXContentObject {
|
|||
currentFieldName = parser.currentName();
|
||||
} else if (currentFieldName == null) {
|
||||
throw new ElasticsearchParseException("could not parse email template. empty [{}] field", fieldName);
|
||||
} else if (Email.Field.BODY_TEXT.match(currentFieldName)) {
|
||||
} else if (Email.Field.BODY_TEXT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.textBody(TextTemplate.parse(parser));
|
||||
} else if (Email.Field.BODY_HTML.match(currentFieldName)) {
|
||||
} else if (Email.Field.BODY_HTML.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.htmlBody(TextTemplate.parse(parser));
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse email template. unknown field [{}.{}] field",
|
||||
|
|
|
@ -42,7 +42,7 @@ public class DataAttachmentParser implements EmailAttachmentParser<DataAttachmen
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Strings.hasLength(currentFieldName) && Fields.FORMAT.match(currentFieldName)) {
|
||||
} else if (Strings.hasLength(currentFieldName) && Fields.FORMAT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
dataAttachment = resolve(parser.text());
|
||||
} else {
|
||||
|
|
|
@ -60,11 +60,11 @@ public class HttpEmailAttachementParser implements EmailAttachmentParser<HttpReq
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Fields.CONTENT_TYPE.match(currentFieldName)) {
|
||||
} else if (Fields.CONTENT_TYPE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
contentType = parser.text();
|
||||
} else if (Fields.INLINE.match(currentFieldName)) {
|
||||
} else if (Fields.INLINE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
inline = parser.booleanValue();
|
||||
} else if (Fields.REQUEST.match(currentFieldName)) {
|
||||
} else if (Fields.REQUEST.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
requestTemplate = requestTemplateParser.parse(parser);
|
||||
} else {
|
||||
String msg = "Unknown field name [" + currentFieldName + "] in http request attachment configuration";
|
||||
|
|
|
@ -248,9 +248,9 @@ public class HipChatMessage implements ToXContentObject {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Field.FROM.match(currentFieldName)) {
|
||||
} else if (Field.FROM.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
from = parser.text();
|
||||
} else if (Field.ROOM.match(currentFieldName)) {
|
||||
} else if (Field.ROOM.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
List<TextTemplate> templates = new ArrayList<>();
|
||||
if (token == XContentParser.Token.START_ARRAY) {
|
||||
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
|
||||
|
@ -270,7 +270,7 @@ public class HipChatMessage implements ToXContentObject {
|
|||
}
|
||||
}
|
||||
rooms = templates.toArray(new TextTemplate[templates.size()]);
|
||||
} else if (Field.USER.match(currentFieldName)) {
|
||||
} else if (Field.USER.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
List<TextTemplate> templates = new ArrayList<>();
|
||||
if (token == XContentParser.Token.START_ARRAY) {
|
||||
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
|
||||
|
@ -290,28 +290,28 @@ public class HipChatMessage implements ToXContentObject {
|
|||
}
|
||||
}
|
||||
users = templates.toArray(new TextTemplate[templates.size()]);
|
||||
} else if (Field.COLOR.match(currentFieldName)) {
|
||||
} else if (Field.COLOR.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
color = TextTemplate.parse(parser);
|
||||
} catch (ElasticsearchParseException | IllegalArgumentException e) {
|
||||
throw new ElasticsearchParseException("failed to parse hipchat message. failed to parse [{}] field", e,
|
||||
Field.COLOR.getPreferredName());
|
||||
}
|
||||
} else if (Field.NOTIFY.match(currentFieldName)) {
|
||||
} else if (Field.NOTIFY.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.VALUE_BOOLEAN) {
|
||||
notify = parser.booleanValue();
|
||||
} else {
|
||||
throw new ElasticsearchParseException("failed to parse hipchat message. failed to parse [{}] field, expected a " +
|
||||
"boolean value but found [{}]", Field.NOTIFY.getPreferredName(), token);
|
||||
}
|
||||
} else if (Field.BODY.match(currentFieldName)) {
|
||||
} else if (Field.BODY.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
body = TextTemplate.parse(parser);
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
throw new ElasticsearchParseException("failed to parse hipchat message. failed to parse [{}] field", pe,
|
||||
Field.BODY.getPreferredName());
|
||||
}
|
||||
} else if (Field.FORMAT.match(currentFieldName)) {
|
||||
} else if (Field.FORMAT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
messageFormat = HipChatMessage.Format.parse(parser);
|
||||
} catch (IllegalArgumentException ilae) {
|
||||
|
|
|
@ -160,12 +160,12 @@ public class JiraIssue implements ToXContentObject {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Field.ERRORS.match(currentFieldName)) {
|
||||
} else if (Field.ERRORS.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
Map<String, Object> fieldErrors = parser.mapOrdered();
|
||||
for (Map.Entry<String, Object> entry : fieldErrors.entrySet()) {
|
||||
errors.add("ThrottlerField [" + entry.getKey() + "] has error [" + String.valueOf(entry.getValue()) + "]");
|
||||
}
|
||||
} else if (Field.ERROR_MESSAGES.match(currentFieldName)) {
|
||||
} else if (Field.ERROR_MESSAGES.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
|
||||
errors.add(parser.text());
|
||||
}
|
||||
|
|
|
@ -290,58 +290,59 @@ public class IncidentEvent implements ToXContentObject {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Fields.INCIDENT_KEY.match(currentFieldName)) {
|
||||
} else if (Fields.INCIDENT_KEY.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
incidentKey = TextTemplate.parse(parser);
|
||||
} catch (ElasticsearchParseException e) {
|
||||
throw new ElasticsearchParseException("could not parse pager duty event template. failed to parse field [{}]",
|
||||
Fields.INCIDENT_KEY.getPreferredName());
|
||||
}
|
||||
} else if (Fields.DESCRIPTION.match(currentFieldName)) {
|
||||
} else if (Fields.DESCRIPTION.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
description = TextTemplate.parse(parser);
|
||||
} catch (ElasticsearchParseException e) {
|
||||
throw new ElasticsearchParseException("could not parse pager duty event template. failed to parse field [{}]",
|
||||
Fields.DESCRIPTION.getPreferredName());
|
||||
}
|
||||
} else if (Fields.CLIENT.match(currentFieldName)) {
|
||||
} else if (Fields.CLIENT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
client = TextTemplate.parse(parser);
|
||||
} catch (ElasticsearchParseException e) {
|
||||
throw new ElasticsearchParseException("could not parse pager duty event template. failed to parse field [{}]",
|
||||
Fields.CLIENT.getPreferredName());
|
||||
}
|
||||
} else if (Fields.CLIENT_URL.match(currentFieldName)) {
|
||||
} else if (Fields.CLIENT_URL.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
clientUrl = TextTemplate.parse(parser);
|
||||
} catch (ElasticsearchParseException e) {
|
||||
throw new ElasticsearchParseException("could not parse pager duty event template. failed to parse field [{}]",
|
||||
Fields.CLIENT_URL.getPreferredName());
|
||||
}
|
||||
} else if (Fields.ACCOUNT.match(currentFieldName)) {
|
||||
} else if (Fields.ACCOUNT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
account = parser.text();
|
||||
} catch (ElasticsearchParseException e) {
|
||||
throw new ElasticsearchParseException("could not parse pager duty event template. failed to parse field [{}]",
|
||||
Fields.CLIENT_URL.getPreferredName());
|
||||
}
|
||||
} else if (Fields.PROXY.match(currentFieldName)) {
|
||||
} else if (Fields.PROXY.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
proxy = HttpProxy.parse(parser);
|
||||
} else if (Fields.EVENT_TYPE.match(currentFieldName)) {
|
||||
} else if (Fields.EVENT_TYPE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
eventType = TextTemplate.parse(parser);
|
||||
} catch (ElasticsearchParseException e) {
|
||||
throw new ElasticsearchParseException("could not parse pager duty event template. failed to parse field [{}]",
|
||||
Fields.EVENT_TYPE.getPreferredName());
|
||||
}
|
||||
} else if (Fields.ATTACH_PAYLOAD.match(currentFieldName)) {
|
||||
} else if (Fields.ATTACH_PAYLOAD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.VALUE_BOOLEAN) {
|
||||
attachPayload = parser.booleanValue();
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse pager duty event template. failed to parse field [{}], " +
|
||||
"expected a boolean value but found [{}] instead", Fields.ATTACH_PAYLOAD.getPreferredName(), token);
|
||||
}
|
||||
} else if (Fields.CONTEXTS.match(currentFieldName) || Fields.CONTEXT_DEPRECATED.match(currentFieldName)) {
|
||||
} else if (Fields.CONTEXTS.match(currentFieldName, parser.getDeprecationHandler())
|
||||
|| Fields.CONTEXT_DEPRECATED.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.START_ARRAY) {
|
||||
List<IncidentEventContext.Template> list = new ArrayList<>();
|
||||
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
|
||||
|
|
|
@ -194,7 +194,7 @@ public class IncidentEventContext implements ToXContentObject {
|
|||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Strings.hasLength(currentFieldName)) {
|
||||
if (XField.TYPE.match(currentFieldName)) {
|
||||
if (XField.TYPE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
type = Type.valueOf(parser.text().toUpperCase(Locale.ROOT));
|
||||
} catch (IllegalArgumentException e) {
|
||||
|
@ -210,13 +210,13 @@ public class IncidentEventContext implements ToXContentObject {
|
|||
throw new ElasticsearchParseException(msg, e, currentFieldName);
|
||||
}
|
||||
|
||||
if (XField.HREF.match(currentFieldName)) {
|
||||
if (XField.HREF.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
href = parsedTemplate;
|
||||
} else if (XField.TEXT.match(currentFieldName)) {
|
||||
} else if (XField.TEXT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
text = parsedTemplate;
|
||||
} else if (XField.SRC.match(currentFieldName)) {
|
||||
} else if (XField.SRC.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
src = parsedTemplate;
|
||||
} else if (XField.ALT.match(currentFieldName)) {
|
||||
} else if (XField.ALT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
alt = parsedTemplate;
|
||||
} else {
|
||||
String msg = "could not parse trigger incident event context. unknown field [{}]";
|
||||
|
|
|
@ -114,11 +114,11 @@ public class SentEvent implements ToXContentObject {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (XField.MESSAGE.match(currentFieldName)) {
|
||||
} else if (XField.MESSAGE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
message = parser.text();
|
||||
} else if (XField.CODE.match(currentFieldName)) {
|
||||
} else if (XField.CODE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
// we don't use this code.. so just consume the token
|
||||
} else if (XField.ERRORS.match(currentFieldName)) {
|
||||
} else if (XField.ERRORS.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
|
||||
errors.add(parser.text());
|
||||
}
|
||||
|
|
|
@ -325,70 +325,70 @@ public class Attachment implements MessageElement {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (XField.FALLBACK.match(currentFieldName)) {
|
||||
} else if (XField.FALLBACK.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
fallback = TextTemplate.parse(parser);
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
throw new ElasticsearchParseException("could not parse message attachment. failed to parse [{}] field", pe,
|
||||
XField.FALLBACK);
|
||||
}
|
||||
} else if (XField.COLOR.match(currentFieldName)) {
|
||||
} else if (XField.COLOR.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
color = TextTemplate.parse(parser);
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
throw new ElasticsearchParseException("could not parse message attachment. failed to parse [{}] field", pe,
|
||||
XField.COLOR);
|
||||
}
|
||||
} else if (XField.PRETEXT.match(currentFieldName)) {
|
||||
} else if (XField.PRETEXT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
pretext = TextTemplate.parse(parser);
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
throw new ElasticsearchParseException("could not parse message attachment. failed to parse [{}] field", pe,
|
||||
XField.PRETEXT);
|
||||
}
|
||||
} else if (XField.AUTHOR_NAME.match(currentFieldName)) {
|
||||
} else if (XField.AUTHOR_NAME.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
authorName = TextTemplate.parse(parser);
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
throw new ElasticsearchParseException("could not parse message attachment. failed to parse [{}] field", pe,
|
||||
XField.AUTHOR_NAME);
|
||||
}
|
||||
} else if (XField.AUTHOR_LINK.match(currentFieldName)) {
|
||||
} else if (XField.AUTHOR_LINK.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
authorLink = TextTemplate.parse(parser);
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
throw new ElasticsearchParseException("could not parse message attachment. failed to parse [{}] field", pe,
|
||||
XField.AUTHOR_LINK);
|
||||
}
|
||||
} else if (XField.AUTHOR_ICON.match(currentFieldName)) {
|
||||
} else if (XField.AUTHOR_ICON.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
authorIcon = TextTemplate.parse(parser);
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
throw new ElasticsearchParseException("could not parse message attachment. failed to parse [{}] field", pe,
|
||||
XField.AUTHOR_ICON);
|
||||
}
|
||||
} else if (XField.TITLE.match(currentFieldName)) {
|
||||
} else if (XField.TITLE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
title = TextTemplate.parse(parser);
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
throw new ElasticsearchParseException("could not parse message attachment. failed to parse [{}] field", pe,
|
||||
XField.TITLE);
|
||||
}
|
||||
} else if (XField.TITLE_LINK.match(currentFieldName)) {
|
||||
} else if (XField.TITLE_LINK.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
titleLink = TextTemplate.parse(parser);
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
throw new ElasticsearchParseException("could not parse message attachment. failed to parse [{}] field", pe,
|
||||
XField.TITLE_LINK);
|
||||
}
|
||||
} else if (XField.TEXT.match(currentFieldName)) {
|
||||
} else if (XField.TEXT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
text = TextTemplate.parse(parser);
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
throw new ElasticsearchParseException("could not parse message attachment. failed to parse [{}] field", pe,
|
||||
XField.TEXT);
|
||||
}
|
||||
} else if (XField.FIELDS.match(currentFieldName)) {
|
||||
} else if (XField.FIELDS.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.START_ARRAY) {
|
||||
List<Field.Template> list = new ArrayList<>();
|
||||
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
|
||||
|
@ -408,21 +408,21 @@ public class Attachment implements MessageElement {
|
|||
XField.FIELDS);
|
||||
}
|
||||
}
|
||||
} else if (XField.IMAGE_URL.match(currentFieldName)) {
|
||||
} else if (XField.IMAGE_URL.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
imageUrl = TextTemplate.parse(parser);
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
throw new ElasticsearchParseException("could not parse message attachment. failed to parse [{}] field", pe,
|
||||
XField.IMAGE_URL);
|
||||
}
|
||||
} else if (XField.THUMB_URL.match(currentFieldName)) {
|
||||
} else if (XField.THUMB_URL.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
thumbUrl = TextTemplate.parse(parser);
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
throw new ElasticsearchParseException("could not parse message attachment. failed to parse [{}] field", pe,
|
||||
XField.THUMB_URL);
|
||||
}
|
||||
} else if (XField.MARKDOWN_IN.match(currentFieldName)) {
|
||||
} else if (XField.MARKDOWN_IN.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.START_ARRAY) {
|
||||
List<TextTemplate> list = new ArrayList<>();
|
||||
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
|
||||
|
@ -442,7 +442,7 @@ public class Attachment implements MessageElement {
|
|||
XField.MARKDOWN_IN);
|
||||
}
|
||||
}
|
||||
} else if (XField.ACTIONS.match(currentFieldName)) {
|
||||
} else if (XField.ACTIONS.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.START_OBJECT) {
|
||||
actions.add(Action.ACTION_PARSER.parse(parser, null));
|
||||
}
|
||||
|
|
|
@ -62,14 +62,14 @@ public class DynamicAttachments implements MessageElement {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (XField.LIST_PATH.match(currentFieldName)) {
|
||||
} else if (XField.LIST_PATH.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
listPath = parser.text();
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse dynamic attachments. expected a string value for [{}] field, " +
|
||||
"but found [{}]", XField.LIST_PATH.getPreferredName(), token);
|
||||
}
|
||||
} else if (XField.TEMPLATE.match(currentFieldName)) {
|
||||
} else if (XField.TEMPLATE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
template = Attachment.Template.parse(parser);
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
|
|
|
@ -115,21 +115,21 @@ class Field implements MessageElement {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (XField.TITLE.match(currentFieldName)) {
|
||||
} else if (XField.TITLE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
title = TextTemplate.parse(parser);
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
throw new ElasticsearchParseException("could not parse message attachment field. failed to parse [{}] field", pe,
|
||||
XField.TITLE);
|
||||
}
|
||||
} else if (XField.VALUE.match(currentFieldName)) {
|
||||
} else if (XField.VALUE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
value = TextTemplate.parse(parser);
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
throw new ElasticsearchParseException("could not parse message attachment field. failed to parse [{}] field", pe,
|
||||
XField.VALUE);
|
||||
}
|
||||
} else if (XField.SHORT.match(currentFieldName)) {
|
||||
} else if (XField.SHORT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.VALUE_BOOLEAN) {
|
||||
isShort = parser.booleanValue();
|
||||
} else {
|
||||
|
|
|
@ -247,14 +247,14 @@ public class SlackMessage implements MessageElement {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (XField.FROM.match(currentFieldName)) {
|
||||
} else if (XField.FROM.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
builder.setFrom(TextTemplate.parse(parser));
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
throw new ElasticsearchParseException("could not parse slack message. failed to parse [{}] field", pe,
|
||||
XField.FROM.getPreferredName());
|
||||
}
|
||||
} else if (XField.TO.match(currentFieldName)) {
|
||||
} else if (XField.TO.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.START_ARRAY) {
|
||||
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
|
||||
try {
|
||||
|
@ -272,21 +272,21 @@ public class SlackMessage implements MessageElement {
|
|||
XField.TO.getPreferredName());
|
||||
}
|
||||
}
|
||||
} else if (XField.TEXT.match(currentFieldName)) {
|
||||
} else if (XField.TEXT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
builder.setText(TextTemplate.parse(parser));
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
throw new ElasticsearchParseException("could not parse slack message. failed to parse [{}] field", pe,
|
||||
XField.TEXT.getPreferredName());
|
||||
}
|
||||
} else if (XField.ICON.match(currentFieldName)) {
|
||||
} else if (XField.ICON.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
builder.setIcon(TextTemplate.parse(parser));
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
throw new ElasticsearchParseException("could not parse slack message. failed to parse [{}] field.", pe,
|
||||
XField.ICON.getPreferredName());
|
||||
}
|
||||
} else if (XField.ATTACHMENTS.match(currentFieldName)) {
|
||||
} else if (XField.ATTACHMENTS.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.START_ARRAY) {
|
||||
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
|
||||
try {
|
||||
|
@ -304,7 +304,7 @@ public class SlackMessage implements MessageElement {
|
|||
XField.ATTACHMENTS.getPreferredName());
|
||||
}
|
||||
}
|
||||
} else if (XField.DYNAMIC_ATTACHMENTS.match(currentFieldName)) {
|
||||
} else if (XField.DYNAMIC_ATTACHMENTS.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
builder.setDynamicAttachments(DynamicAttachments.parse(parser));
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
|
|
|
@ -89,24 +89,24 @@ public class RestExecuteWatchAction extends WatcherRestHandler implements RestRe
|
|||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (token == XContentParser.Token.VALUE_BOOLEAN) {
|
||||
if (IGNORE_CONDITION.match(currentFieldName)) {
|
||||
if (IGNORE_CONDITION.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.setIgnoreCondition(parser.booleanValue());
|
||||
} else if (RECORD_EXECUTION.match(currentFieldName)) {
|
||||
} else if (RECORD_EXECUTION.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.setRecordExecution(parser.booleanValue());
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not parse watch execution request. unexpected boolean field [{}]",
|
||||
currentFieldName);
|
||||
}
|
||||
} else if (token == XContentParser.Token.START_OBJECT) {
|
||||
if (Field.ALTERNATIVE_INPUT.match(currentFieldName)) {
|
||||
if (Field.ALTERNATIVE_INPUT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.setAlternativeInput(parser.map());
|
||||
} else if (Field.TRIGGER_DATA.match(currentFieldName)) {
|
||||
} else if (Field.TRIGGER_DATA.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
builder.setTriggerData(parser.map());
|
||||
} else if (Field.WATCH.match(currentFieldName)) {
|
||||
} else if (Field.WATCH.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
XContentBuilder watcherSource = XContentBuilder.builder(parser.contentType().xContent());
|
||||
XContentHelper.copyCurrentStructure(watcherSource.generator(), parser);
|
||||
builder.setWatchSource(watcherSource.bytes(), parser.contentType());
|
||||
} else if (Field.ACTION_MODES.match(currentFieldName)) {
|
||||
} else if (Field.ACTION_MODES.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
|
|
|
@ -171,7 +171,7 @@ public class WatcherSearchTemplateRequest implements ToXContentObject {
|
|||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (token == XContentParser.Token.START_ARRAY) {
|
||||
if (INDICES_FIELD.match(currentFieldName)) {
|
||||
if (INDICES_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
indices.add(parser.textOrNull());
|
||||
|
@ -180,7 +180,7 @@ public class WatcherSearchTemplateRequest implements ToXContentObject {
|
|||
currentFieldName + "] field, but instead found [" + token + "]");
|
||||
}
|
||||
}
|
||||
} else if (TYPES_FIELD.match(currentFieldName)) {
|
||||
} else if (TYPES_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
types.add(parser.textOrNull());
|
||||
|
@ -194,12 +194,12 @@ public class WatcherSearchTemplateRequest implements ToXContentObject {
|
|||
currentFieldName + "]");
|
||||
}
|
||||
} else if (token == XContentParser.Token.START_OBJECT) {
|
||||
if (BODY_FIELD.match(currentFieldName)) {
|
||||
if (BODY_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try (XContentBuilder builder = XContentFactory.jsonBuilder()) {
|
||||
builder.copyCurrentStructure(parser);
|
||||
searchSource = builder.bytes();
|
||||
}
|
||||
} else if (INDICES_OPTIONS_FIELD.match(currentFieldName)) {
|
||||
} else if (INDICES_OPTIONS_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
boolean expandOpen = DEFAULT_INDICES_OPTIONS.expandWildcardsOpen();
|
||||
boolean expandClosed = DEFAULT_INDICES_OPTIONS.expandWildcardsClosed();
|
||||
boolean allowNoIndices = DEFAULT_INDICES_OPTIONS.allowNoIndices();
|
||||
|
@ -208,7 +208,7 @@ public class WatcherSearchTemplateRequest implements ToXContentObject {
|
|||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (token.isValue()) {
|
||||
if (EXPAND_WILDCARDS_FIELD.match(currentFieldName)) {
|
||||
if (EXPAND_WILDCARDS_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
switch (parser.text()) {
|
||||
case "all":
|
||||
expandOpen = true;
|
||||
|
@ -230,9 +230,9 @@ public class WatcherSearchTemplateRequest implements ToXContentObject {
|
|||
throw new ElasticsearchParseException("could not read search request. unknown value [" +
|
||||
parser.text() + "] for [" + currentFieldName + "] field ");
|
||||
}
|
||||
} else if (IGNORE_UNAVAILABLE_FIELD.match(currentFieldName)) {
|
||||
} else if (IGNORE_UNAVAILABLE_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
ignoreUnavailable = parser.booleanValue();
|
||||
} else if (ALLOW_NO_INDICES_FIELD.match(currentFieldName)) {
|
||||
} else if (ALLOW_NO_INDICES_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
allowNoIndices = parser.booleanValue();
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not read search request. unexpected index option [" +
|
||||
|
@ -245,20 +245,20 @@ public class WatcherSearchTemplateRequest implements ToXContentObject {
|
|||
}
|
||||
indicesOptions = IndicesOptions.fromOptions(ignoreUnavailable, allowNoIndices, expandOpen, expandClosed,
|
||||
DEFAULT_INDICES_OPTIONS);
|
||||
} else if (TEMPLATE_FIELD.match(currentFieldName)) {
|
||||
} else if (TEMPLATE_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
template = Script.parse(parser, Script.DEFAULT_TEMPLATE_LANG);
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not read search request. unexpected object field [" +
|
||||
currentFieldName + "]");
|
||||
}
|
||||
} else if (token == XContentParser.Token.VALUE_STRING) {
|
||||
if (INDICES_FIELD.match(currentFieldName)) {
|
||||
if (INDICES_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
String indicesStr = parser.text();
|
||||
indices.addAll(Arrays.asList(Strings.delimitedListToStringArray(indicesStr, ",", " \t")));
|
||||
} else if (TYPES_FIELD.match(currentFieldName)) {
|
||||
} else if (TYPES_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
String typesStr = parser.text();
|
||||
types.addAll(Arrays.asList(Strings.delimitedListToStringArray(typesStr, ",", " \t")));
|
||||
} else if (SEARCH_TYPE_FIELD.match(currentFieldName)) {
|
||||
} else if (SEARCH_TYPE_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
searchType = SearchType.fromString(parser.text().toLowerCase(Locale.ROOT));
|
||||
} else {
|
||||
throw new ElasticsearchParseException("could not read search request. unexpected string field [" +
|
||||
|
|
|
@ -98,19 +98,19 @@ public class SearchTransform implements Transform {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Field.REQUEST.match(currentFieldName)) {
|
||||
} else if (Field.REQUEST.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
request = WatcherSearchTemplateRequest.fromXContent(parser, ExecutableSearchTransform.DEFAULT_SEARCH_TYPE);
|
||||
} catch (ElasticsearchParseException srpe) {
|
||||
throw new ElasticsearchParseException("could not parse [{}] transform for watch [{}]. failed to parse [{}]", srpe,
|
||||
TYPE, watchId, currentFieldName);
|
||||
}
|
||||
} else if (Field.TIMEOUT.match(currentFieldName)) {
|
||||
} else if (Field.TIMEOUT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
timeout = timeValueMillis(parser.longValue());
|
||||
} else if (Field.TIMEOUT_HUMAN.match(currentFieldName)) {
|
||||
} else if (Field.TIMEOUT_HUMAN.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
// Parser for human specified timeouts and 2.x compatibility
|
||||
timeout = WatcherDateTimeUtils.parseTimeValue(parser, Field.TIMEOUT_HUMAN.toString());
|
||||
} else if (Field.DYNAMIC_NAME_TIMEZONE.match(currentFieldName)) {
|
||||
} else if (Field.DYNAMIC_NAME_TIMEZONE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token == XContentParser.Token.VALUE_STRING) {
|
||||
dynamicNameTimeZone = DateTimeZone.forID(parser.text());
|
||||
} else {
|
||||
|
|
|
@ -88,7 +88,7 @@ public class DailySchedule extends CronnableSchedule {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (AT_FIELD.match(currentFieldName)) {
|
||||
} else if (AT_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token != XContentParser.Token.START_ARRAY) {
|
||||
try {
|
||||
times.add(DayTimes.parse(parser, token));
|
||||
|
|
|
@ -100,7 +100,7 @@ public class HourlySchedule extends CronnableSchedule {
|
|||
currentFieldName = parser.currentName();
|
||||
} else if (currentFieldName == null) {
|
||||
throw new ElasticsearchParseException("could not parse [{}] schedule. unexpected token [{}]", TYPE, token);
|
||||
} else if (MINUTE_FIELD.match(currentFieldName)) {
|
||||
} else if (MINUTE_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token.isValue()) {
|
||||
try {
|
||||
minutes.add(DayTimes.parseMinuteValue(parser, token));
|
||||
|
|
|
@ -64,7 +64,7 @@ public class ScheduleTriggerEvent extends TriggerEvent {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (Field.TRIGGERED_TIME.match(currentFieldName)) {
|
||||
} else if (Field.TRIGGERED_TIME.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
triggeredTime = WatcherDateTimeUtils.parseDateMath(currentFieldName, parser, DateTimeZone.UTC, clock);
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
|
@ -72,7 +72,7 @@ public class ScheduleTriggerEvent extends TriggerEvent {
|
|||
throw new ElasticsearchParseException("could not parse [{}] trigger event for [{}] for watch [{}]. failed to parse " +
|
||||
"date field [{}]", pe, ScheduleTriggerEngine.TYPE, context, watchId, currentFieldName);
|
||||
}
|
||||
} else if (Field.SCHEDULED_TIME.match(currentFieldName)) {
|
||||
} else if (Field.SCHEDULED_TIME.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
try {
|
||||
scheduledTime = WatcherDateTimeUtils.parseDateMath(currentFieldName, parser, DateTimeZone.UTC, clock);
|
||||
} catch (ElasticsearchParseException pe) {
|
||||
|
|
|
@ -196,7 +196,7 @@ public class DayTimes implements Times {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (HOUR_FIELD.match(currentFieldName)) {
|
||||
} else if (HOUR_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token.isValue()) {
|
||||
hours.add(parseHourValue(parser, token));
|
||||
} else if (token == XContentParser.Token.START_ARRAY) {
|
||||
|
@ -207,7 +207,7 @@ public class DayTimes implements Times {
|
|||
throw new ElasticsearchParseException("invalid time hour value. expected string/number value or an array of " +
|
||||
"string/number values, but found [{}]", token);
|
||||
}
|
||||
} else if (MINUTE_FIELD.match(currentFieldName)) {
|
||||
} else if (MINUTE_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token.isValue()) {
|
||||
minutes.add(parseMinuteValue(parser, token));
|
||||
} else if (token == XContentParser.Token.START_ARRAY) {
|
||||
|
|
|
@ -154,7 +154,7 @@ public class MonthTimes implements Times {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (DAY_FIELD.match(currentFieldName)) {
|
||||
} else if (DAY_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token.isValue()) {
|
||||
daysSet.add(parseDayValue(parser, token));
|
||||
} else if (token == XContentParser.Token.START_ARRAY) {
|
||||
|
@ -165,7 +165,7 @@ public class MonthTimes implements Times {
|
|||
throw new ElasticsearchParseException("invalid month day value for [{}] field. expected string/number value or an " +
|
||||
"array of string/number values, but found [{}]", currentFieldName, token);
|
||||
}
|
||||
} else if (TIME_FIELD.match(currentFieldName)) {
|
||||
} else if (TIME_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token != XContentParser.Token.START_ARRAY) {
|
||||
try {
|
||||
timesSet.add(DayTimes.parse(parser, token));
|
||||
|
|
|
@ -111,7 +111,7 @@ public class WeekTimes implements Times {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (DAY_FIELD.match(currentFieldName)) {
|
||||
} else if (DAY_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token.isValue()) {
|
||||
daysSet.add(parseDayValue(parser, token));
|
||||
} else if (token == XContentParser.Token.START_ARRAY) {
|
||||
|
@ -122,7 +122,7 @@ public class WeekTimes implements Times {
|
|||
throw new ElasticsearchParseException("invalid week day value for [{}] field. expected string/number value or an " +
|
||||
"array of string/number values, but found [{}]", currentFieldName, token);
|
||||
}
|
||||
} else if (TIME_FIELD.match(currentFieldName)) {
|
||||
} else if (TIME_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token != XContentParser.Token.START_ARRAY) {
|
||||
try {
|
||||
timesSet.add(DayTimes.parse(parser, token));
|
||||
|
|
|
@ -144,7 +144,7 @@ public class YearTimes implements Times {
|
|||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||
if (token == XContentParser.Token.FIELD_NAME) {
|
||||
currentFieldName = parser.currentName();
|
||||
} else if (MONTH_FIELD.match(currentFieldName)) {
|
||||
} else if (MONTH_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token.isValue()) {
|
||||
monthsSet.add(parseMonthValue(parser, token));
|
||||
} else if (token == XContentParser.Token.START_ARRAY) {
|
||||
|
@ -155,7 +155,7 @@ public class YearTimes implements Times {
|
|||
throw new ElasticsearchParseException("invalid year month value for [{}] field. expected string/number value or an " +
|
||||
"array of string/number values, but found [{}]", currentFieldName, token);
|
||||
}
|
||||
} else if (DAY_FIELD.match(currentFieldName)) {
|
||||
} else if (DAY_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token.isValue()) {
|
||||
daysSet.add(MonthTimes.parseDayValue(parser, token));
|
||||
} else if (token == XContentParser.Token.START_ARRAY) {
|
||||
|
@ -166,7 +166,7 @@ public class YearTimes implements Times {
|
|||
throw new ElasticsearchParseException("invalid year day value for [{}] field. expected string/number value or an " +
|
||||
"array of string/number values, but found [{}]", currentFieldName, token);
|
||||
}
|
||||
} else if (TIME_FIELD.match(currentFieldName)) {
|
||||
} else if (TIME_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (token != XContentParser.Token.START_ARRAY) {
|
||||
try {
|
||||
timesSet.add(DayTimes.parse(parser, token));
|
||||
|
|
|
@ -129,17 +129,17 @@ public class WatchParser extends AbstractComponent {
|
|||
currentFieldName = parser.currentName();
|
||||
} else if (token == null || currentFieldName == null) {
|
||||
throw new ElasticsearchParseException("could not parse watch [{}], unexpected token [{}]", id, token);
|
||||
} else if (WatchField.TRIGGER.match(currentFieldName)) {
|
||||
} else if (WatchField.TRIGGER.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
trigger = triggerService.parseTrigger(id, parser);
|
||||
} else if (WatchField.INPUT.match(currentFieldName)) {
|
||||
} else if (WatchField.INPUT.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
input = inputRegistry.parse(id, parser);
|
||||
} else if (WatchField.CONDITION.match(currentFieldName)) {
|
||||
} else if (WatchField.CONDITION.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
condition = actionRegistry.getConditionRegistry().parseExecutable(id, parser);
|
||||
} else if (WatchField.TRANSFORM.match(currentFieldName)) {
|
||||
} else if (WatchField.TRANSFORM.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
transform = actionRegistry.getTransformRegistry().parse(id, parser);
|
||||
} else if (WatchField.THROTTLE_PERIOD.match(currentFieldName)) {
|
||||
} else if (WatchField.THROTTLE_PERIOD.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
throttlePeriod = timeValueMillis(parser.longValue());
|
||||
} else if (WatchField.THROTTLE_PERIOD_HUMAN.match(currentFieldName)) {
|
||||
} else if (WatchField.THROTTLE_PERIOD_HUMAN.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
// Parser for human specified and 2.x backwards compatible throttle period
|
||||
try {
|
||||
throttlePeriod = WatcherDateTimeUtils.parseTimeValue(parser, WatchField.THROTTLE_PERIOD_HUMAN.toString());
|
||||
|
@ -147,11 +147,11 @@ public class WatchParser extends AbstractComponent {
|
|||
throw new ElasticsearchParseException("could not parse watch [{}]. failed to parse time value for field [{}]",
|
||||
pe, id, currentFieldName);
|
||||
}
|
||||
} else if (WatchField.ACTIONS.match(currentFieldName)) {
|
||||
} else if (WatchField.ACTIONS.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
actions = actionRegistry.parseActions(id, parser);
|
||||
} else if (WatchField.METADATA.match(currentFieldName)) {
|
||||
} else if (WatchField.METADATA.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
metatdata = parser.map();
|
||||
} else if (WatchField.STATUS.match(currentFieldName)) {
|
||||
} else if (WatchField.STATUS.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (includeStatus) {
|
||||
status = WatchStatus.parse(id, parser);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue