Search in sources :

Example 76 with Process

use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.

the class ColumnListControllerTest method before.

@Before
public void before() {
    instance = mock(ColumnListController.class);
    IComponent component = ComponentsFactoryProvider.getInstance().get("tRowGenerator", "DI");
    Property property = PropertiesFactory.eINSTANCE.createProperty();
    Process process = new Process(property);
    node = new Node(component, process);
    table = node.getMetadataList().get(0);
    column = new MetadataColumn();
}
Also used : IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) MetadataColumn(org.talend.core.model.metadata.MetadataColumn) IComponent(org.talend.core.model.components.IComponent) Node(org.talend.designer.core.ui.editor.nodes.Node) Process(org.talend.designer.core.ui.editor.process.Process) Property(org.talend.core.model.properties.Property) Before(org.junit.Before)

Example 77 with Process

use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.

the class DesignerUtilitiesTest method testGetMainSchemaParameterName.

@Test
public void testGetMainSchemaParameterName() {
    Process process = new Process(new FakePropertyImpl());
    // New component
    //$NON-NLS-1$ //$NON-NLS-2$
    IComponent component = ComponentsFactoryProvider.getInstance().get("tSalesforceInput", "DI");
    Node node = new Node(component, process);
    String parameterName = DesignerUtilities.getMainSchemaParameterName(node);
    //$NON-NLS-1$ //$NON-NLS-2$
    assertEquals("module.main.schema" + ":" + EParameterName.REPOSITORY_SCHEMA_TYPE.getName(), parameterName);
    // Old component
    //$NON-NLS-1$ //$NON-NLS-2$
    component = ComponentsFactoryProvider.getInstance().get("tJavaRow", "DI");
    node = new Node(component, process);
    parameterName = DesignerUtilities.getMainSchemaParameterName(node);
    //$NON-NLS-1$
    assertEquals("SCHEMA:" + EParameterName.REPOSITORY_SCHEMA_TYPE.getName(), parameterName);
}
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) Process(org.talend.designer.core.ui.editor.process.Process) Test(org.junit.Test)

Example 78 with Process

use of org.talend.designer.core.ui.editor.process.Process in project tesb-studio-se by Talend.

the class CamelEditorDropTargetListener method createNewComponent.

public void createNewComponent(DropTargetEvent event1) {
    boolean quickCreateInput = event1.detail == DND.DROP_LINK;
    boolean quickCreateOutput = event1.detail == DND.DROP_COPY;
    List<TempStore> list = new ArrayList<TempStore>();
    List<IComponent> components = new ArrayList<IComponent>();
    for (Object obj : selectSourceList) {
        if (obj instanceof RepositoryNode) {
            RepositoryNode sourceNode = (RepositoryNode) obj;
            ERepositoryObjectType type = sourceNode.getObjectType();
            Item item = sourceNode.getObject().getProperty().getItem();
            TempStore store = new TempStore();
            store.seletetedNode = sourceNode;
            getAppropriateComponent(item, quickCreateInput, quickCreateOutput, store, type);
            if (store.component != null) {
                list.add(store);
            } else {
                MessageDialog.openInformation(editor.getEditorSite().getShell(), //$NON-NLS-1$
                Messages.getString("TalendEditorDropTargetListener.dngsupportdialog.title"), //$NON-NLS-1$
                Messages.getString("TalendEditorDropTargetListener.dngsupportdialog.content"));
                return;
            }
        }
        org.eclipse.swt.graphics.Point swtLocation = new org.eclipse.swt.graphics.Point(event1.x, event1.y);
        Canvas canvas = (Canvas) editor.getViewer().getControl();
        /*
             * translate to Canvas coordinate
             */
        swtLocation = canvas.toControl(swtLocation);
        /*
             * translate to Viewport coordinate with zoom
             */
        org.eclipse.draw2d.geometry.Point draw2dPosition = new org.eclipse.draw2d.geometry.Point(swtLocation.x, swtLocation.y);
        /*
             * calcule the view port position. Take into acounte the scroll position
             */
        ProcessPart part = (ProcessPart) editor.getViewer().getRootEditPart().getRoot().getChildren().get(0);
        IFigure targetFigure = part.getFigure();
        translateAbsolateToRelative(targetFigure, draw2dPosition);
        // creates every node
        for (TempStore store : list) {
            RepositoryNode selectedNode = store.seletetedNode;
            IComponent element = store.component;
            if (!components.contains(element)) {
                components.add(element);
            }
            Node node = new Node(element);
            IPreferenceStore preferenceStore = DesignerPlugin.getDefault().getPreferenceStore();
            if (preferenceStore.getBoolean(TalendDesignerPrefConstants.USE_REPOSITORY_NAME)) {
                String LabelValue = null;
                if (CorePlugin.getDefault().getDesignerCoreService().getPreferenceStore(TalendDesignerPrefConstants.DEFAULT_LABEL).equals(node.getPropertyValue(EParameterName.LABEL.getName()))) {
                    // dnd a default
                    LabelValue = selectedNode.getObject().getLabel();
                }
                if (LabelValue != null) {
                    node.setPropertyValue(EParameterName.LABEL.getName(), LabelValue);
                }
            }
            NodeContainer nc = ((Process) node.getProcess()).loadNodeContainer(node, false);
            // create the node on the design sheet
            execCommandStack(new CreateNodeContainerCommand((Process) editor.getProcess(), nc, draw2dPosition));
            // initialize the propertiesView
            CompoundCommand cc = new CompoundCommand();
            createRefreshingPropertiesCommand(cc, selectedNode, node);
            execCommandStack(cc);
            draw2dPosition = draw2dPosition.getCopy();
            draw2dPosition.x += TalendEditor.GRID_SIZE;
            draw2dPosition.y += TalendEditor.GRID_SIZE;
            node.checkNode();
        }
    }
}
Also used : IComponent(org.talend.core.model.components.IComponent) Node(org.talend.designer.core.ui.editor.nodes.Node) INode(org.talend.core.model.process.INode) RepositoryNode(org.talend.repository.model.RepositoryNode) ArrayList(java.util.ArrayList) NodeContainer(org.talend.designer.core.ui.editor.nodecontainer.NodeContainer) Process(org.talend.designer.core.ui.editor.process.Process) CompoundCommand(org.eclipse.gef.commands.CompoundCommand) ContextItem(org.talend.core.model.properties.ContextItem) Item(org.talend.core.model.properties.Item) ProcessItem(org.talend.core.model.properties.ProcessItem) CreateNodeContainerCommand(org.talend.designer.core.ui.editor.cmd.CreateNodeContainerCommand) ProcessPart(org.talend.designer.core.ui.editor.process.ProcessPart) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) IFigure(org.eclipse.draw2d.IFigure) Canvas(org.eclipse.swt.widgets.Canvas) RepositoryNode(org.talend.repository.model.RepositoryNode) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 79 with Process

