Search in sources :

Example 1 with IDragAndDropServiceHandler

use of org.talend.core.model.utils.IDragAndDropServiceHandler in project tdi-studio-se by Talend.

the class RepositoryChangeMetadataCommand method setTableRelevantParameterValues.

protected void setTableRelevantParameterValues() {
    Connection conn = connection;
    if (conn == null) {
        if (newPropValue != null && newPropValue instanceof String) {
            String schemaId = (String) newPropValue;
            //$NON-NLS-1$
            String[] values = schemaId.split(" - ");
            String repositoryID = values[0];
            IRepositoryNode repositoryNode = RepositorySeekerManager.getInstance().searchRepoViewNode(repositoryID);
            if (repositoryNode != null && repositoryNode.getObject() != null) {
                Item item = repositoryNode.getObject().getProperty().getItem();
                if (item instanceof ConnectionItem) {
                    ConnectionItem conItem = (ConnectionItem) item;
                    conn = conItem.getConnection();
                }
            }
        }
    }
    for (IDragAndDropServiceHandler handler : DragAndDropManager.getHandlers()) {
        if (handler.canHandle(conn)) {
            handler.handleTableRelevantParameters(conn, node, newOutputMetadata);
        }
    }
}
Also used : ConnectionItem(org.talend.core.model.properties.ConnectionItem) SalesforceSchemaConnectionItem(org.talend.core.model.properties.SalesforceSchemaConnectionItem) Item(org.talend.core.model.properties.Item) IRepositoryNode(org.talend.repository.model.IRepositoryNode) IDragAndDropServiceHandler(org.talend.core.model.utils.IDragAndDropServiceHandler) ConnectionItem(org.talend.core.model.properties.ConnectionItem) SalesforceSchemaConnectionItem(org.talend.core.model.properties.SalesforceSchemaConnectionItem) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) Connection(org.talend.core.model.metadata.builder.connection.Connection) XmlFileConnection(org.talend.core.model.metadata.builder.connection.XmlFileConnection) SalesforceSchemaConnection(org.talend.core.model.metadata.builder.connection.SalesforceSchemaConnection)

Example 2 with IDragAndDropServiceHandler

use of org.talend.core.model.utils.IDragAndDropServiceHandler in project tdi-studio-se by Talend.

the class ComponentChooseDialog method getAppropriateComponent.

private void getAppropriateComponent(Item item, boolean quickCreateInput, boolean quickCreateOutput, TempStore store, ERepositoryObjectType type) {
    IComponentName rcSetting = RepositoryComponentManager.getSetting(item, type);
    // For handler, need check for esb
    if (rcSetting == null) {
        for (IDragAndDropServiceHandler handler : DragAndDropManager.getHandlers()) {
            rcSetting = handler.getCorrespondingComponentName(item, type);
            if (rcSetting != null) {
                break;
            }
        }
        if (rcSetting == null) {
            return;
        }
    }
    boolean isCurrentProject = true;
    String projectName = null;
    if (store.seletetedNode.getObject() != null) {
        projectName = store.seletetedNode.getObject().getProjectLabel();
        isCurrentProject = projectName.equals(ProjectManager.getInstance().getCurrentProject().getLabel());
    }
    List<IComponent> neededComponents = RepositoryComponentManager.filterNeededComponents(item, store.seletetedNode, type, isCurrentProject, projectName);
    for (IDragAndDropServiceHandler handler : DragAndDropManager.getHandlers()) {
        List<IComponent> comList = handler.filterNeededComponents(item, store.seletetedNode, type);
        if (comList != null) {
            for (IComponent handlerComp : comList) {
                if (!neededComponents.contains(handlerComp) && !handlerComp.isTechnical()) {
                    neededComponents.add(handlerComp);
                }
            }
        }
    }
    // special handle hbase to support tpigLoad
    String hbaseName = EDatabaseTypeName.HBASE.getDisplayName().toUpperCase();
    if (rcSetting != null && (hbaseName).equals(rcSetting.toString())) {
        IComponentsService service = (IComponentsService) GlobalServiceRegister.getDefault().getService(IComponentsService.class);
        String componentProductname = null;
        Set<IComponent> components = service.getComponentsFactory().getComponents();
        for (IComponent component : components) {
            componentProductname = component.getRepositoryType();
            if (componentProductname != null && componentProductname.contains(hbaseName) && !neededComponents.contains(component) && !component.isTechnical()) {
                neededComponents.add(component);
            }
        }
    }
    neededComponents = (List<IComponent>) ComponentUtilities.filterVisibleComponents(neededComponents);
    // Check if the components in the list neededComponents have the same category that is required by Process.
    IComponent component = chooseOneComponent(extractComponents(neededComponents), rcSetting, quickCreateInput, quickCreateOutput);
    store.component = component;
    store.componentName = rcSetting;
}
Also used : IComponentsService(org.talend.core.model.components.IComponentsService) IDragAndDropServiceHandler(org.talend.core.model.utils.IDragAndDropServiceHandler) IComponent(org.talend.core.model.components.IComponent) IComponentName(org.talend.core.model.utils.IComponentName)

