public void setHopEvaluationTrue() { currentHop.setConditional(); currentHop.setEvaluation( true ); spoon.refreshGraph(); }
public void saveJobHopMeta( JobHopMeta hop, ObjectId id_job ) throws KettleException { try { ObjectId id_jobentry_from = null; ObjectId id_jobentry_to = null; id_jobentry_from = hop.getFromEntry() == null ? null : hop.getFromEntry().getObjectId(); id_jobentry_to = hop.getToEntry() == null ? null : hop.getToEntry().getObjectId(); // Insert new job hop in repository // hop.setObjectId( insertJobHop( id_job, id_jobentry_from, id_jobentry_to, hop.isEnabled(), hop .getEvaluation(), hop.isUnconditional() ) ); } catch ( KettleDatabaseException dbe ) { throw new KettleException( BaseMessages.getString( PKG, "JobHopMeta.Exception.UnableToSaveHopInfoRep", "" + id_job ), dbe ); } }
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; }
public void setEvaluation() { if ( !evaluation ) { setChanged(); } setEvaluation( true ); }
/** * Find nr next job entries. * * @param from the from * @return the int */ public int findNrNextJobEntries( JobEntryCopy from ) { int count = 0; for ( JobHopMeta hi : jobhops ) { // Look at all the hops if ( hi.isEnabled() && ( hi.getFromEntry() != null ) && hi.getFromEntry().equals( from ) ) { count++; } } return count; }
if ( hop.getFromEntry().evaluates() ) { if ( hop.isUnconditional() ) { hop.setUnconditional( false ); hop.setEvaluation( true ); } else { if ( hop.getEvaluation() ) { hop.setEvaluation( false ); } else { hop.setUnconditional( true ); JobHopMeta before = (JobHopMeta) hop.clone(); hop.setEnabled( !hop.isEnabled() ); if ( hop.isEnabled() && ( jobMeta.hasLoop( hop.getToEntry() ) ) ) { MessageBox mb = new MessageBox( shell, SWT.CANCEL | SWT.OK | SWT.ICON_WARNING ); mb.setMessage( BaseMessages.getString( PKG, "JobGraph.Dialog.LoopAfterHopEnabled.Message" ) ); int choice = mb.open(); if ( choice == SWT.CANCEL ) { hop.setEnabled( false ); JobHopMeta after = (JobHopMeta) hop.clone(); spoon.addUndoChange( jobMeta, new JobHopMeta[] { before }, new JobHopMeta[] { after }, new int[] { jobMeta
public JobHopMeta loadJobHopMeta( ObjectId id_job_hop, List<JobEntryCopy> jobcopies ) throws KettleException { JobHopMeta jobHopMeta = new JobHopMeta(); try { RowMetaAndData r = getJobHop( id_job_hop ); if ( r != null ) { long id_jobentry_copy_from = r.getInteger( "ID_JOBENTRY_COPY_FROM", -1L ); long id_jobentry_copy_to = r.getInteger( "ID_JOBENTRY_COPY_TO", -1L ); jobHopMeta.setEnabled( r.getBoolean( "ENABLED", true ) ); jobHopMeta.setEvaluation( r.getBoolean( "EVALUATION", true ) ); jobHopMeta.setConditional(); if ( r.getBoolean( "UNCONDITIONAL", !jobHopMeta.getEvaluation() ) ) { jobHopMeta.setUnconditional(); } jobHopMeta.setFromEntry( JobMeta.findJobEntryCopy( jobcopies, new LongObjectId( id_jobentry_copy_from ) ) ); jobHopMeta.setToEntry( JobMeta.findJobEntryCopy( jobcopies, new LongObjectId( id_jobentry_copy_to ) ) ); return jobHopMeta; } else { throw new KettleException( "Unable to find job hop with ID : " + id_job_hop ); } } catch ( KettleDatabaseException dbe ) { throw new KettleException( BaseMessages.getString( PKG, "JobHopMeta.Exception.UnableToLoadHopInfoRep", "" + id_job_hop ), dbe ); } }
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() ); JobEntryCopy jge = jobMeta.findNextJobEntry( hop_candidate.getFromEntry(), 0 ); JobHopMeta other = jobMeta.findJobHop( hop_candidate.getFromEntry(), jge ); if ( other != null ) { hop_candidate.setEvaluation( !other.getEvaluation() ); 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" ) );
null, BaseMessages.getString( PKG, "TransGraph.Dialog.SplitHop.Message" ) + Const.CR + hi.toString(), MessageDialog.QUESTION, new String[] { 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(); .indexOfJobHop( newhop1 ), }, true ); if ( jobMeta.findJobHop( selectedEntry, hi.getToEntry(), true ) == null ) { JobHopMeta newhop2 = new JobHopMeta( selectedEntry, hi.getToEntry() ); if ( selectedEntry.getEntry().isUnconditional() ) { newhop2.setUnconditional();
/** * Find next job entry. * * @param from the from * @param cnt the cnt * @return the job entry copy */ public JobEntryCopy findNextJobEntry( JobEntryCopy from, int cnt ) { int count = 0; for ( JobHopMeta hi : jobhops ) { // Look at all the hops if ( hi.isEnabled() && ( hi.getFromEntry() != null ) && hi.getFromEntry().equals( from ) ) { if ( count == cnt ) { return hi.getToEntry(); } count++; } } return null; }
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 );
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(); }
public void flipHop() { selectionRegion = null; JobEntryCopy origFrom = currentHop.getFromEntry(); JobEntryCopy origTo = currentHop.getToEntry(); currentHop.setFromEntry( currentHop.getToEntry() ); currentHop.setToEntry( origFrom ); boolean cancel = false; if ( jobMeta.hasLoop( currentHop.getToEntry() ) ) { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.CANCEL | SWT.ICON_WARNING ); mb.setMessage( BaseMessages.getString( PKG, "JobGraph.Dialog.HopFlipCausesLoop.Message" ) ); mb.setText( BaseMessages.getString( PKG, "JobGraph.Dialog.HopCausesLoop.Title" ) ); int choice = mb.open(); if ( choice == SWT.CANCEL ) { cancel = true; currentHop.setFromEntry( origFrom ); currentHop.setToEntry( origTo ); } } if ( !cancel ) { currentHop.setChanged(); } spoon.refreshGraph(); spoon.refreshTree(); spoon.setShellText(); }
protected void drawJobHop( JobHopMeta hop, boolean candidate ) { if ( hop == null || hop.getFromEntry() == null || hop.getToEntry() == null ) { return; } if ( !hop.getFromEntry().isDrawn() || !hop.getToEntry().isDrawn() ) { return; } drawLine( hop, candidate ); }
public void deleteJobEntryCopies( JobMeta jobMeta, JobEntryCopy jobEntry ) { for ( int i = jobMeta.nrJobHops() - 1; i >= 0; i-- ) { JobHopMeta hi = jobMeta.getJobHop( i ); if ( hi.getFromEntry().equals( jobEntry ) || hi.getToEntry().equals( jobEntry ) ) { int idx = jobMeta.indexOfJobHop( hi ); spoon.addUndoDelete( jobMeta, new JobHopMeta[] { (JobHopMeta) hi.clone() }, new int[] { idx } ); jobMeta.removeJobHop( idx ); spoon.refreshTree(); } } int pos = jobMeta.indexOfJobEntry( jobEntry ); jobMeta.removeJobEntry( pos ); spoon.addUndoDelete( jobMeta, new JobEntryCopy[] { jobEntry }, new int[] { pos } ); spoon.refreshTree(); spoon.refreshGraph(); }
if ( !hi.getFromEntry().equals( selectedEntry ) && !hi.getToEntry().equals( selectedEntry ) ) { split_hop = true; last_hop_split = hi; hop_candidate = new JobHopMeta( startHopEntry, jobEntryCopy ); endHopLocation = null; } else { hop_candidate = new JobHopMeta( jobEntryCopy, endHopEntry ); endHopLocation = null;
public void disableHop() { selectionRegion = null; boolean orig = currentHop.isEnabled(); currentHop.setEnabled( !currentHop.isEnabled() ); if ( !orig && ( jobMeta.hasLoop( currentHop.getToEntry() ) ) ) { MessageBox mb = new MessageBox( shell, SWT.CANCEL | SWT.OK | SWT.ICON_WARNING ); mb.setMessage( BaseMessages.getString( PKG, "JobGraph.Dialog.LoopAfterHopEnabled.Message" ) ); mb.setText( BaseMessages.getString( PKG, "JobGraph.Dialog.LoopAfterHopEnabled.Title" ) ); int choice = mb.open(); if ( choice == SWT.CANCEL ) { currentHop.setEnabled( orig ); } } spoon.refreshGraph(); spoon.refreshTree(); }
public void newJobHop( JobMeta jobMeta, JobEntryCopy fr, JobEntryCopy to ) { JobHopMeta hi = new JobHopMeta( fr, to ); jobMeta.addJobHop( hi ); spoon.addUndoNew( jobMeta, new JobHopMeta[] { hi }, new int[] { jobMeta.indexOfJobHop( hi ) } ); spoon.refreshGraph(); spoon.refreshTree(); }
jobMeta.addJobHop( new JobHopMeta( startEntry, writeToLogEntry ) ); JobHopMeta greenHop = new JobHopMeta( writeToLogEntry, successEntry ); greenHop.setEvaluation( true ); jobMeta.addJobHop( greenHop ); JobHopMeta redHop = new JobHopMeta( writeToLogEntry, abortEntry ); redHop.setEvaluation( false ); jobMeta.addJobHop( redHop );
public void enableDisableHopsDownstream( boolean enabled ) { if ( currentHop == null ) { return; } JobHopMeta before = (JobHopMeta) currentHop.clone(); currentHop.setEnabled( enabled ); JobHopMeta after = (JobHopMeta) currentHop.clone(); spoon.addUndoChange( jobMeta, new JobHopMeta[] { before }, new JobHopMeta[] { after }, new int[] { jobMeta .indexOfJobHop( currentHop ) } ); Set<JobEntryCopy> checkedEntries = enableDisableNextHops( currentHop.getToEntry(), enabled, new HashSet<>() ); if ( checkedEntries.stream().anyMatch( entry -> jobMeta.hasLoop( entry ) ) ) { 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(); }