Search in sources :

Example 76 with ConnectionItem

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

the class ESBService method repositoryChange.

private void repositoryChange(RepositoryNode repNode, INode node, IProcess2 process) {
    IElementParameter param = node.getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE);
    ConnectionItem connectionItem = (ConnectionItem) repNode.getObject().getProperty().getItem();
    if (param != null) {
        param.getChildParameters().get(EParameterName.PROPERTY_TYPE.getName()).setValue(EmfComponent.REPOSITORY);
        param.getChildParameters().get(EParameterName.REPOSITORY_PROPERTY_TYPE.getName()).setValue("");
        connectionItem.getProperty().getId();
        ((PortRepositoryObject) repNode.getParent().getObject()).getId();
        ((OperationRepositoryObject) repNode.getObject()).getId();
        ChangeValuesFromRepository command2 = new ChangeValuesFromRepository(node, null, param.getName() + ":" + EParameterName.PROPERTY_TYPE.getName(), //$NON-NLS-1$
        "BUILT_IN");
        IEditorPart editor = process.getEditor();
        if (editor == null) {
            command2.execute();
        } else {
            ((AbstractMultiPageTalendEditor) editor).getTalendEditor().getCommandStack().execute(command2);
        }
    }
}
Also used : ChangeValuesFromRepository(org.talend.designer.core.ui.editor.cmd.ChangeValuesFromRepository) ConnectionItem(org.talend.core.model.properties.ConnectionItem) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) IElementParameter(org.talend.core.model.process.IElementParameter) PortRepositoryObject(org.talend.repository.services.utils.PortRepositoryObject) IEditorPart(org.eclipse.ui.IEditorPart) OperationRepositoryObject(org.talend.repository.services.utils.OperationRepositoryObject)

Example 77 with ConnectionItem

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

the class AssignJobAction method repositoryChange.

private void repositoryChange(RepositoryNode repNode, INode node) {
    IElementParameter param = node.getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE);
    ConnectionItem connectionItem = (ConnectionItem) repNode.getObject().getProperty().getItem();
    if (param != null) {
        param.getChildParameters().get(EParameterName.PROPERTY_TYPE.getName()).setValue(EmfComponent.REPOSITORY);
        String serviceId = connectionItem.getProperty().getId();
        String portId = ((PortRepositoryObject) repNode.getParent().getObject()).getId();
        String operationId = ((OperationRepositoryObject) repNode.getObject()).getId();
        ChangeValuesFromRepository command2 = new ChangeValuesFromRepository(node, connectionItem.getConnection(), param.getName() + ":" + EParameterName.REPOSITORY_PROPERTY_TYPE.getName(), //$NON-NLS-1$
        serviceId + " - " + portId + " - " + operationId);
        command2.execute();
    }
}
Also used : ChangeValuesFromRepository(org.talend.designer.core.ui.editor.cmd.ChangeValuesFromRepository) ConnectionItem(org.talend.core.model.properties.ConnectionItem) IElementParameter(org.talend.core.model.process.IElementParameter) PortRepositoryObject(org.talend.repository.services.utils.PortRepositoryObject) OperationRepositoryObject(org.talend.repository.services.utils.OperationRepositoryObject)

Example 78 with ConnectionItem

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

the class RenameOracleRACToOracleCustomMigrationTask method execute.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.core.model.migration.AbstractItemMigrationTask#execute(org.talend.core.model.properties.Item)
     */
@Override
public ExecutionResult execute(Item item) {
    ConnectionItem connectionItem = (ConnectionItem) item;
    DatabaseConnection connection = (DatabaseConnection) connectionItem.getConnection();
    if (connection != null) {
        if (connection.getDatabaseType().equals("Oracle RAC")) {
            connection.setDatabaseType(EDatabaseTypeName.ORACLE_CUSTOM.getDisplayName());
            try {
                ProxyRepositoryFactory.getInstance().save(item);
            } catch (PersistenceException e) {
                ExceptionHandler.process(e);
                return ExecutionResult.FAILURE;
            }
            return ExecutionResult.SUCCESS_NO_ALERT;
        } else {
            return ExecutionResult.NOTHING_TO_DO;
        }
    }
    return ExecutionResult.NOTHING_TO_DO;
}
Also used : ConnectionItem(org.talend.core.model.properties.ConnectionItem) PersistenceException(org.talend.commons.exception.PersistenceException) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection)

Example 79 with ConnectionItem

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

the class RemoveErrorTagMigrationTask method execute.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.core.model.migration.AbstractItemMigrationTask#execute(org.talend.core.model.properties.Item)
     */
@Override
public ExecutionResult execute(Item item) {
    ConnectionItem connectionItem = (ConnectionItem) item;
    DatabaseConnection connection = (DatabaseConnection) connectionItem.getConnection();
    if (connection != null) {
        boolean flag = false;
        Iterator it = connectionItem.getProperty().getInformations().iterator();
        while (it.hasNext()) {
            org.talend.core.model.properties.Information Information = (org.talend.core.model.properties.Information) it.next();
            if (Information.getLevel().getName().equals(InformationLevel.ERROR_LITERAL.getName()) || Information.getLevel().getName().equals(InformationLevel.WARN_LITERAL.getName())) {
                it.remove();
                flag = true;
            }
        }
        if (flag) {
            try {
                ProxyRepositoryFactory.getInstance().save(item);
            } catch (PersistenceException e) {
                ExceptionHandler.process(e);
                return ExecutionResult.FAILURE;
            }
            return ExecutionResult.SUCCESS_NO_ALERT;
        }
    }
    return ExecutionResult.NOTHING_TO_DO;
}
Also used : ConnectionItem(org.talend.core.model.properties.ConnectionItem) Iterator(java.util.Iterator) PersistenceException(org.talend.commons.exception.PersistenceException) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection)

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