Search in sources :

Example 6 with JobEntryResult

use of org.pentaho.di.job.JobEntryResult in project pentaho-kettle by pentaho.

the class JobGridDelegate method addTrackerToTree.

private void addTrackerToTree(JobTracker jobTracker, TreeItem parentItem) {
    try {
        if (jobTracker != null) {
            TreeItem treeItem = new TreeItem(parentItem, SWT.NONE);
            if (nrRow % 2 != 0) {
                treeItem.setBackground(GUIResource.getInstance().getColorBlueCustomGrid());
            }
            nrRow++;
            if (jobTracker.nrJobTrackers() > 0) {
                // This is a sub-job: display the name at the top of the list...
                treeItem.setText(0, BaseMessages.getString(PKG, "JobLog.Tree.JobPrefix") + jobTracker.getJobName());
                // then populate the sub-job entries ...
                for (int i = 0; i < jobTracker.nrJobTrackers(); i++) {
                    addTrackerToTree(jobTracker.getJobTracker(i), treeItem);
                }
            } else {
                JobEntryResult result = jobTracker.getJobEntryResult();
                if (result != null) {
                    String jobEntryName = result.getJobEntryName();
                    if (!Utils.isEmpty(jobEntryName)) {
                        treeItem.setText(0, jobEntryName);
                        treeItem.setText(4, Const.NVL(result.getJobEntryFilename(), ""));
                    } else {
                        treeItem.setText(0, BaseMessages.getString(PKG, "JobLog.Tree.JobPrefix2") + jobTracker.getJobName());
                    }
                    String comment = result.getComment();
                    if (comment != null) {
                        treeItem.setText(1, comment);
                    }
                    Result res = result.getResult();
                    if (res != null) {
                        treeItem.setText(2, res.getResult() ? BaseMessages.getString(PKG, "JobLog.Tree.Success") : BaseMessages.getString(PKG, "JobLog.Tree.Failure"));
                        treeItem.setText(5, Long.toString(res.getEntryNr()));
                        if (res.getResult()) {
                            treeItem.setForeground(GUIResource.getInstance().getColorSuccessGreen());
                        } else {
                            treeItem.setForeground(GUIResource.getInstance().getColorRed());
                        }
                    }
                    String reason = result.getReason();
                    if (reason != null) {
                        treeItem.setText(3, reason);
                    }
                    Date logDate = result.getLogDate();
                    if (logDate != null) {
                        treeItem.setText(6, new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(logDate));
                    }
                }
            }
            treeItem.setExpanded(true);
        }
    } catch (Exception e) {
        log.logError(Const.getStackTracker(e));
    }
}
Also used : TreeItem(org.eclipse.swt.widgets.TreeItem) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) JobEntryResult(org.pentaho.di.job.JobEntryResult) Result(org.pentaho.di.core.Result) JobEntryResult(org.pentaho.di.job.JobEntryResult)

Example 7 with JobEntryResult

use of org.pentaho.di.job.JobEntryResult in project pentaho-kettle by pentaho.

the class JobTrackerTest method createTracker.

private static JobTracker createTracker(String jobEntryName, int jobEntryNr) {
    JobMeta jobMeta = mock(JobMeta.class);
    JobTracker jobTracker = new JobTracker(jobMeta);
    if (jobEntryName != null) {
        JobEntryResult result = mock(JobEntryResult.class);
        when(result.getJobEntryName()).thenReturn(jobEntryName);
        when(result.getJobEntryNr()).thenReturn(jobEntryNr);
        jobTracker.setJobEntryResult(result);
    }
    return jobTracker;
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) JobEntryResult(org.pentaho.di.job.JobEntryResult)

Aggregations

JobEntryResult (org.pentaho.di.job.JobEntryResult)7 Result (org.pentaho.di.core.Result)3 JobEntryCopy (org.pentaho.di.job.entry.JobEntryCopy)3 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 Image (org.eclipse.swt.graphics.Image)2 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)2 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)2 JobTracker (org.pentaho.di.core.gui.JobTracker)2 Point (org.pentaho.di.core.gui.Point)2 SimpleDateFormat (java.text.SimpleDateFormat)1 TreeItem (org.eclipse.swt.widgets.TreeItem)1 ResultFile (org.pentaho.di.core.ResultFile)1 AreaOwner (org.pentaho.di.core.gui.AreaOwner)1 GCInterface (org.pentaho.di.core.gui.GCInterface)1 Job (org.pentaho.di.job.Job)1 JobHopMeta (org.pentaho.di.job.JobHopMeta)1 JobMeta (org.pentaho.di.job.JobMeta)1 JobPainter (org.pentaho.di.job.JobPainter)1 JobEntryInterface (org.pentaho.di.job.entry.JobEntryInterface)1