Search in sources :

Example 1 with TextElementParameter

use of org.talend.core.model.runprocess.shadow.TextElementParameter in project tdi-studio-se by Talend.

the class WSDLSchemaInputNode method addParameters.

/**
     * DOC qwei Comment method "addParameters".
     * 
     * @param schemaBean
     * @param parameters
     */
private void addParameters(WSDLSchemaBean schemaBean, ArrayList parameters) {
    //$NON-NLS-1$
    IElementParameter param = new TextElementParameter("ENDPOINT", schemaBean.getWslUrl());
    addParameter(param);
    if (LanguageManager.getCurrentLanguage().equals(ECodeLanguage.JAVA)) {
        addJavaParameters(schemaBean);
    } else if (LanguageManager.getCurrentLanguage().equals(ECodeLanguage.PERL)) {
        addPerlParameters(schemaBean);
    }
    //$NON-NLS-1$
    param = new TextElementParameter("METHOD", schemaBean.getMethod());
    addParameter(param);
    // fix preview
    //$NON-NLS-1$
    param = new TextElementParameter("ADVANCED_USE", Boolean.toString(false));
    addParameter(param);
    List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
    if (parameters != null) {
        for (Object string : parameters) {
            Map<String, Object> map = new HashMap<String, Object>();
            //$NON-NLS-1$
            map.put("VALUE", TalendTextUtils.addQuotes(string.toString()));
            list.add(map);
        }
    }
    //$NON-NLS-1$
    param = new ObjectElementParameter("PARAMS", list);
    //$NON-NLS-1$
    param.setListItemsDisplayCodeName(new String[] { "VALUE" });
    addParameter(param);
}
Also used : HashMap(java.util.HashMap) TextElementParameter(org.talend.core.model.runprocess.shadow.TextElementParameter) ArrayList(java.util.ArrayList) IElementParameter(org.talend.core.model.process.IElementParameter) ObjectElementParameter(org.talend.core.model.runprocess.shadow.ObjectElementParameter) Map(java.util.Map) HashMap(java.util.HashMap)

Example 2 with TextElementParameter

use of org.talend.core.model.runprocess.shadow.TextElementParameter in project tdi-studio-se by Talend.

the class WSDLSchemaInputNode method addJavaParameters.

private void addJavaParameters(WSDLSchemaBean schemaBean) {
    //$NON-NLS-1$ //$NON-NLS-2$
    IElementParameter param = new TextElementParameter("NEED_AUTH", "" + schemaBean.isNeedAuth());
    addParameter(param);
    //$NON-NLS-1$
    param = new TextElementParameter("AUTH_USERNAME", schemaBean.getUserName());
    addParameter(param);
    //$NON-NLS-1$
    param = new TextElementParameter("AUTH_PASSWORD", schemaBean.getPassword());
    addParameter(param);
    //$NON-NLS-1$ //$NON-NLS-2$
    param = new TextElementParameter("UES_PROXY", "" + schemaBean.isUseProxy());
    addParameter(param);
    //$NON-NLS-1$
    param = new TextElementParameter("PROXY_HOST", schemaBean.getProxyHost());
    addParameter(param);
    //$NON-NLS-1$
    param = new TextElementParameter("PROXY_PORT", schemaBean.getProxyPort());
    addParameter(param);
    //$NON-NLS-1$
    param = new TextElementParameter("PROXY_USERNAME", schemaBean.getProxyUser());
    addParameter(param);
    //$NON-NLS-1$
    param = new TextElementParameter("PROXY_PASSWORD", schemaBean.getProxyPassword());
    addParameter(param);
    //$NON-NLS-1$
    param = new TextElementParameter("TIMEOUT", "" + schemaBean.getTimeOut());
    addParameter(param);
    if (!schemaBean.getIsInputModel()) {
        //$NON-NLS-1$
        param = new TextElementParameter("PORT_NAME", schemaBean.getPortName());
        addParameter(param);
        //$NON-NLS-1$
        param = new TextElementParameter("PORT_NS", schemaBean.getPortNS());
        addParameter(param);
        //$NON-NLS-1$
        param = new TextElementParameter("SERVICE_NAME", schemaBean.getServerName());
        addParameter(param);
        //$NON-NLS-1$
        param = new TextElementParameter("SERVICE_NS", "" + schemaBean.getServerNS());
        addParameter(param);
    }
}
Also used : TextElementParameter(org.talend.core.model.runprocess.shadow.TextElementParameter) IElementParameter(org.talend.core.model.process.IElementParameter)

Example 3 with TextElementParameter

use of org.talend.core.model.runprocess.shadow.TextElementParameter in project tdi-studio-se by Talend.

the class ExpressionTest method testEvaluateDistrib_link.

