protected static Pair<String, Object> getFieldAndSource(DeserializedEvent devent, List<String> sourceFieldsNames, boolean asString) throws FieldNotFoundException { Object sourceValue = null; String foundSourceFieldName = null; for (String sourceFieldName : sourceFieldsNames) { try { if (asString) { sourceValue = devent.getFieldAsString(sourceFieldName); } else { sourceValue = devent.getField(sourceFieldName); } foundSourceFieldName = sourceFieldName; break; } catch (FieldNotFoundException e) { continue; } } if (sourceValue == null) { throw new FieldNotFoundException(); } return new ImmutablePair<String, Object>(foundSourceFieldName, sourceValue); } }
payload = ievent.getEventObj().getField(this.path); } catch (FieldNotFoundException e) { throw new OperationException(e);
protected static Pair<String, Object> getFieldAndSource(DeserializedEvent devent, List<String> sourceFieldsNames, boolean asString) throws FieldNotFoundException { Object sourceValue = null; String foundSourceFieldName = null; for (String sourceFieldName : sourceFieldsNames) { try { if (asString) { sourceValue = devent.getFieldAsString(sourceFieldName); } else { sourceValue = devent.getField(sourceFieldName); } foundSourceFieldName = sourceFieldName; break; } catch (FieldNotFoundException e) { continue; } } if (sourceValue == null) { throw new FieldNotFoundException(); } return new ImmutablePair<String, Object>(foundSourceFieldName, sourceValue); } }
payload = ievent.getEventObj().getField(this.path); } catch (FieldNotFoundException e) { throw new OperationException(e);
/** * The {@link DeserializedEvent} payload must be a {@link JsonObject}. * * @param event Event with payload to mutate. */ protected void mutateEvent(DeserializedEvent event) throws OperationException { Object payload = event.getPayload(); if (payload == null) { return; } if (!(payload instanceof JsonObject)) { throw new OperationException("Payload data is not a JsonObject"); } Object o; try { o = event.getField(path); } catch (FieldNotFoundException e) { throw new OperationException(e); } if (!(o instanceof JsonObject)) { throw new OperationException("specified node '" + path +"' is not an object"); } event.setPayload(o); }
/** * The {@link DeserializedEvent} payload must be a {@link JsonObject}. * * @param event Event with payload to mutate. */ protected void mutateEvent(DeserializedEvent event) throws OperationException { Object payload = event.getPayload(); if (payload == null) { return; } if (!(payload instanceof JsonObject)) { throw new OperationException("Payload data is not a JsonObject"); } Object o; try { o = event.getField(path); } catch (FieldNotFoundException e) { throw new OperationException(e); } if (!(o instanceof JsonObject)) { throw new OperationException("specified node '" + path +"' is not an object"); } event.setPayload(o); }