Search in sources :

Example 56 with ConnectionItem

use of org.talend.core.model.properties.ConnectionItem in project tdi-studio-se by Talend.

the class StatsAndLogsViewHelper method reloadValuesFromPreferencePage.

/**
     * ftang Comment method "reloadValuesFromPreferencePage".
     * 
     * @param preferenceStore
     * @param element
     */
public static void reloadValuesFromPreferencePage(Element element, IDynamicProperty propertyComposite) {
    List<? extends IElementParameter> elementParameters = element.getElementParameters();
    for (IElementParameter elementParameter : elementParameters) {
        String name = elementParameter.getName();
        if (name.equals(EParameterName.ON_STATCATCHER_FLAG.getName())) {
            elementParameter.setValue(PREFERENCE_STORE.getBoolean(LANGUAGE_PREFIX + EParameterName.ON_STATCATCHER_FLAG.getName()));
            continue;
        }
        if (name.equals(EParameterName.ON_LOGCATCHER_FLAG.getName())) {
            elementParameter.setValue(PREFERENCE_STORE.getBoolean(LANGUAGE_PREFIX + EParameterName.ON_LOGCATCHER_FLAG.getName()));
            continue;
        }
        if (name.equals(EParameterName.ON_METERCATCHER_FLAG.getName())) {
            elementParameter.setValue(PREFERENCE_STORE.getBoolean(LANGUAGE_PREFIX + EParameterName.ON_METERCATCHER_FLAG.getName()));
            continue;
        }
        if (name.equals(EParameterName.ON_FILES_FLAG.getName())) {
            elementParameter.setValue(PREFERENCE_STORE.getBoolean(LANGUAGE_PREFIX + EParameterName.ON_FILES_FLAG.getName()));
            continue;
        }
        if (name.equals(EParameterName.FILE_PATH.getName())) {
            elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.FILE_PATH.getName())));
            continue;
        }
        if (name.equals(EParameterName.FILENAME_STATS.getName())) {
            elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.FILENAME_STATS.getName())));
            continue;
        }
        if (name.equals(EParameterName.FILENAME_LOGS.getName())) {
            elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.FILENAME_LOGS.getName())));
            continue;
        }
        if (name.equals(EParameterName.FILENAME_METTER.getName())) {
            elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.FILENAME_METTER.getName())));
            continue;
        }
        if (name.equals(EParameterName.ON_DATABASE_FLAG.getName())) {
            elementParameter.setValue(PREFERENCE_STORE.getBoolean(LANGUAGE_PREFIX + EParameterName.ON_DATABASE_FLAG.getName()));
            continue;
        }
        if (name.equals(EParameterName.PROPERTY_TYPE.getName())) {
            String propertyType = PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.PROPERTY_TYPE.getName());
            String id = PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
            /* 16969 */
            Connection repositoryConnection = null;
            IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
            Item item = null;
            try {
                IRepositoryViewObject repobj = factory.getLastVersion(id);
                if (repobj != null) {
                    Property tmpproperty = repobj.getProperty();
                    if (tmpproperty != null) {
                        item = tmpproperty.getItem();
                    }
                }
            } catch (PersistenceException e) {
                ExceptionHandler.process(e);
            }
            if (item != null && item instanceof ConnectionItem) {
                repositoryConnection = ((ConnectionItem) item).getConnection();
            } else {
                repositoryConnection = null;
            }
            // Map<String, ConnectionItem> repositoryConnectionItemMap =
            // propertyComposite.getRepositoryConnectionItemMap();
            //
            // if (repositoryConnectionItemMap.containsKey(id)) {
            // repositoryConnection = repositoryConnectionItemMap.get(id).getConnection();
            // } else {
            // repositoryConnection = null;
            // }
            ChangeValuesFromRepository cmd1 = new ChangeValuesFromRepository(element, repositoryConnection, EParameterName.PROPERTY_TYPE.getName() + ":" + EParameterName.PROPERTY_TYPE.getName(), //$NON-NLS-1$
            propertyType);
            ChangeValuesFromRepository cmd2 = new ChangeValuesFromRepository(element, repositoryConnection, EParameterName.PROPERTY_TYPE.getName() + ":" + EParameterName.REPOSITORY_PROPERTY_TYPE.getName(), //$NON-NLS-1$
            id);
            AbstractMultiPageTalendEditor part = (AbstractMultiPageTalendEditor) ((IProcess2) element).getEditor();
            if (part instanceof AbstractMultiPageTalendEditor) {
                Object adapter = part.getTalendEditor().getAdapter(CommandStack.class);
                if (adapter != null) {
                    CommandStack commandStack = ((CommandStack) adapter);
                    commandStack.execute(cmd1);
                    commandStack.execute(cmd2);
                }
            }
            continue;
        }
        if (PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.PROPERTY_TYPE.getName()).equals(EmfComponent.BUILTIN)) {
            if (name.equals(EParameterName.DB_TYPE.getName())) {
                elementParameter.setValue(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.DB_TYPE.getName()));
                continue;
            }
            if (name.equals(EParameterName.HOST.getName())) {
                elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.HOST.getName())));
                continue;
            }
            if (name.equals(EParameterName.PORT.getName())) {
                elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.PORT.getName())));
                continue;
            }
            if (name.equals(EParameterName.DBNAME.getName())) {
                elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.DBNAME.getName())));
                continue;
            }
            if (name.equals(EParameterName.PROPERTIES.getName())) {
                elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.PROPERTIES.getName())));
                continue;
            }
            if (name.equals(EParameterName.DBFILE.getName())) {
                elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.DBFILE.getName())));
                continue;
            }
            if (name.equals(EParameterName.SCHEMA_DB.getName())) {
                elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.SCHEMA_DB.getName())));
                continue;
            }
            if (name.equals(EParameterName.USER.getName())) {
                elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.USER.getName())));
                continue;
            }
            if (name.equals(EParameterName.PASS.getName())) {
                elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.PASS.getName())));
                continue;
            }
        }
        if (name.equals(EParameterName.TABLE_STATS.getName())) {
            elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.TABLE_STATS.getName())));
            continue;
        }
        if (name.equals(EParameterName.TABLE_LOGS.getName())) {
            elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.TABLE_LOGS.getName())));
            continue;
        }
        if (name.equals(EParameterName.TABLE_METER.getName())) {
            elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.TABLE_METER.getName())));
            continue;
        }
        if (name.equals(EParameterName.CATCH_RUNTIME_ERRORS.getName())) {
            elementParameter.setValue(PREFERENCE_STORE.getBoolean(LANGUAGE_PREFIX + EParameterName.CATCH_RUNTIME_ERRORS.getName()));
            continue;
        }
        if (name.equals(EParameterName.CATCH_USER_ERRORS.getName())) {
            elementParameter.setValue(PREFERENCE_STORE.getBoolean(LANGUAGE_PREFIX + EParameterName.CATCH_USER_ERRORS.getName()));
            continue;
        }
        if (name.equals(EParameterName.CATCH_USER_WARNING.getName())) {
            elementParameter.setValue(PREFERENCE_STORE.getBoolean(LANGUAGE_PREFIX + EParameterName.CATCH_USER_WARNING.getName()));
            continue;
        }
        if (name.equals(EParameterName.CATCH_REALTIME_STATS.getName())) {
            elementParameter.setValue(PREFERENCE_STORE.getBoolean(LANGUAGE_PREFIX + EParameterName.CATCH_REALTIME_STATS.getName()));
            continue;
        }
    }
}
Also used : CommandStack(org.eclipse.gef.commands.CommandStack) ChangeValuesFromRepository(org.talend.designer.core.ui.editor.cmd.ChangeValuesFromRepository) ConnectionItem(org.talend.core.model.properties.ConnectionItem) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) Connection(org.talend.core.model.metadata.builder.connection.Connection) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Item(org.talend.core.model.properties.Item) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) IElementParameter(org.talend.core.model.process.IElementParameter) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IDynamicProperty(org.talend.core.ui.properties.tab.IDynamicProperty) Property(org.talend.core.model.properties.Property) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 57 with ConnectionItem