@Test
public void testEvaluateDistrib_link() {
    List<IElementParameter> params = new ArrayList<>();
    ElementParameter param1 = createMockParameter("PARA1", true, null);
    params.add(param1);
    ElementParameter paramNode = mock(ElementParameter.class);
    INode testElement = mock(INode.class);
    when(paramNode.getName()).thenReturn("PARANODE");
    TextElementParameter testParam = mock(TextElementParameter.class);
    when(paramNode.getElement()).thenReturn(testElement);
    when(paramNode.getElement().getElementName()).thenReturn("testComponent");
    when(testElement.getElementParametersWithChildrens()).thenReturn((List) Arrays.asList(testParam));
    when(testParam.getVariableName()).thenReturn("__CONNECTION__");
    when(testParam.getValue()).thenReturn("relatedNode");
    INode relatedNode = mock(INode.class);
    when(relatedNode.getUniqueName()).thenReturn("relatedNode");
    when(relatedNode.getElementParameters()).thenReturn((List) params);
    IProcess process = mock(IProcess.class);
    when(process.getGeneratingNodes()).thenReturn((List) Arrays.asList(relatedNode));
    when(testElement.getProcess()).thenReturn(process);
    params.add(paramNode);
    ElementParameter distrib = createMockParameter("DISTRIBUTION", "CUSTOM");
    params.add(distrib);
    ElementParameter version = createMockParameter("HIVE_VERSION", "testVersion");
    params.add(version);
    ElementParameter invaliddistrib = createMockParameter("INVALDDISTRIB", "INVALID");
    params.add(invaliddistrib);
    assertTrue(Expression.evaluateDistrib("DISTRIB[#LINK@NODE.CONNECTION.DISTRIBUTION, #LINK@NODE.CONNECTION.HIVE_VERSION].doSupportUseDatanodeHostname[]", params, paramNode));
    assertFalse(Expression.evaluateDistrib("!DISTRIB[#LINK@NODE.CONNECTION.DISTRIBUTION, #LINK@NODE.CONNECTION.HIVE_VERSION].doSupportUseDatanodeHostname[]", params, paramNode));
}
Also used : IElementParameter(org.talend.core.model.process.IElementParameter) TextElementParameter(org.talend.core.model.runprocess.shadow.TextElementParameter) INode(org.talend.core.model.process.INode) TextElementParameter(org.talend.core.model.runprocess.shadow.TextElementParameter) ArrayList(java.util.ArrayList) IElementParameter(org.talend.core.model.process.IElementParameter) IProcess(org.talend.core.model.process.IProcess) Test(org.junit.Test)

Example 4 with TextElementParameter

use of org.talend.core.model.runprocess.shadow.TextElementParameter in project tdi-studio-se by Talend.

the class SalesforceSchemaInputNode method addParameters.

/**
     * DOC YeXiaowei Comment method "addParameters".
     * 
     * @param schemaBean
     */
private void addParameters(SalesforceSchemaBean schemaBean) {
    // modify for feature 7507
    String[] parameters = new String[] { "ENDPOINT", "USER", "PASS", "MODULENAME", "CONDITION", "CUSTOM_MODULE", "BATCH_SIZE", "NORMALIZE_DELIMITER", "COLUMNNAME_DELIMITER", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
    "TIMEOUT" };
    String[] values = new String[] { schemaBean.getWebServerUrl(), schemaBean.getUserName(), schemaBean.getPassword(), //$NON-NLS-1$
    schemaBean.isUseCustomModule() ? "CustomModule" : schemaBean.getModuleName(), //$NON-NLS-1$
    schemaBean.getQueryCondition(), schemaBean.getModuleName(), schemaBean.getBatchSize().toString(), ";", "_", String.valueOf(schemaBean.getTimeOut()) };
    for (int i = 0, n = values.length; i < n; i++) {
        if (values[i] == null || values[i].equals("")) {
            //$NON-NLS-1$
            continue;
        }
        TextElementParameter param = null;
        if (parameters[i].equals("MODULENAME")) {
            //$NON-NLS-1$
            param = new TextElementParameter(parameters[i], values[i]);
        } else {
            if (parameters[i].equals("TIMEOUT")) {
                param = new TextElementParameter(parameters[i], values[i]);
            } else {
                param = new TextElementParameter(parameters[i], TalendTextUtils.addQuotes(values[i]));
            }
        }
        addParameter(param);
    }
    // set the limit for tSalesforceInput, only preview the first 100 records in wizard
    //$NON-NLS-1$ //$NON-NLS-1$
    addParameter(new TextElementParameter("LIMIT", "100"));
}
Also used : TextElementParameter(org.talend.core.model.runprocess.shadow.TextElementParameter)

Example 5 with TextElementParameter

use of org.talend.core.model.runprocess.shadow.TextElementParameter in project tdi-studio-se by Talend.

the class WSDLSchemaInputNode method addPerlParameters.

private void addPerlParameters(WSDLSchemaBean schemaBean) {
    //$NON-NLS-1$
    IElementParameter param = new TextElementParameter("WSDL", schemaBean.getEndpointURI());
    addParameter(param);
    //$NON-NLS-1$
    param = new TextElementParameter("ENCODING", this.encoding);
    addParameter(param);
}
Also used : TextElementParameter(org.talend.core.model.runprocess.shadow.TextElementParameter) IElementParameter(org.talend.core.model.process.IElementParameter)

Aggregations

TextElementParameter (org.talend.core.model.runprocess.shadow.TextElementParameter)5 IElementParameter (org.talend.core.model.process.IElementParameter)4 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Test (org.junit.Test)1 INode (org.talend.core.model.process.INode)1 IProcess (org.talend.core.model.process.IProcess)1 ObjectElementParameter (org.talend.core.model.runprocess.shadow.ObjectElementParameter)1