Search in sources :

Example 71 with TransHopMeta

use of org.pentaho.di.trans.TransHopMeta in project pentaho-kettle by pentaho.

the class Spoon method setMenu.

private synchronized void setMenu(Tree tree) {
    TreeSelection[] objects = getTreeObjects(tree);
    if (objects.length != 1) {
        // not yet supported, we can do this later when the OSX bug
        return;
    // goes away
    }
    TreeSelection object = objects[0];
    selectionObject = object.getSelection();
    Object selection = selectionObject;
    selectionObjectParent = object.getParent();
    // Not clicked on a real object: returns a class
    XulMenupopup spoonMenu = null;
    if (selection instanceof Class<?>) {
        if (selection.equals(TransMeta.class)) {
            // New
            spoonMenu = (XulMenupopup) menuMap.get("trans-class");
        } else if (selection.equals(JobMeta.class)) {
            // New
            spoonMenu = (XulMenupopup) menuMap.get("job-class");
        } else if (selection.equals(TransHopMeta.class)) {
            // New
            spoonMenu = (XulMenupopup) menuMap.get("trans-hop-class");
        } else if (selection.equals(DatabaseMeta.class)) {
            spoonMenu = (XulMenupopup) menuMap.get("database-class");
        } else if (selection.equals(PartitionSchema.class)) {
            // New
            spoonMenu = (XulMenupopup) menuMap.get("partition-schema-class");
        } else if (selection.equals(ClusterSchema.class)) {
            spoonMenu = (XulMenupopup) menuMap.get("cluster-schema-class");
        } else if (selection.equals(SlaveServer.class)) {
            spoonMenu = (XulMenupopup) menuMap.get("slave-cluster-class");
        } else {
            spoonMenu = null;
        }
    } else {
        if (selection instanceof TransMeta) {
            spoonMenu = (XulMenupopup) menuMap.get("trans-inst");
        } else if (selection instanceof JobMeta) {
            spoonMenu = (XulMenupopup) menuMap.get("job-inst");
        } else if (selection instanceof PluginInterface) {
            spoonMenu = (XulMenupopup) menuMap.get("step-plugin");
        } else if (selection instanceof DatabaseMeta) {
            spoonMenu = (XulMenupopup) menuMap.get("database-inst");
            // disable for now if the connection is an SAP ERP type of database...
            // 
            XulMenuitem item = (XulMenuitem) mainSpoonContainer.getDocumentRoot().getElementById("database-inst-explore");
            if (item != null) {
                final DatabaseMeta databaseMeta = (DatabaseMeta) selection;
                item.setDisabled(!databaseMeta.isExplorable());
            }
            item = (XulMenuitem) mainSpoonContainer.getDocumentRoot().getElementById("database-inst-clear-cache");
            if (item != null) {
                final DatabaseMeta databaseMeta = (DatabaseMeta) selectionObject;
                item.setLabel(BaseMessages.getString(PKG, "Spoon.Menu.Popup.CONNECTIONS.ClearDBCache") + // Clear
                databaseMeta.getName());
            }
            item = (XulMenuitem) mainSpoonContainer.getDocumentRoot().getElementById("database-inst-share");
            if (item != null) {
                final DatabaseMeta databaseMeta = (DatabaseMeta) selection;
                if (databaseMeta.isShared()) {
                    item.setLabel(BaseMessages.getString(PKG, "Spoon.Menu.Popup.CONNECTIONS.UnShare"));
                } else {
                    item.setLabel(BaseMessages.getString(PKG, "Spoon.Menu.Popup.CONNECTIONS.Share"));
                }
            }
        } else if (selection instanceof StepMeta) {
            spoonMenu = (XulMenupopup) menuMap.get("step-inst");
        } else if (selection instanceof JobEntryCopy) {
            spoonMenu = (XulMenupopup) menuMap.get("job-entry-copy-inst");
        } else if (selection instanceof TransHopMeta) {
            spoonMenu = (XulMenupopup) menuMap.get("trans-hop-inst");
        } else if (selection instanceof PartitionSchema) {
            spoonMenu = (XulMenupopup) menuMap.get("partition-schema-inst");
        } else if (selection instanceof ClusterSchema) {
            spoonMenu = (XulMenupopup) menuMap.get("cluster-schema-inst");
        } else if (selection instanceof SlaveServer) {
            spoonMenu = (XulMenupopup) menuMap.get("slave-server-inst");
        }
    }
    if (spoonMenu != null) {
        ConstUI.displayMenu(spoonMenu, tree);
    } else {
        tree.setMenu(null);
    }
    createPopUpMenuExtension();
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) PartitionSchema(org.pentaho.di.partition.PartitionSchema) PluginInterface(org.pentaho.di.core.plugins.PluginInterface) TransMeta(org.pentaho.di.trans.TransMeta) SlaveServer(org.pentaho.di.cluster.SlaveServer) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) StepMeta(org.pentaho.di.trans.step.StepMeta) XulMenupopup(org.pentaho.ui.xul.containers.XulMenupopup) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) XulMenuitem(org.pentaho.ui.xul.components.XulMenuitem) RepositoryObject(org.pentaho.di.repository.RepositoryObject) SimpleLoggingObject(org.pentaho.di.core.logging.SimpleLoggingObject) FileObject(org.apache.commons.vfs2.FileObject) TransHopMeta(org.pentaho.di.trans.TransHopMeta) ClusterSchema(org.pentaho.di.cluster.ClusterSchema)

