Repository: nifi Updated Branches: refs/heads/master 196ca237e -> 20a1fc24d
NIFI-3885 DynamoDB Processor EL Support Add EL support to remaining Dynamo processor properties Signed-off-by: James Wing <[email protected]> This closes #1793. Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/20a1fc24 Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/20a1fc24 Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/20a1fc24 Branch: refs/heads/master Commit: 20a1fc24d712e1be2f26a203cbbf8c789bdf940f Parents: 196ca23 Author: Tim Reardon <[email protected]> Authored: Fri May 12 14:43:03 2017 -0400 Committer: James Wing <[email protected]> Committed: Mon May 15 10:13:53 2017 -0700 ---------------------------------------------------------------------- .../aws/dynamodb/AbstractDynamoDBProcessor.java | 8 ++++++-- .../nifi/processors/aws/dynamodb/DeleteDynamoDB.java | 8 ++++---- .../nifi/processors/aws/dynamodb/GetDynamoDB.java | 10 +++++----- .../nifi/processors/aws/dynamodb/PutDynamoDB.java | 12 ++++++------ 4 files changed, 21 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/20a1fc24/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/AbstractDynamoDBProcessor.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/AbstractDynamoDBProcessor.java b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/AbstractDynamoDBProcessor.java index e1a31a9..3a5adf7 100644 --- a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/AbstractDynamoDBProcessor.java +++ b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/AbstractDynamoDBProcessor.java @@ -86,7 +86,7 @@ public abstract class AbstractDynamoDBProcessor extends AbstractAWSCredentialsPr public static final PropertyDescriptor TABLE = new PropertyDescriptor.Builder() .name("Table Name") .required(true) - .expressionLanguageSupported(false) + .expressionLanguageSupported(true) .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) .description("The DynamoDB table name") .build(); @@ -127,6 +127,7 @@ public abstract class AbstractDynamoDBProcessor extends AbstractAWSCredentialsPr public static final PropertyDescriptor HASH_KEY_NAME = new PropertyDescriptor.Builder() .name("Hash Key Name") .required(true) + .expressionLanguageSupported(true) .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) .description("The hash key name of the item") .build(); @@ -134,6 +135,7 @@ public abstract class AbstractDynamoDBProcessor extends AbstractAWSCredentialsPr public static final PropertyDescriptor RANGE_KEY_NAME = new PropertyDescriptor.Builder() .name("Range Key Name") .required(false) + .expressionLanguageSupported(true) .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) .description("The range key name of the item") .build(); @@ -141,6 +143,7 @@ public abstract class AbstractDynamoDBProcessor extends AbstractAWSCredentialsPr public static final PropertyDescriptor JSON_DOCUMENT = new PropertyDescriptor.Builder() .name("Json Document attribute") .required(true) + .expressionLanguageSupported(true) .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) .description("The Json document to be retrieved from the dynamodb item") .build(); @@ -148,7 +151,7 @@ public abstract class AbstractDynamoDBProcessor extends AbstractAWSCredentialsPr public static final PropertyDescriptor BATCH_SIZE = new PropertyDescriptor.Builder() .name("Batch items for each request (between 1 and 50)") .required(false) - .expressionLanguageSupported(false) + .expressionLanguageSupported(true) .addValidator(StandardValidators.createLongValidator(1, 50, true)) .defaultValue("1") .description("The items to be retrieved in one batch") @@ -159,6 +162,7 @@ public abstract class AbstractDynamoDBProcessor extends AbstractAWSCredentialsPr .description("Character set of data in the document") .addValidator(StandardValidators.CHARACTER_SET_VALIDATOR) .required(true) + .expressionLanguageSupported(true) .defaultValue(Charset.defaultCharset().name()) .build(); http://git-wip-us.apache.org/repos/asf/nifi/blob/20a1fc24/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/DeleteDynamoDB.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/DeleteDynamoDB.java b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/DeleteDynamoDB.java index a82de34..ee614a6 100644 --- a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/DeleteDynamoDB.java +++ b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/DeleteDynamoDB.java @@ -83,18 +83,18 @@ public class DeleteDynamoDB extends AbstractWriteDynamoDBProcessor { @Override public void onTrigger(final ProcessContext context, final ProcessSession session) { - List<FlowFile> flowFiles = session.get(context.getProperty(BATCH_SIZE).asInteger()); + List<FlowFile> flowFiles = session.get(context.getProperty(BATCH_SIZE).evaluateAttributeExpressions().asInteger()); if (flowFiles == null || flowFiles.size() == 0) { return; } Map<ItemKeys,FlowFile> keysToFlowFileMap = new HashMap<>(); - final String table = context.getProperty(TABLE).getValue(); + final String table = context.getProperty(TABLE).evaluateAttributeExpressions().getValue(); - final String hashKeyName = context.getProperty(HASH_KEY_NAME).getValue(); + final String hashKeyName = context.getProperty(HASH_KEY_NAME).evaluateAttributeExpressions().getValue(); final String hashKeyValueType = context.getProperty(HASH_KEY_VALUE_TYPE).getValue(); - final String rangeKeyName = context.getProperty(RANGE_KEY_NAME).getValue(); + final String rangeKeyName = context.getProperty(RANGE_KEY_NAME).evaluateAttributeExpressions().getValue(); final String rangeKeyValueType = context.getProperty(RANGE_KEY_VALUE_TYPE).getValue(); TableWriteItems tableWriteItems = new TableWriteItems(table); http://git-wip-us.apache.org/repos/asf/nifi/blob/20a1fc24/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/GetDynamoDB.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/GetDynamoDB.java b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/GetDynamoDB.java index 808600c..73c9f9a 100644 --- a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/GetDynamoDB.java +++ b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/GetDynamoDB.java @@ -100,19 +100,19 @@ public class GetDynamoDB extends AbstractDynamoDBProcessor { @Override public void onTrigger(final ProcessContext context, final ProcessSession session) { - List<FlowFile> flowFiles = session.get(context.getProperty(BATCH_SIZE).asInteger()); + List<FlowFile> flowFiles = session.get(context.getProperty(BATCH_SIZE).evaluateAttributeExpressions().asInteger()); if (flowFiles == null || flowFiles.size() == 0) { return; } Map<ItemKeys,FlowFile> keysToFlowFileMap = new HashMap<>(); - final String table = context.getProperty(TABLE).getValue(); + final String table = context.getProperty(TABLE).evaluateAttributeExpressions().getValue(); TableKeysAndAttributes tableKeysAndAttributes = new TableKeysAndAttributes(table); - final String hashKeyName = context.getProperty(HASH_KEY_NAME).getValue(); - final String rangeKeyName = context.getProperty(RANGE_KEY_NAME).getValue(); - final String jsonDocument = context.getProperty(JSON_DOCUMENT).getValue(); + final String hashKeyName = context.getProperty(HASH_KEY_NAME).evaluateAttributeExpressions().getValue(); + final String rangeKeyName = context.getProperty(RANGE_KEY_NAME).evaluateAttributeExpressions().getValue(); + final String jsonDocument = context.getProperty(JSON_DOCUMENT).evaluateAttributeExpressions().getValue(); for (FlowFile flowFile : flowFiles) { final Object hashKeyValue = getValue(context, HASH_KEY_VALUE_TYPE, HASH_KEY_VALUE, flowFile); http://git-wip-us.apache.org/repos/asf/nifi/blob/20a1fc24/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/PutDynamoDB.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/PutDynamoDB.java b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/PutDynamoDB.java index 83fea37..a6b1764 100644 --- a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/PutDynamoDB.java +++ b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/PutDynamoDB.java @@ -95,21 +95,21 @@ public class PutDynamoDB extends AbstractWriteDynamoDBProcessor { @Override public void onTrigger(final ProcessContext context, final ProcessSession session) { - List<FlowFile> flowFiles = session.get(context.getProperty(BATCH_SIZE).asInteger()); + List<FlowFile> flowFiles = session.get(context.getProperty(BATCH_SIZE).evaluateAttributeExpressions().asInteger()); if (flowFiles == null || flowFiles.size() == 0) { return; } Map<ItemKeys, FlowFile> keysToFlowFileMap = new HashMap<>(); - final String table = context.getProperty(TABLE).getValue(); + final String table = context.getProperty(TABLE).evaluateAttributeExpressions().getValue(); - final String hashKeyName = context.getProperty(HASH_KEY_NAME).getValue(); + final String hashKeyName = context.getProperty(HASH_KEY_NAME).evaluateAttributeExpressions().getValue(); final String hashKeyValueType = context.getProperty(HASH_KEY_VALUE_TYPE).getValue(); - final String rangeKeyName = context.getProperty(RANGE_KEY_NAME).getValue(); + final String rangeKeyName = context.getProperty(RANGE_KEY_NAME).evaluateAttributeExpressions().getValue(); final String rangeKeyValueType = context.getProperty(RANGE_KEY_VALUE_TYPE).getValue(); - final String jsonDocument = context.getProperty(JSON_DOCUMENT).getValue(); - final String charset = context.getProperty(DOCUMENT_CHARSET).getValue(); + final String jsonDocument = context.getProperty(JSON_DOCUMENT).evaluateAttributeExpressions().getValue(); + final String charset = context.getProperty(DOCUMENT_CHARSET).evaluateAttributeExpressions().getValue(); TableWriteItems tableWriteItems = new TableWriteItems(table);
