Search in sources :

Example 6 with GenericConnectionItem

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

the class GenericConnPropertiesWizard method performFinish.

@Override
public boolean performFinish() {
    boolean done = super.performFinish();
    if (done) {
        Property property = object.getProperty();
        GenericConnectionItem gcItem = (GenericConnectionItem) property.getItem();
        boolean itemChanged = GenericConnectionUtil.synNamePropertyWithItem(gcItem);
        if (itemChanged) {
            try {
                ProxyRepositoryFactory.getInstance().save(gcItem);
            } catch (PersistenceException e) {
                done = false;
                ExceptionHandler.process(e);
            }
        }
    }
    return done;
}
Also used : PersistenceException(org.talend.commons.exception.PersistenceException) GenericConnectionItem(org.talend.repository.generic.model.genericMetadata.GenericConnectionItem) Property(org.talend.core.model.properties.Property)

Example 7 with GenericConnectionItem

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

the class GenericRepositoryContentHandler method createNewItem.

@Override
public Item createNewItem(ERepositoryObjectType type) {
    GenericConnectionItem item = null;
    if (isRepObjType(type)) {
        item = GenericMetadataFactory.eINSTANCE.createGenericConnectionItem();
        item.setTypeName(type.getType());
    }
    return item;
}
Also used : GenericConnectionItem(org.talend.repository.generic.model.genericMetadata.GenericConnectionItem)

Example 8 with GenericConnectionItem

use of org.talend.repository.generic.model.genericMetadata.GenericConnectionItem 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 GenericConnectionItem

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

the class RepositoryUpdateTest method launchRepositoryUpdateOnNode.

/**
     * DOC nrousseau Comment method "updateNode".
     * @param id
     * @param process
     * @param node
     * @throws PersistenceException
     */
private void launchRepositoryUpdateOnNode(String id, Process process, Node node) throws PersistenceException {
    GenericConnectionItem connectionItem;
    IRepositoryViewObject object;
    object = ProxyRepositoryFactory.getInstance().getLastVersion(id);
    connectionItem = (GenericConnectionItem) object.getProperty().getItem();
    Assert.assertEquals(1, SchemaUtils.getMetadataTables(connectionItem.getConnection(), SubContainer.class).size());
    UpdateResult ur = createUpdateResult(node);
    ur.setResult(EUpdateItemType.NODE_PROPERTY, EUpdateResult.UPDATE, connectionItem);
    ur.setJob(process);
    UpdateNodeParameterCommand cmd = new UpdateNodeParameterCommand(ur);
    cmd.execute();
}
Also used : UpdateNodeParameterCommand(org.talend.designer.core.ui.editor.update.cmd.UpdateNodeParameterCommand) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) GenericConnectionItem(org.talend.repository.generic.model.genericMetadata.GenericConnectionItem) UpdateResult(org.talend.core.model.update.UpdateResult) EUpdateResult(org.talend.core.model.update.EUpdateResult)

Example 10 with GenericConnectionItem

use of org.talend.repository.generic.model.genericMetadata.GenericConnectionItem 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

GenericConnectionItem (org.talend.repository.generic.model.genericMetadata.GenericConnectionItem)18 GenericConnection (org.talend.repository.generic.model.genericMetadata.GenericConnection)9 ComponentProperties (org.talend.components.api.properties.ComponentProperties)5 ComponentWizard (org.talend.components.api.wizard.ComponentWizard)4 ConnectionItem (org.talend.core.model.properties.ConnectionItem)4 Property (org.talend.core.model.properties.Property)4 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)4 ArrayList (java.util.ArrayList)3 Path (org.eclipse.core.runtime.Path)3 ComponentService (org.talend.components.api.service.ComponentService)3 IOException (java.io.IOException)2 Properties (java.util.Properties)2 Test (org.junit.Test)2 IComponent (org.talend.core.model.components.IComponent)2 Connection (org.talend.core.model.metadata.builder.connection.Connection)2 Item (org.talend.core.model.properties.Item)2 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)2 ProxyRepositoryFactory (org.talend.core.repository.model.ProxyRepositoryFactory)2 HashSet (java.util.HashSet)1 List (java.util.List)1