From 94eb11bfa6428b46c7807b0607b94957d4230d89 Mon Sep 17 00:00:00 2001 From: zenfenaan Date: Fri, 12 Jan 2018 22:45:13 +0530 Subject: [PATCH] NIFI-4770 - ListAzureBlobStorage now properly writes azure.container flowfile attribute Signed-off-by: Pierre Villard This closes #2402. --- .../azure/storage/ListAzureBlobStorage.java | 2 ++ .../processors/azure/storage/utils/BlobInfo.java | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/nifi-nar-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/storage/ListAzureBlobStorage.java b/nifi-nar-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/storage/ListAzureBlobStorage.java index 2cb63164b1..b9c1ecb807 100644 --- a/nifi-nar-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/storage/ListAzureBlobStorage.java +++ b/nifi-nar-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/storage/ListAzureBlobStorage.java @@ -102,6 +102,7 @@ public class ListAzureBlobStorage extends AbstractListProcessor { @Override protected Map createAttributes(BlobInfo entity, ProcessContext context) { final Map attributes = new HashMap<>(); + attributes.put("azure.container", entity.getContainerName()); attributes.put("azure.etag", entity.getEtag()); attributes.put("azure.primaryUri", entity.getPrimaryUri()); attributes.put("azure.secondaryUri", entity.getSecondaryUri()); @@ -162,6 +163,7 @@ public class ListAzureBlobStorage extends AbstractListProcessor { Builder builder = new BlobInfo.Builder() .primaryUri(uri.getPrimaryUri().toString()) + .containerName(containerName) .contentType(properties.getContentType()) .contentLanguage(properties.getContentLanguage()) .etag(properties.getEtag()) diff --git a/nifi-nar-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/storage/utils/BlobInfo.java b/nifi-nar-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/storage/utils/BlobInfo.java index 28a47ea5b0..36fb1df512 100644 --- a/nifi-nar-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/storage/utils/BlobInfo.java +++ b/nifi-nar-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/storage/utils/BlobInfo.java @@ -31,6 +31,7 @@ public class BlobInfo implements Comparable, Serializable, ListableEnt private final long lastModifiedTime; private final long length; private final String blobType; + private final String containerName; public static long getSerialversionuid() { return serialVersionUID; @@ -52,6 +53,10 @@ public class BlobInfo implements Comparable, Serializable, ListableEnt return contentLanguage; } + public String getContainerName() { + return containerName; + } + public String getEtag() { return etag; } @@ -77,6 +82,7 @@ public class BlobInfo implements Comparable, Serializable, ListableEnt private long lastModifiedTime; private long length; private String blobType; + private String containerName; public Builder primaryUri(String primaryUri) { this.primaryUri = primaryUri; @@ -98,6 +104,11 @@ public class BlobInfo implements Comparable, Serializable, ListableEnt return this; } + public Builder containerName(String containerName) { + this.containerName = containerName; + return this; + } + public Builder etag(String etag) { this.etag = etag; return this; @@ -164,6 +175,7 @@ public class BlobInfo implements Comparable, Serializable, ListableEnt this.secondaryUri = builder.secondaryUri; this.contentType = builder.contentType; this.contentLanguage = builder.contentLanguage; + this.containerName = builder.containerName; this.etag = builder.etag; this.lastModifiedTime = builder.lastModifiedTime; this.length = builder.length;