use of org.apache.nifi.groups.ProcessGroup in project nifi by apache.
the class ControllerFacade method getProcessGroupStatusHistory.
/**
* Returns the status history for the specified process group.
*
* @param groupId group id
* @return status history
*/
public StatusHistoryDTO getProcessGroupStatusHistory(final String groupId) {
final String searchId = groupId.equals(ROOT_GROUP_ID_ALIAS) ? flowController.getRootGroupId() : groupId;
final ProcessGroup root = flowController.getGroup(flowController.getRootGroupId());
final ProcessGroup group = root.findProcessGroup(searchId);
// ensure the processor was found
if (group == null) {
throw new ResourceNotFoundException(String.format("Unable to locate process group with id '%s'.", groupId));
}
final StatusHistoryDTO statusHistory = flowController.getProcessGroupStatusHistory(groupId);
// if not authorized
if (!group.isAuthorized(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser())) {
statusHistory.getComponentDetails().put(ComponentStatusRepository.COMPONENT_DETAIL_NAME, groupId);
}
return statusHistory;
}
use of org.apache.nifi.groups.ProcessGroup in project nifi by apache.
the class ControllerFacade method getOutputPorts.
/**
* Gets the output ports on the root group.
*
* @return output ports
*/
public Set<RootGroupPort> getOutputPorts() {
final Set<RootGroupPort> outputPorts = new HashSet<>();
ProcessGroup rootGroup = flowController.getGroup(flowController.getRootGroupId());
for (final Port port : rootGroup.getOutputPorts()) {
if (port instanceof RootGroupPort) {
outputPorts.add((RootGroupPort) port);
}
}
return outputPorts;
}
use of org.apache.nifi.groups.ProcessGroup in project nifi by apache.
the class ControllerFacade method getInputPorts.
/**
* Gets the input ports on the root group.
*
* @return input ports
*/
public Set<RootGroupPort> getInputPorts() {
final Set<RootGroupPort> inputPorts = new HashSet<>();
ProcessGroup rootGroup = flowController.getGroup(flowController.getRootGroupId());
for (final Port port : rootGroup.getInputPorts()) {
if (port instanceof RootGroupPort) {
inputPorts.add((RootGroupPort) port);
}
}
return inputPorts;
}
use of org.apache.nifi.groups.ProcessGroup in project nifi by apache.
the class ControllerFacade method getInputPortStatus.
/**
* Gets the status for the specified input port.
*
* @param portId input port id
* @return the status for the specified input port
*/
public PortStatus getInputPortStatus(final String portId) {
final ProcessGroup root = flowController.getGroup(flowController.getRootGroupId());
final Port port = root.findInputPort(portId);
// ensure the input port was found
if (port == null) {
throw new ResourceNotFoundException(String.format("Unable to locate input port with id '%s'.", portId));
}
final String groupId = port.getProcessGroup().getIdentifier();
final ProcessGroupStatus processGroupStatus = flowController.getGroupStatus(groupId, NiFiUserUtils.getNiFiUser());
if (processGroupStatus == null) {
throw new ResourceNotFoundException(String.format("Unable to locate group with id '%s'.", groupId));
}
final PortStatus status = processGroupStatus.getInputPortStatus().stream().filter(portStatus -> portId.equals(portStatus.getId())).findFirst().orElse(null);
if (status == null) {
throw new ResourceNotFoundException(String.format("Unable to locate input port with id '%s'.", portId));
}
return status;
}
use of org.apache.nifi.groups.ProcessGroup in project nifi by apache.
the class ControllerFacade method getRemoteProcessGroupStatusHistory.
/**
* Returns the status history for the specified remote process group.
*
* @param remoteProcessGroupId remote process group id
* @return status history
*/
public StatusHistoryDTO getRemoteProcessGroupStatusHistory(final String remoteProcessGroupId) {
final ProcessGroup root = flowController.getGroup(flowController.getRootGroupId());
final RemoteProcessGroup remoteProcessGroup = root.findRemoteProcessGroup(remoteProcessGroupId);
// ensure the output port was found
if (remoteProcessGroup == null) {
throw new ResourceNotFoundException(String.format("Unable to locate remote process group with id '%s'.", remoteProcessGroupId));
}
final StatusHistoryDTO statusHistory = flowController.getRemoteProcessGroupStatusHistory(remoteProcessGroupId);
// if not authorized
if (!remoteProcessGroup.isAuthorized(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser())) {
statusHistory.getComponentDetails().put(ComponentStatusRepository.COMPONENT_DETAIL_NAME, remoteProcessGroupId);
statusHistory.getComponentDetails().remove(ComponentStatusRepository.COMPONENT_DETAIL_URI);
}
return statusHistory;
}
Aggregations