All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ikasan.dashboard.notification.scheduler.service.SchedulerNotificationService Maven / Gradle / Ivy

There is a newer version: 4.0.1
Show newest version
package org.ikasan.dashboard.notification.scheduler.service;

import org.ikasan.solr.model.IkasanSolrDocument;
import org.ikasan.solr.model.IkasanSolrDocumentSearchResults;
import org.ikasan.spec.solr.SolrGeneralService;

import java.util.List;
import java.util.Optional;
import java.util.Set;

public class SchedulerNotificationService {
    private SolrGeneralService solrGeneralService;

    public SchedulerNotificationService(SolrGeneralService solrGeneralService) {
        this.solrGeneralService = solrGeneralService;
    }

    public Optional> getFailedScheduledJobs(String agentName, Long startTimestamp, Integer resultSize) {

        IkasanSolrDocumentSearchResults results = this.solrGeneralService.search(Set.of(agentName), Set.of()
            , "returnCode:0", startTimestamp, System.currentTimeMillis(), resultSize, List.of("scheduledProcessEvent")
            ,true, null, null);

        if(results.getTotalNumberOfResults() == 0) {
            return Optional.empty();
        }

        return Optional.of(results.getResultList());
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy