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);
}
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);
}
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);
}
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);
}
}
}
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;
}
Aggregations