This is an automated email from the ASF dual-hosted git repository.
mcgilman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/master by this push:
new 731df87 NIFI-6626: Fixed the order of arguments passed to the
ComponentDetails constructor when creating the Component Details for a
connection. Also noticed that null fields are being added to the map when
calling ComponentDetails.toMap() and this causes the UI to display these fields
even though they have no value, so avoided populating the map with fields whose
values are null
731df87 is described below
commit 731df87f22d5028f044c3c6d5f34a3a6da4972ca
Author: Mark Payne <[email protected]>
AuthorDate: Thu Sep 5 15:05:42 2019 -0400
NIFI-6626: Fixed the order of arguments passed to the ComponentDetails
constructor when creating the Component Details for a connection. Also noticed
that null fields are being added to the map when calling
ComponentDetails.toMap() and this causes the UI to display these fields even
though they have no value, so avoided populating the map with fields whose
values are null
This closes #3696
---
.../status/history/ComponentDetails.java | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/ComponentDetails.java
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/ComponentDetails.java
index 68a79b9..e7a93fa 100644
---
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/ComponentDetails.java
+++
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/ComponentDetails.java
@@ -58,7 +58,7 @@ public class ComponentDetails {
}
public static ComponentDetails forConnection(final String id, final String
groupId, final String connectionName, final String sourceName, final String
destinationName) {
- return new ComponentDetails(id, groupId, connectionName, sourceName,
destinationName, null, null);
+ return new ComponentDetails(id, groupId, connectionName, null,
sourceName, destinationName, null);
}
public static ComponentDetails forProcessGroup(final ProcessGroupStatus
status) {
@@ -111,13 +111,19 @@ public class ComponentDetails {
*/
public Map<String, String> toMap() {
final Map<String, String> map = new HashMap<>();
- map.put(ComponentStatusRepository.COMPONENT_DETAIL_ID, componentId);
- map.put(ComponentStatusRepository.COMPONENT_DETAIL_GROUP_ID, groupId);
- map.put(ComponentStatusRepository.COMPONENT_DETAIL_NAME,
componentName);
- map.put(ComponentStatusRepository.COMPONENT_DETAIL_TYPE,
componentType);
- map.put(ComponentStatusRepository.COMPONENT_DETAIL_SOURCE_NAME,
sourceName);
- map.put(ComponentStatusRepository.COMPONENT_DETAIL_DESTINATION_NAME,
destinationName);
- map.put(ComponentStatusRepository.COMPONENT_DETAIL_URI, targetUri);
+ addToMap(map, ComponentStatusRepository.COMPONENT_DETAIL_ID,
componentId);
+ addToMap(map, ComponentStatusRepository.COMPONENT_DETAIL_GROUP_ID,
groupId);
+ addToMap(map, ComponentStatusRepository.COMPONENT_DETAIL_NAME,
componentName);
+ addToMap(map, ComponentStatusRepository.COMPONENT_DETAIL_TYPE,
componentType);
+ addToMap(map, ComponentStatusRepository.COMPONENT_DETAIL_SOURCE_NAME,
sourceName);
+ addToMap(map,
ComponentStatusRepository.COMPONENT_DETAIL_DESTINATION_NAME, destinationName);
+ addToMap(map, ComponentStatusRepository.COMPONENT_DETAIL_URI,
targetUri);
return map;
}
+
+ private void addToMap(final Map<String, String> map, final String key,
final String value) {
+ if (value != null) {
+ map.put(key, value);
+ }
+ }
}