use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.
the class JobGraph method delSelected.
public void delSelected(JobEntryCopy clickedEntry) {
List<JobEntryCopy> copies = jobMeta.getSelectedEntries();
int nrsels = copies.size();
if (nrsels == 0) {
if (clickedEntry != null) {
spoon.deleteJobEntryCopies(jobMeta, clickedEntry);
}
return;
}
JobEntryCopy[] jobEntries = copies.toArray(new JobEntryCopy[copies.size()]);
spoon.deleteJobEntryCopies(jobMeta, jobEntries);
}
use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.
the class JobGraph method replayJob.
public void replayJob() {
List<JobEntryCopy> selectedEntries = jobMeta.getSelectedEntries();
if (selectedEntries.size() != 1) {
MessageBox box = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.CLOSE);
box.setText(BaseMessages.getString(PKG, "JobGraph.ReplayJob.SelectOneEntryToStartFrom.Title"));
box.setMessage(BaseMessages.getString(PKG, "JobGraph.ReplayJob.SelectOneEntryToStartFrom.Message"));
box.open();
return;
}
JobEntryCopy copy = selectedEntries.get(0);
spoon.executeJob(jobMeta, true, false, null, false, copy.getName(), copy.getNr());
}
use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.
the class JobGraph method addCandidateAsHop.
private void addCandidateAsHop() {
if (hop_candidate != null) {
if (!hop_candidate.getFromEntry().evaluates() && hop_candidate.getFromEntry().isUnconditional()) {
hop_candidate.setUnconditional();
} else {
hop_candidate.setConditional();
int nr = jobMeta.findNrNextJobEntries(hop_candidate.getFromEntry());
// vice-versa)
if (nr == 1) {
JobEntryCopy jge = jobMeta.findNextJobEntry(hop_candidate.getFromEntry(), 0);
JobHopMeta other = jobMeta.findJobHop(hop_candidate.getFromEntry(), jge);
if (other != null) {
hop_candidate.setEvaluation(!other.getEvaluation());
}
}
}
if (checkIfHopAlreadyExists(jobMeta, hop_candidate)) {
boolean cancel = false;
jobMeta.addJobHop(hop_candidate);
if (jobMeta.hasLoop(hop_candidate.getToEntry())) {
MessageBox mb = new MessageBox(spoon.getShell(), SWT.OK | SWT.CANCEL | SWT.ICON_WARNING);
mb.setMessage(BaseMessages.getString(PKG, "JobGraph.Dialog.HopCausesLoop.Message"));
mb.setText(BaseMessages.getString(PKG, "JobGraph.Dialog.HopCausesLoop.Title"));
int choice = mb.open();
if (choice == SWT.CANCEL) {
jobMeta.removeJobHop(hop_candidate);
cancel = true;
}
}
if (!cancel) {
spoon.addUndoNew(jobMeta, new JobHopMeta[] { hop_candidate }, new int[] { jobMeta.indexOfJobHop(hop_candidate) });
}
spoon.refreshTree();
clearSettings();
redraw();
}
}
}
use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.
the class JobGraph method selectInRect.
public void selectInRect(JobMeta jobMeta, org.pentaho.di.core.gui.Rectangle rect) {
int i;
for (i = 0; i < jobMeta.nrJobEntries(); i++) {
JobEntryCopy je = jobMeta.getJobEntry(i);
Point p = je.getLocation();
if (((p.x >= rect.x && p.x <= rect.x + rect.width) || (p.x >= rect.x + rect.width && p.x <= rect.x)) && ((p.y >= rect.y && p.y <= rect.y + rect.height) || (p.y >= rect.y + rect.height && p.y <= rect.y))) {
je.setSelected(true);
}
}
for (i = 0; i < jobMeta.nrNotes(); i++) {
NotePadMeta ni = jobMeta.getNote(i);
Point a = ni.getLocation();
Point b = new Point(a.x + ni.width, a.y + ni.height);
if (rect.contains(a.x, a.y) && rect.contains(b.x, b.y)) {
ni.setSelected(true);
}
}
}
use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.
the class JobGraph method enableDisableNextHops.
private Set<JobEntryCopy> enableDisableNextHops(JobEntryCopy from, boolean enabled, Set<JobEntryCopy> checkedEntries) {
checkedEntries.add(from);
jobMeta.getJobhops().stream().filter(hop -> from.equals(hop.getFromEntry())).forEach(hop -> {
if (hop.isEnabled() != enabled) {
JobHopMeta before = (JobHopMeta) hop.clone();
hop.setEnabled(enabled);
JobHopMeta after = (JobHopMeta) hop.clone();
spoon.addUndoChange(jobMeta, new JobHopMeta[] { before }, new JobHopMeta[] { after }, new int[] { jobMeta.indexOfJobHop(hop) });
}
if (!checkedEntries.contains(hop.getToEntry())) {
enableDisableNextHops(hop.getToEntry(), enabled, checkedEntries);
}
});
return checkedEntries;
}
Aggregations