Example 3 with IDragAndDropServiceHandler

use of org.talend.core.model.utils.IDragAndDropServiceHandler in project tdi-studio-se by Talend.

the class ComponentChooseDialog method getChangePropertyCommand.

private Command getChangePropertyCommand(RepositoryNode selectedNode, Node node, ConnectionItem connectionItem) {
    ERepositoryObjectType selectedNodeType = selectedNode.getObjectType();
    IComponentName rcSetting = RepositoryComponentManager.getSetting(connectionItem, selectedNodeType);
    if (rcSetting == null) {
        for (IDragAndDropServiceHandler handler : DragAndDropManager.getHandlers()) {
            rcSetting = handler.getCorrespondingComponentName(connectionItem, selectedNodeType);
            if (rcSetting != null) {
                break;
            }
        }
        if (rcSetting == null) {
            return null;
        }
    }
    List<IComponent> neededComponents = RepositoryComponentManager.filterNeededComponents(connectionItem, selectedNode, selectedNodeType);
    for (IDragAndDropServiceHandler handler : DragAndDropManager.getHandlers()) {
        List<IComponent> comList = handler.filterNeededComponents(connectionItem, selectedNode, selectedNodeType);
        if (comList != null) {
            for (IComponent handlerComp : comList) {
                if (!neededComponents.contains(handlerComp)) {
                    neededComponents.add(handlerComp);
                }
            }
        }
    }
    List<String> componentNameList = new ArrayList<String>();
    for (IComponent component : neededComponents) {
        componentNameList.add(component.getName());
    }
    String nodeComponentName = node.getComponent().getName();
    if (componentNameList.contains(nodeComponentName)) {
        IElementParameter param = node.getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE);
        if (param != null) {
            return getPropertyPublicPart(selectedNode, param, node, connectionItem);
        }
    }
    return null;
}
Also used : IDragAndDropServiceHandler(org.talend.core.model.utils.IDragAndDropServiceHandler) IComponent(org.talend.core.model.components.IComponent) ArrayList(java.util.ArrayList) IElementParameter(org.talend.core.model.process.IElementParameter) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) IComponentName(org.talend.core.model.utils.IComponentName)

Example 4 with IDragAndDropServiceHandler

use of org.talend.core.model.utils.IDragAndDropServiceHandler in project tesb-studio-se by Talend.

the class CamelEditorDropTargetListener method getAppropriateComponent.

private void getAppropriateComponent(Item item, boolean quickCreateInput, boolean quickCreateOutput, TempStore store, ERepositoryObjectType type) {
    IComponentName rcSetting = RepositoryComponentManager.getSetting(item, type);
    // For handler, need check for esb
    if (rcSetting == null) {
        for (IDragAndDropServiceHandler handler : DragAndDropManager.getHandlers()) {
            rcSetting = handler.getCorrespondingComponentName(item, type);
            if (rcSetting != null) {
                break;
            }
        }
        if (rcSetting == null) {
            return;
        }
    }
    boolean isCurrentProject = true;
    String projectName = null;
    if (store.seletetedNode.getObject() != null) {
        projectName = store.seletetedNode.getObject().getProjectLabel();
        isCurrentProject = projectName.equals(ProjectManager.getInstance().getCurrentProject().getLabel());
    }
    List<IComponent> neededComponents = RepositoryComponentManager.filterNeededComponents(item, store.seletetedNode, type, isCurrentProject, projectName);
    neededComponents = (List<IComponent>) ComponentUtilities.filterVisibleComponents(neededComponents);
    // Check if the components in the list neededComponents have the same category that is required by Process.
    IComponent component = chooseOneComponent(extractComponents(neededComponents), rcSetting, quickCreateInput, quickCreateOutput);
    store.component = component;
    store.componentName = rcSetting;
}
Also used : IDragAndDropServiceHandler(org.talend.core.model.utils.IDragAndDropServiceHandler) IComponent(org.talend.core.model.components.IComponent) IComponentName(org.talend.core.model.utils.IComponentName)

Aggregations

IDragAndDropServiceHandler (org.talend.core.model.utils.IDragAndDropServiceHandler)4 IComponent (org.talend.core.model.components.IComponent)3 IComponentName (org.talend.core.model.utils.IComponentName)3 ArrayList (java.util.ArrayList)1 IComponentsService (org.talend.core.model.components.IComponentsService)1 Connection (org.talend.core.model.metadata.builder.connection.Connection)1 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)1 SalesforceSchemaConnection (org.talend.core.model.metadata.builder.connection.SalesforceSchemaConnection)1 XmlFileConnection (org.talend.core.model.metadata.builder.connection.XmlFileConnection)1 IElementParameter (org.talend.core.model.process.IElementParameter)1 ConnectionItem (org.talend.core.model.properties.ConnectionItem)1 Item (org.talend.core.model.properties.Item)1 SalesforceSchemaConnectionItem (org.talend.core.model.properties.SalesforceSchemaConnectionItem)1 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)1 IRepositoryNode (org.talend.repository.model.IRepositoryNode)1