/** * Find start. * * @return the job entry copy */ public JobEntryCopy findStart() { for ( int i = 0; i < nrJobEntries(); i++ ) { if ( getJobEntry( i ).isStart() ) { return getJobEntry( i ); } } return null; }
/** * Find job entry. * * @param full_name_nr the full_name_nr * @return the job entry copy */ public JobEntryCopy findJobEntry( String full_name_nr ) { int i; for ( i = 0; i < nrJobEntries(); i++ ) { JobEntryCopy jec = getJobEntry( i ); JobEntryInterface je = jec.getEntry(); if ( je.toString().equalsIgnoreCase( full_name_nr ) ) { return jec; } } return null; }
/** * Gets the start. * * @return the start */ public JobEntryCopy getStart() { for ( int i = 0; i < nrJobEntries(); i++ ) { JobEntryCopy cge = getJobEntry( i ); if ( cge.isStart() ) { return cge; } } return null; }
/** * Gets the dummy. * * @return the dummy */ public JobEntryCopy getDummy() { for ( int i = 0; i < nrJobEntries(); i++ ) { JobEntryCopy cge = getJobEntry( i ); if ( cge.isDummy() ) { return cge; } } return null; }
/** * Count entries. * * @param name the name * @return the int */ public int countEntries( String name ) { int count = 0; int i; for ( i = 0; i < nrJobEntries(); i++ ) { // Look at all the hops; JobEntryCopy je = getJobEntry( i ); if ( je.getName().equalsIgnoreCase( name ) ) { count++; } } return count; }
/** * Have job entries changed. * * @return true, if successful */ public boolean haveJobEntriesChanged() { if ( changedEntries ) { return true; } for ( int i = 0; i < nrJobEntries(); i++ ) { JobEntryCopy entry = getJobEntry( i ); if ( entry.hasChanged() ) { return true; } } return false; }
/** * Gets the all job graph entries. * * @param name the name * @return the all job graph entries */ public JobEntryCopy[] getAllJobGraphEntries( String name ) { int count = 0; for ( int i = 0; i < nrJobEntries(); i++ ) { JobEntryCopy je = getJobEntry( i ); if ( je.getName().equalsIgnoreCase( name ) ) { count++; } } JobEntryCopy[] retval = new JobEntryCopy[count]; count = 0; for ( int i = 0; i < nrJobEntries(); i++ ) { JobEntryCopy je = getJobEntry( i ); if ( je.getName().equalsIgnoreCase( name ) ) { retval[count] = je; count++; } } return retval; }
/** * Gets the job entry copy. * * @param x the x * @param y the y * @param iconsize the iconsize * @return the job entry copy */ public JobEntryCopy getJobEntryCopy( int x, int y, int iconsize ) { int i, s; s = nrJobEntries(); for ( i = s - 1; i >= 0; i-- ) { // Back to front because drawing goes from start to end JobEntryCopy je = getJobEntry( i ); Point p = je.getLocation(); if ( p != null ) { if ( x >= p.x && x <= p.x + iconsize && y >= p.y && y <= p.y + iconsize ) { return je; } } } return null; }
/** * Find max nr. * * @param name the name * @return the int */ public int findMaxNr( String name ) { int max = 0; for ( int i = 0; i < nrJobEntries(); i++ ) { JobEntryCopy je = getJobEntry( i ); if ( je.getName().equalsIgnoreCase( name ) ) { if ( je.getNr() > max ) { max = je.getNr(); } } } return max; }
/** * Find an existing JobEntryCopy by it's name and number * * @param name The name of the job entry copy * @param nr The number of the job entry copy * @return The JobEntryCopy or null if nothing was found! */ public JobEntryCopy findJobEntry( String name, int nr, boolean searchHiddenToo ) { for ( int i = 0; i < nrJobEntries(); i++ ) { JobEntryCopy jec = getJobEntry( i ); if ( jec.getName().equalsIgnoreCase( name ) && jec.getNr() == nr ) { if ( searchHiddenToo || jec.isDrawn() ) { return jec; } } } return null; }
/** * Clears the different changed flags of the job. */ @Override public void clearChanged() { changedEntries = false; changedHops = false; for ( int i = 0; i < nrJobEntries(); i++ ) { JobEntryCopy entry = getJobEntry( i ); entry.setChanged( false ); } for ( JobHopMeta hi : jobhops ) { // Look at all the hops hi.setChanged( false ); } super.clearChanged(); }
protected JobMeta processLinkedJobs( JobMeta jobMeta ) { for ( int i = 0; i < jobMeta.nrJobEntries(); i++ ) { JobEntryCopy jec = jobMeta.getJobEntry( i ); if ( jec.getEntry() instanceof JobEntryJob ) { JobEntryJob jej = (JobEntryJob) jec.getEntry(); ObjectLocationSpecificationMethod specMethod = jej.getSpecificationMethod(); // If the reference is by filename, change it to Repository By Name. Otherwise it's fine so leave it alone if ( specMethod == ObjectLocationSpecificationMethod.FILENAME ) { jej.setSpecificationMethod( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME ); String filename = jej.getFilename(); // if the filename is a missing variable name, it will not contain a slash - we don't want to fail // ungracefully in this case, simply set the job name to the whole filename value and let the run-time // handle any exceptions that arise from this if ( filename != null ) { if ( filename.indexOf( "/" ) > -1 ) { String jobname = filename.substring( filename.lastIndexOf( "/" ) + 1, filename.lastIndexOf( '.' ) ); String directory = filename.substring( 0, filename.lastIndexOf( "/" ) ); jej.setJobName( jobname ); jej.setDirectory( directory ); } else { jej.setJobName( filename ); } } jobMeta.setJobEntry( i, jec ); } } } return jobMeta; }
protected JobMeta processLinkedTrans( JobMeta jobMeta ) { for ( int i = 0; i < jobMeta.nrJobEntries(); i++ ) { JobEntryCopy jec = jobMeta.getJobEntry( i ); if ( jec.getEntry() instanceof JobEntryTrans ) { JobEntryTrans jet = (JobEntryTrans) jec.getEntry(); ObjectLocationSpecificationMethod specMethod = jet.getSpecificationMethod(); // If the reference is by filename, change it to Repository By Name. Otherwise it's fine so leave it alone if ( specMethod == ObjectLocationSpecificationMethod.FILENAME ) { jet.setSpecificationMethod( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME ); String filename = jet.getFilename(); // if the filename is a missing variable name, it will not contain a slash - we don't want to fail // ungracefully in this case, simply set the trans name to the whole filename value and let the run-time // handle any exceptions that arise from this if ( filename != null ) { if ( filename.indexOf( "/" ) > -1 ) { String jobname = filename.substring( filename.lastIndexOf( "/" ) + 1, filename.lastIndexOf( '.' ) ); String directory = filename.substring( 0, filename.lastIndexOf( "/" ) ); jet.setTransname( jobname ); jet.setDirectory( directory ); } else { jet.setTransname( filename ); } } jobMeta.setJobEntry( i, jec ); } } } return jobMeta; }
/** * Unselect all. */ public void unselectAll() { int i; for ( i = 0; i < nrJobEntries(); i++ ) { JobEntryCopy ce = getJobEntry( i ); ce.setSelected( false ); } for ( i = 0; i < nrNotes(); i++ ) { NotePadMeta ni = getNote( i ); ni.setSelected( false ); } }
/** * Select all. */ public void selectAll() { int i; for ( i = 0; i < nrJobEntries(); i++ ) { JobEntryCopy ce = getJobEntry( i ); ce.setSelected( true ); } for ( i = 0; i < nrNotes(); i++ ) { NotePadMeta ni = getNote( i ); ni.setSelected( true ); } setChanged(); notifyObservers( "refreshGraph" ); }
/** * Gets the maximum. * * @return the maximum */ public Point getMaximum() { int maxx = 0, maxy = 0; for ( int i = 0; i < nrJobEntries(); i++ ) { JobEntryCopy entry = getJobEntry( i ); Point loc = entry.getLocation(); if ( loc.x > maxx ) { maxx = loc.x; } if ( loc.y > maxy ) { maxy = loc.y; } } for ( int i = 0; i < nrNotes(); i++ ) { NotePadMeta ni = getNote( i ); Point loc = ni.getLocation(); if ( loc.x + ni.width > maxx ) { maxx = loc.x + ni.width; } if ( loc.y + ni.height > maxy ) { maxy = loc.y + ni.height; } } return new Point( maxx + 100, maxy + 100 ); }
int miny = Integer.MAX_VALUE; for ( int i = 0; i < nrJobEntries(); i++ ) { JobEntryCopy jobEntryCopy = getJobEntry( i ); Point loc = jobEntryCopy.getLocation(); if ( loc.x < minx ) {
protected void updateLoadedJobs( String key, RunConfiguration runConfig ) { for ( JobMeta job : spoonSupplier.get().getLoadedJobs() ) { for ( int i = 0; i < job.nrJobEntries(); i++ ) { JobEntryInterface entry = job.getJobEntry( i ).getEntry(); if ( entry instanceof JobEntryRunConfigurableInterface ) { JobEntryRunConfigurableInterface jet = (JobEntryRunConfigurableInterface) entry; if ( jet.getRunConfiguration() != null ) { if ( jet.getRunConfiguration().equals( key ) ) { try { ExtensionPointHandler.callExtensionPoint( job.getLogChannel(), KettleExtensionPoint.JobEntryTransSave.id, new Object[] { job, runConfig.getName() } ); } catch ( KettleException e ) { spoonSupplier.get().getLog().logBasic( "Unable to set run configuration in job " + job.getName() ); } jet.setRunConfiguration( runConfig.getName() ); if ( runConfig instanceof DefaultRunConfiguration ) { jet.setRemoteSlaveServerName( ( (DefaultRunConfiguration) runConfig ).getServer() ); jet.setLoggingRemoteWork( ( (DefaultRunConfiguration) runConfig ).isLogRemoteExecutionLocally() ); } jet.setChanged(); } } } } } }
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 ); } } }
@Override public void refresh( AbstractMeta meta, TreeNode treeNode, String filter ) { JobMeta jobMeta = (JobMeta) meta; for ( int i = 0; i < jobMeta.nrJobEntries(); i++ ) { JobEntryCopy jobEntry = jobMeta.getJobEntry( i ); if ( !filterMatch( jobEntry.getName(), filter ) && !filterMatch( jobEntry.getDescription(), filter ) ) { continue; } Image icon; if ( jobEntry.isStart() ) { icon = GUIResource.getInstance().getImageStartMedium(); } else if ( jobEntry.isDummy() ) { icon = GUIResource.getInstance().getImageDummyMedium(); } else { String key = jobEntry.getEntry().getPluginId(); icon = GUIResource.getInstance().getImagesJobentriesSmall().get( key ); } createTreeNode( treeNode, jobEntry.getName(), icon ); } }