Search in sources :

Example 41 with ElementParameter

use of org.talend.designer.core.model.components.ElementParameter in project tdi-studio-se by Talend.

the class JobContextLoadComponent method addDatabaseParameter.

private void addDatabaseParameter(List<IElementParameter> elemParamList, INode node) {
    //
    IElementParameter newParam = new ElementParameter(node);
    newParam.setName(JobSettingsConstants.getExtraParameterName(EParameterName.DRIVER_JAR.getName()));
    newParam.setFieldType(EParameterFieldType.TABLE);
    newParam.setListItemsDisplayName(new String[] { EmfComponent.TEXT_BUILTIN, EmfComponent.TEXT_REPOSITORY });
    newParam.setListItemsDisplayCodeName(new String[] { EmfComponent.BUILTIN, EmfComponent.REPOSITORY });
    elemParamList.add(newParam);
    newParam = new ElementParameter(node);
    newParam.setName(JobSettingsConstants.getExtraParameterName(EParameterName.DRIVER_CLASS.getName()));
    newParam.setFieldType(EParameterFieldType.TEXT);
    elemParamList.add(newParam);
    newParam = new ElementParameter(node);
    newParam.setName(JobSettingsConstants.getExtraParameterName(EParameterName.URL.getName()));
    newParam.setFieldType(EParameterFieldType.TEXT);
    elemParamList.add(newParam);
    newParam = new ElementParameter(node);
    newParam.setName(JobSettingsConstants.getExtraParameterName(EParameterName.HOST.getName()));
    newParam.setFieldType(EParameterFieldType.TEXT);
    elemParamList.add(newParam);
    newParam = new ElementParameter(node);
    newParam.setName(JobSettingsConstants.getExtraParameterName(EParameterName.CONNECTION_TYPE.getName()));
    newParam.setFieldType(EParameterFieldType.TEXT);
    elemParamList.add(newParam);
    newParam = new ElementParameter(node);
    //$NON-NLS-1$
    newParam.setName("SERVER");
    newParam.setFieldType(EParameterFieldType.TEXT);
    elemParamList.add(newParam);
    newParam = new ElementParameter(node);
    //$NON-NLS-1$
    newParam.setName("DSN");
    newParam.setFieldType(EParameterFieldType.TEXT);
    elemParamList.add(newParam);
    newParam = new ElementParameter(node);
    newParam.setName(JobSettingsConstants.getExtraParameterName(EParameterName.PORT.getName()));
    newParam.setFieldType(EParameterFieldType.TEXT);
    elemParamList.add(newParam);
    newParam = new ElementParameter(node);
    newParam.setName(JobSettingsConstants.getExtraParameterName(EParameterName.DBNAME.getName()));
    newParam.setFieldType(EParameterFieldType.TEXT);
    elemParamList.add(newParam);
    newParam = new ElementParameter(node);
    newParam.setName(JobSettingsConstants.getExtraParameterName(EParameterName.DB_VERSION.getName()));
    newParam.setFieldType(EParameterFieldType.TEXT);
    elemParamList.add(newParam);
    newParam = new ElementParameter(node);
    newParam.setName(JobSettingsConstants.getExtraParameterName(EParameterName.PROPERTIES.getName()));
    newParam.setFieldType(EParameterFieldType.TEXT);
    elemParamList.add(newParam);
    newParam = new ElementParameter(node);
    newParam.setName(JobSettingsConstants.getExtraParameterName(EParameterName.SCHEMA_DB.getName()));
    newParam.setFieldType(EParameterFieldType.TEXT);
    elemParamList.add(newParam);
    newParam = new ElementParameter(node);
    newParam.setName(JobSettingsConstants.getExtraParameterName(EParameterName.USER.getName()));
    newParam.setFieldType(EParameterFieldType.TEXT);
    elemParamList.add(newParam);
    newParam = new ElementParameter(node);
    newParam.setName(JobSettingsConstants.getExtraParameterName(EParameterName.PASS.getName()));
    newParam.setFieldType(EParameterFieldType.TEXT);
    elemParamList.add(newParam);
    newParam = new ElementParameter(node);
    newParam.setName(JobSettingsConstants.getExtraParameterName(EParameterName.DBTABLE.getName()));
    newParam.setFieldType(EParameterFieldType.TEXT);
    elemParamList.add(newParam);
    newParam = new ElementParameter(node);
    newParam.setName(JobSettingsConstants.QUERY);
    newParam.setFieldType(EParameterFieldType.TEXT);
    elemParamList.add(newParam);
}
Also used : IElementParameter(org.talend.core.model.process.IElementParameter) ElementParameter(org.talend.designer.core.model.components.ElementParameter) IElementParameter(org.talend.core.model.process.IElementParameter)

Example 42 with ElementParameter

use of org.talend.designer.core.model.components.ElementParameter in project tdi-studio-se by Talend.

the class JobContextLoadComponent method addtContextLoadParameter.

