use of org.apache.nifi.web.api.dto.status.StatusHistoryDTO in project nifi by apache.
the class StandardNiFiServiceFacade method getProcessorStatusHistory.
@Override
public StatusHistoryEntity getProcessorStatusHistory(final String id) {
final ProcessorNode processor = processorDAO.getProcessor(id);
final PermissionsDTO permissions = dtoFactory.createPermissionsDto(processor);
final StatusHistoryDTO dto = controllerFacade.getProcessorStatusHistory(id);
return entityFactory.createStatusHistoryEntity(dto, permissions);
}
use of org.apache.nifi.web.api.dto.status.StatusHistoryDTO in project nifi by apache.
the class StandardNiFiServiceFacade method getProcessGroupStatusHistory.
@Override
public StatusHistoryEntity getProcessGroupStatusHistory(final String groupId) {
final ProcessGroup processGroup = processGroupDAO.getProcessGroup(groupId);
final PermissionsDTO permissions = dtoFactory.createPermissionsDto(processGroup);
final StatusHistoryDTO dto = controllerFacade.getProcessGroupStatusHistory(groupId);
return entityFactory.createStatusHistoryEntity(dto, permissions);
}
use of org.apache.nifi.web.api.dto.status.StatusHistoryDTO 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.web.api.dto.status.StatusHistoryDTO 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;
}
use of org.apache.nifi.web.api.dto.status.StatusHistoryDTO in project nifi by apache.
the class ControllerFacade method getProcessorStatusHistory.
/**
* Returns the status history for the specified processor.
*
* @param processorId processor id
* @return status history
*/
public StatusHistoryDTO getProcessorStatusHistory(final String processorId) {
final ProcessGroup root = flowController.getGroup(flowController.getRootGroupId());
final ProcessorNode processor = root.findProcessor(processorId);
// ensure the processor was found
if (processor == null) {
throw new ResourceNotFoundException(String.format("Unable to locate processor with id '%s'.", processorId));
}
final boolean authorized = processor.isAuthorized(authorizer, RequestAction.READ, NiFiUserUtils.getNiFiUser());
final StatusHistoryDTO statusHistory = flowController.getProcessorStatusHistory(processorId, authorized);
// if not authorized
if (!authorized) {
statusHistory.getComponentDetails().put(ComponentStatusRepository.COMPONENT_DETAIL_NAME, processorId);
statusHistory.getComponentDetails().put(ComponentStatusRepository.COMPONENT_DETAIL_TYPE, "Processor");
}
return statusHistory;
}
Aggregations