Search in sources :

Example 1 with SearchResultsDTO

use of org.apache.nifi.web.api.dto.search.SearchResultsDTO in project kylo by Teradata.

the class LegacyNifiRestClient method findProcessorById.

public ProcessorDTO findProcessorById(String processorId) {
    SearchResultsDTO results = search(processorId);
    // log this
    if (results != null && results.getProcessorResults() != null && !results.getProcessorResults().isEmpty()) {
        log.info("Attempt to find processor by id {}. Processors Found: {} ", processorId, results.getProcessorResults().size());
        ComponentSearchResultDTO processorResult = results.getProcessorResults().get(0);
        String id = processorResult.getId();
        String groupId = processorResult.getGroupId();
        ProcessorDTO processorEntity = getProcessor(groupId, id);
        if (processorEntity != null) {
            return processorEntity;
        }
    } else {
        log.info("Unable to find Processor in Nifi for id: {}", processorId);
    }
    return null;
}
Also used : SearchResultsDTO(org.apache.nifi.web.api.dto.search.SearchResultsDTO) ProcessorDTO(org.apache.nifi.web.api.dto.ProcessorDTO) ComponentSearchResultDTO(org.apache.nifi.web.api.dto.search.ComponentSearchResultDTO)

Example 2 with SearchResultsDTO

use of org.apache.nifi.web.api.dto.search.SearchResultsDTO in project nifi by apache.

the class ControllerSearchServiceTest method setUp.

@Before
public void setUp() {
    variableRegistry = mock(MutableVariableRegistry.class);
    service = new ControllerSearchService();
    searchResultsDTO = new SearchResultsDTO();
}
Also used : SearchResultsDTO(org.apache.nifi.web.api.dto.search.SearchResultsDTO) MutableVariableRegistry(org.apache.nifi.registry.variable.MutableVariableRegistry) Before(org.junit.Before)

Example 3 with SearchResultsDTO

use of org.apache.nifi.web.api.dto.search.SearchResultsDTO in project nifi by apache.

the class FlowResource method searchFlow.

// ------
// search
// ------
/**
 * Performs a search request in this flow.
 *
 * @param value Search string
 * @return A searchResultsEntity
 * @throws InterruptedException if interrupted
 */
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@Path("search-results")
@ApiOperation(value = "Performs a search against this NiFi using the specified search term", notes = "Only search results from authorized components will be returned.", response = SearchResultsEntity.class, authorizations = { @Authorization(value = "Read - /flow") })
@ApiResponses(value = { @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(code = 401, message = "Client could not be authenticated."), @ApiResponse(code = 403, message = "Client is not authorized to make this request."), @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") })
public Response searchFlow(@QueryParam("q") @DefaultValue(StringUtils.EMPTY) String value) throws InterruptedException {
    authorizeFlow();
    // query the controller
    final SearchResultsDTO results = serviceFacade.searchController(value);
    // create the entity
    final SearchResultsEntity entity = new SearchResultsEntity();
    entity.setSearchResultsDTO(results);
    // generate the response
    return noCache(Response.ok(entity)).build();
}
Also used : SearchResultsDTO(org.apache.nifi.web.api.dto.search.SearchResultsDTO) ClusterSearchResultsEntity(org.apache.nifi.web.api.entity.ClusterSearchResultsEntity) SearchResultsEntity(org.apache.nifi.web.api.entity.SearchResultsEntity) Path(javax.ws.rs.Path) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 4 with SearchResultsDTO

use of org.apache.nifi.web.api.dto.search.SearchResultsDTO in project nifi by apache.

the class ControllerFacade method search.

/**
 * Searches this controller for the specified term.
 *
 * @param search search
 * @return result
 */
public SearchResultsDTO search(final String search) {
    final ProcessGroup rootGroup = flowController.getGroup(flowController.getRootGroupId());
    final SearchResultsDTO results = new SearchResultsDTO();
    controllerSearchService.search(results, search, rootGroup);
    return results;
}
Also used : SearchResultsDTO(org.apache.nifi.web.api.dto.search.SearchResultsDTO) VersionedProcessGroup(org.apache.nifi.registry.flow.VersionedProcessGroup) RemoteProcessGroup(org.apache.nifi.groups.RemoteProcessGroup) ProcessGroup(org.apache.nifi.groups.ProcessGroup)

Aggregations

SearchResultsDTO (org.apache.nifi.web.api.dto.search.SearchResultsDTO)4 ApiOperation (io.swagger.annotations.ApiOperation)1 ApiResponses (io.swagger.annotations.ApiResponses)1 Consumes (javax.ws.rs.Consumes)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 ProcessGroup (org.apache.nifi.groups.ProcessGroup)1 RemoteProcessGroup (org.apache.nifi.groups.RemoteProcessGroup)1 VersionedProcessGroup (org.apache.nifi.registry.flow.VersionedProcessGroup)1 MutableVariableRegistry (org.apache.nifi.registry.variable.MutableVariableRegistry)1 ProcessorDTO (org.apache.nifi.web.api.dto.ProcessorDTO)1 ComponentSearchResultDTO (org.apache.nifi.web.api.dto.search.ComponentSearchResultDTO)1 ClusterSearchResultsEntity (org.apache.nifi.web.api.entity.ClusterSearchResultsEntity)1 SearchResultsEntity (org.apache.nifi.web.api.entity.SearchResultsEntity)1 Before (org.junit.Before)1