private void addtContextLoadParameter(List<IElementParameter> elemParamList, INode node) {
    IElementParameter newParam = new ElementParameter(node);
    newParam.setName(EParameterName.LOAD_NEW_VARIABLE.getName());
    newParam.setFieldType(EParameterFieldType.CLOSED_LIST);
    newParam.setValue(ContextLoadInfo.WARNING);
    elemParamList.add(newParam);
    newParam = new ElementParameter(node);
    newParam.setName(EParameterName.NOT_LOAD_OLD_VARIABLE.getName());
    newParam.setFieldType(EParameterFieldType.CLOSED_LIST);
    newParam.setValue(ContextLoadInfo.WARNING);
    elemParamList.add(newParam);
    newParam = new ElementParameter(node);
    newParam.setName(EParameterName.PRINT_OPERATIONS.getName());
    newParam.setFieldType(EParameterFieldType.CHECK);
    newParam.setValue(false);
    elemParamList.add(newParam);
    newParam = new ElementParameter(node);
    newParam.setName(EParameterName.DISABLE_ERROR.getName());
    newParam.setFieldType(EParameterFieldType.CHECK);
    newParam.setValue(false);
    elemParamList.add(newParam);
    newParam = new ElementParameter(node);
    newParam.setName(EParameterName.DISABLE_INFO.getName());
    newParam.setFieldType(EParameterFieldType.CHECK);
    newParam.setValue(true);
    elemParamList.add(newParam);
    newParam = new ElementParameter(node);
    newParam.setName(EParameterName.DISABLE_WARNINGS.getName());
    newParam.setFieldType(EParameterFieldType.CHECK);
    newParam.setValue(true);
    elemParamList.add(newParam);
}
Also used : IElementParameter(org.talend.core.model.process.IElementParameter) ElementParameter(org.talend.designer.core.model.components.ElementParameter) IElementParameter(org.talend.core.model.process.IElementParameter)

Example 43 with ElementParameter

use of org.talend.designer.core.model.components.ElementParameter in project tdi-studio-se by Talend.

the class Connection method createMeterParameters.

// public boolean checkResumingShowEnable() {
// // enable
// boolean enabled = DesignerPlugin.getDefault().getRunProcessService().enableResumingForActiveRunProcess();
// return enabled;
// }
private void createMeterParameters(IProcess2 process) {
    ElementParameter param = new ElementParameter(this);
    param.setName(EParameterName.MONITOR_CONNECTION.getName());
    param.setDisplayName(EParameterName.MONITOR_CONNECTION.getDisplayName());
    param.setFieldType(EParameterFieldType.CHECK);
    param.setValue(monitorConnection);
    param.setCategory(EComponentCategory.ADVANCED);
    param.setShow(true);
    param.setNumRow(10);
    // param.setDefaultValue(param.getValue());
    addElementParameter(param);
    Node meterAttached = new Node(ComponentsFactoryProvider.getInstance().get("tFlowMeter", ComponentCategory.CATEGORY_4_DI.getName()), //$NON-NLS-1$
    process);
    for (IElementParameter curParam : meterAttached.getElementParameters()) {
        if (curParam.getCategory() == EComponentCategory.BASIC && !curParam.getName().equals(EParameterName.NOT_SYNCHRONIZED_SCHEMA.getName())) {
            curParam.setCategory(EComponentCategory.ADVANCED);
            curParam.setNumRow(curParam.getNumRow() + 1);
            if (curParam.getShowIf() == null || curParam.getShowIf().equals("")) {
                //$NON-NLS-1$
                //$NON-NLS-1$
                curParam.setShowIf("MONITOR_CONNECTION == 'true'");
            } else {
                //$NON-NLS-1$ //$NON-NLS-2$
                curParam.setShowIf("(" + curParam.getShowIf() + " and MONITOR_CONNECTION == 'true')");
            }
            curParam.setElement(this);
            ((ElementParameter) curParam).setDefaultValue(curParam.getValue());
            addElementParameter(curParam);
        }
    }
    meterAttached = null;
    setMonitorLabel(new MonitorConnectionLabel(this));
    updateMonitorLabel(param);
}
Also used : IElementParameter(org.talend.core.model.process.IElementParameter) ElementParameter(org.talend.designer.core.model.components.ElementParameter) Node(org.talend.designer.core.ui.editor.nodes.Node) INode(org.talend.core.model.process.INode) DataNode(org.talend.designer.core.model.process.DataNode) IElementParameter(org.talend.core.model.process.IElementParameter)

Example 44 with ElementParameter

use of org.talend.designer.core.model.components.ElementParameter in project tdi-studio-se by Talend.

the class ParallelExecutionUtils method setHashKeysForCon.

