Search in sources :

Example 1 with StatusHistoryDTO

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);
}
Also used : ProcessorNode(org.apache.nifi.controller.ProcessorNode) StatusHistoryDTO(org.apache.nifi.web.api.dto.status.StatusHistoryDTO) PermissionsDTO(org.apache.nifi.web.api.dto.PermissionsDTO)

Example 2 with StatusHistoryDTO

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);
}
Also used : StatusHistoryDTO(org.apache.nifi.web.api.dto.status.StatusHistoryDTO) PermissionsDTO(org.apache.nifi.web.api.dto.PermissionsDTO) VersionedProcessGroup(org.apache.nifi.registry.flow.VersionedProcessGroup) RemoteProcessGroup(org.apache.nifi.groups.RemoteProcessGroup) ProcessGroup(org.apache.nifi.groups.ProcessGroup) InstantiatedVersionedProcessGroup(org.apache.nifi.registry.flow.mapping.InstantiatedVersionedProcessGroup)

Example 3 with StatusHistoryDTO

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;
}
Also used : StatusHistoryDTO(org.apache.nifi.web.api.dto.status.StatusHistoryDTO) VersionedProcessGroup(org.apache.nifi.registry.flow.VersionedProcessGroup) RemoteProcessGroup(org.apache.nifi.groups.RemoteProcessGroup) ProcessGroup(org.apache.nifi.groups.ProcessGroup) ResourceNotFoundException(org.apache.nifi.web.ResourceNotFoundException)

Example 4 with StatusHistoryDTO

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;
}
Also used : RemoteProcessGroup(org.apache.nifi.groups.RemoteProcessGroup) StatusHistoryDTO(org.apache.nifi.web.api.dto.status.StatusHistoryDTO) VersionedProcessGroup(org.apache.nifi.registry.flow.VersionedProcessGroup) RemoteProcessGroup(org.apache.nifi.groups.RemoteProcessGroup) ProcessGroup(org.apache.nifi.groups.ProcessGroup) ResourceNotFoundException(org.apache.nifi.web.ResourceNotFoundException)

Example 5 with StatusHistoryDTO

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;
}
Also used : ProcessorNode(org.apache.nifi.controller.ProcessorNode) StatusHistoryDTO(org.apache.nifi.web.api.dto.status.StatusHistoryDTO) VersionedProcessGroup(org.apache.nifi.registry.flow.VersionedProcessGroup) RemoteProcessGroup(org.apache.nifi.groups.RemoteProcessGroup) ProcessGroup(org.apache.nifi.groups.ProcessGroup) ResourceNotFoundException(org.apache.nifi.web.ResourceNotFoundException)

Aggregations

StatusHistoryDTO (org.apache.nifi.web.api.dto.status.StatusHistoryDTO)10 RemoteProcessGroup (org.apache.nifi.groups.RemoteProcessGroup)6 ProcessGroup (org.apache.nifi.groups.ProcessGroup)5 VersionedProcessGroup (org.apache.nifi.registry.flow.VersionedProcessGroup)5 ResourceNotFoundException (org.apache.nifi.web.ResourceNotFoundException)4 PermissionsDTO (org.apache.nifi.web.api.dto.PermissionsDTO)4 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 LinkedHashMap (java.util.LinkedHashMap)2 LinkedHashSet (java.util.LinkedHashSet)2 Connection (org.apache.nifi.connectable.Connection)2 ProcessorNode (org.apache.nifi.controller.ProcessorNode)2 StatusSnapshotDTO (org.apache.nifi.web.api.dto.status.StatusSnapshotDTO)2 URI (java.net.URI)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 TreeMap (java.util.TreeMap)1