Search in sources :

Example 1 with SpoonTreeDelegateExtension

use of org.pentaho.di.ui.spoon.delegates.SpoonTreeDelegateExtension in project pentaho-kettle by pentaho.

the class RunConfigurationTreeDelegateExtension method callExtensionPoint.

@Override
public void callExtensionPoint(LogChannelInterface log, Object extension) throws KettleException {
    SpoonTreeDelegateExtension treeDelExt = (SpoonTreeDelegateExtension) extension;
    int caseNumber = treeDelExt.getCaseNumber();
    AbstractMeta meta = treeDelExt.getTransMeta();
    String[] path = treeDelExt.getPath();
    List<TreeSelection> objects = treeDelExt.getObjects();
    TreeSelection object = null;
    if (path[2].equals(RunConfigurationViewTreeExtension.TREE_LABEL)) {
        switch(caseNumber) {
            case 3:
                object = new TreeSelection(path[2], RunConfiguration.class, meta);
                break;
            case 4:
                try {
                    RunConfiguration runConfiguration = runConfigurationManager.load(path[3]);
                    if (!runConfiguration.isReadOnly()) {
                        object = new TreeSelection(path[3], runConfiguration, meta);
                    }
                } catch (Exception e) {
                // Do Nothing
                }
                break;
        }
    }
    if (object != null) {
        objects.add(object);
    }
}
Also used : RunConfiguration(org.pentaho.di.engine.configuration.api.RunConfiguration) TreeSelection(org.pentaho.di.ui.spoon.TreeSelection) AbstractMeta(org.pentaho.di.base.AbstractMeta) SpoonTreeDelegateExtension(org.pentaho.di.ui.spoon.delegates.SpoonTreeDelegateExtension) ExtensionPoint(org.pentaho.di.core.extension.ExtensionPoint) KettleException(org.pentaho.di.core.exception.KettleException)

Example 2 with SpoonTreeDelegateExtension

use of org.pentaho.di.ui.spoon.delegates.SpoonTreeDelegateExtension in project pdi-dataservice-server-plugin by pentaho.

the class DataServiceTreeDelegateExtension method callExtensionPoint.

@Override
public void callExtensionPoint(LogChannelInterface log, Object extension) throws KettleException {
    SpoonTreeDelegateExtension treeDelExt = (SpoonTreeDelegateExtension) extension;
    int caseNumber = treeDelExt.getCaseNumber();
    if (!(treeDelExt.getTransMeta() instanceof TransMeta)) {
        return;
    }
    TransMeta transMeta = (TransMeta) treeDelExt.getTransMeta();
    String[] path = treeDelExt.getPath();
    List<TreeSelection> objects = treeDelExt.getObjects();
    TreeSelection object = null;
    if (path[2].equals(STRING_DATA_SERVICES)) {
        switch(caseNumber) {
            case 3:
                object = new TreeSelection(path[2], DataServiceMeta.class, transMeta);
                break;
            case 4:
                try {
                    DataServiceMeta dataService = metaStoreUtil.getDataService(path[3], transMeta);
                    object = new TreeSelection(path[3], dataService, transMeta);
                } catch (Exception e) {
                // Do Nothing
                }
                break;
        }
    }
    if (object != null) {
        objects.add(object);
    }
}
Also used : DataServiceMeta(org.pentaho.di.trans.dataservice.DataServiceMeta) TreeSelection(org.pentaho.di.ui.spoon.TreeSelection) SpoonTreeDelegateExtension(org.pentaho.di.ui.spoon.delegates.SpoonTreeDelegateExtension) TransMeta(org.pentaho.di.trans.TransMeta) ExtensionPoint(org.pentaho.di.core.extension.ExtensionPoint) KettleException(org.pentaho.di.core.exception.KettleException)

Aggregations

KettleException (org.pentaho.di.core.exception.KettleException)2 ExtensionPoint (org.pentaho.di.core.extension.ExtensionPoint)2 TreeSelection (org.pentaho.di.ui.spoon.TreeSelection)2 SpoonTreeDelegateExtension (org.pentaho.di.ui.spoon.delegates.SpoonTreeDelegateExtension)2 AbstractMeta (org.pentaho.di.base.AbstractMeta)1 RunConfiguration (org.pentaho.di.engine.configuration.api.RunConfiguration)1 TransMeta (org.pentaho.di.trans.TransMeta)1 DataServiceMeta (org.pentaho.di.trans.dataservice.DataServiceMeta)1