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));
}
}
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;
}
Aggregations