Search in sources :

Example 6 with GenericConnection

use of org.talend.repository.generic.model.genericMetadata.GenericConnection in project tdi-studio-se by Talend.

the class NewGenericWizardMigrationTask method initGenericConnection.

protected GenericConnection initGenericConnection(Connection oldConnection) {
    if (oldConnection == null) {
        return null;
    }
    GenericConnection genericConnection = GenericMetadataFactory.eINSTANCE.createGenericConnection();
    genericConnection.setName(oldConnection.getName());
    genericConnection.setLabel(oldConnection.getLabel() != null ? oldConnection.getLabel() : oldConnection.getName());
    genericConnection.setContextId(oldConnection.getContextId());
    genericConnection.setContextMode(oldConnection.isContextMode());
    return genericConnection;
}
Also used : GenericConnection(org.talend.repository.generic.model.genericMetadata.GenericConnection)

Example 7 with GenericConnection

use of org.talend.repository.generic.model.genericMetadata.GenericConnection in project tdi-studio-se by Talend.

the class DynamicComposite method resetComponentProperties.

private void resetComponentProperties() {
    if (connectionItem != null) {
        Connection connection = connectionItem.getConnection();
        if (connection instanceof GenericConnection) {
            GenericConnection genericConnection = (GenericConnection) connection;
            genericConnection.setCompProperties(form.getProperties().toSerialized());
        }
    }
}
Also used : GenericConnection(org.talend.repository.generic.model.genericMetadata.GenericConnection) Connection(org.talend.core.model.metadata.builder.connection.Connection) GenericConnection(org.talend.repository.generic.model.genericMetadata.GenericConnection)

Example 8 with GenericConnection

use of org.talend.repository.generic.model.genericMetadata.GenericConnection in project tdi-studio-se by Talend.

the class GenericRepositoryContentHandler method addNode.

@Override
public void addNode(ERepositoryObjectType type, RepositoryNode recBinNode, IRepositoryViewObject repositoryObject, RepositoryNode node) {
    if (isRepObjType(type)) {
        Item item = repositoryObject.getProperty().getItem();
        if (item instanceof GenericConnectionItem) {
            GenericConnectionItem connItem = (GenericConnectionItem) item;
            GenericConnection connection = (GenericConnection) connItem.getConnection();
            createSubNodes(node, repositoryObject, connection);
        }
    }
}
Also used : GenericConnectionItem(org.talend.repository.generic.model.genericMetadata.GenericConnectionItem) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Item(org.talend.core.model.properties.Item) GenericConnection(org.talend.repository.generic.model.genericMetadata.GenericConnection) GenericConnectionItem(org.talend.repository.generic.model.genericMetadata.GenericConnectionItem)

Example 9 with GenericConnection

use of org.talend.repository.generic.model.genericMetadata.GenericConnection in project tdi-studio-se by Talend.

the class RepositoryUpdateTest method testRepositoryChange.

@Test
public void testRepositoryChange() throws PersistenceException {
    //$NON-NLS-1$
    String id = "testId";
    try {
        //$NON-NLS-1$ //$NON-NLS-2$
        IComponent component = ComponentsFactoryProvider.getInstance().get("tSalesforceInput", "DI");
        Node node = new Node(component, new Process(new FakePropertyImpl()));
        GenericConnection connection = (GenericConnection) createBasicConnection(id).getConnection();
        setupPropertiesWithoutProxy(id);
        updateNode(id, node, connection);
        //$NON-NLS-1$  //$NON-NLS-2$
        testRepositoryValue(node, "connection.userPassword.userId", "\"myUser\"");
        //$NON-NLS-1$  //$NON-NLS-2$
        testRepositoryValue(node, "connection.userPassword.password", "\"myPassword\"");
        //$NON-NLS-1$
        testRepositoryValue(node, "connection.proxy.useProxy", Boolean.FALSE);
        //$NON-NLS-1$  //$NON-NLS-2$
        testRepositoryValue(node, "connection.proxy.host", "\"\"");
        //$NON-NLS-1$
        testRepositoryValue(node, "connection.proxy.port", null);
        //$NON-NLS-1$  //$NON-NLS-2$
        testRepositoryValue(node, "connection.proxy.userPassword.userId", "\"\"");
        //$NON-NLS-1$  //$NON-NLS-2$
        testRepositoryValue(node, "connection.proxy.userPassword.password", "\"\"");
        setupPropertiesWithProxy(id);
        updateNode(id, node, connection);
        //$NON-NLS-1$  //$NON-NLS-2$
        testRepositoryValue(node, "connection.userPassword.userId", "\"myUser\"");
        //$NON-NLS-1$  //$NON-NLS-2$
        testRepositoryValue(node, "connection.userPassword.password", "\"myPassword\"");
        //$NON-NLS-1$
        testRepositoryValue(node, "connection.proxy.useProxy", Boolean.TRUE);
        //$NON-NLS-1$  //$NON-NLS-2$
        testRepositoryValue(node, "connection.proxy.host", "\"host\"");
        //$NON-NLS-1$
        testRepositoryValue(node, "connection.proxy.port", 1234);
        //$NON-NLS-1$  //$NON-NLS-2$
        testRepositoryValue(node, "connection.proxy.userPassword.userId", "\"proxyUser\"");
        //$NON-NLS-1$  //$NON-NLS-2$
        testRepositoryValue(node, "connection.proxy.userPassword.password", "\"proxyPassword\"");
    } finally {
        IRepositoryViewObject object = ProxyRepositoryFactory.getInstance().getLastVersion(id);
        if (object != null) {
            ProxyRepositoryFactory.getInstance().deleteObjectPhysical(object);
        }
    }
}
Also used : FakePropertyImpl(org.talend.core.model.repository.FakePropertyImpl) IComponent(org.talend.core.model.components.IComponent) Node(org.talend.designer.core.ui.editor.nodes.Node) INode(org.talend.core.model.process.INode) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) Process(org.talend.designer.core.ui.editor.process.Process) GenericConnection(org.talend.repository.generic.model.genericMetadata.GenericConnection) Test(org.junit.Test)

Example 10 with GenericConnection

use of org.talend.repository.generic.model.genericMetadata.GenericConnection in project tdi-studio-se by Talend.

the class RepositoryUpdateTest method createBasicConnection.

/**
     * DOC nrousseau Comment method "createBasicConnection".
     * 
     * @param id
     * @return
     * @throws PersistenceException
     */
private GenericConnectionItem createBasicConnection(String id) throws PersistenceException {
    GenericConnection connection = GenericMetadataFactory.eINSTANCE.createGenericConnection();
    Property connectionProperty = PropertiesFactory.eINSTANCE.createProperty();
    // ses the id to be used for persistence lookup
    connectionProperty.setId(id);
    connectionProperty.setAuthor(((RepositoryContext) CoreRuntimePlugin.getInstance().getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getUser());
    connectionProperty.setVersion(VersionUtils.DEFAULT_VERSION);
    //$NON-NLS-1$
    connectionProperty.setStatusCode("");
    connectionProperty.setLabel("test");
    GenericConnectionItem connectionItem = GenericMetadataFactory.eINSTANCE.createGenericConnectionItem();
    connectionItem.setProperty(connectionProperty);
    connectionItem.setConnection(connection);
    connectionItem.setTypeName("salesforce");
    ProxyRepositoryFactory.getInstance().create(connectionItem, new Path(""));
    return connectionItem;
}
Also used : Path(org.eclipse.core.runtime.Path) GenericConnection(org.talend.repository.generic.model.genericMetadata.GenericConnection) GenericConnectionItem(org.talend.repository.generic.model.genericMetadata.GenericConnectionItem) Property(org.talend.core.model.properties.Property)

Aggregations

GenericConnection (org.talend.repository.generic.model.genericMetadata.GenericConnection)24 ComponentProperties (org.talend.components.api.properties.ComponentProperties)11 GenericConnectionItem (org.talend.repository.generic.model.genericMetadata.GenericConnectionItem)10 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)6 ArrayList (java.util.ArrayList)5 Test (org.junit.Test)5 ConnectionItem (org.talend.core.model.properties.ConnectionItem)5 IComponent (org.talend.core.model.components.IComponent)4 Connection (org.talend.core.model.metadata.builder.connection.Connection)4 IConnParamName (org.talend.metadata.managment.ui.model.IConnParamName)4 Path (org.eclipse.core.runtime.Path)3 ComponentService (org.talend.components.api.service.ComponentService)3 ComponentWizard (org.talend.components.api.wizard.ComponentWizard)3 MetadataTable (org.talend.core.model.metadata.builder.connection.MetadataTable)3 INode (org.talend.core.model.process.INode)3 Property (org.talend.core.model.properties.Property)3 FakePropertyImpl (org.talend.core.model.repository.FakePropertyImpl)3 Node (org.talend.designer.core.ui.editor.nodes.Node)3 Process (org.talend.designer.core.ui.editor.process.Process)3 GenericConnParamName (org.talend.metadata.managment.ui.utils.GenericConnParamName)3