This is an automated email from the ASF dual-hosted git repository.
bbende pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new 3dda694fd6 NIFI-10139: Adding fields to RemoteProcessGroupStatus
(#6137)
3dda694fd6 is described below
commit 3dda694fd633562392ec1a80daa9f1d108b324ff
Author: Joe Gresock <[email protected]>
AuthorDate: Wed Jun 22 12:24:23 2022 -0400
NIFI-10139: Adding fields to RemoteProcessGroupStatus (#6137)
---
.../nifi/controller/status/ProcessGroupStatus.java | 8 +++++
.../status/RemoteProcessGroupStatus.java | 37 ++++++++++++++++++++++
.../apache/nifi/reporting/AbstractEventAccess.java | 3 ++
3 files changed, 48 insertions(+)
diff --git
a/nifi-api/src/main/java/org/apache/nifi/controller/status/ProcessGroupStatus.java
b/nifi-api/src/main/java/org/apache/nifi/controller/status/ProcessGroupStatus.java
index e0fda6dda2..f4e48d53c4 100644
---
a/nifi-api/src/main/java/org/apache/nifi/controller/status/ProcessGroupStatus.java
+++
b/nifi-api/src/main/java/org/apache/nifi/controller/status/ProcessGroupStatus.java
@@ -20,6 +20,7 @@ import org.apache.nifi.registry.flow.VersionedFlowState;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -586,6 +587,13 @@ public class ProcessGroupStatus implements Cloneable {
merged.setSentContentSize(merged.getSentContentSize() +
statusToMerge.getSentContentSize());
merged.setSentCount(merged.getSentCount() +
statusToMerge.getSentCount());
merged.setActiveThreadCount(merged.getActiveThreadCount() +
statusToMerge.getActiveThreadCount());
+
+ // Take the earliest last refresh time
+ final Date mergedLastRefreshTime = merged.getLastRefreshTime();
+ final Date toMergeLastRefreshTime =
statusToMerge.getLastRefreshTime();
+ if (mergedLastRefreshTime == null || (toMergeLastRefreshTime !=
null && toMergeLastRefreshTime.before(mergedLastRefreshTime))) {
+ merged.setLastRefreshTime(toMergeLastRefreshTime);
+ }
}
target.setRemoteProcessGroupStatus(mergedRemoteGroupMap.values());
diff --git
a/nifi-api/src/main/java/org/apache/nifi/controller/status/RemoteProcessGroupStatus.java
b/nifi-api/src/main/java/org/apache/nifi/controller/status/RemoteProcessGroupStatus.java
index 2b0efffcc6..e259598c05 100644
---
a/nifi-api/src/main/java/org/apache/nifi/controller/status/RemoteProcessGroupStatus.java
+++
b/nifi-api/src/main/java/org/apache/nifi/controller/status/RemoteProcessGroupStatus.java
@@ -16,6 +16,7 @@
*/
package org.apache.nifi.controller.status;
+import java.util.Date;
import java.util.concurrent.TimeUnit;
/**
@@ -28,6 +29,9 @@ public class RemoteProcessGroupStatus implements Cloneable {
private TransmissionStatus transmissionStatus;
private String uri;
private String name;
+ private String comments;
+ private String authorizationIssue;
+ private Date lastRefreshTime;
private Integer activeThreadCount;
private int sentCount;
private long sentContentSize;
@@ -70,6 +74,30 @@ public class RemoteProcessGroupStatus implements Cloneable {
this.name = name;
}
+ public String getComments() {
+ return comments;
+ }
+
+ public void setComments(String comments) {
+ this.comments = comments;
+ }
+
+ public String getAuthorizationIssue() {
+ return authorizationIssue;
+ }
+
+ public void setAuthorizationIssue(String authorizationIssue) {
+ this.authorizationIssue = authorizationIssue;
+ }
+
+ public Date getLastRefreshTime() {
+ return lastRefreshTime;
+ }
+
+ public void setLastRefreshTime(Date lastRefreshTime) {
+ this.lastRefreshTime = lastRefreshTime;
+ }
+
public String getId() {
return id;
}
@@ -156,6 +184,9 @@ public class RemoteProcessGroupStatus implements Cloneable {
clonedObj.id = id;
clonedObj.groupId = groupId;
clonedObj.name = name;
+ clonedObj.comments = comments;
+ clonedObj.authorizationIssue = authorizationIssue;
+ clonedObj.lastRefreshTime = lastRefreshTime;
clonedObj.uri = uri;
clonedObj.activeThreadCount = activeThreadCount;
clonedObj.transmissionStatus = transmissionStatus;
@@ -178,6 +209,12 @@ public class RemoteProcessGroupStatus implements Cloneable
{
builder.append(groupId);
builder.append(", name=");
builder.append(name);
+ builder.append(", comments=");
+ builder.append(comments);
+ builder.append(", authorizationIssue=");
+ builder.append(authorizationIssue);
+ builder.append(", lastRefreshTime=");
+ builder.append(lastRefreshTime);
builder.append(", uri=");
builder.append(uri);
builder.append(", activeThreadCount=");
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/reporting/AbstractEventAccess.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/reporting/AbstractEventAccess.java
index 2a0d409fb9..a9930dad92 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/reporting/AbstractEventAccess.java
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/reporting/AbstractEventAccess.java
@@ -510,6 +510,9 @@ public abstract class AbstractEventAccess implements
EventAccess {
final RemoteProcessGroupStatus status = new RemoteProcessGroupStatus();
status.setGroupId(remoteGroup.getProcessGroup().getIdentifier());
status.setName(isRemoteProcessGroupAuthorized ? remoteGroup.getName()
: remoteGroup.getIdentifier());
+ status.setComments(isRemoteProcessGroupAuthorized ?
remoteGroup.getComments() : null);
+ status.setAuthorizationIssue(remoteGroup.getAuthorizationIssue());
+ status.setLastRefreshTime(remoteGroup.getLastRefreshTime());
status.setTargetUri(isRemoteProcessGroupAuthorized ?
remoteGroup.getTargetUri() : null);
long lineageMillis = 0L;