use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.
the class JobMeta method getAlternativeJobentryName.
/**
* Proposes an alternative job entry name when the original already exists...
*
* @param entryname The job entry name to find an alternative for..
* @return The alternative stepname.
*/
public String getAlternativeJobentryName(String entryname) {
String newname = entryname;
JobEntryCopy jec = findJobEntry(newname);
int nr = 1;
while (jec != null) {
nr++;
newname = entryname + " " + nr;
jec = findJobEntry(newname);
}
return newname;
}
use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.
the class JobMeta method getUsedDatabaseMetas.
private Set<DatabaseMeta> getUsedDatabaseMetas() {
Set<DatabaseMeta> databaseMetas = new HashSet<DatabaseMeta>();
for (JobEntryCopy jobEntryCopy : getJobCopies()) {
DatabaseMeta[] dbs = jobEntryCopy.getEntry().getUsedDatabaseConnections();
if (dbs != null) {
for (DatabaseMeta db : dbs) {
databaseMetas.add(db);
}
}
}
databaseMetas.add(jobLogTable.getDatabaseMeta());
for (LogTableInterface logTable : getExtraLogTables()) {
databaseMetas.add(logTable.getDatabaseMeta());
}
return databaseMetas;
}
use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.
the class JobMeta method getMaximum.
/**
* 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);
}
use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.
the class JobMeta method hasLoop.
/**
* Checks for loop.
*
* @param entry the entry
* @param lookup the lookup
* @return true, if successful
*/
private boolean hasLoop(JobEntryCopy entry, JobEntryCopy lookup, HashSet<JobEntryCopy> checkedEntries) {
String cacheKey = entry.getName() + " - " + (lookup != null ? lookup.getName() : "");
Boolean hasLoop = loopCache.get(cacheKey);
if (hasLoop != null) {
return hasLoop;
}
hasLoop = false;
checkedEntries.add(entry);
int nr = findNrPrevJobEntries(entry);
for (int i = 0; i < nr; i++) {
JobEntryCopy prevJobMeta = findPrevJobEntry(entry, i);
if (prevJobMeta != null && (prevJobMeta.equals(lookup) || (!checkedEntries.contains(prevJobMeta) && hasLoop(prevJobMeta, lookup == null ? entry : lookup, checkedEntries)))) {
hasLoop = true;
break;
}
}
loopCache.put(cacheKey, hasLoop);
return hasLoop;
}
use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.
the class JobMeta method getMinimum.
/**
* Get the minimum point on the canvas of a job
*
* @return Minimum coordinate of a step in the job
*/
public Point getMinimum() {
int minx = Integer.MAX_VALUE;
int miny = Integer.MAX_VALUE;
for (int i = 0; i < nrJobEntries(); i++) {
JobEntryCopy jobEntryCopy = getJobEntry(i);
Point loc = jobEntryCopy.getLocation();
if (loc.x < minx) {
minx = loc.x;
}
if (loc.y < miny) {
miny = loc.y;
}
}
for (int i = 0; i < nrNotes(); i++) {
NotePadMeta notePadMeta = getNote(i);
Point loc = notePadMeta.getLocation();
if (loc.x < minx) {
minx = loc.x;
}
if (loc.y < miny) {
miny = loc.y;
}
}
if (minx > BORDER_INDENT && minx != Integer.MAX_VALUE) {
minx -= BORDER_INDENT;
} else {
minx = 0;
}
if (miny > BORDER_INDENT && miny != Integer.MAX_VALUE) {
miny -= BORDER_INDENT;
} else {
miny = 0;
}
return new Point(minx, miny);
}
Aggregations