use of org.apache.nifi.web.api.dto.search.ComponentSearchResultDTO in project nifi by apache.
the class ControllerSearchService method search.
private ComponentSearchResultDTO search(final String searchStr, final Funnel funnel) {
final List<String> matches = new ArrayList<>();
addIfAppropriate(searchStr, funnel.getIdentifier(), "Id", matches);
addIfAppropriate(searchStr, funnel.getVersionedComponentId().orElse(null), "Version Control ID", matches);
if (matches.isEmpty()) {
return null;
}
final ComponentSearchResultDTO dto = new ComponentSearchResultDTO();
dto.setId(funnel.getIdentifier());
dto.setName(funnel.getName());
dto.setMatches(matches);
return dto;
}
use of org.apache.nifi.web.api.dto.search.ComponentSearchResultDTO in project nifi by apache.
the class ControllerSearchService method search.
private ComponentSearchResultDTO search(final String searchStr, final Port port) {
final List<String> matches = new ArrayList<>();
addIfAppropriate(searchStr, port.getIdentifier(), "Id", matches);
addIfAppropriate(searchStr, port.getVersionedComponentId().orElse(null), "Version Control ID", matches);
addIfAppropriate(searchStr, port.getName(), "Name", matches);
addIfAppropriate(searchStr, port.getComments(), "Comments", matches);
// consider scheduled state
if (ScheduledState.DISABLED.equals(port.getScheduledState())) {
if (StringUtils.containsIgnoreCase("disabled", searchStr)) {
matches.add("Run status: Disabled");
}
} else {
if (StringUtils.containsIgnoreCase("invalid", searchStr) && !port.isValid()) {
matches.add("Run status: Invalid");
} else if (ScheduledState.RUNNING.equals(port.getScheduledState()) && StringUtils.containsIgnoreCase("running", searchStr)) {
matches.add("Run status: Running");
} else if (ScheduledState.STOPPED.equals(port.getScheduledState()) && StringUtils.containsIgnoreCase("stopped", searchStr)) {
matches.add("Run status: Stopped");
}
}
if (port instanceof RootGroupPort) {
final RootGroupPort rootGroupPort = (RootGroupPort) port;
// user access controls
for (final String userAccessControl : rootGroupPort.getUserAccessControl()) {
addIfAppropriate(searchStr, userAccessControl, "User access control", matches);
}
// group access controls
for (final String groupAccessControl : rootGroupPort.getGroupAccessControl()) {
addIfAppropriate(searchStr, groupAccessControl, "Group access control", matches);
}
}
if (matches.isEmpty()) {
return null;
}
final ComponentSearchResultDTO dto = new ComponentSearchResultDTO();
dto.setId(port.getIdentifier());
dto.setName(port.getName());
dto.setMatches(matches);
return dto;
}
use of org.apache.nifi.web.api.dto.search.ComponentSearchResultDTO in project nifi by apache.
the class ControllerSearchService method search.
private ComponentSearchResultDTO search(final String searchStr, final RemoteProcessGroup group) {
final List<String> matches = new ArrayList<>();
addIfAppropriate(searchStr, group.getIdentifier(), "Id", matches);
addIfAppropriate(searchStr, group.getVersionedComponentId().orElse(null), "Version Control ID", matches);
addIfAppropriate(searchStr, group.getName(), "Name", matches);
addIfAppropriate(searchStr, group.getComments(), "Comments", matches);
addIfAppropriate(searchStr, group.getTargetUris(), "URLs", matches);
// consider the transmission status
if ((StringUtils.containsIgnoreCase("transmitting", searchStr) || StringUtils.containsIgnoreCase("transmission enabled", searchStr)) && group.isTransmitting()) {
matches.add("Transmission: On");
} else if ((StringUtils.containsIgnoreCase("not transmitting", searchStr) || StringUtils.containsIgnoreCase("transmission disabled", searchStr)) && !group.isTransmitting()) {
matches.add("Transmission: Off");
}
if (matches.isEmpty()) {
return null;
}
final ComponentSearchResultDTO result = new ComponentSearchResultDTO();
result.setId(group.getIdentifier());
result.setName(group.getName());
result.setMatches(matches);
return result;
}
Aggregations