use of org.talend.core.model.properties.ConnectionItem in project tdi-studio-se by Talend.

the class SchemaUtils method getCurrentComponentProperties.

public static ComponentProperties getCurrentComponentProperties(IMetadataTable table) {
    if (table != null) {
        String serializedProperties = null;
        SerializerDeserializer.Deserialized<ComponentProperties> fromSerializedProperties = null;
        if (table instanceof MetadataTableRepositoryObject) {
            MetadataTableRepositoryObject metaTableRepObj = (MetadataTableRepositoryObject) table;
            MetadataTable metadataTable = metaTableRepObj.getTable();
            if (metadataTable != null && metadataTable.getTaggedValue() != null) {
                for (TaggedValue serializedProps : metadataTable.getTaggedValue()) {
                    if (IComponentConstants.COMPONENT_PROPERTIES_TAG.equals(serializedProps.getTag())) {
                        serializedProperties = serializedProps.getValue();
                        break;
                    }
                }
            }
            if (serializedProperties != null) {
                Connection connection = ((ConnectionItem) metaTableRepObj.getViewObject().getProperty().getItem()).getConnection();
                return ComponentsUtils.getComponentPropertiesFromSerialized(serializedProperties, connection);
            }
        } else if (table instanceof org.talend.core.model.metadata.MetadataTable) {
            org.talend.core.model.metadata.MetadataTable metaTable = (org.talend.core.model.metadata.MetadataTable) table;
            Map<String, String> additionalProperties = metaTable.getAdditionalProperties();
            serializedProperties = additionalProperties.get(IComponentConstants.COMPONENT_PROPERTIES_TAG);
            if (serializedProperties != null) {
                fromSerializedProperties = Properties.Helper.fromSerializedPersistent(serializedProperties, ComponentProperties.class, null);
            }
        }
        if (fromSerializedProperties != null) {
            return fromSerializedProperties.object;
        }
    }
    return null;
}
Also used : ComponentProperties(org.talend.components.api.properties.ComponentProperties) TaggedValue(orgomg.cwm.objectmodel.core.TaggedValue) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Connection(org.talend.core.model.metadata.builder.connection.Connection) MetadataTableRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) SerializerDeserializer(org.talend.daikon.serialize.SerializerDeserializer) Map(java.util.Map)

Example 58 with ConnectionItem

use of org.talend.core.model.properties.ConnectionItem in project tdi-studio-se by Talend.

the class DynamicComposite method updateRepositoryList.

/**
     * ftang Comment method "updateRepositoryList".
     */
//$NON-NLS-1$
@SuppressWarnings("unchecked")
private void updateRepositoryList() {
    IProxyRepositoryFactory factory = DesignerPlugin.getDefault().getProxyRepositoryFactory();
    tableIdAndDbTypeMap = new HashMap<String, String>();
    tableIdAndDbSchemaMap = new HashMap<String, String>();
    List<ConnectionItem> metadataConnectionsItem = null;
    String[] repositoryTableNameList = new String[] {};
    String[] repositoryTableValueList = new String[] {};
    String[] repositoryConnectionNameList = new String[] {};
    String[] repositoryConnectionValueList = new String[] {};
    String[] repositoryQueryNameList = new String[] {};
    String[] repositoryQueryValueList = new String[] {};
    try {
        metadataConnectionsItem = getConnectionItems();
    } catch (PersistenceException e) {
        throw new RuntimeException(e);
    }
    if (metadataConnectionsItem != null) {
        repositoryTableMap.clear();
        repositoryQueryStoreMap.clear();
        repositoryConnectionItemMap.clear();
        tablesMap.clear();
        queriesMap.clear();
        List<String> tableNamesList = new ArrayList<String>();
        List<String> tableValuesList = new ArrayList<String>();
        List<String> queryStoreNameList = new ArrayList<String>();
        List<String> queryStoreValuesList = new ArrayList<String>();
        for (ConnectionItem connectionItem : metadataConnectionsItem) {
            Connection connection = connectionItem.getConnection();
            if (!connection.isReadOnly()) {
                //$NON-NLS-1$
                repositoryConnectionItemMap.put(connectionItem.getProperty().getId() + "", connectionItem);
                for (Object tableObj : ConnectionHelper.getTables(connection)) {
                    org.talend.core.model.metadata.builder.connection.MetadataTable table;
                    table = (org.talend.core.model.metadata.builder.connection.MetadataTable) tableObj;
                    if (factory.getStatus(connectionItem) != ERepositoryStatus.DELETED) {
                        if (!factory.isDeleted(table)) {
                            String name = //$NON-NLS-1$
                            getRepositoryAliasName(connectionItem) + ":" + connectionItem.getProperty().getLabel() + " - " + //$NON-NLS-1$
                            table.getLabel();
                            //$NON-NLS-1$
                            String value = connectionItem.getProperty().getId() + " - " + table.getLabel();
                            IMetadataTable newTable = ConvertionHelper.convert(table);
                            repositoryTableMap.put(value, newTable);
                            if (connection instanceof DatabaseConnection) {
                                String dbType = ((DatabaseConnection) connection).getDatabaseType();
                                String schema = ((DatabaseConnection) connection).getUiSchema();
                                tableIdAndDbTypeMap.put(newTable.getId(), dbType);
                                if (schema != null && !schema.equals("")) {
                                    //$NON-NLS-1$
                                    tableIdAndDbSchemaMap.put(newTable.getId(), schema);
                                }
                            }
                            addOrderDisplayNames(tableValuesList, tableNamesList, value, name);
                        // tableNamesList.add(name);
                        // tableValuesList.add(value);
                        }
                    }
                }
            }
            tablesMap.put(connectionItem.getProperty().getId(), tableValuesList);
            if (connection instanceof DatabaseConnection && !connection.isReadOnly()) {
                DatabaseConnection dbConnection = (DatabaseConnection) connection;
                QueriesConnection queriesConnection = dbConnection.getQueries();
                if (queriesConnection != null) {
                    List<Query> qs = queriesConnection.getQuery();
                    for (Query query : qs) {
                        String name = //$NON-NLS-1$
                        getRepositoryAliasName(connectionItem) + ":" + connectionItem.getProperty().getLabel() + " - " + //$NON-NLS-1$
                        query.getLabel();
                        //$NON-NLS-1$
                        String value = connectionItem.getProperty().getId() + " - " + query.getLabel();
                        repositoryQueryStoreMap.put(value, query);
                        addOrderDisplayNames(queryStoreValuesList, queryStoreNameList, value, name);
                    // queryStoreNameList.add(name);
                    // queryStoreValuesList.add(value);
                    }
                }
            }
            queriesMap.put(connectionItem.getProperty().getId(), queryStoreValuesList);
        }
        repositoryTableNameList = tableNamesList.toArray(new String[0]);
        repositoryTableValueList = tableValuesList.toArray(new String[0]);
        repositoryQueryNameList = queryStoreNameList.toArray(new String[0]);
        repositoryQueryValueList = queryStoreValuesList.toArray(new String[0]);
    }
    initMaps();
    for (int i = 0; i < elem.getElementParameters().size(); i++) {
        IElementParameter param = elem.getElementParameters().get(i);
        if (param.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE)) {
            IElementParameter repositoryType = param.getChildParameters().get(EParameterName.REPOSITORY_SCHEMA_TYPE.getName());
            repositoryType.setListItemsDisplayName(repositoryTableNameList);
            repositoryType.setListItemsValue(repositoryTableValueList);
            if (!repositoryTableMap.keySet().contains(repositoryType.getValue())) {
                IElementParameter repositoryPropertyType = elem.getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE, param.getCategory());
                if (repositoryPropertyType != null) {
                    List<String> list2 = tablesMap.get(repositoryPropertyType.getChildParameters().get(EParameterName.REPOSITORY_PROPERTY_TYPE.getName()).getValue());
                    boolean isNeeded = list2 != null && !list2.isEmpty();
                    if (repositoryTableNameList.length > 0 && repositoryConnectionValueList.length > 0 && isNeeded) {
                        repositoryType.setValue(getDefaultRepository(param, true, repositoryConnectionValueList[0]));
                    }
                }
            }
        }
        if (param.getFieldType().equals(EParameterFieldType.QUERYSTORE_TYPE)) {
            IElementParameter repositoryType = param.getChildParameters().get(EParameterName.REPOSITORY_QUERYSTORE_TYPE.getName());
            repositoryType.setListItemsDisplayName(repositoryQueryNameList);
            repositoryType.setListItemsValue(repositoryQueryValueList);
            if (!repositoryQueryStoreMap.keySet().contains(repositoryType.getValue())) {
                IElementParameter repositoryPropertyType = elem.getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE, param.getCategory());
                if (repositoryPropertyType != null) {
                    List<String> list2 = queriesMap.get(repositoryPropertyType.getChildParameters().get(EParameterName.REPOSITORY_PROPERTY_TYPE.getName()).getValue());
                    boolean isNeeded = list2 != null && !list2.isEmpty();
                    if (repositoryQueryNameList.length > 0 && repositoryConnectionValueList.length > 0 && isNeeded) {
                        repositoryType.setValue(getDefaultRepository(elem.getElementParameterFromField(EParameterFieldType.SCHEMA_TYPE), false, repositoryConnectionValueList[0]));
                    }
                }
            }
        }
        if (param.getFieldType().equals(EParameterFieldType.PROPERTY_TYPE)) {
            IElementParameter repositoryType = param.getChildParameters().get(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
            List<String> nameList = new ArrayList<String>();
            List<String> valueList = new ArrayList<String>();
            updateRepositoryListExtra(repositoryType, nameList, valueList, false);
            repositoryConnectionNameList = nameList.toArray(new String[0]);
            repositoryConnectionValueList = valueList.toArray(new String[0]);
        }
    }
}
Also used : Query(org.talend.core.model.metadata.builder.connection.Query) ConnectionItem(org.talend.core.model.properties.ConnectionItem) ArrayList(java.util.ArrayList) IElementParameter(org.talend.core.model.process.IElementParameter) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory) QueriesConnection(org.talend.core.model.metadata.builder.connection.QueriesConnection) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) SalesforceSchemaConnection(org.talend.core.model.metadata.builder.connection.SalesforceSchemaConnection) WSDLSchemaConnection(org.talend.core.model.metadata.builder.connection.WSDLSchemaConnection) GenericSchemaConnection(org.talend.core.model.metadata.builder.connection.GenericSchemaConnection) PositionalFileConnection(org.talend.core.model.metadata.builder.connection.PositionalFileConnection) RegexpFileConnection(org.talend.core.model.metadata.builder.connection.RegexpFileConnection) DelimitedFileConnection(org.talend.core.model.metadata.builder.connection.DelimitedFileConnection) Connection(org.talend.core.model.metadata.builder.connection.Connection) XmlFileConnection(org.talend.core.model.metadata.builder.connection.XmlFileConnection) QueriesConnection(org.talend.core.model.metadata.builder.connection.QueriesConnection) LDAPSchemaConnection(org.talend.core.model.metadata.builder.connection.LDAPSchemaConnection) FileExcelConnection(org.talend.core.model.metadata.builder.connection.FileExcelConnection) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) PersistenceException(org.talend.commons.exception.PersistenceException) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject)

Example 59 with ConnectionItem

use of org.talend.core.model.properties.ConnectionItem in project tdi-studio-se by Talend.

the class AbstractJobSettingsPage method saveProcess.

protected void saveProcess(IRepositoryViewObject object, boolean addContextModel, Map<String, Set<String>> contextVars, IProgressMonitor monitor) {
    Property property = object.getProperty();
    ProcessItem pItem = (ProcessItem) property.getItem();
    if (isOpenProcess(object)) {
        Process process = getProcess(openedProcessList, object);
        LoadProjectSettingsCommand command = new LoadProjectSettingsCommand(process, getParameterName().getName(), Boolean.TRUE);
        exeCommand(process, command);
        //
        IElementParameter ptParam = elem.getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE);
        if (ptParam != null) {
            IElementParameter propertyElem = ptParam.getChildParameters().get(EParameterName.PROPERTY_TYPE.getName());
            Object proValue = propertyElem.getValue();
            if (proValue instanceof String && ((String) proValue).equalsIgnoreCase(EmfComponent.REPOSITORY)) {
                IElementParameter repositoryElem = ptParam.getChildParameters().get(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
                String value = (String) repositoryElem.getValue();
                ConnectionItem connectionItem = UpdateRepositoryUtils.getConnectionItemByItemId(value);
                if (connectionItem != null) {
                    Connection connection = connectionItem.getConnection();
                    ChangeValuesFromRepository cmd = new ChangeValuesFromRepository(process, connection, addContextModel ? getRepositoryPropertyName() : getPropertyTypeName(), value);
                    cmd.ignoreContextMode(true);
                    exeCommand(process, cmd);
                }
            }
        }
        monitor.worked(100);
    } else {
        try {
            reloadFromProjectSetings(pItem, addContextModel, contextVars);
            factory.save(pItem);
            monitor.worked(100);
        } catch (PersistenceException e) {
            ExceptionHandler.process(e);
        }
    }
}
Also used : ProcessItem(org.talend.core.model.properties.ProcessItem) LoadProjectSettingsCommand(org.talend.designer.core.ui.editor.cmd.LoadProjectSettingsCommand) ChangeValuesFromRepository(org.talend.designer.core.ui.editor.cmd.ChangeValuesFromRepository) DatabaseConnectionItem(org.talend.core.model.properties.DatabaseConnectionItem) ConnectionItem(org.talend.core.model.properties.ConnectionItem) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) Connection(org.talend.core.model.metadata.builder.connection.Connection) PersistenceException(org.talend.commons.exception.PersistenceException) IElementParameter(org.talend.core.model.process.IElementParameter) Process(org.talend.designer.core.ui.editor.process.Process) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) Property(org.talend.core.model.properties.Property) RepositoryToComponentProperty(org.talend.core.model.metadata.designerproperties.RepositoryToComponentProperty)