Example 72 with TransHopMeta

use of org.pentaho.di.trans.TransHopMeta in project pentaho-kettle by pentaho.

the class Spoon method delHop.

public void delHop() {
    final TransMeta transMeta = (TransMeta) selectionObjectParent;
    final TransHopMeta transHopMeta = (TransHopMeta) selectionObject;
    delHop(transMeta, transHopMeta);
}
Also used : TransMeta(org.pentaho.di.trans.TransMeta) TransHopMeta(org.pentaho.di.trans.TransHopMeta)

Example 73 with TransHopMeta

use of org.pentaho.di.trans.TransHopMeta in project pentaho-kettle by pentaho.

the class Spoon method editHop.

public void editHop(TransMeta transMeta, TransHopMeta transHopMeta) {
    // Backup situation BEFORE edit:
    String name = transHopMeta.toString();
    TransHopMeta before = (TransHopMeta) transHopMeta.clone();
    TransHopDialog hd = new TransHopDialog(shell, SWT.NONE, transHopMeta, transMeta);
    if (hd.open() != null) {
        // Backup situation for redo/undo:
        TransHopMeta after = (TransHopMeta) transHopMeta.clone();
        addUndoChange(transMeta, new TransHopMeta[] { before }, new TransHopMeta[] { after }, new int[] { transMeta.indexOfTransHop(transHopMeta) });
        String newName = transHopMeta.toString();
        if (!name.equalsIgnoreCase(newName)) {
            refreshTree();
            // color, nr of copies...
            refreshGraph();
        }
    }
    setShellText();
}
Also used : TransHopDialog(org.pentaho.di.ui.trans.dialog.TransHopDialog) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) TransHopMeta(org.pentaho.di.trans.TransHopMeta)

Example 74 with TransHopMeta

use of org.pentaho.di.trans.TransHopMeta in project pentaho-kettle by pentaho.

the class Spoon method editHop.

public void editHop() {
    final TransMeta transMeta = (TransMeta) selectionObjectParent;
    final TransHopMeta transHopMeta = (TransHopMeta) selectionObject;
    editHop(transMeta, transHopMeta);
}
Also used : TransMeta(org.pentaho.di.trans.TransMeta) TransHopMeta(org.pentaho.di.trans.TransHopMeta)

Example 75 with TransHopMeta

use of org.pentaho.di.trans.TransHopMeta in project pentaho-kettle by pentaho.

the class Spoon method copySelected.

