Search in sources :

Example 6 with JobHopMeta

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

the class JobGraph method detach.

protected void detach(JobEntryCopy je) {
    JobHopMeta hfrom = jobMeta.findJobHopTo(je);
    JobHopMeta hto = jobMeta.findJobHopFrom(je);
    if (hfrom != null && hto != null) {
        if (jobMeta.findJobHop(hfrom.getFromEntry(), hto.getToEntry()) == null) {
            JobHopMeta hnew = new JobHopMeta(hfrom.getFromEntry(), hto.getToEntry());
            jobMeta.addJobHop(hnew);
            spoon.addUndoNew(jobMeta, new JobHopMeta[] { (JobHopMeta) hnew.clone() }, new int[] { jobMeta.indexOfJobHop(hnew) });
        }
    }
    if (hfrom != null) {
        int fromidx = jobMeta.indexOfJobHop(hfrom);
        if (fromidx >= 0) {
            jobMeta.removeJobHop(fromidx);
            spoon.addUndoDelete(jobMeta, new JobHopMeta[] { hfrom }, new int[] { fromidx });
        }
    }
    if (hto != null) {
        int toidx = jobMeta.indexOfJobHop(hto);
        if (toidx >= 0) {
            jobMeta.removeJobHop(toidx);
            spoon.addUndoDelete(jobMeta, new JobHopMeta[] { hto }, new int[] { toidx });
        }
    }
    spoon.refreshTree();
    redraw();
}
Also used : JobHopMeta(org.pentaho.di.job.JobHopMeta) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint)

Example 7 with JobHopMeta

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

the class JobGraph method findHop.

/**
 * See if location (x,y) is on a line between two steps: the hop!
 *
 * @param x
 * @param y
 * @param exclude
 *          the step to exclude from the hops (from or to location). Specify null if no step is to be excluded.
 * @return the transformation hop on the specified location, otherwise: null
 */
private JobHopMeta findHop(int x, int y, JobEntryCopy exclude) {
    int i;
    JobHopMeta online = null;
    for (i = 0; i < jobMeta.nrJobHops(); i++) {
        JobHopMeta hi = jobMeta.getJobHop(i);
        JobEntryCopy fs = hi.getFromEntry();
        JobEntryCopy ts = hi.getToEntry();
        if (fs == null || ts == null) {
            return null;
        }
        // 
        if (exclude != null && (exclude.equals(fs) || exclude.equals(ts))) {
            continue;
        }
        int[] line = getLine(fs, ts);
        if (pointOnLine(x, y, line)) {
            online = hi;
        }
    }
    return online;
}
Also used : JobHopMeta(org.pentaho.di.job.JobHopMeta) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint)

Example 8 with JobHopMeta

use of org.pentaho.di.job.JobHopMeta 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();
        }
    }
}
Also used : JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) JobHopMeta(org.pentaho.di.job.JobHopMeta) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 9 with JobHopMeta