use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.

the class RepositoryUpdateTest method testRepositoryChangeFromConnection.

@Test
public void testRepositoryChangeFromConnection() 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);
        updateNodeConnectionOnly(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);
        updateNodeConnectionOnly(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 80 with Process

use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.

the class RepositoryUpdateTest method testRepositoryResetParams.

@Test
public void testRepositoryResetParams() 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\"");
        IElementParameter param = node.getElementParameter("connection.userPassword.userId");
        assertTrue(param.isRepositoryValueUsed());
        assertNotNull(param.getRepositoryValue());
        Form form = node.getComponentProperties().getForm(Form.MAIN);
        List<ElementParameter> parameters = new ArrayList<>();
        parameters = ComponentsUtils.getParametersFromForm(node, false, EComponentCategory.BASIC, node.getComponentProperties(), form);
        node.setElementParameters(parameters);
        param = node.getElementParameter("connection.userPassword.userId");
        assertTrue(param.isRepositoryValueUsed());
        assertNotNull(param.getRepositoryValue());
    } finally {
        IRepositoryViewObject object = ProxyRepositoryFactory.getInstance().getLastVersion(id);
        if (object != null) {
            ProxyRepositoryFactory.getInstance().deleteObjectPhysical(object);
        }
    }
}
Also used : IElementParameter(org.talend.core.model.process.IElementParameter) ElementParameter(org.talend.designer.core.model.components.ElementParameter) FakePropertyImpl(org.talend.core.model.repository.FakePropertyImpl) Form(org.talend.daikon.properties.presentation.Form) IComponent(org.talend.core.model.components.IComponent) Node(org.talend.designer.core.ui.editor.nodes.Node) INode(org.talend.core.model.process.INode) ArrayList(java.util.ArrayList) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IElementParameter(org.talend.core.model.process.IElementParameter) Process(org.talend.designer.core.ui.editor.process.Process) GenericConnection(org.talend.repository.generic.model.genericMetadata.GenericConnection) Test(org.junit.Test)

Aggregations

Process (org.talend.designer.core.ui.editor.process.Process)119 Node (org.talend.designer.core.ui.editor.nodes.Node)69 INode (org.talend.core.model.process.INode)48 ArrayList (java.util.ArrayList)45 IComponent (org.talend.core.model.components.IComponent)36 IElementParameter (org.talend.core.model.process.IElementParameter)28 Test (org.junit.Test)26 List (java.util.List)25 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)25 IProcess (org.talend.core.model.process.IProcess)24 Connection (org.talend.designer.core.ui.editor.connections.Connection)24 Property (org.talend.core.model.properties.Property)23 INodeConnector (org.talend.core.model.process.INodeConnector)22 IConnection (org.talend.core.model.process.IConnection)20 NodeContainer (org.talend.designer.core.ui.editor.nodecontainer.NodeContainer)20 FakePropertyImpl (org.talend.core.model.repository.FakePropertyImpl)15 ProcessItem (org.talend.core.model.properties.ProcessItem)12 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)11 HashMap (java.util.HashMap)10 Before (org.junit.Before)9