public void copySelected(TransMeta transMeta, List<StepMeta> steps, List<NotePadMeta> notes) {
    if (steps == null || steps.size() == 0) {
        return;
    }
    if (RepositorySecurityUI.verifyOperations(shell, rep, RepositoryOperation.MODIFY_TRANSFORMATION, RepositoryOperation.EXECUTE_TRANSFORMATION)) {
        return;
    }
    StringBuilder xml = new StringBuilder(5000).append(XMLHandler.getXMLHeader());
    try {
        xml.append(XMLHandler.openTag(Spoon.XML_TAG_TRANSFORMATION_STEPS)).append(Const.CR);
        xml.append(XMLHandler.openTag(Spoon.XML_TAG_STEPS)).append(Const.CR);
        for (StepMeta step : steps) {
            xml.append(step.getXML());
        }
        xml.append(XMLHandler.closeTag(Spoon.XML_TAG_STEPS)).append(Const.CR);
        // Also check for the hops in between the selected steps...
        xml.append(XMLHandler.openTag(TransMeta.XML_TAG_ORDER)).append(Const.CR);
        for (StepMeta step1 : steps) {
            for (StepMeta step2 : steps) {
                if (step1 != step2) {
                    TransHopMeta hop = transMeta.findTransHop(step1, step2, true);
                    if (hop != null) {
                        // Ok, we found one...
                        xml.append(hop.getXML()).append(Const.CR);
                    }
                }
            }
        }
        xml.append(XMLHandler.closeTag(TransMeta.XML_TAG_ORDER)).append(Const.CR);
        xml.append(XMLHandler.openTag(TransMeta.XML_TAG_NOTEPADS)).append(Const.CR);
        if (notes != null) {
            for (NotePadMeta note : notes) {
                xml.append(note.getXML());
            }
        }
        xml.append(XMLHandler.closeTag(TransMeta.XML_TAG_NOTEPADS)).append(Const.CR);
        xml.append(XMLHandler.openTag(TransMeta.XML_TAG_STEP_ERROR_HANDLING)).append(Const.CR);
        for (StepMeta step : steps) {
            if (step.getStepErrorMeta() != null) {
                xml.append(step.getStepErrorMeta().getXML()).append(Const.CR);
            }
        }
        xml.append(XMLHandler.closeTag(TransMeta.XML_TAG_STEP_ERROR_HANDLING)).append(Const.CR);
        xml.append(XMLHandler.closeTag(Spoon.XML_TAG_TRANSFORMATION_STEPS)).append(Const.CR);
        toClipboard(xml.toString());
    } catch (Exception ex) {
        new ErrorDialog(getShell(), "Error", "Error encoding to XML", ex);
    }
}
Also used : ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) TransHopMeta(org.pentaho.di.trans.TransHopMeta) NotePadMeta(org.pentaho.di.core.NotePadMeta) StepMeta(org.pentaho.di.trans.step.StepMeta) SWTException(org.eclipse.swt.SWTException) KettleRowException(org.pentaho.di.core.exception.KettleRowException) FileSystemException(org.apache.commons.vfs2.FileSystemException) MetaStoreException(org.pentaho.metastore.api.exceptions.MetaStoreException) KettleValueException(org.pentaho.di.core.exception.KettleValueException) KettleAuthException(org.pentaho.di.core.exception.KettleAuthException) KettleRepositoryLostException(org.pentaho.di.repository.KettleRepositoryLostException) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) LifecycleException(org.pentaho.di.core.lifecycle.LifecycleException) KettleMissingPluginsException(org.pentaho.di.core.exception.KettleMissingPluginsException) KettleFileException(org.pentaho.di.core.exception.KettleFileException) KettleException(org.pentaho.di.core.exception.KettleException) MalformedURLException(java.net.MalformedURLException)

Aggregations

TransHopMeta (org.pentaho.di.trans.TransHopMeta)153 StepMeta (org.pentaho.di.trans.step.StepMeta)127 TransMeta (org.pentaho.di.trans.TransMeta)114 PluginRegistry (org.pentaho.di.core.plugins.PluginRegistry)80 Trans (org.pentaho.di.trans.Trans)78 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)71 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)71 StepInterface (org.pentaho.di.trans.step.StepInterface)70 RowStepCollector (org.pentaho.di.trans.RowStepCollector)66 DummyTransMeta (org.pentaho.di.trans.steps.dummytrans.DummyTransMeta)63 RowProducer (org.pentaho.di.trans.RowProducer)49 InjectorMeta (org.pentaho.di.trans.steps.injector.InjectorMeta)49 Test (org.junit.Test)35 KettleException (org.pentaho.di.core.exception.KettleException)28 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)25 Point (org.pentaho.di.core.gui.Point)21 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)19 NotePadMeta (org.pentaho.di.core.NotePadMeta)15 StepMetaInterface (org.pentaho.di.trans.step.StepMetaInterface)14 File (java.io.File)12