use of org.pentaho.di.job.JobHopMeta 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;
}
Also used : RepositoryExplorerDialog(org.pentaho.di.ui.repository.dialog.RepositoryExplorerDialog) SashForm(org.eclipse.swt.custom.SashForm) MouseMoveListener(org.eclipse.swt.events.MouseMoveListener) XulException(org.pentaho.ui.xul.XulException) DefaultToolTip(org.eclipse.jface.window.DefaultToolTip) AbstractGraph(org.pentaho.di.ui.spoon.AbstractGraph) Point(org.pentaho.di.core.gui.Point) DND(org.eclipse.swt.dnd.DND) RepositorySecurityUI(org.pentaho.di.ui.repository.RepositorySecurityUI) XulToolbarbutton(org.pentaho.ui.xul.components.XulToolbarbutton) DropTargetEvent(org.eclipse.swt.dnd.DropTargetEvent) JobAdapter(org.pentaho.di.job.JobAdapter) XulSpoonResourceBundle(org.pentaho.di.ui.spoon.XulSpoonResourceBundle) TabMapEntry(org.pentaho.di.ui.spoon.TabMapEntry) Composite(org.eclipse.swt.widgets.Composite) Map(java.util.Map) KeyEvent(org.eclipse.swt.events.KeyEvent) Job(org.pentaho.di.job.Job) ConstUI(org.pentaho.di.ui.core.ConstUI) TabItemInterface(org.pentaho.di.ui.spoon.TabItemInterface) TimerTask(java.util.TimerTask) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) KeyAdapter(org.eclipse.swt.events.KeyAdapter) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) LogParentProvidedInterface(org.pentaho.di.core.logging.LogParentProvidedInterface) CTabFolder(org.eclipse.swt.custom.CTabFolder) Device(org.eclipse.swt.graphics.Device) JobEntryResult(org.pentaho.di.job.JobEntryResult) JfaceMenupopup(org.pentaho.ui.xul.jface.tags.JfaceMenupopup) Set(java.util.Set) PropsUI(org.pentaho.di.ui.core.PropsUI) CheckBoxToolTipListener(org.pentaho.di.ui.core.widget.CheckBoxToolTipListener) ToolItem(org.eclipse.swt.widgets.ToolItem) Utils(org.pentaho.di.core.util.Utils) JobEntryInterface(org.pentaho.di.job.entry.JobEntryInterface) Transfer(org.eclipse.swt.dnd.Transfer) LogChannel(org.pentaho.di.core.logging.LogChannel) MouseEvent(org.eclipse.swt.events.MouseEvent) Redrawable(org.pentaho.di.core.gui.Redrawable) JobEntryListener(org.pentaho.di.job.JobEntryListener) MenuItem(org.eclipse.swt.widgets.MenuItem) SWT(org.eclipse.swt.SWT) JfaceMenuitem(org.pentaho.ui.xul.jface.tags.JfaceMenuitem) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) SWTGC(org.pentaho.di.ui.spoon.SWTGC) PaintListener(org.eclipse.swt.events.PaintListener) NotePadDialog(org.pentaho.di.ui.spoon.dialog.NotePadDialog) JobHopMeta(org.pentaho.di.job.JobHopMeta) SnapAllignDistribute(org.pentaho.di.core.gui.SnapAllignDistribute) Callable(java.util.concurrent.Callable) EngineMetaInterface(org.pentaho.di.core.EngineMetaInterface) DragAndDropContainer(org.pentaho.di.core.dnd.DragAndDropContainer) ArrayList(java.util.ArrayList) Spoon(org.pentaho.di.ui.spoon.Spoon) AreaType(org.pentaho.di.core.gui.AreaOwner.AreaType) LoggingObjectType(org.pentaho.di.core.logging.LoggingObjectType) RepositoryObjectType(org.pentaho.di.repository.RepositoryObjectType) ResourceBundle(java.util.ResourceBundle) Const(org.pentaho.di.core.Const) GCInterface(org.pentaho.di.core.gui.GCInterface) JobExecutionConfiguration(org.pentaho.di.job.JobExecutionConfiguration) Document(org.pentaho.ui.xul.dom.Document) GridData(org.eclipse.swt.layout.GridData) EnterTextDialog(org.pentaho.di.ui.core.dialog.EnterTextDialog) XulEventHandler(org.pentaho.ui.xul.impl.XulEventHandler) JobDialog(org.pentaho.di.ui.job.dialog.JobDialog) Shell(org.eclipse.swt.widgets.Shell) SimpleLoggingObject(org.pentaho.di.core.logging.SimpleLoggingObject) FormLayout(org.eclipse.swt.layout.FormLayout) Repository(org.pentaho.di.repository.Repository) SharedObjects(org.pentaho.di.shared.SharedObjects) FormData(org.eclipse.swt.layout.FormData) JobMeta(org.pentaho.di.job.JobMeta) KettleRepositoryLostException(org.pentaho.di.repository.KettleRepositoryLostException) LogChannelInterface(org.pentaho.di.core.logging.LogChannelInterface) SpoonPluginManager(org.pentaho.di.ui.spoon.SpoonPluginManager) RepositoryRevisionBrowserDialogInterface(org.pentaho.di.ui.repository.dialog.RepositoryRevisionBrowserDialogInterface) RowMetaAndData(org.pentaho.di.core.RowMetaAndData) Color(org.eclipse.swt.graphics.Color) MessageBox(org.eclipse.swt.widgets.MessageBox) ToolTip(org.eclipse.jface.window.ToolTip) JobEntryTrans(org.pentaho.di.job.entries.trans.JobEntryTrans) XulDomContainer(org.pentaho.ui.xul.XulDomContainer) ExtensionPointHandler(org.pentaho.di.core.extension.ExtensionPointHandler) ObjectType(org.pentaho.di.ui.spoon.TabMapEntry.ObjectType) Trans(org.pentaho.di.trans.Trans) DisposeEvent(org.eclipse.swt.events.DisposeEvent) KettleLogStore(org.pentaho.di.core.logging.KettleLogStore) XulToolbar(org.pentaho.ui.xul.containers.XulToolbar) DisposeListener(org.eclipse.swt.events.DisposeListener) ToolBar(org.eclipse.swt.widgets.ToolBar) GUIResource(org.pentaho.di.ui.core.gui.GUIResource) Timer(java.util.Timer) KettleVFS(org.pentaho.di.core.vfs.KettleVFS) GC(org.eclipse.swt.graphics.GC) JobEntryJob(org.pentaho.di.job.entries.job.JobEntryJob) PaintEvent(org.eclipse.swt.events.PaintEvent) TransMeta(org.pentaho.di.trans.TransMeta) NotePadMeta(org.pentaho.di.core.NotePadMeta) Widget(org.eclipse.swt.widgets.Widget) BaseMessages(org.pentaho.di.i18n.BaseMessages) TransPainter(org.pentaho.di.trans.TransPainter) DropTarget(org.eclipse.swt.dnd.DropTarget) JobPainter(org.pentaho.di.job.JobPainter) MouseWheelListener(org.eclipse.swt.events.MouseWheelListener) UUID(java.util.UUID) Display(org.eclipse.swt.widgets.Display) CheckBoxToolTip(org.pentaho.di.ui.core.widget.CheckBoxToolTip) AreaOwner(org.pentaho.di.core.gui.AreaOwner) List(java.util.List) MouseListener(org.eclipse.swt.events.MouseListener) MouseTrackListener(org.eclipse.swt.events.MouseTrackListener) SwtScrollBar(org.pentaho.di.ui.spoon.SwtScrollBar) ResultFile(org.pentaho.di.core.ResultFile) MouseAdapter(org.eclipse.swt.events.MouseAdapter) Label(org.eclipse.swt.widgets.Label) Result(org.pentaho.di.core.Result) XulMenuitem(org.pentaho.ui.xul.components.XulMenuitem) HasLogChannelInterface(org.pentaho.di.core.logging.HasLogChannelInterface) KettleException(org.pentaho.di.core.exception.KettleException) Image(org.eclipse.swt.graphics.Image) Rectangle(org.eclipse.swt.graphics.Rectangle) HashMap(java.util.HashMap) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) HashSet(java.util.HashSet) XulMenu(org.pentaho.ui.xul.containers.XulMenu) XulSpoonSettingsManager(org.pentaho.di.ui.spoon.XulSpoonSettingsManager) MessageDialogWithToggle(org.eclipse.jface.dialogs.MessageDialogWithToggle) Canvas(org.eclipse.swt.widgets.Canvas) TransGraph(org.pentaho.di.ui.spoon.trans.TransGraph) FillLayout(org.eclipse.swt.layout.FillLayout) RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) KettleXulLoader(org.pentaho.di.ui.xul.KettleXulLoader) Props(org.pentaho.di.core.Props) Combo(org.eclipse.swt.widgets.Combo) Iterator(java.util.Iterator) DropTargetListener(org.eclipse.swt.dnd.DropTargetListener) XulMenupopup(org.pentaho.ui.xul.containers.XulMenupopup) Action(org.eclipse.jface.action.Action) FormAttachment(org.eclipse.swt.layout.FormAttachment) CTabItem(org.eclipse.swt.custom.CTabItem) DelayListener(org.pentaho.di.ui.spoon.trans.DelayListener) RepositoryOperation(org.pentaho.di.repository.RepositoryOperation) XMLTransfer(org.pentaho.di.core.dnd.XMLTransfer) DelayTimer(org.pentaho.di.ui.spoon.trans.DelayTimer) KeyListener(org.eclipse.swt.events.KeyListener) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Menu(org.eclipse.swt.widgets.Menu) Control(org.eclipse.swt.widgets.Control) JobHopMeta(org.pentaho.di.job.JobHopMeta)

