/** * Find nr prev job entries. * * @param to the to * @param info the info * @return the int */ public int findNrPrevJobEntries( JobEntryCopy to, boolean info ) { int count = 0; for ( JobHopMeta hi : jobhops ) { // Look at all the hops if ( hi.isEnabled() && hi.getToEntry().equals( to ) ) { count++; } } return count; }
@Override public List<ImportValidationFeedback> verifyRule( Object subject ) { List<ImportValidationFeedback> feedback = new ArrayList<ImportValidationFeedback>(); if ( !isEnabled() ) { return feedback; } if ( !( subject instanceof JobMeta ) ) { return feedback; } JobMeta jobMeta = (JobMeta) subject; for ( int i = 0; i < jobMeta.nrJobHops(); i++ ) { JobHopMeta hop = jobMeta.getJobHop( i ); if ( !hop.isEnabled() ) { feedback.add( new ImportValidationFeedback( this, ImportValidationResultType.ERROR, "There is a disabled hop in the job." ) ); } } if ( feedback.isEmpty() ) { feedback.add( new ImportValidationFeedback( this, ImportValidationResultType.APPROVAL, "All hops are enabled in this job." ) ); } return feedback; }
/** * 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; }
/** * Find prev job entry. * * @param to the to * @param nr the nr * @param info the info * @return the job entry copy */ public JobEntryCopy findPrevJobEntry( JobEntryCopy to, int nr, boolean info ) { int count = 0; for ( JobHopMeta hi : jobhops ) { // Look at all the hops if ( hi.isEnabled() && hi.getToEntry().equals( to ) ) { if ( count == nr ) { return hi.getFromEntry(); } count++; } } return null; }
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; }
/** * 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; }
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(); }
/** * Find job hop. * * @param from the from * @param to the to * @param includeDisabled the include disabled * @return the job hop meta */ public JobHopMeta findJobHop( JobEntryCopy from, JobEntryCopy to, boolean includeDisabled ) { for ( JobHopMeta hi : jobhops ) { if ( hi.isEnabled() || includeDisabled ) { if ( hi != null && hi.getFromEntry() != null && hi.getToEntry() != null && hi.getFromEntry().equals( from ) && hi.getToEntry().equals( to ) ) { return hi; } } } return null; }
hi.getToEntry().getName() ).append( Const.CR ); tip.append( BaseMessages.getString( PKG, "TransGraph.Dialog.HopInfo.Status" ) ).append( " " ); tip.append( ( hi.isEnabled() ? BaseMessages.getString( PKG, "JobGraph.Dialog.HopInfo.Enable" ) : BaseMessages.getString( PKG, "JobGraph.Dialog.HopInfo.Disable" ) ) );
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 ); } }
col = EColor.BLUE; arrow = EImage.ARROW_CANDIDATE; } else if ( jobHop.isEnabled() ) { if ( jobHop.isUnconditional() ) { col = EColor.HOP_DEFAULT;
if ( hop != null ) { 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" ) );
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() );
if ( hi.isEnabled() ) { miDisHop.setLabel( BaseMessages.getString( PKG, "JobGraph.PopupMenu.Hop.Disable" ) ); } else {