private 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(); jet.setSpecificationMethod(ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME); String filename = jet.getFilename(); String jobname = filename.substring(filename.lastIndexOf("/") + 1, filename.lastIndexOf('.')); String directory = filename.substring(0, filename.lastIndexOf("/")); jet.setTransname(jobname); jet.setDirectory(directory); jobMeta.setJobEntry(i, jec); } } return jobMeta; }
private void getInfo(JobEntryTrans jet) throws KettleException { jet.setName(wName.getText()); if (rep != null) { specificationMethod = ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME; } else { specificationMethod = ObjectLocationSpecificationMethod.FILENAME; } jet.setSpecificationMethod(specificationMethod); switch (specificationMethod) { case FILENAME: jet.setFileName(wPath.getText()); if (jet.getFilename().isEmpty()) { throw new KettleException( BaseMessages.getString(PKG, "JobTrans.Dialog.Exception.NoValidMappingDetailsFound")); } jet.setDirectory(null); jet.setTransname(null); jet.setTransObjectId(null); break; case REPOSITORY_BY_NAME: String transPath = wPath.getText(); String transName = transPath; String directory = ""; int index = transPath.lastIndexOf("/"); if (index != -1) { transName = transPath.substring(index + 1); directory = transPath.substring(0, index); } jet.setDirectory(directory); if (jet.getDirectory().isEmpty()) { throw new KettleException( BaseMessages.getString( PKG, "JobTrans.Dialog.Exception.UnableToFindRepositoryDirectory")); } jet.setTransname(transName); jet.setFileName(null); jet.setTransObjectId(null); break; default: break; } int nritems = wFields.nrNonEmpty(); int nr = 0; for (int i = 0; i < nritems; i++) { String arg = wFields.getNonEmpty(i).getText(1); if (arg != null && arg.length() != 0) { nr++; } } jet.arguments = new String[nr]; nr = 0; for (int i = 0; i < nritems; i++) { String arg = wFields.getNonEmpty(i).getText(1); if (arg != null && arg.length() != 0) { jet.arguments[nr] = arg; nr++; } } // Do the parameters nritems = wParameters.nrNonEmpty(); nr = 0; for (int i = 0; i < nritems; i++) { String param = wParameters.getNonEmpty(i).getText(1); if (param != null && param.length() != 0) { nr++; } } jet.parameters = new String[nr]; jet.parameterFieldNames = new String[nr]; jet.parameterValues = new String[nr]; nr = 0; for (int i = 0; i < nritems; i++) { String param = wParameters.getNonEmpty(i).getText(1); String fieldName = wParameters.getNonEmpty(i).getText(2); String value = wParameters.getNonEmpty(i).getText(3); jet.parameters[nr] = param; if (!Utils.isEmpty(Const.trim(fieldName))) { jet.parameterFieldNames[nr] = fieldName; } else { jet.parameterFieldNames[nr] = ""; } if (!Utils.isEmpty(Const.trim(value))) { jet.parameterValues[nr] = value; } else { jet.parameterValues[nr] = ""; } nr++; } jet.setPassingAllParameters(wPassParams.getSelection()); jet.logfile = wLogfile.getText(); jet.logext = wLogext.getText(); if (wLoglevel.getSelectionIndex() >= 0) { jet.logFileLevel = LogLevel.values()[wLoglevel.getSelectionIndex()]; } else { jet.logFileLevel = LogLevel.BASIC; } jet.argFromPrevious = wPrevious.getSelection(); jet.paramsFromPrevious = wPrevToParams.getSelection(); jet.execPerRow = wEveryRow.getSelection(); jet.setLogfile = wSetLogfile.getSelection(); jet.addDate = wAddDate.getSelection(); jet.addTime = wAddTime.getSelection(); jet.clearResultRows = wClearRows.getSelection(); jet.clearResultFiles = wClearFiles.getSelection(); jet.setClustering(wCluster.getSelection()); jet.setLoggingRemoteWork(wLogRemoteWork.getSelection()); jet.createParentFolder = wCreateParentFolder.getSelection(); jet.setRemoteSlaveServerName(wSlaveServer.getText()); jet.setAppendLogfile = wAppendLogfile.getSelection(); jet.setWaitingToFinish(wWaitingToFinish.getSelection()); jet.setFollowingAbortRemotely(wFollowingAbortRemotely.getSelection()); }
public void getData() { wName.setText(Const.NVL(jobEntry.getName(), "")); specificationMethod = jobEntry.getSpecificationMethod(); switch (specificationMethod) { case FILENAME: wPath.setText(Const.NVL(jobEntry.getFilename(), "")); break; case REPOSITORY_BY_NAME: String fullPath = Const.NVL(jobEntry.getDirectory(), "") + "/" + Const.NVL(jobEntry.getTransname(), ""); wPath.setText(fullPath); break; case REPOSITORY_BY_REFERENCE: referenceObjectId = jobEntry.getTransObjectId(); if (rep != null && jobEntry.getTransObjectId() != null) { getByReferenceData(jobEntry.getTransObjectId()); } break; default: break; } // Arguments if (jobEntry.arguments != null) { for (int i = 0; i < jobEntry.arguments.length; i++) { TableItem ti = wFields.table.getItem(i); if (jobEntry.arguments[i] != null) { ti.setText(1, jobEntry.arguments[i]); } } wFields.setRowNums(); wFields.optWidth(true); } // Parameters if (jobEntry.parameters != null) { for (int i = 0; i < jobEntry.parameters.length; i++) { TableItem ti = wParameters.table.getItem(i); if (!Utils.isEmpty(jobEntry.parameters[i])) { ti.setText(1, Const.NVL(jobEntry.parameters[i], "")); ti.setText(2, Const.NVL(jobEntry.parameterFieldNames[i], "")); ti.setText(3, Const.NVL(jobEntry.parameterValues[i], "")); } } wParameters.setRowNums(); wParameters.optWidth(true); } wPassParams.setSelection(jobEntry.isPassingAllParameters()); if (jobEntry.logfile != null) { wLogfile.setText(jobEntry.logfile); } if (jobEntry.logext != null) { wLogext.setText(jobEntry.logext); } wPrevious.setSelection(jobEntry.argFromPrevious); wPrevToParams.setSelection(jobEntry.paramsFromPrevious); wEveryRow.setSelection(jobEntry.execPerRow); wSetLogfile.setSelection(jobEntry.setLogfile); wAddDate.setSelection(jobEntry.addDate); wAddTime.setSelection(jobEntry.addTime); wClearRows.setSelection(jobEntry.clearResultRows); wClearFiles.setSelection(jobEntry.clearResultFiles); if (jobEntry.isClustering()) { wCluster.setSelection(true); } else if (jobEntry.getRemoteSlaveServerName() != null && !Utils.isEmpty(jobEntry.getRemoteSlaveServerName())) { wbServer.setSelection(true); } else { wbLocal.setSelection(true); } wLogRemoteWork.setSelection(jobEntry.isLoggingRemoteWork()); if (jobEntry.getRemoteSlaveServerName() != null) { wSlaveServer.setText(jobEntry.getRemoteSlaveServerName()); } wWaitingToFinish.setSelection(jobEntry.isWaitingToFinish()); wFollowingAbortRemotely.setSelection(jobEntry.isFollowingAbortRemotely()); wAppendLogfile.setSelection(jobEntry.setAppendLogfile); wbLogFilename.setSelection(jobEntry.setAppendLogfile); wCreateParentFolder.setSelection(jobEntry.createParentFolder); if (jobEntry.logFileLevel != null) { wLoglevel.select(jobEntry.logFileLevel.getLevel()); } }