Example 10 with JobHopMeta

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

the class KettleDatabaseRepositoryJobDelegate method loadJobMeta.

/**
 * Load a job in a directory
 *
 * @param log
 *          the logging channel
 * @param rep
 *          The Repository
 * @param jobname
 *          The name of the job
 * @param repdir
 *          The directory in which the job resides.
 * @throws KettleException
 */
public JobMeta loadJobMeta(String jobname, RepositoryDirectoryInterface repdir, ProgressMonitorListener monitor) throws KettleException {
    JobMeta jobMeta = new JobMeta();
    synchronized (repository) {
        try {
            // Clear everything...
            jobMeta.clear();
            jobMeta.setRepositoryDirectory(repdir);
            // Get the transformation id
            jobMeta.setObjectId(getJobID(jobname, repdir.getObjectId()));
            // If no valid id is available in the database, then give error...
            if (jobMeta.getObjectId() != null) {
                // Load the notes...
                ObjectId[] noteids = repository.getJobNoteIDs(jobMeta.getObjectId());
                ObjectId[] jecids = repository.getJobEntryCopyIDs(jobMeta.getObjectId());
                ObjectId[] hopid = repository.getJobHopIDs(jobMeta.getObjectId());
                int nrWork = 2 + noteids.length + jecids.length + hopid.length;
                if (monitor != null) {
                    monitor.beginTask(BaseMessages.getString(PKG, "JobMeta.Monitor.LoadingJob") + repdir + Const.FILE_SEPARATOR + jobname, nrWork);
                }
                // 
                if (monitor != null) {
                    monitor.subTask(BaseMessages.getString(PKG, "JobMeta.Monitor.ReadingJobInformation"));
                }
                RowMetaAndData jobRow = getJob(jobMeta.getObjectId());
                jobMeta.setName(jobRow.getString(KettleDatabaseRepository.FIELD_JOB_NAME, null));
                jobMeta.setDescription(jobRow.getString(KettleDatabaseRepository.FIELD_JOB_DESCRIPTION, null));
                jobMeta.setExtendedDescription(jobRow.getString(KettleDatabaseRepository.FIELD_JOB_EXTENDED_DESCRIPTION, null));
                jobMeta.setJobversion(jobRow.getString(KettleDatabaseRepository.FIELD_JOB_JOB_VERSION, null));
                jobMeta.setJobstatus(Const.toInt(jobRow.getString(KettleDatabaseRepository.FIELD_JOB_JOB_STATUS, null), -1));
                jobMeta.setCreatedUser(jobRow.getString(KettleDatabaseRepository.FIELD_JOB_CREATED_USER, null));
                jobMeta.setCreatedDate(jobRow.getDate(KettleDatabaseRepository.FIELD_JOB_CREATED_DATE, new Date()));
                jobMeta.setModifiedUser(jobRow.getString(KettleDatabaseRepository.FIELD_JOB_MODIFIED_USER, null));
                jobMeta.setModifiedDate(jobRow.getDate(KettleDatabaseRepository.FIELD_JOB_MODIFIED_DATE, new Date()));
                long id_logdb = jobRow.getInteger(KettleDatabaseRepository.FIELD_JOB_ID_DATABASE_LOG, 0);
                if (id_logdb > 0) {
                    // Get the logconnection
                    // 
                    DatabaseMeta logDb = repository.loadDatabaseMeta(new LongObjectId(id_logdb), null);
                    jobMeta.getJobLogTable().setConnectionName(logDb.getName());
                // jobMeta.getJobLogTable().getDatabaseMeta().shareVariablesWith(jobMeta);
                }
                jobMeta.getJobLogTable().setTableName(jobRow.getString(KettleDatabaseRepository.FIELD_JOB_TABLE_NAME_LOG, null));
                jobMeta.getJobLogTable().setBatchIdUsed(jobRow.getBoolean(KettleDatabaseRepository.FIELD_JOB_USE_BATCH_ID, false));
                jobMeta.getJobLogTable().setLogFieldUsed(jobRow.getBoolean(KettleDatabaseRepository.FIELD_JOB_USE_LOGFIELD, false));
                jobMeta.getJobLogTable().setLogSizeLimit(getJobAttributeString(jobMeta.getObjectId(), 0, KettleDatabaseRepository.JOB_ATTRIBUTE_LOG_SIZE_LIMIT));
                jobMeta.setBatchIdPassed(jobRow.getBoolean(KettleDatabaseRepository.FIELD_JOB_PASS_BATCH_ID, false));
                // Load all the log tables for the job...
                // 
                RepositoryAttributeInterface attributeInterface = new KettleDatabaseRepositoryJobAttribute(repository.connectionDelegate, jobMeta.getObjectId());
                for (LogTableInterface logTable : jobMeta.getLogTables()) {
                    logTable.loadFromRepository(attributeInterface);
                }
                if (monitor != null) {
                    monitor.worked(1);
                }
                // 
                if (monitor != null) {
                    monitor.subTask(BaseMessages.getString(PKG, "JobMeta.Monitor.ReadingAvailableDatabasesFromRepository"));
                }
                // Read objects from the shared XML file & the repository
                try {
                    jobMeta.setSharedObjectsFile(jobRow.getString(KettleDatabaseRepository.FIELD_JOB_SHARED_FILE, null));
                    jobMeta.setSharedObjects(repository != null ? repository.readJobMetaSharedObjects(jobMeta) : jobMeta.readSharedObjects());
                } catch (Exception e) {
                    log.logError(BaseMessages.getString(PKG, "JobMeta.ErrorReadingSharedObjects.Message", e.toString()));
                    // 
                    log.logError(Const.getStackTracker(e));
                }
                if (monitor != null) {
                    monitor.worked(1);
                }
                if (log.isDetailed()) {
                    log.logDetailed("Loading " + noteids.length + " notes");
                }
                for (int i = 0; i < noteids.length; i++) {
                    if (monitor != null) {
                        monitor.subTask(BaseMessages.getString(PKG, "JobMeta.Monitor.ReadingNoteNr") + (i + 1) + "/" + noteids.length);
                    }
                    NotePadMeta ni = repository.notePadDelegate.loadNotePadMeta(noteids[i]);
                    if (jobMeta.indexOfNote(ni) < 0) {
                        jobMeta.addNote(ni);
                    }
                    if (monitor != null) {
                        monitor.worked(1);
                    }
                }
                // Load the group attributes map
                // 
                jobMeta.setAttributesMap(loadJobAttributesMap(jobMeta.getObjectId()));
                // Load the job entries...
                // 
                // Keep a unique list of job entries to facilitate in the loading.
                // 
                List<JobEntryInterface> jobentries = new ArrayList<JobEntryInterface>();
                if (log.isDetailed()) {
                    log.logDetailed("Loading " + jecids.length + " job entries");
                }
                for (int i = 0; i < jecids.length; i++) {
                    if (monitor != null) {
                        monitor.subTask(BaseMessages.getString(PKG, "JobMeta.Monitor.ReadingJobEntryNr") + (i + 1) + "/" + (jecids.length));
                    }
                    JobEntryCopy jec = repository.jobEntryDelegate.loadJobEntryCopy(jobMeta.getObjectId(), jecids[i], jobentries, jobMeta.getDatabases(), jobMeta.getSlaveServers(), jobname);
                    if (jec.isMissing()) {
                        jobMeta.addMissingEntry((MissingEntry) jec.getEntry());
                    }
                    // Also set the copy number...
                    // We count the number of job entry copies that use the job
                    // entry
                    // 
                    int copyNr = 0;
                    for (JobEntryCopy copy : jobMeta.getJobCopies()) {
                        if (jec.getEntry() == copy.getEntry()) {
                            copyNr++;
                        }
                    }
                    jec.setNr(copyNr);
                    int idx = jobMeta.indexOfJobEntry(jec);
                    if (idx < 0) {
                        if (jec.getName() != null && jec.getName().length() > 0) {
                            jobMeta.addJobEntry(jec);
                        }
                    } else {
                        // replace it!
                        jobMeta.setJobEntry(idx, jec);
                    }
                    if (monitor != null) {
                        monitor.worked(1);
                    }
                }
                // Load the hops...
                if (log.isDetailed()) {
                    log.logDetailed("Loading " + hopid.length + " job hops");
                }
                for (int i = 0; i < hopid.length; i++) {
                    if (monitor != null) {
                        monitor.subTask(BaseMessages.getString(PKG, "JobMeta.Monitor.ReadingJobHopNr") + (i + 1) + "/" + (jecids.length));
                    }
                    JobHopMeta hi = loadJobHopMeta(hopid[i], jobMeta.getJobCopies());
                    jobMeta.getJobhops().add(hi);
                    if (monitor != null) {
                        monitor.worked(1);
                    }
                }
                loadRepParameters(jobMeta);
                // Finally, clear the changed flags...
                jobMeta.clearChanged();
                if (monitor != null) {
                    monitor.subTask(BaseMessages.getString(PKG, "JobMeta.Monitor.FinishedLoadOfJob"));
                }
                if (monitor != null) {
                    monitor.done();
                }
                // close prepared statements, minimize locking etc.
                // 
                repository.connectionDelegate.closeAttributeLookupPreparedStatements();
                return jobMeta;
            } else {
                throw new KettleException(BaseMessages.getString(PKG, "JobMeta.Exception.CanNotFindJob") + jobname);
            }
        } catch (KettleException dbe) {
            throw new KettleException(BaseMessages.getString(PKG, "JobMeta.Exception.AnErrorOccuredReadingJob", jobname), dbe);
        } finally {
            jobMeta.initializeVariablesFrom(jobMeta.getParentVariableSpace());
            jobMeta.setInternalKettleVariables();
        }
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) JobMeta(org.pentaho.di.job.JobMeta) JobHopMeta(org.pentaho.di.job.JobHopMeta) JobEntryInterface(org.pentaho.di.job.entry.JobEntryInterface) LongObjectId(org.pentaho.di.repository.LongObjectId) ObjectId(org.pentaho.di.repository.ObjectId) ArrayList(java.util.ArrayList) LongObjectId(org.pentaho.di.repository.LongObjectId) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) Date(java.util.Date) ValueMetaDate(org.pentaho.di.core.row.value.ValueMetaDate) RepositoryAttributeInterface(org.pentaho.di.repository.RepositoryAttributeInterface) KettleException(org.pentaho.di.core.exception.KettleException) KettleDatabaseException(org.pentaho.di.core.exception.KettleDatabaseException) LogTableInterface(org.pentaho.di.core.logging.LogTableInterface) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) RowMetaAndData(org.pentaho.di.core.RowMetaAndData) NotePadMeta(org.pentaho.di.core.NotePadMeta)

Aggregations

JobHopMeta (org.pentaho.di.job.JobHopMeta)31 JobEntryCopy (org.pentaho.di.job.entry.JobEntryCopy)24 Point (org.pentaho.di.core.gui.Point)17 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)16 NotePadMeta (org.pentaho.di.core.NotePadMeta)12 KettleException (org.pentaho.di.core.exception.KettleException)10 JobMeta (org.pentaho.di.job.JobMeta)10 ArrayList (java.util.ArrayList)8 MessageBox (org.eclipse.swt.widgets.MessageBox)6 JobEntryInterface (org.pentaho.di.job.entry.JobEntryInterface)6 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)4 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)4 AreaOwner (org.pentaho.di.core.gui.AreaOwner)4 Job (org.pentaho.di.job.Job)4 Date (java.util.Date)3 Test (org.junit.Test)3 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)3 JobEntrySpecial (org.pentaho.di.job.entries.special.JobEntrySpecial)3 KettleRepositoryLostException (org.pentaho.di.repository.KettleRepositoryLostException)3 XulException (org.pentaho.ui.xul.XulException)3