Search in sources :

Example 86 with IRepositoryViewObject

use of org.talend.core.model.repository.IRepositoryViewObject in project tdi-studio-se by Talend.

the class MultiTypesProcessor method selectRepositoryNode.

protected boolean selectRepositoryNode(Viewer viewer, RepositoryNode parentNode, RepositoryNode node) {
    if (node == null) {
        return false;
    }
    IRepositoryViewObject object = node.getObject();
    if (object != null) {
        // column
        if (object instanceof MetadataColumnRepositoryObject) {
            return false;
        }
    }
    // hide the column folder
    if (object == null && node.getParent() != null && node.getParent().getObject() != null && node.getParent().getObjectType() == ERepositoryObjectType.METADATA_CON_TABLE) {
        return false;
    }
    // cdc
    ICDCProviderService cdcService = null;
    if (node.getObjectType() == ERepositoryObjectType.METADATA_CON_CDC) {
        return false;
    }
    if (isCDCConnection(node)) {
        return false;
    }
    if (PluginChecker.isCDCPluginLoaded()) {
        cdcService = (ICDCProviderService) GlobalServiceRegister.getDefault().getService(ICDCProviderService.class);
        if (cdcService != null && cdcService.isSubscriberTableNode(node)) {
            return false;
        }
    }
    return true;
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) ICDCProviderService(org.talend.core.ui.ICDCProviderService)

Example 87 with IRepositoryViewObject

use of org.talend.core.model.repository.IRepositoryViewObject in project tdi-studio-se by Talend.

the class MetadataColumnComparator method getItem.

/**
     * method "getItem" get DatabaseConnectionItem by current RepositoryNode .
     * 
     * @param newNode current RepositoryNode
     * @return DatabaseConnectionItem : item current node.
     */
public static DatabaseConnectionItem getItem(RepositoryNode newNode) {
    IRepositoryViewObject repositoryObject = newNode.getObject();
    DatabaseConnectionItem item = (DatabaseConnectionItem) repositoryObject.getProperty().getItem();
    return item;
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) DatabaseConnectionItem(org.talend.core.model.properties.DatabaseConnectionItem)

Example 88 with IRepositoryViewObject

use of org.talend.core.model.repository.IRepositoryViewObject 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 89 with IRepositoryViewObject

use of org.talend.core.model.repository.IRepositoryViewObject 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 90 with IRepositoryViewObject

use of org.talend.core.model.repository.IRepositoryViewObject in project tesb-studio-se by Talend.

the class ESBService method updateOperation.

@Override
public void updateOperation(INode node, String linkedRepository, RepositoryNode selectNode) {
    String[] ids = linkedRepository.split(" - ");
    if (ids.length == 3) {
        try {
            IRepositoryViewObject reViewObject = ProxyRepositoryFactory.getInstance().getLastVersion(ids[0]);
            ServiceItem servicesItem = (ServiceItem) reViewObject.getProperty().getItem();
            ServiceConnection serConn = (ServiceConnection) servicesItem.getConnection();
            String portName = "";
            EList<ServicePort> portList = serConn.getServicePort();
            ServiceOperation operation = null;
            for (ServicePort port : portList) {
                if (port.getId().equals(ids[1])) {
                    portName = port.getName();
                    EList<ServiceOperation> opeList = port.getServiceOperation();
                    for (ServiceOperation ope : opeList) {
                        if (ope.getId().equals(ids[2])) {
                            operation = ope;
                            break;
                        }
                    }
                    break;
                }
            }
            if (operation == null) {
                return;
            }
            RepositoryNode topParent = getServicesTopNode(selectNode);
            changeOldOperationLabel(topParent, node, operation);
            IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
            IProcess2 process = (IProcess2) RepositoryPlugin.getDefault().getDesignerCoreService().getCurrentProcess();
            Item jobItem = process.getProperty().getItem();
            String jobID = jobItem.getProperty().getId();
            String jobName = jobItem.getProperty().getLabel();
            if (operation.getReferenceJobId() != null && !operation.getReferenceJobId().equals(jobID)) {
                changeOtherJobSchemaValue(factory, operation, /* serConn, */
                selectNode);
                MessageDialog.openWarning(new Shell(), Messages.ESBService_DisconnectWarningTitle, Messages.ESBService_DisconnectWarningMsg);
            }
            operation.setReferenceJobId(jobID);
            operation.setLabel(operation.getName() + '-' + jobName);
            IFile wsdlPath = WSDLUtils.getWsdlFile(selectNode);
            Map<String, String> serviceParameters = WSDLUtils.getServiceOperationParameters(wsdlPath, operation.getName(), portName);
            CreateNewJobAction.setProviderRequestComponentConfiguration(node, serviceParameters);
            factory.save(servicesItem);
        } catch (PersistenceException e) {
            ExceptionHandler.process(e);
        } catch (CoreException e) {
            ExceptionHandler.process(e);
        }
    }
}
Also used : ServicePort(org.talend.repository.services.model.services.ServicePort) ServiceConnection(org.talend.repository.services.model.services.ServiceConnection) IFile(org.eclipse.core.resources.IFile) ServiceOperation(org.talend.repository.services.model.services.ServiceOperation) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) Item(org.talend.core.model.properties.Item) ConnectionItem(org.talend.core.model.properties.ConnectionItem) ServiceItem(org.talend.repository.services.model.services.ServiceItem) ProcessItem(org.talend.core.model.properties.ProcessItem) Shell(org.eclipse.swt.widgets.Shell) CoreException(org.eclipse.core.runtime.CoreException) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IProcess2(org.talend.core.model.process.IProcess2) PersistenceException(org.talend.commons.exception.PersistenceException) ServiceItem(org.talend.repository.services.model.services.ServiceItem) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Aggregations

IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)222 PersistenceException (org.talend.commons.exception.PersistenceException)115 Item (org.talend.core.model.properties.Item)86 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)67 ArrayList (java.util.ArrayList)63 ConnectionItem (org.talend.core.model.properties.ConnectionItem)54 ProcessItem (org.talend.core.model.properties.ProcessItem)54 RepositoryNode (org.talend.repository.model.RepositoryNode)50 IElementParameter (org.talend.core.model.process.IElementParameter)43 Property (org.talend.core.model.properties.Property)43 IRepositoryNode (org.talend.repository.model.IRepositoryNode)33 List (java.util.List)32 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)32 DatabaseConnectionItem (org.talend.core.model.properties.DatabaseConnectionItem)31 INode (org.talend.core.model.process.INode)30 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)25 Node (org.talend.designer.core.ui.editor.nodes.Node)25 Connection (org.talend.core.model.metadata.builder.connection.Connection)23 CoreException (org.eclipse.core.runtime.CoreException)17 RoutineItem (org.talend.core.model.properties.RoutineItem)17