use of org.pentaho.di.job.JobHopMeta in project pentaho-kettle by pentaho.
the class JobGraph method enableHopsBetweenSelectedEntries.
/**
* This method enables or disables all the hops between the selected Entries.
*/
public void enableHopsBetweenSelectedEntries(boolean enabled) {
List<JobEntryCopy> list = jobMeta.getSelectedEntries();
boolean hasLoop = false;
for (int i = 0; i < jobMeta.nrJobHops(); i++) {
JobHopMeta hop = jobMeta.getJobHop(i);
if (list.contains(hop.getFromEntry()) && list.contains(hop.getToEntry())) {
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 (jobMeta.hasLoop(hop.getToEntry())) {
hasLoop = true;
}
}
}
if (hasLoop && enabled) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_WARNING);
mb.setMessage(BaseMessages.getString(PKG, "JobGraph.Dialog.LoopAfterHopEnabled.Message"));
mb.setText(BaseMessages.getString(PKG, "JobGraph.Dialog.LoopAfterHopEnabled.Title"));
mb.open();
}
spoon.refreshGraph();
}
use of org.pentaho.di.job.JobHopMeta in project pentaho-kettle by pentaho.
the class JobGraph method mouseUp.
public void mouseUp(MouseEvent e) {
boolean control = (e.stateMask & SWT.MOD1) != 0;
if (iconoffset == null) {
iconoffset = new Point(0, 0);
}
Point real = screen2real(e.x, e.y);
Point icon = new Point(real.x - iconoffset.x, real.y - iconoffset.y);
//
if (hop_candidate != null) {
addCandidateAsHop();
redraw();
} else {
//
if (selectionRegion != null) {
selectionRegion.width = real.x - selectionRegion.x;
selectionRegion.height = real.y - selectionRegion.y;
jobMeta.unselectAll();
selectInRect(jobMeta, selectionRegion);
selectionRegion = null;
stopEntryMouseOverDelayTimers();
redraw();
} else {
//
if (selectedEntry != null && startHopEntry == null) {
if (e.button == 1) {
Point realclick = screen2real(e.x, e.y);
if (lastclick.x == realclick.x && lastclick.y == realclick.y) {
// Flip selection when control is pressed!
if (control) {
selectedEntry.flipSelected();
} else {
// Otherwise, select only the icon clicked on!
jobMeta.unselectAll();
selectedEntry.setSelected(true);
}
} else {
// Find out which Steps & Notes are selected
selectedEntries = jobMeta.getSelectedEntries();
selectedNotes = jobMeta.getSelectedNotes();
// We moved around some items: store undo info...
//
boolean also = false;
if (selectedNotes != null && selectedNotes.size() > 0 && previous_note_locations != null) {
int[] indexes = jobMeta.getNoteIndexes(selectedNotes);
addUndoPosition(selectedNotes.toArray(new NotePadMeta[selectedNotes.size()]), indexes, previous_note_locations, jobMeta.getSelectedNoteLocations(), also);
also = selectedEntries != null && selectedEntries.size() > 0;
}
if (selectedEntries != null && selectedEntries.size() > 0 && previous_step_locations != null) {
int[] indexes = jobMeta.getEntryIndexes(selectedEntries);
addUndoPosition(selectedEntries.toArray(new JobEntryCopy[selectedEntries.size()]), indexes, previous_step_locations, jobMeta.getSelectedLocations(), also);
}
}
}
// If so, ask to split the hop!
if (split_hop) {
JobHopMeta hi = findHop(icon.x + iconsize / 2, icon.y + iconsize / 2, selectedEntry);
if (hi != null) {
int id = 0;
if (!spoon.props.getAutoSplit()) {
MessageDialogWithToggle md = new MessageDialogWithToggle(shell, BaseMessages.getString(PKG, "TransGraph.Dialog.SplitHop.Title"), null, BaseMessages.getString(PKG, "TransGraph.Dialog.SplitHop.Message") + Const.CR + hi.toString(), MessageDialog.QUESTION, new String[] { BaseMessages.getString(PKG, "System.Button.Yes"), BaseMessages.getString(PKG, "System.Button.No") }, 0, BaseMessages.getString(PKG, "TransGraph.Dialog.Option.SplitHop.DoNotAskAgain"), spoon.props.getAutoSplit());
MessageDialogWithToggle.setDefaultImage(GUIResource.getInstance().getImageSpoon());
id = md.open();
spoon.props.setAutoSplit(md.getToggleState());
}
if ((id & 0xFF) == 0) {
//
if (jobMeta.findJobHop(selectedEntry, hi.getFromEntry()) == null && jobMeta.findJobHop(hi.getToEntry(), selectedEntry) == null) {
if (jobMeta.findJobHop(hi.getFromEntry(), selectedEntry, true) == null) {
JobHopMeta newhop1 = new JobHopMeta(hi.getFromEntry(), selectedEntry);
if (hi.getFromEntry().getEntry().isUnconditional()) {
newhop1.setUnconditional();
}
jobMeta.addJobHop(newhop1);
spoon.addUndoNew(jobMeta, new JobHopMeta[] { newhop1 }, new int[] { jobMeta.indexOfJobHop(newhop1) }, true);
}
if (jobMeta.findJobHop(selectedEntry, hi.getToEntry(), true) == null) {
JobHopMeta newhop2 = new JobHopMeta(selectedEntry, hi.getToEntry());
if (selectedEntry.getEntry().isUnconditional()) {
newhop2.setUnconditional();
}
jobMeta.addJobHop(newhop2);
spoon.addUndoNew(jobMeta, new JobHopMeta[] { newhop2 }, new int[] { jobMeta.indexOfJobHop(newhop2) }, true);
}
int idx = jobMeta.indexOfJobHop(hi);
spoon.addUndoDelete(jobMeta, new JobHopMeta[] { hi }, new int[] { idx }, true);
jobMeta.removeJobHop(idx);
spoon.refreshTree();
}
// else: Silently discard this hop-split attempt.
}
}
split_hop = false;
}
selectedEntries = null;
selectedNotes = null;
selectedEntry = null;
selectedNote = null;
startHopEntry = null;
endHopLocation = null;
redraw();
spoon.setShellText();
} else {
// Notes?
if (selectedNote != null) {
if (e.button == 1) {
if (lastclick.x == e.x && lastclick.y == e.y) {
// Flip selection when control is pressed!
if (control) {
selectedNote.flipSelected();
} else {
// Otherwise, select only the note clicked on!
jobMeta.unselectAll();
selectedNote.setSelected(true);
}
} else {
// Find out which Steps & Notes are selected
selectedEntries = jobMeta.getSelectedEntries();
selectedNotes = jobMeta.getSelectedNotes();
// We moved around some items: store undo info...
boolean also = false;
if (selectedNotes != null && selectedNotes.size() > 0 && previous_note_locations != null) {
int[] indexes = jobMeta.getNoteIndexes(selectedNotes);
addUndoPosition(selectedNotes.toArray(new NotePadMeta[selectedNotes.size()]), indexes, previous_note_locations, jobMeta.getSelectedNoteLocations(), also);
also = selectedEntries != null && selectedEntries.size() > 0;
}
if (selectedEntries != null && selectedEntries.size() > 0 && previous_step_locations != null) {
int[] indexes = jobMeta.getEntryIndexes(selectedEntries);
addUndoPosition(selectedEntries.toArray(new JobEntryCopy[selectedEntries.size()]), indexes, previous_step_locations, jobMeta.getSelectedLocations(), also);
}
}
}
selectedNotes = null;
selectedEntries = null;
selectedEntry = null;
selectedNote = null;
startHopEntry = null;
endHopLocation = null;
} else {
AreaOwner areaOwner = getVisibleAreaOwner(real.x, real.y);
if (areaOwner == null && selectionRegion == null) {
// Hit absolutely nothing: clear the settings
//
clearSettings();
}
}
}
}
}
lastButton = 0;
}
use of org.pentaho.di.job.JobHopMeta in project pentaho-kettle by pentaho.
the class JobGraph method setMenu.
protected synchronized void setMenu(int x, int y) {
currentMouseX = x;
currentMouseY = y;
final JobEntryCopy jobEntry = jobMeta.getJobEntryCopy(x, y, iconsize);
setJobEntry(jobEntry);
Document doc = xulDomContainer.getDocumentRoot();
if (jobEntry != null) {
// We clicked on a Job Entry!
XulMenupopup menu = (XulMenupopup) doc.getElementById("job-graph-entry");
if (menu != null) {
List<JobEntryCopy> selection = jobMeta.getSelectedEntries();
doRightClickSelection(jobEntry, selection);
int sels = selection.size();
XulMenuitem item = (XulMenuitem) doc.getElementById("job-graph-entry-newhop");
item.setDisabled(sels < 2);
JfaceMenupopup launchMenu = (JfaceMenupopup) doc.getElementById("job-graph-entry-launch-popup");
String[] referencedObjects = jobEntry.getEntry().getReferencedObjectDescriptions();
boolean[] enabledObjects = jobEntry.getEntry().isReferencedObjectEnabled();
launchMenu.setDisabled(Utils.isEmpty(referencedObjects));
launchMenu.removeChildren();
if (!Utils.isEmpty(referencedObjects)) {
for (int i = 0; i < referencedObjects.length; i++) {
final int index = i;
String referencedObject = referencedObjects[i];
Action action = new Action(referencedObject, Action.AS_DROP_DOWN_MENU) {
public void run() {
loadReferencedObject(jobEntry, index);
}
};
JfaceMenuitem child = new JfaceMenuitem(null, launchMenu, xulDomContainer, referencedObject, i, action);
child.setLabel(referencedObject);
child.setDisabled(!enabledObjects[i]);
}
}
item = (XulMenuitem) doc.getElementById("job-graph-entry-align-snap");
item.setAcceltext("ALT-HOME");
item.setLabel(BaseMessages.getString(PKG, "JobGraph.PopupMenu.JobEntry.AllignDistribute.SnapToGrid"));
item.setAccesskey("alt-home");
XulMenu aMenu = (XulMenu) doc.getElementById("job-graph-entry-align");
if (aMenu != null) {
aMenu.setDisabled(sels < 1);
}
item = (XulMenuitem) doc.getElementById("job-graph-entry-detach");
if (item != null) {
item.setDisabled(!jobMeta.isEntryUsedInHops(jobEntry));
}
item = (XulMenuitem) doc.getElementById("job-graph-entry-hide");
if (item != null) {
item.setDisabled(!(jobEntry.isDrawn() && !jobMeta.isEntryUsedInHops(jobEntry)));
}
item = (XulMenuitem) doc.getElementById("job-graph-entry-delete");
if (item != null) {
item.setDisabled(!jobEntry.isDrawn());
}
item = (XulMenuitem) doc.getElementById("job-graph-entry-parallel");
if (item != null) {
item.setSelected(jobEntry.isLaunchingInParallel());
}
try {
JobGraphJobEntryMenuExtension extension = new JobGraphJobEntryMenuExtension(xulDomContainer, doc, jobMeta, jobEntry, this);
ExtensionPointHandler.callExtensionPoint(log, KettleExtensionPoint.JobGraphJobEntrySetMenu.id, extension);
} catch (Exception e) {
log.logError("Error handling menu right click on job entry through extension point", e);
}
ConstUI.displayMenu(menu, canvas);
}
} else {
// Clear the menu
final JobHopMeta hi = findJobHop(x, y);
setCurrentHop(hi);
if (hi != null) {
// We clicked on a HOP!
XulMenupopup menu = (XulMenupopup) doc.getElementById("job-graph-hop");
if (menu != null) {
XulMenuitem miPopEvalUncond = (XulMenuitem) doc.getElementById("job-graph-hop-evaluation-uncond");
XulMenuitem miPopEvalTrue = (XulMenuitem) doc.getElementById("job-graph-hop-evaluation-true");
XulMenuitem miPopEvalFalse = (XulMenuitem) doc.getElementById("job-graph-hop-evaluation-false");
XulMenuitem miDisHop = (XulMenuitem) doc.getElementById("job-graph-hop-enabled");
XulMenuitem miFlipHop = (XulMenuitem) doc.getElementById("job-graph-hop-flip");
//
if (miPopEvalUncond != null && miPopEvalTrue != null && miPopEvalFalse != null) {
if (hi.isUnconditional()) {
miPopEvalUncond.setSelected(true);
miPopEvalTrue.setSelected(false);
miPopEvalFalse.setSelected(false);
} else {
if (hi.getEvaluation()) {
miPopEvalUncond.setSelected(false);
miPopEvalTrue.setSelected(true);
miPopEvalFalse.setSelected(false);
} else {
miPopEvalUncond.setSelected(false);
miPopEvalTrue.setSelected(false);
miPopEvalFalse.setSelected(true);
}
}
if (!hi.getFromEntry().evaluates()) {
miPopEvalTrue.setDisabled(true);
miPopEvalFalse.setDisabled(true);
} else {
miPopEvalTrue.setDisabled(false);
miPopEvalFalse.setDisabled(false);
}
if (!hi.getFromEntry().isUnconditional()) {
miPopEvalUncond.setDisabled(true);
} else {
miPopEvalUncond.setDisabled(false);
}
if (hi.getFromEntry().isStart()) {
miFlipHop.setDisabled(true);
} else {
miFlipHop.setDisabled(false);
}
}
if (miDisHop != null) {
if (hi.isEnabled()) {
miDisHop.setLabel(BaseMessages.getString(PKG, "JobGraph.PopupMenu.Hop.Disable"));
} else {
miDisHop.setLabel(BaseMessages.getString(PKG, "JobGraph.PopupMenu.Hop.Enable"));
}
}
ConstUI.displayMenu(menu, canvas);
}
} else {
// Clicked on the background: maybe we hit a note?
final NotePadMeta ni = jobMeta.getNote(x, y);
setCurrentNote(ni);
if (ni != null) {
XulMenupopup menu = (XulMenupopup) doc.getElementById("job-graph-note");
if (menu != null) {
ConstUI.displayMenu(menu, canvas);
}
} else {
XulMenupopup menu = (XulMenupopup) doc.getElementById("job-graph-background");
if (menu != null) {
final String clipcontent = spoon.fromClipboard();
XulMenuitem item = (XulMenuitem) doc.getElementById("job-graph-note-paste");
if (item != null) {
item.setDisabled(clipcontent == null);
}
ConstUI.displayMenu(menu, canvas);
}
}
}
}
}
use of org.pentaho.di.job.JobHopMeta in project pentaho-kettle by pentaho.
the class JobDelegate method elementToDataNode.
public DataNode elementToDataNode(final RepositoryElementInterface element) throws KettleException {
JobMeta jobMeta = (JobMeta) element;
DataNode rootNode = new DataNode(NODE_JOB);
if (jobMeta.getPrivateDatabases() != null) {
// save all private database names http://jira.pentaho.com/browse/PPP-3413
String privateDatabaseNames = StringUtils.join(jobMeta.getPrivateDatabases(), JOB_PRIVATE_DATABASE_DELIMITER);
DataNode privateDatabaseNode = rootNode.addNode(NODE_JOB_PRIVATE_DATABASES);
privateDatabaseNode.setProperty(PROP_JOB_PRIVATE_DATABASE_NAMES, privateDatabaseNames);
}
// Save the notes
//
DataNode notesNode = rootNode.addNode(NODE_NOTES);
notesNode.setProperty(PROP_NR_NOTES, jobMeta.nrNotes());
for (int i = 0; i < jobMeta.nrNotes(); i++) {
NotePadMeta note = jobMeta.getNote(i);
DataNode noteNode = notesNode.addNode(NOTE_PREFIX + i);
noteNode.setProperty(PROP_XML, note.getXML());
}
//
if (log.isDetailed()) {
// $NON-NLS-1$ //$NON-NLS-2$
log.logDetailed(toString(), "Saving " + jobMeta.nrJobEntries() + " Job enty copies to repository...");
}
DataNode entriesNode = rootNode.addNode(NODE_ENTRIES);
entriesNode.setProperty(PROP_NR_JOB_ENTRY_COPIES, jobMeta.nrJobEntries());
for (int i = 0; i < jobMeta.nrJobEntries(); i++) {
JobEntryCopy copy = jobMeta.getJobEntry(i);
JobEntryInterface entry = copy.getEntry();
// Create a new node for each entry...
//
DataNode copyNode = entriesNode.addNode(// $NON-NLS-1$
sanitizeNodeName(copy.getName()) + "_" + (i + 1) + EXT_JOB_ENTRY_COPY);
copyNode.setProperty(PROP_NAME, copy.getName());
copyNode.setProperty(PROP_DESCRIPTION, copy.getDescription());
copyNode.setProperty(PROP_NR, copy.getNr());
copyNode.setProperty(PROP_GUI_LOCATION_X, copy.getLocation().x);
copyNode.setProperty(PROP_GUI_LOCATION_Y, copy.getLocation().y);
copyNode.setProperty(PROP_GUI_DRAW, copy.isDrawn());
copyNode.setProperty(PROP_PARALLEL, copy.isLaunchingInParallel());
//
if (entry instanceof JobEntryBase) {
AttributesMapUtil.saveAttributesMap(copyNode, (JobEntryBase) entry);
}
AttributesMapUtil.saveAttributesMap(copyNode, copy);
// Save the entry information here as well, for completeness.
// TODO: since this slightly stores duplicate information, figure out how to store this separately.
//
copyNode.setProperty(PROP_JOBENTRY_TYPE, entry.getPluginId());
DataNode customNode = new DataNode(NODE_CUSTOM);
RepositoryProxy proxy = new RepositoryProxy(customNode);
entry.saveRep(proxy, proxy.getMetaStore(), null);
compatibleEntrySaveRep(entry, proxy, null);
copyNode.addNode(customNode);
}
// Finally, save the hops
//
DataNode hopsNode = rootNode.addNode(NODE_HOPS);
hopsNode.setProperty(PROP_NR_HOPS, jobMeta.nrJobHops());
for (int i = 0; i < jobMeta.nrJobHops(); i++) {
JobHopMeta hop = jobMeta.getJobHop(i);
DataNode hopNode = hopsNode.addNode(JOB_HOP_PREFIX + i);
hopNode.setProperty(JOB_HOP_FROM, hop.getFromEntry().getName());
hopNode.setProperty(JOB_HOP_FROM_NR, hop.getFromEntry().getNr());
hopNode.setProperty(JOB_HOP_TO, hop.getToEntry().getName());
hopNode.setProperty(JOB_HOP_TO_NR, hop.getToEntry().getNr());
hopNode.setProperty(JOB_HOP_ENABLED, hop.isEnabled());
hopNode.setProperty(JOB_HOP_EVALUATION, hop.getEvaluation());
hopNode.setProperty(JOB_HOP_UNCONDITIONAL, hop.isUnconditional());
}
String[] paramKeys = jobMeta.listParameters();
DataNode paramsNode = rootNode.addNode(NODE_PARAMETERS);
paramsNode.setProperty(PROP_NR_PARAMETERS, paramKeys == null ? 0 : paramKeys.length);
for (int idx = 0; idx < paramKeys.length; idx++) {
DataNode paramNode = paramsNode.addNode(PARAM_PREFIX + idx);
String key = paramKeys[idx];
String description = jobMeta.getParameterDescription(paramKeys[idx]);
String defaultValue = jobMeta.getParameterDefault(paramKeys[idx]);
// $NON-NLS-1$
paramNode.setProperty(PARAM_KEY, key != null ? key : "");
// $NON-NLS-1$
paramNode.setProperty(PARAM_DEFAULT, defaultValue != null ? defaultValue : "");
// $NON-NLS-1$
paramNode.setProperty(PARAM_DESC, description != null ? description : "");
}
// Let's not forget to save the details of the transformation itself.
// This includes logging information, parameters, etc.
//
saveJobDetails(rootNode, jobMeta);
return rootNode;
}
use of org.pentaho.di.job.JobHopMeta in project pentaho-kettle by pentaho.
the class JobDelegate method dataNodeToElement.
public void dataNodeToElement(final DataNode rootNode, final RepositoryElementInterface element) throws KettleException {
JobMeta jobMeta = (JobMeta) element;
Set<String> privateDatabases = null;
// read the private databases
DataNode privateDbsNode = rootNode.getNode(NODE_JOB_PRIVATE_DATABASES);
// BACKLOG-6635
if (privateDbsNode != null) {
privateDatabases = new HashSet<String>();
if (privateDbsNode.hasProperty(PROP_JOB_PRIVATE_DATABASE_NAMES)) {
for (String privateDatabaseName : getString(privateDbsNode, PROP_JOB_PRIVATE_DATABASE_NAMES).split(JOB_PRIVATE_DATABASE_DELIMITER)) {
if (!privateDatabaseName.isEmpty()) {
privateDatabases.add(privateDatabaseName);
}
}
} else {
for (DataNode privateDatabase : privateDbsNode.getNodes()) {
privateDatabases.add(privateDatabase.getName());
}
}
}
jobMeta.setPrivateDatabases(privateDatabases);
jobMeta.setSharedObjectsFile(getString(rootNode, PROP_SHARED_FILE));
// Keep a unique list of job entries to facilitate in the loading.
//
List<JobEntryInterface> jobentries = new ArrayList<JobEntryInterface>();
// Read the job entry copies
//
DataNode entriesNode = rootNode.getNode(NODE_ENTRIES);
int nrCopies = (int) entriesNode.getProperty(PROP_NR_JOB_ENTRY_COPIES).getLong();
//
for (DataNode copyNode : entriesNode.getNodes()) {
// String name = copyNode.getName();
// Read the entry...
//
JobEntryInterface jobEntry = readJobEntry(copyNode, jobMeta, jobentries);
JobEntryCopy copy = new JobEntryCopy(jobEntry);
copy.setName(getString(copyNode, PROP_NAME));
copy.setDescription(getString(copyNode, PROP_DESCRIPTION));
copy.setObjectId(new StringObjectId(copyNode.getId().toString()));
copy.setNr((int) copyNode.getProperty(PROP_NR).getLong());
int x = (int) copyNode.getProperty(PROP_GUI_LOCATION_X).getLong();
int y = (int) copyNode.getProperty(PROP_GUI_LOCATION_Y).getLong();
copy.setLocation(x, y);
copy.setDrawn(copyNode.getProperty(PROP_GUI_DRAW).getBoolean());
copy.setLaunchingInParallel(copyNode.getProperty(PROP_PARALLEL).getBoolean());
//
if (jobEntry instanceof JobEntryBase) {
AttributesMapUtil.loadAttributesMap(copyNode, (JobEntryBase) jobEntry);
}
AttributesMapUtil.loadAttributesMap(copyNode, copy);
jobMeta.getJobCopies().add(copy);
}
if (jobMeta.getJobCopies().size() != nrCopies) {
throw new KettleException("The number of job entry copies read [" + jobMeta.getJobCopies().size() + "] was not the number we expected [" + nrCopies + "]");
}
// Read the notes...
//
DataNode notesNode = rootNode.getNode(NODE_NOTES);
int nrNotes = (int) notesNode.getProperty(PROP_NR_NOTES).getLong();
for (DataNode noteNode : notesNode.getNodes()) {
// String name = noteNode.getName();
String xml = getString(noteNode, PROP_XML);
jobMeta.addNote(new NotePadMeta(XMLHandler.getSubNode(XMLHandler.loadXMLString(xml), NotePadMeta.XML_TAG)));
}
if (jobMeta.nrNotes() != nrNotes) {
throw new KettleException("The number of notes read [" + jobMeta.nrNotes() + "] was not the number we expected [" + nrNotes + "]");
}
// Read the hops...
//
DataNode hopsNode = rootNode.getNode(NODE_HOPS);
int nrHops = (int) hopsNode.getProperty(PROP_NR_HOPS).getLong();
for (DataNode hopNode : hopsNode.getNodes()) {
// String name = hopNode.getName();
String copyFromName = getString(hopNode, JOB_HOP_FROM);
int copyFromNr = (int) hopNode.getProperty(JOB_HOP_FROM_NR).getLong();
String copyToName = getString(hopNode, JOB_HOP_TO);
int copyToNr = (int) hopNode.getProperty(JOB_HOP_TO_NR).getLong();
boolean enabled = true;
if (hopNode.hasProperty(JOB_HOP_ENABLED)) {
enabled = hopNode.getProperty(JOB_HOP_ENABLED).getBoolean();
}
boolean evaluation = true;
if (hopNode.hasProperty(JOB_HOP_EVALUATION)) {
evaluation = hopNode.getProperty(JOB_HOP_EVALUATION).getBoolean();
}
boolean unconditional = true;
if (hopNode.hasProperty(JOB_HOP_UNCONDITIONAL)) {
unconditional = hopNode.getProperty(JOB_HOP_UNCONDITIONAL).getBoolean();
}
JobEntryCopy copyFrom = jobMeta.findJobEntry(copyFromName, copyFromNr, true);
JobEntryCopy copyTo = jobMeta.findJobEntry(copyToName, copyToNr, true);
JobHopMeta jobHopMeta = new JobHopMeta(copyFrom, copyTo);
jobHopMeta.setEnabled(enabled);
jobHopMeta.setEvaluation(evaluation);
jobHopMeta.setUnconditional(unconditional);
jobMeta.addJobHop(jobHopMeta);
}
if (jobMeta.nrJobHops() != nrHops) {
throw new KettleException("The number of hops read [" + jobMeta.nrJobHops() + "] was not the number we expected [" + nrHops + "]");
}
// Load the details at the end, to make sure we reference the databases correctly, etc.
//
loadJobMetaDetails(rootNode, jobMeta);
jobMeta.eraseParameters();
DataNode paramsNode = rootNode.getNode(NODE_PARAMETERS);
int count = (int) paramsNode.getProperty(PROP_NR_PARAMETERS).getLong();
for (int idx = 0; idx < count; idx++) {
DataNode paramNode = paramsNode.getNode(PARAM_PREFIX + idx);
String key = getString(paramNode, PARAM_KEY);
String def = getString(paramNode, PARAM_DEFAULT);
String desc = getString(paramNode, PARAM_DESC);
jobMeta.addParameterDefinition(key, def, desc);
}
}
Aggregations