Example 60 with ConnectionItem

use of org.talend.core.model.properties.ConnectionItem in project tdi-studio-se by Talend.

the class ComponentChooseDialog method createProperty.

private void createProperty(Object dragModel, EditPart targetEditPart) {
    if (!(dragModel instanceof RepositoryNode && targetEditPart instanceof NodeContainerPart)) {
        return;
    }
    RepositoryNode dragNode = (RepositoryNode) dragModel;
    NodeContainerPart nodePart = (NodeContainerPart) targetEditPart;
    if (dragNode.getObject().getProperty().getItem() instanceof ConnectionItem) {
        ConnectionItem connectionItem = (ConnectionItem) dragNode.getObject().getProperty().getItem();
        Command command = getChangePropertyCommand(dragNode, (Node) nodePart.getNodePart().getModel(), connectionItem);
        if (command != null) {
            execCommandStack(command);
        }
    }
}
Also used : NodeContainerPart(org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart) ConnectionCreateCommand(org.talend.designer.core.ui.editor.cmd.ConnectionCreateCommand) RepositoryChangeMetadataForSAPCommand(org.talend.core.ui.metadata.command.RepositoryChangeMetadataForSAPCommand) PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand) CreateNodeContainerCommand(org.talend.designer.core.ui.editor.cmd.CreateNodeContainerCommand) RepositoryChangeQueryCommand(org.talend.designer.core.ui.editor.cmd.RepositoryChangeQueryCommand) ConnectionReconnectCommand(org.talend.designer.core.ui.editor.cmd.ConnectionReconnectCommand) RepositoryChangeMetadataCommand(org.talend.designer.core.ui.editor.cmd.RepositoryChangeMetadataCommand) CompoundCommand(org.eclipse.gef.commands.CompoundCommand) Command(org.eclipse.gef.commands.Command) RepositoryChangeMetadataForEBCDICCommand(org.talend.core.ui.metadata.command.RepositoryChangeMetadataForEBCDICCommand) QueryGuessCommand(org.talend.designer.core.ui.editor.cmd.QueryGuessCommand) RepositoryChangeMetadataForHL7Command(org.talend.core.ui.metadata.command.RepositoryChangeMetadataForHL7Command) ValidationRulesConnectionItem(org.talend.core.model.properties.ValidationRulesConnectionItem) ConnectionItem(org.talend.core.model.properties.ConnectionItem) MDMConnectionItem(org.talend.core.model.properties.MDMConnectionItem) SAPConnectionItem(org.talend.core.model.properties.SAPConnectionItem) DatabaseConnectionItem(org.talend.core.model.properties.DatabaseConnectionItem) EbcdicConnectionItem(org.talend.core.model.properties.EbcdicConnectionItem) HL7ConnectionItem(org.talend.core.model.properties.HL7ConnectionItem) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode)

Aggregations

ConnectionItem (org.talend.core.model.properties.ConnectionItem)79 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)44 PersistenceException (org.talend.commons.exception.PersistenceException)38 Connection (org.talend.core.model.metadata.builder.connection.Connection)38 IElementParameter (org.talend.core.model.process.IElementParameter)38 Item (org.talend.core.model.properties.Item)34 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)31 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)27 DatabaseConnectionItem (org.talend.core.model.properties.DatabaseConnectionItem)20 ArrayList (java.util.ArrayList)19 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)19 Property (org.talend.core.model.properties.Property)17 ChangeValuesFromRepository (org.talend.designer.core.ui.editor.cmd.ChangeValuesFromRepository)17 RepositoryNode (org.talend.repository.model.RepositoryNode)17 INode (org.talend.core.model.process.INode)15 Node (org.talend.designer.core.ui.editor.nodes.Node)15 List (java.util.List)14 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)14 PropertyChangeCommand (org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand)13 ProcessItem (org.talend.core.model.properties.ProcessItem)12