public static void setHashKeysForCon(IConnection con) {
    List<String> conKeyColumnList = getKeyColumnList(con.getMetadataTable());
    IElementParameter parTableCon = con.getElementParameter(HASH_KEYS);
    boolean isExistHashValue = false;
    if (parTableCon != null) {
        if (conKeyColumnList.size() > 0) {
            ((List) parTableCon.getValue()).clear();
            con.getElementParameter(HASH_PARTION).setValue(true);
            Object[] itemCon = parTableCon.getListItemsValue();
            String clumnKeyListName = "";
            for (Object itemList : itemCon) {
                if (((ElementParameter) itemList).getFieldType().equals(EParameterFieldType.PREV_COLUMN_LIST) || ((ElementParameter) itemList).getFieldType().equals(EParameterFieldType.COLUMN_LIST)) {
                    clumnKeyListName = ((ElementParameter) itemList).getName();
                    break;
                }
            }
            for (String partionValue : conKeyColumnList) {
                for (Object keyParMap : ((List) parTableCon.getValue())) {
                    Map existKeyMap = (Map) keyParMap;
                    if (existKeyMap.get(clumnKeyListName).equals(partionValue)) {
                        isExistHashValue = true;
                        break;
                    }
                }
                if (!isExistHashValue) {
                    Map partionKeyMap = new HashMap<String, String>();
                    partionKeyMap.put(clumnKeyListName, partionValue);
                    ((List) parTableCon.getValue()).add(partionKeyMap);
                }
            }
        } else {
            con.getElementParameter(HASH_PARTION).setValue(false);
        }
    }
}
Also used : IElementParameter(org.talend.core.model.process.IElementParameter) ElementParameter(org.talend.designer.core.model.components.ElementParameter) HashMap(java.util.HashMap) IElementParameter(org.talend.core.model.process.IElementParameter) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map)

Example 45 with ElementParameter

use of org.talend.designer.core.model.components.ElementParameter in project tdi-studio-se by Talend.

the class ParallelExecutionUtils method compareKeyPartions.

public static boolean compareKeyPartions(IConnection parConnection, Node needToPar) {
    String partitioning = needToPar.getComponent().getPartitioning();
    boolean isSame = false;
    String[] partitionKey = partitioning.split("\\.");
    boolean canCompare = partitionKey.length > 1 ? true : false;
    if (canCompare) {
        // before compare,in case there is a Integer value exist in the column list
        if (isPartitionKeysExist(parConnection)) {
            reSetParKeyValuesForCon(parConnection);
        }
        IElementParameter parTableCon = parConnection.getElementParameter(HASH_KEYS);
        IElementParameter parTableNode = needToPar.getElementParameter(partitionKey[0]);
        if (parTableNode != null) {
            // for the partition key
            String clumnKeyListName = "KEY_COLUMN";
            String clumnNodeListName = partitionKey[1];
            List<String> parKeyValues = new ArrayList<String>();
            List<String> columnKeyValues = new ArrayList<String>();
            ElementParameter nodeElemForList = null;
            for (Map conColumnListMap : (List<Map>) parTableCon.getValue()) {
                if (conColumnListMap.get(clumnKeyListName) instanceof String) {
                    parKeyValues.add((String) conColumnListMap.get(clumnKeyListName));
                }
            }
            for (Object nodeItemList : parTableNode.getListItemsValue()) {
                if (((ElementParameter) nodeItemList).getFieldType().equals(EParameterFieldType.PREV_COLUMN_LIST) || ((ElementParameter) nodeItemList).getFieldType().equals(EParameterFieldType.COLUMN_LIST)) {
                    nodeElemForList = (ElementParameter) nodeItemList;
                    break;
                }
            }
            if (nodeElemForList != null) {
                for (Map nodeColumnListMap : (List<Map>) parTableNode.getValue()) {
                    Object value = nodeColumnListMap.get(clumnNodeListName);
                    if (nodeColumnListMap.get(clumnNodeListName) instanceof String) {
                        columnKeyValues.add((String) value);
                    } else if (value instanceof Integer) {
                        Integer index = (Integer) value;
                        if (nodeElemForList.getListItemsDisplayName().length > index) {
                            columnKeyValues.add(nodeElemForList.getListItemsDisplayName()[index]);
                        }
                    }
                }
            }
            if (columnKeyValues.size() > 0) {
                if (columnKeyValues.equals(parKeyValues)) {
                    isSame = true;
                } else {
                    isSame = false;
                }
            }
        }
    }
    return isSame;
}
Also used : IElementParameter(org.talend.core.model.process.IElementParameter) ElementParameter(org.talend.designer.core.model.components.ElementParameter) ArrayList(java.util.ArrayList) IElementParameter(org.talend.core.model.process.IElementParameter) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

ElementParameter (org.talend.designer.core.model.components.ElementParameter)72 IElementParameter (org.talend.core.model.process.IElementParameter)62 ArrayList (java.util.ArrayList)44 List (java.util.List)26 INode (org.talend.core.model.process.INode)20 Map (java.util.Map)19 HashMap (java.util.HashMap)15 Node (org.talend.designer.core.ui.editor.nodes.Node)12 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)11 GenericElementParameter (org.talend.designer.core.generic.model.GenericElementParameter)10 Test (org.junit.Test)9 IComponent (org.talend.core.model.components.IComponent)8 ComponentProperties (org.talend.components.api.properties.ComponentProperties)7 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)7 IConnection (org.talend.core.model.process.IConnection)7 Form (org.talend.daikon.properties.presentation.Form)6 ModuleNeeded (org.talend.core.model.general.ModuleNeeded)5 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)5 INodeConnector (org.talend.core.model.process.INodeConnector)5 IProcess (org.talend.core.model.process.IProcess)4