/** Rename the tabs */ public void renameTabs() { List<TabMapEntry> list = new ArrayList<TabMapEntry>(tabMap); for (TabMapEntry entry : list) { if (entry.getTabItem().isDisposed()) { // this should not be in the map, get rid of it. tabMap.remove(entry.getObjectName()); continue; } // TabItem before = entry.getTabItem(); // PDI-1683: need to get the String here, otherwise using only the "before" instance below, // the reference gets // changed and result is always the same // String beforeText=before.getText(); // Object managedObject = entry.getObject().getManagedObject(); if (managedObject != null) { if (entry.getObject() instanceof TransGraph) { TransMeta transMeta = (TransMeta) managedObject; String tabText = makeTabName(transMeta, entry.isShowingLocation()); entry.getTabItem().setText(tabText); String toolTipText = BaseMessages.getString(PKG, "Spoon.TabTrans.Tooltip", tabText); if (Const.isWindows() && !Const.isEmpty(transMeta.getFilename())) { toolTipText += Const.CR + Const.CR + transMeta.getFilename(); } entry.getTabItem().setToolTipText(toolTipText); } else if (entry.getObject() instanceof JobGraph) { JobMeta jobMeta = (JobMeta) managedObject; entry.getTabItem().setText(makeTabName(jobMeta, entry.isShowingLocation())); String toolTipText = BaseMessages.getString( PKG, "Spoon.TabJob.Tooltip", makeTabName(jobMeta, entry.isShowingLocation())); if (Const.isWindows() && !Const.isEmpty(jobMeta.getFilename())) { toolTipText += Const.CR + Const.CR + jobMeta.getFilename(); } entry.getTabItem().setToolTipText(toolTipText); } } /* * String after = entry.getTabItem().getText(); * * if (!beforeText.equals(after)) // PDI-1683, could be improved to rename all the time { * entry.setObjectName(after); * * // Also change the transformation map if (entry.getObject() instanceof TransGraph) { * spoon.delegates.trans.removeTransformation(beforeText); spoon.delegates.trans.addTransformation(after, * (TransMeta) entry.getObject().getManagedObject()); } // Also change the job map if (entry.getObject() * instanceof JobGraph) { spoon.delegates.jobs.removeJob(beforeText); spoon.delegates.jobs.addJob(after, (JobMeta) * entry.getObject().getManagedObject()); } } */ } spoon.setShellText(); }
protected void saveJobMeta(JobMeta jobMeta) throws KettleException { // Keep info on who & when this transformation was created... if (jobMeta.getCreatedUser() == null || jobMeta.getCreatedUser().equals("-")) { jobMeta.setCreatedDate(new Date()); if (rep.getUserInfo() != null) { jobMeta.setCreatedUser(rep.getUserInfo().getLogin()); } else { jobMeta.setCreatedUser(null); } } rep.save(jobMeta, versionComment, null, overwrite); }
private void patchJobEntries(JobMeta jobMeta) { for (JobEntryCopy copy : jobMeta.getJobCopies()) { if (copy.isTransformation()) { JobEntryTrans entry = (JobEntryTrans) copy.getEntry(); if (entry.getSpecificationMethod() == ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME) { if (transDirOverride != null) { entry.setDirectory(transDirOverride); continue; } String entryPath = resolvePath(baseDirectory.getPath(), entry.getDirectory()); entry.setDirectory(entryPath); } } if (copy.isJob()) { JobEntryJob entry = (JobEntryJob) copy.getEntry(); if (entry.getSpecificationMethod() == ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME) { if (jobDirOverride != null) { entry.setDirectory(jobDirOverride); continue; } String entryPath = resolvePath(baseDirectory.getPath(), entry.getDirectory()); entry.setDirectory(entryPath); } } } }
private 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(); jej.setSpecificationMethod(ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME); String filename = jej.getFilename(); String jobname = filename.substring(filename.lastIndexOf("/") + 1, filename.lastIndexOf('.')); String directory = filename.substring(0, filename.lastIndexOf("/")); jej.setJobName(jobname); jej.setDirectory(directory); jobMeta.setJobEntry(i, jec); } } return jobMeta; }
public List<ResourceReference> getResourceDependencies(JobMeta jobMeta) { List<ResourceReference> references = super.getResourceDependencies(jobMeta); if (!Const.isEmpty(serverName)) { String realServerName = jobMeta.environmentSubstitute(serverName); ResourceReference reference = new ResourceReference(this); reference.getEntries().add(new ResourceEntry(realServerName, ResourceType.SERVER)); references.add(reference); } return references; }
public void testRule() throws Exception { JobMeta jobMeta = new JobMeta(); jobMeta.setDescription("This job is used for testing an import rule"); PluginRegistry registry = PluginRegistry.getInstance(); PluginInterface plugin = registry.findPluginWithId(ImportRulePluginType.class, "JobHasDescription"); assertNotNull( "The 'job has description' rule could not be found in the plugin registry!", plugin); JobHasDescriptionImportRule rule = (JobHasDescriptionImportRule) registry.loadClass(plugin); assertNotNull( "The 'job has description rule' class could not be loaded by the plugin registry!", plugin); rule.setMinLength(20); rule.setEnabled(true); List<ImportValidationFeedback> feedback = rule.verifyRule(jobMeta); assertTrue( "We didn't get any feedback from the 'job has description rule'", !feedback.isEmpty()); assertTrue( "An approval ruling was expected", feedback.get(0).getResultType() == ImportValidationResultType.APPROVAL); rule.setMinLength(2000); rule.setEnabled(true); feedback = rule.verifyRule(jobMeta); assertTrue( "We didn't get any feedback from the 'job has description rule'", !feedback.isEmpty()); assertTrue( "An error ruling was expected", feedback.get(0).getResultType() == ImportValidationResultType.ERROR); rule.setEnabled(false); feedback = rule.verifyRule(jobMeta); assertTrue( "We didn't expect any feedback from the 'job has description rule' while disabled", feedback.isEmpty()); }
private void saveJobToRepo(JobMeta jobMeta, RepositoryImportFeedbackInterface feedback) throws KettleException { try { jobMeta.lookupRepositoryReferences(rep); } catch (LookupReferencesException e) { // log and continue; might fail from exports performed before PDI-5294 feedback.addLog( BaseMessages.getString( PKG, "RepositoryImporter.LookupRepoRefsError.Log", jobMeta.getName(), RepositoryObjectType.JOB)); feedback.addLog( BaseMessages.getString( PKG, "RepositoryImporter.LookupRepoRefsError.Log.Cause", e.objectTypePairsToString())); } rep.save(jobMeta, "import object reference specification", null); }
public List<ResourceReference> getResourceDependencies(JobMeta jobMeta) { List<ResourceReference> references = super.getResourceDependencies(jobMeta); if ((!Const.isEmpty(xslfilename)) && (!Const.isEmpty(xmlfilename))) { String realXmlFileName = jobMeta.environmentSubstitute(xmlfilename); String realXslFileName = jobMeta.environmentSubstitute(xslfilename); ResourceReference reference = new ResourceReference(this); reference.getEntries().add(new ResourceEntry(realXmlFileName, ResourceType.FILE)); reference.getEntries().add(new ResourceEntry(realXslFileName, ResourceType.FILE)); references.add(reference); } return references; }
public List<ResourceReference> getResourceDependencies(JobMeta jobMeta) { List<ResourceReference> references = super.getResourceDependencies(jobMeta); if (variableName != null) { ResourceReference reference = null; for (int i = 0; i < variableName.length; i++) { String filename = jobMeta.environmentSubstitute(variableName[i]); if (reference == null) { reference = new ResourceReference(this); references.add(reference); } reference.getEntries().add(new ResourceEntry(filename, ResourceType.FILE)); } } return references; }
public boolean open(Node jobNode, String fname, boolean importfile) { Spoon spoon = Spoon.getInstance(); try { // Call extension point(s) before the file has been opened ExtensionPointHandler.callExtensionPoint( spoon.getLog(), KettleExtensionPoint.JobBeforeOpen.id, fname); JobMeta jobMeta = new JobMeta(); jobMeta.loadXML(jobNode, fname, spoon.getRepository(), spoon.getMetaStore(), false, spoon); jobMeta.setRepositoryDirectory(spoon.getDefaultSaveLocation(jobMeta)); jobMeta.setRepository(spoon.getRepository()); jobMeta.setMetaStore(spoon.getMetaStore()); spoon.setJobMetaVariables(jobMeta); spoon.getProperties().addLastFile(LastUsedFile.FILE_TYPE_JOB, fname, null, false, null); spoon.addMenuLast(); // If we are importing into a repository we need to fix // up the references to other jobs and transformations // if any exist. if (importfile) { if (spoon.getRepository() != null) { jobMeta = fixLinks(jobMeta); } } else { jobMeta.clearChanged(); } jobMeta.setFilename(fname); spoon.delegates.jobs.addJobGraph(jobMeta); // Call extension point(s) now that the file has been opened ExtensionPointHandler.callExtensionPoint( spoon.getLog(), KettleExtensionPoint.JobAfterOpen.id, jobMeta); spoon.refreshTree(); SpoonPerspectiveManager.getInstance().activatePerspective(MainSpoonPerspective.class); return true; } catch (KettleException e) { new ErrorDialog( spoon.getShell(), BaseMessages.getString(PKG, "Spoon.Dialog.ErrorOpening.Title"), BaseMessages.getString(PKG, "Spoon.Dialog.ErrorOpening.Message") + fname, e); } return false; }
/** * @return The object that is selected in the tree or null if we couldn't figure it out. (titles * etc. == null) */ public TreeSelection[] getTreeObjects(final Tree tree, Tree selectionTree, Tree coreObjectsTree) { List<TreeSelection> objects = new ArrayList<TreeSelection>(); if (selectionTree != null && !selectionTree.isDisposed() && tree.equals(selectionTree)) { TreeItem[] selection = selectionTree.getSelection(); for (int s = 0; s < selection.length; s++) { TreeItem treeItem = selection[s]; String[] path = ConstUI.getTreeStrings(treeItem); TreeSelection object = null; switch (path.length) { case 0: break; case 1: // ------complete----- if (path[0].equals( Spoon.STRING_TRANSFORMATIONS)) { // the top level Transformations entry object = new TreeSelection(path[0], TransMeta.class); } if (path[0].equals(Spoon.STRING_JOBS)) { // the top level Jobs entry object = new TreeSelection(path[0], JobMeta.class); } break; case 2: // ------complete----- if (path[0].equals( Spoon.STRING_BUILDING_BLOCKS)) { // the top level Transformations entry if (path[1].equals(Spoon.STRING_TRANS_BASE)) { object = new TreeSelection(path[1], PluginInterface.class); } } if (path[0].equals(Spoon.STRING_TRANSFORMATIONS)) { // Transformation title object = new TreeSelection(path[1], spoon.delegates.trans.getTransformation(path[1])); } if (path[0].equals(Spoon.STRING_JOBS)) { // Jobs title object = new TreeSelection(path[1], spoon.delegates.jobs.getJob(path[1])); } break; case 3: // ------complete----- if (path[0].equals(Spoon.STRING_TRANSFORMATIONS)) { // Transformations title TransMeta transMeta = spoon.delegates.trans.getTransformation(path[1]); if (path[2].equals(Spoon.STRING_CONNECTIONS)) { object = new TreeSelection(path[2], DatabaseMeta.class, transMeta); } if (path[2].equals(Spoon.STRING_STEPS)) { object = new TreeSelection(path[2], StepMeta.class, transMeta); } if (path[2].equals(Spoon.STRING_HOPS)) { object = new TreeSelection(path[2], TransHopMeta.class, transMeta); } if (path[2].equals(Spoon.STRING_PARTITIONS)) { object = new TreeSelection(path[2], PartitionSchema.class, transMeta); } if (path[2].equals(Spoon.STRING_SLAVES)) { object = new TreeSelection(path[2], SlaveServer.class, transMeta); } if (path[2].equals(Spoon.STRING_CLUSTERS)) { object = new TreeSelection(path[2], ClusterSchema.class, transMeta); } } if (path[0].equals(Spoon.STRING_JOBS)) { // Jobs title JobMeta jobMeta = spoon.delegates.jobs.getJob(path[1]); if (path[2].equals(Spoon.STRING_CONNECTIONS)) { object = new TreeSelection(path[2], DatabaseMeta.class, jobMeta); } if (path[2].equals(Spoon.STRING_JOB_ENTRIES)) { object = new TreeSelection(path[2], JobEntryCopy.class, jobMeta); } if (path[2].equals(Spoon.STRING_SLAVES)) { object = new TreeSelection(path[2], SlaveServer.class, jobMeta); } } break; case 4: // ------complete----- if (path[0].equals(Spoon.STRING_TRANSFORMATIONS)) { // The name of a transformation final TransMeta transMeta = spoon.delegates.trans.getTransformation(path[1]); if (transMeta != null) { if (path[2].equals(Spoon.STRING_CONNECTIONS)) { String dbName = path[3]; DatabaseMeta databaseMeta = transMeta.findDatabase(dbName); if (databaseMeta != null) { dbName = databaseMeta.getName(); } object = new TreeSelection(dbName, databaseMeta, transMeta); } if (path[2].equals(Spoon.STRING_STEPS)) { object = new TreeSelection(path[3], transMeta.findStep(path[3]), transMeta); } if (path[2].equals(Spoon.STRING_HOPS)) { object = new TreeSelection(path[3], transMeta.findTransHop(path[3]), transMeta); } if (path[2].equals(Spoon.STRING_PARTITIONS)) { object = new TreeSelection(path[3], transMeta.findPartitionSchema(path[3]), transMeta); } if (path[2].equals(Spoon.STRING_SLAVES)) { object = new TreeSelection(path[3], transMeta.findSlaveServer(path[3]), transMeta); } if (path[2].equals(Spoon.STRING_CLUSTERS)) { object = new TreeSelection(path[3], transMeta.findClusterSchema(path[3]), transMeta); } } } if (path[0].equals(Spoon.STRING_JOBS)) { // The name of a job JobMeta jobMeta = spoon.delegates.jobs.getJob(path[1]); if (jobMeta != null && path[2].equals(Spoon.STRING_CONNECTIONS)) { String dbName = path[3]; DatabaseMeta databaseMeta = jobMeta.findDatabase(dbName); if (databaseMeta != null) { dbName = databaseMeta.getName(); } object = new TreeSelection(dbName, databaseMeta, jobMeta); } if (jobMeta != null && path[2].equals(Spoon.STRING_JOB_ENTRIES)) { object = new TreeSelection(path[3], jobMeta.findJobEntry(path[3]), jobMeta); } if (jobMeta != null && path[2].equals(Spoon.STRING_SLAVES)) { object = new TreeSelection(path[3], jobMeta.findSlaveServer(path[3]), jobMeta); } } break; case 5: if (path[0].equals(Spoon.STRING_TRANSFORMATIONS)) { // The name of a transformation TransMeta transMeta = spoon.delegates.trans.getTransformation(path[1]); if (transMeta != null && path[2].equals(Spoon.STRING_CLUSTERS)) { ClusterSchema clusterSchema = transMeta.findClusterSchema(path[3]); object = new TreeSelection( path[4], clusterSchema.findSlaveServer(path[4]), clusterSchema, transMeta); } } break; default: break; } if (object != null) { objects.add(object); } } } if (tree != null && coreObjectsTree != null && tree.equals(coreObjectsTree)) { TreeItem[] selection = coreObjectsTree.getSelection(); for (int s = 0; s < selection.length; s++) { TreeItem treeItem = selection[s]; String[] path = ConstUI.getTreeStrings(treeItem); TreeSelection object = null; switch (path.length) { case 0: break; case 2: // Job entries if (spoon.showJob) { PluginRegistry registry = PluginRegistry.getInstance(); Class<? extends PluginTypeInterface> pluginType = JobEntryPluginType.class; PluginInterface plugin = registry.findPluginWithName(pluginType, path[1]); // Retry for Start // if (plugin == null) { if (path[1].equals(JobMeta.STRING_SPECIAL_START)) { plugin = registry.findPluginWithId(pluginType, JobMeta.STRING_SPECIAL); } } // Retry for Dummy // if (plugin == null) { if (path[1].equals(JobMeta.STRING_SPECIAL_DUMMY)) { plugin = registry.findPluginWithId(pluginType, JobMeta.STRING_SPECIAL); } } if (plugin != null) { object = new TreeSelection(path[1], plugin); } } if (spoon.showTrans) { // Steps object = new TreeSelection( path[1], PluginRegistry.getInstance() .findPluginWithName(StepPluginType.class, path[1])); } break; default: break; } if (object != null) { objects.add(object); } } } return objects.toArray(new TreeSelection[objects.size()]); }
@Override protected void customAnalyze(JobExecutorMeta meta, IMetaverseNode node) throws MetaverseAnalyzerException { String jobPath = meta.getFileName(); JobMeta subJobMeta = null; Repository repo = parentTransMeta.getRepository(); switch (meta.getSpecificationMethod()) { case FILENAME: jobPath = parentTransMeta.environmentSubstitute(meta.getFileName()); try { String normalized = KettleAnalyzerUtil.normalizeFilePath(jobPath); subJobMeta = getSubJobMeta(parentTransMeta, normalized); jobPath = normalized; } catch (Exception e) { throw new MetaverseAnalyzerException( "Sub transformation can not be found - " + jobPath, e); } break; case REPOSITORY_BY_NAME: if (repo != null) { String dir = parentTransMeta.environmentSubstitute(meta.getDirectoryPath()); String file = parentTransMeta.environmentSubstitute(meta.getJobName()); try { RepositoryDirectoryInterface rdi = repo.findDirectory(dir); subJobMeta = repo.loadJob(file, rdi, null, null); String filename = subJobMeta.getFilename() == null ? subJobMeta.toString() : subJobMeta.getFilename(); jobPath = filename + "." + subJobMeta.getDefaultExtension(); } catch (KettleException e) { throw new MetaverseAnalyzerException( "Sub transformation can not be found in repository - " + file, e); } } else { throw new MetaverseAnalyzerException( "Not connected to a repository, can't get the transformation"); } break; case REPOSITORY_BY_REFERENCE: if (repo != null) { try { subJobMeta = repo.loadJob(meta.getJobObjectId(), null); String filename = subJobMeta.getFilename() == null ? subJobMeta.toString() : subJobMeta.getFilename(); jobPath = filename + "." + subJobMeta.getDefaultExtension(); } catch (KettleException e) { throw new MetaverseAnalyzerException( "Sub transformation can not be found by reference - " + meta.getJobObjectId(), e); } } else { throw new MetaverseAnalyzerException( "Not connected to a repository, can't get the transformation"); } break; } // analyze the sub trans? IComponentDescriptor ds = new MetaverseComponentDescriptor( subJobMeta.getName(), DictionaryConst.NODE_TYPE_JOB, descriptor.getNamespace().getParentNamespace()); IMetaverseNode jobNode = createNodeFromDescriptor(ds); jobNode.setProperty(DictionaryConst.PROPERTY_NAMESPACE, ds.getNamespaceId()); jobNode.setProperty(DictionaryConst.PROPERTY_PATH, jobPath); jobNode.setLogicalIdGenerator(DictionaryConst.LOGICAL_ID_GENERATOR_DOCUMENT); metaverseBuilder.addLink(node, DictionaryConst.LINK_EXECUTES, jobNode); connectToSubJobOutputFields(meta, subJobMeta, jobNode, descriptor); node.setProperty(JOB_TO_EXECUTE, jobPath); if (StringUtils.isNotEmpty(meta.getExecutionResultTargetStep())) { node.setProperty(EXECUTION_RESULTS_TARGET, meta.getExecutionResultTargetStep()); } /* TODO remove? if ( StringUtils.isNotEmpty( meta.getOutputRowsSourceStep() ) ) { node.setProperty( OUTPUT_ROWS_TARGET, meta.getOutputRowsSourceStep() ); }*/ if (StringUtils.isNotEmpty(meta.getResultFilesTargetStep())) { node.setProperty(RESULT_FILES_TARGET, meta.getResultFilesTargetStep()); } }
protected void optionsSectionControls() { wSafeMode = new Button(gDetails, SWT.CHECK); wSafeMode.setText( BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.SafeMode.Label")); wSafeMode.setToolTipText( BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.SafeMode.Tooltip")); props.setLook(wSafeMode); FormData fdSafeMode = new FormData(); fdSafeMode.right = new FormAttachment(0, 186); fdSafeMode.top = new FormAttachment(0, 30); fdSafeMode.left = new FormAttachment(0, 10); wSafeMode.setLayoutData(fdSafeMode); wGatherMetrics = new Button(gDetails, SWT.CHECK); wGatherMetrics.setText( BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.GatherMetrics.Label")); wGatherMetrics.setToolTipText( BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.GatherMetrics.Tooltip")); props.setLook(wGatherMetrics); FormData fdGatherMetrics = new FormData(); fdGatherMetrics.right = new FormAttachment(0, 230); fdGatherMetrics.top = new FormAttachment(0, 55); fdGatherMetrics.left = new FormAttachment(0, 10); wGatherMetrics.setLayoutData(fdGatherMetrics); wClearLog = new Button(gDetails, SWT.CHECK); wClearLog.setText( BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.ClearLog.Label")); wClearLog.setToolTipText( BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.ClearLog.Tooltip")); props.setLook(wClearLog); FormData fdClearLog = new FormData(); fdClearLog.right = new FormAttachment(0, 200); fdClearLog.top = new FormAttachment(0, 5); fdClearLog.left = new FormAttachment(0, 10); wClearLog.setLayoutData(fdClearLog); wlLogLevel = new Label(gDetails, SWT.RIGHT); props.setLook(wlLogLevel); wlLogLevel.setText( BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.LogLevel.Label")); wlLogLevel.setToolTipText( BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.LogLevel.Tooltip")); FormData fdlLogLevel = new FormData(); fdlLogLevel.right = new FormAttachment(0, 333); fdlLogLevel.top = new FormAttachment(0, 7); fdlLogLevel.left = new FormAttachment(0, 260); wlLogLevel.setLayoutData(fdlLogLevel); wLogLevel = new CCombo(gDetails, SWT.READ_ONLY | SWT.BORDER); wLogLevel.setToolTipText( BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.LogLevel.Tooltip")); props.setLook(wLogLevel); FormData fdLogLevel = new FormData(); fdLogLevel.left = new FormAttachment(wlLogLevel, 6); fdLogLevel.width = 200; if (Const.isOSX()) { fdLogLevel.top = new FormAttachment(wClearLog, 2, SWT.TOP); } else { fdLogLevel.top = new FormAttachment(wClearLog, -2, SWT.TOP); } fdLogLevel.right = new FormAttachment(0, 500); wLogLevel.setLayoutData(fdLogLevel); wLogLevel.setItems(LogLevel.getLogLevelDescriptions()); wStartCopy = new CCombo(gDetails, SWT.READ_ONLY | SWT.BORDER); props.setLook(wStartCopy); wStartCopy.setToolTipText( BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.StartCopy.Tooltip")); FormData fd_startJobCombo = new FormData(); fd_startJobCombo.right = new FormAttachment(wLogLevel, 0, SWT.RIGHT); if (Const.isOSX()) { fd_startJobCombo.top = new FormAttachment(wLogLevel, 8); } else { fd_startJobCombo.top = new FormAttachment(wLogLevel, 10); } wStartCopy.setLayoutData(fd_startJobCombo); JobMeta jobMeta = (JobMeta) super.abstractMeta; String[] names = new String[jobMeta.getJobCopies().size()]; for (int i = 0; i < names.length; i++) { JobEntryCopy copy = jobMeta.getJobCopies().get(i); names[i] = getJobEntryCopyName(copy); } wStartCopy.setItems(names); Label lblStartJob = new Label(gDetails, SWT.NONE); props.setLook(lblStartJob); fd_startJobCombo.left = new FormAttachment(lblStartJob, 6); FormData fd_lblStartJob = new FormData(); if (Const.isOSX()) { fd_lblStartJob.top = new FormAttachment(wlLogLevel, 8); } else { fd_lblStartJob.top = new FormAttachment(wlLogLevel, 18); } fd_lblStartJob.right = new FormAttachment(wlLogLevel, 0, SWT.RIGHT); lblStartJob.setLayoutData(fd_lblStartJob); lblStartJob.setText( BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.StartCopy.Label")); lblStartJob.setToolTipText( BaseMessages.getString(PKG, "JobExecutionConfigurationDialog.StartCopy.Tooltip")); }
public void syncMetaName(EngineMetaInterface meta, String name) { ((JobMeta) meta).setName(name); }
protected boolean importJob(Node jobnode, RepositoryImportFeedbackInterface feedback) throws KettleException { // Load the job from the XML node. // JobMeta jobMeta = createJobMetaForNode(jobnode); feedback.setLabel( BaseMessages.getString( PKG, "RepositoryImporter.ImportJob.Label", Integer.toString(jobNumber), jobMeta.getName())); validateImportedElement(importRules, jobMeta); // What's the directory path? String directoryPath = Const.NVL(XMLHandler.getTagValue(jobnode, "directory"), Const.FILE_SEPARATOR); if (jobDirOverride != null) { directoryPath = jobDirOverride; } if (directoryPath.startsWith("/")) { // remove the leading root, we don't need it. directoryPath = directoryPath.substring(1); } // If we have a set of source directories to limit ourselves to, consider this. // if (limitDirs.size() > 0 && Const.indexOfString(directoryPath, limitDirs) < 0) { // Not in the limiting set of source directories, skip the import of this transformation... // feedback.addLog( BaseMessages.getString( PKG, "RepositoryImporter.SkippedJobNotPartOfLimitingDirectories.Log", jobMeta.getName())); return true; } RepositoryDirectoryInterface targetDirectory = getTargetDirectory(directoryPath, jobDirOverride, feedback); // OK, we loaded the job from XML and all went well... // See if the job already exists! ObjectId existintId = rep.getJobId(jobMeta.getName(), targetDirectory); if (existintId != null && askOverwrite) { overwrite = feedback.jobOverwritePrompt(jobMeta); askOverwrite = feedback.isAskingOverwriteConfirmation(); } else { updateDisplay(); } if (existintId == null || overwrite) { replaceSharedObjects(jobMeta); jobMeta.setRepositoryDirectory(targetDirectory); jobMeta.setObjectId(existintId); patchJobEntries(jobMeta); try { saveJobMeta(jobMeta); if (jobMeta.hasRepositoryReferences()) { referencingObjects.add( new RepositoryObject( jobMeta.getObjectId(), jobMeta.getName(), jobMeta.getRepositoryDirectory(), null, null, RepositoryObjectType.JOB, null, false)); } feedback.addLog( BaseMessages.getString( PKG, "RepositoryImporter.JobSaved.Log", Integer.toString(jobNumber), jobMeta.getName())); } catch (Exception e) { feedback.addLog( BaseMessages.getString( PKG, "RepositoryImporter.ErrorSavingJob.Log", Integer.toString(jobNumber), jobMeta.getName(), Const.getStackTracker(e))); if (!feedback.askContinueOnErrorQuestion( BaseMessages.getString(PKG, "RepositoryImporter.DoYouWantToContinue.Title"), BaseMessages.getString(PKG, "RepositoryImporter.DoYouWantToContinue.Message"))) { return false; } } } else { feedback.addLog( BaseMessages.getString( PKG, "RepositoryImporter.SkippedExistingJob.Log", jobMeta.getName())); } return true; }