use of com.redhat.service.smartevents.infra.models.processors.ProcessorType in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorDAO method getProcessorIds.
private ProcessorResults getProcessorIds(String customerId, String bridgeId, QueryProcessorResourceInfo queryInfo, Set<ProcessorType> restrictTypes) {
Parameters parameters = Parameters.with("customerId", customerId).and("bridgeId", bridgeId);
PanacheQuery<Processor> query = find("#PROCESSOR.findByBridgeIdAndCustomerIdNoFilter", parameters);
// filter by name
String filterName = queryInfo.getFilterInfo().getFilterName();
if (Objects.nonNull(filterName)) {
query.filter("byName", Parameters.with("name", filterName + "%"));
}
// filter by status
Set<ManagedResourceStatus> filterStatus = queryInfo.getFilterInfo().getFilterStatus();
if (Objects.nonNull(filterStatus) && !filterStatus.isEmpty()) {
query.filter("byStatus", Parameters.with("status", filterStatus));
}
// filter by type, considering onlyUserVisible flag
ProcessorType filterType = queryInfo.getFilterInfo().getFilterType();
if (restrictTypes != null) {
if (Objects.isNull(filterType)) {
query.filter(BY_TYPE_FILTER_NAME, Parameters.with(BY_TYPE_FILTER_PARAM, restrictTypes));
} else {
if (restrictTypes.contains(filterType)) {
query.filter(BY_TYPE_FILTER_NAME, Parameters.with(BY_TYPE_FILTER_PARAM, Set.of(filterType)));
} else {
return new ProcessorResults(emptyList(), 0);
}
}
} else {
if (Objects.nonNull(filterType)) {
query.filter(BY_TYPE_FILTER_NAME, Parameters.with(BY_TYPE_FILTER_PARAM, Set.of(filterType)));
}
}
long total = query.count();
List<Processor> processors = query.page(queryInfo.getPageNumber(), queryInfo.getPageSize()).list();
List<String> ids = processors.stream().map(Processor::getId).collect(Collectors.toList());
return new ProcessorResults(ids, total);
}
use of com.redhat.service.smartevents.infra.models.processors.ProcessorType in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceImpl method createErrorHandlerProcessor.
@Override
@Transactional
public Processor createErrorHandlerProcessor(String bridgeId, String customerId, String owner, ProcessorRequest processorRequest) {
Bridge bridge = bridgesService.getBridge(bridgeId, customerId);
ProcessorType processorType = processorRequest.getType();
if (processorType != ProcessorType.SINK) {
throw new InternalPlatformException("Unable to configure error handler");
}
return doCreateProcessor(bridge, customerId, owner, ProcessorType.ERROR_HANDLER, processorRequest);
}
Aggregations