Java Code Examples for org.pentaho.di.job.JobMeta#removeJobEntry()
The following examples show how to use
org.pentaho.di.job.JobMeta#removeJobEntry() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpoonJobDelegate.java From pentaho-kettle with Apache License 2.0 | 6 votes |
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(); }
Example 2
Source File: SpoonJobDelegate.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public void deleteJobEntryCopies( JobMeta job, JobEntryCopy[] jobEntries ) { // Hops belonging to the deleting jobEntries are placed in a single transaction and removed. List<JobHopMeta> jobHops = new ArrayList<>(); int[] hopIndexes = new int[job.nrJobHops()]; int hopIndex = 0; for ( int i = job.nrJobHops() - 1; i >= 0; i-- ) { JobHopMeta hi = job.getJobHop( i ); for ( int j = 0; j < jobEntries.length && hopIndex < hopIndexes.length; j++ ) { if ( hi.getFromEntry().equals( jobEntries[j] ) || hi.getToEntry().equals( jobEntries[j] ) ) { int idx = job.indexOfJobHop( hi ); jobHops.add( (JobHopMeta) hi.clone() ); hopIndexes[hopIndex] = idx; job.removeJobHop( idx ); spoon.refreshTree(); hopIndex++; break; } } } if ( !jobHops.isEmpty() ) { JobHopMeta[] hops = jobHops.toArray( new JobHopMeta[jobHops.size()] ); spoon.addUndoDelete( job, hops, hopIndexes ); } // Deleting jobEntries are placed all in a single transaction and removed. int[] positions = new int[jobEntries.length]; for ( int i = 0; i < jobEntries.length; i++ ) { int pos = job.indexOfJobEntry( jobEntries[i] ); job.removeJobEntry( pos ); positions[i] = pos; } spoon.addUndoDelete( job, jobEntries, positions ); spoon.refreshTree(); spoon.refreshGraph(); }