Search in sources :

Example 6 with BulletinStatus

use of org.apache.nifi.minifi.commons.status.common.BulletinStatus in project nifi-minifi by apache.

the class StatusReportPopulator method addReportingTaskStatus.

public static void addReportingTaskStatus(FlowStatusReport flowStatusReport, boolean addHealth, boolean addValidationErrors, boolean addBulletins, boolean populateBulletins) {
    ReportingTaskStatus reportingTaskStatus = new ReportingTaskStatus();
    reportingTaskStatus.setName("ReportProvenance");
    if (addHealth) {
        ReportingTaskHealth reportingTaskHealth = new ReportingTaskHealth();
        reportingTaskHealth.setActiveThreads(1);
        reportingTaskHealth.setScheduledState("RUNNING");
        reportingTaskHealth.setHasBulletins(populateBulletins);
        if (addValidationErrors) {
            List<ValidationError> validationErrorList = new LinkedList<>();
            ValidationError validationError1 = new ValidationError();
            validationError1.setInput("input");
            validationError1.setSubject("subject");
            validationError1.setReason("is not valid");
            validationErrorList.add(validationError1);
            ValidationError validationError2 = new ValidationError();
            validationError2.setInput("input2");
            validationError2.setSubject("subject2");
            validationError2.setReason("is not valid too");
            validationErrorList.add(validationError2);
            reportingTaskHealth.setValidationErrorList(validationErrorList);
        } else {
            reportingTaskHealth.setValidationErrorList(Collections.EMPTY_LIST);
        }
        reportingTaskStatus.setReportingTaskHealth(reportingTaskHealth);
    }
    if (addBulletins) {
        if (populateBulletins) {
            BulletinStatus bulletinStatus = new BulletinStatus();
            bulletinStatus.setMessage("Bulletin message");
            bulletinStatus.setTimestamp(new Date(1464019245000L));
            reportingTaskStatus.setBulletinList(Collections.singletonList(bulletinStatus));
        } else {
            reportingTaskStatus.setBulletinList(Collections.EMPTY_LIST);
        }
    }
    flowStatusReport.setReportingTaskStatusList(Collections.singletonList(reportingTaskStatus));
}
Also used : ValidationError(org.apache.nifi.minifi.commons.status.common.ValidationError) ReportingTaskStatus(org.apache.nifi.minifi.commons.status.reportingTask.ReportingTaskStatus) BulletinStatus(org.apache.nifi.minifi.commons.status.common.BulletinStatus) LinkedList(java.util.LinkedList) Date(java.util.Date) ReportingTaskHealth(org.apache.nifi.minifi.commons.status.reportingTask.ReportingTaskHealth)

Aggregations

BulletinStatus (org.apache.nifi.minifi.commons.status.common.BulletinStatus)6 Date (java.util.Date)5 LinkedList (java.util.LinkedList)4 ValidationError (org.apache.nifi.minifi.commons.status.common.ValidationError)3 ControllerServiceHealth (org.apache.nifi.minifi.commons.status.controllerservice.ControllerServiceHealth)1 ControllerServiceStatus (org.apache.nifi.minifi.commons.status.controllerservice.ControllerServiceStatus)1 InstanceHealth (org.apache.nifi.minifi.commons.status.instance.InstanceHealth)1 InstanceStats (org.apache.nifi.minifi.commons.status.instance.InstanceStats)1 InstanceStatus (org.apache.nifi.minifi.commons.status.instance.InstanceStatus)1 ProcessorHealth (org.apache.nifi.minifi.commons.status.processor.ProcessorHealth)1 ProcessorStats (org.apache.nifi.minifi.commons.status.processor.ProcessorStats)1 ProcessorStatusBean (org.apache.nifi.minifi.commons.status.processor.ProcessorStatusBean)1 ReportingTaskHealth (org.apache.nifi.minifi.commons.status.reportingTask.ReportingTaskHealth)1 ReportingTaskStatus (org.apache.nifi.minifi.commons.status.reportingTask.ReportingTaskStatus)1 PortStatus (org.apache.nifi.minifi.commons.status.rpg.PortStatus)1 RemoteProcessGroupHealth (org.apache.nifi.minifi.commons.status.rpg.RemoteProcessGroupHealth)1 RemoteProcessGroupStats (org.apache.nifi.minifi.commons.status.rpg.RemoteProcessGroupStats)1 RemoteProcessGroupStatusBean (org.apache.nifi.minifi.commons.status.rpg.RemoteProcessGroupStatusBean)1 SystemProcessorStats (org.apache.nifi.minifi.commons.status.system.SystemProcessorStats)1 Bulletin (org.apache.nifi.reporting.Bulletin)1