use of org.talend.core.model.process.IElementParameter in project tdi-studio-se by Talend.
the class StatsAndLogsManager method getUrl.
/**
* DOC zli Comment method "getUrl".
*
* @param process
*/
private static String getUrl(IProcess process) {
String processDBType = (String) process.getElementParameter(EParameterName.DB_TYPE.getName()).getValue();
if (StatsAndLogsConstants.JDBC_OUTPUT.equals(processDBType)) {
IElementParameter urlParam = process.getElementParameter(EParameterName.URL.getName());
if (urlParam != null && urlParam.getValue() != null) {
return urlParam.getValue().toString();
}
}
int indexOfItemFromList = process.getElementParameter(EParameterName.DB_TYPE.getName()).getIndexOfItemFromList(processDBType);
String[] listItemsDisplayName = process.getElementParameter(EParameterName.DB_TYPE.getName()).getListItemsDisplayName();
processDBType = listItemsDisplayName[indexOfItemFromList];
IElementParameter param = process.getElementParameter(EParameterName.DBFILE.getName());
//$NON-NLS-1$
final String empty = "";
String processDBFileName = empty;
if (param != null) {
processDBFileName = (String) param.getValue();
}
param = process.getElementParameter(EParameterName.DATASOURCE.getName());
String processDBDatasouce = empty;
if (param != null) {
processDBDatasouce = (String) param.getValue();
}
param = process.getElementParameter(EParameterName.DBNAME.getName());
String processDBName = empty;
if (param != null) {
processDBName = (String) param.getValue();
}
param = process.getElementParameter(EParameterName.HOST.getName());
String processHost = empty;
if (param != null) {
processHost = (String) param.getValue();
}
param = process.getElementParameter(EParameterName.PORT.getName());
String processDBPort = empty;
if (param != null) {
processDBPort = (String) param.getValue();
}
param = process.getElementParameter(EParameterName.PASS.getName());
String processDBPass = empty;
if (param != null) {
processDBPass = (String) param.getValue();
}
param = process.getElementParameter(EParameterName.SCHEMA_DB.getName());
String processDBSID = empty;
if (param != null) {
processDBSID = (String) param.getValue();
}
param = process.getElementParameter(EParameterName.USER.getName());
String processDBUser = empty;
if (param != null) {
processDBUser = (String) param.getValue();
}
param = process.getElementParameter(EParameterName.PROPERTIES.getName());
String processDBAdditionParameters = empty;
if (param != null) {
processDBAdditionParameters = (String) param.getValue();
}
param = process.getElementParameter(EParameterName.DB_VERSION.getName());
String processDBVersion = empty;
if (param != null) {
processDBVersion = (String) param.getValue();
}
if (processDBType.equals("Oracle OCI")) {
processDBSID = processDBName;
}
String dbURL = DatabaseConnStrUtil.getURLString(true, processDBType, processDBVersion, processHost, processDBUser, processDBPass, processDBPort, processDBSID, processDBFileName, processDBDatasouce, processDBFileName, processDBAdditionParameters);
return dbURL;
}
use of org.talend.core.model.process.IElementParameter in project tdi-studio-se by Talend.
the class StatsAndLogsManager method statsAndLogsParametersFinalPart.
private static List<IElementParameter> statsAndLogsParametersFinalPart(IProcess process) {
ElementParameter param;
IPreferenceStore preferenceStore = DesignerPlugin.getDefault().getPreferenceStore();
List<IElementParameter> paramList = new ArrayList<IElementParameter>();
//$NON-NLS-1$
String languagePrefix = LanguageManager.getCurrentLanguage().toString() + "_";
// Catch runtime errors
param = new ElementParameter(process);
//$NON-NLS-1$
param.setName("CATCH_RUNTIME_ERRORS");
param.setValue(preferenceStore.getBoolean(languagePrefix + EParameterName.CATCH_RUNTIME_ERRORS.getName()));
param.setDisplayName(EParameterName.CATCH_RUNTIME_ERRORS.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.STATSANDLOGS);
param.setNumRow(90);
//$NON-NLS-1$
param.setShowIf("((CATCH_RUNTIME_ERRORS == 'true' or CATCH_RUNTIME_ERRORS == 'false') and (ON_LOGCATCHER_FLAG == 'true'))");
paramList.add(param);
// Catch user errors
param = new ElementParameter(process);
//$NON-NLS-1$
param.setName("CATCH_USER_ERRORS");
param.setValue(preferenceStore.getBoolean(languagePrefix + EParameterName.CATCH_USER_ERRORS.getName()));
param.setDisplayName(EParameterName.CATCH_USER_ERRORS.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.STATSANDLOGS);
param.setNumRow(90);
//$NON-NLS-1$
param.setShowIf("((CATCH_USER_ERRORS == 'true' or CATCH_USER_ERRORS == 'false') and (ON_LOGCATCHER_FLAG == 'true'))");
paramList.add(param);
// Catch user warning
param = new ElementParameter(process);
//$NON-NLS-1$
param.setName("CATCH_USER_WARNING");
param.setValue(preferenceStore.getBoolean(languagePrefix + EParameterName.CATCH_USER_WARNING.getName()));
param.setDisplayName(EParameterName.CATCH_USER_WARNING.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.STATSANDLOGS);
param.setNumRow(90);
//$NON-NLS-1$
param.setShowIf("((CATCH_USER_WARNING == 'true' or CATCH_USER_WARNING == 'false') and (ON_LOGCATCHER_FLAG == 'true'))");
paramList.add(param);
// Catch realtime statistics
param = new ElementParameter(process);
//$NON-NLS-1$
param.setName("CATCH_REALTIME_STATS");
param.setValue(preferenceStore.getBoolean(languagePrefix + EParameterName.CATCH_REALTIME_STATS.getName()));
param.setDisplayName(//$NON-NLS-1$
EParameterName.CATCH_REALTIME_STATS.getDisplayName() + " (" + EParameterName.TSTATCATCHER_STATS.getDisplayName() + //$NON-NLS-1$
")");
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.STATSANDLOGS);
param.setNumRow(91);
//$NON-NLS-1$
param.setShowIf("((CATCH_REALTIME_STATS == 'true' or CATCH_REALTIME_STATS == 'false') and (ON_STATCATCHER_FLAG == 'true'))");
paramList.add(param);
return paramList;
}
use of org.talend.core.model.process.IElementParameter in project tdi-studio-se by Talend.
the class StatsAndLogsManager method createStatsNode.
private static DataNode createStatsNode(boolean useFile, boolean console, String dbOutput) {
JobStatsComponent statsComponent = new JobStatsComponent(useFile, console, dbOutput);
DataNode statsNode = new DataNode(statsComponent, STAT_UNIQUE_NAME);
statsNode.setStart(true);
statsNode.setSubProcessStart(true);
statsNode.setActivate(true);
statsNode.getMetadataList().clear();
// load the tStatCatcher to get the schema.
IComponent tmpComponent = ComponentsFactoryProvider.getInstance().get("tStatCatcher", //$NON-NLS-1$
ComponentCategory.CATEGORY_4_DI.getName());
//$NON-NLS-1$
DataNode tmpNode = new DataNode(tmpComponent, "tmp");
boolean found = false;
for (int k = 0; k < tmpNode.getElementParameters().size() && !found; k++) {
IElementParameter currentParam = tmpNode.getElementParameters().get(k);
if (currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) || currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE)) {
Object value = currentParam.getValue();
if (value instanceof IMetadataTable) {
IMetadataTable table = ((IMetadataTable) value).clone();
table.setTableName(STAT_UNIQUE_NAME);
table.setAttachedConnector(currentParam.getContext());
statsNode.getMetadataList().add(table);
}
found = true;
}
}
return statsNode;
}
use of org.talend.core.model.process.IElementParameter in project tdi-studio-se by Talend.
the class Connection method init.
private void init(INode source, INode target, EConnectionType lineStyle, String connectorName, String metaName, String linkName, final boolean monitorConnection) {
if (lineStyle.equals(EConnectionType.ITERATE)) {
performance = new IterateConnectionPerformance(this);
} else if (lineStyle.hasConnectionCategory(IConnectionCategory.DEPENDENCY)) {
// "OnComponentOK/OnComponentError/OnSubJobOK/OnSubJobError/If"
performance = new LiteralConnectionPerformance(this);
} else if (ComponentCategory.CATEGORY_4_SPARK.getName().equals(source.getProcess().getComponentsType())) {
performance = new SparkBatchConnectionPerformance(this);
} else {
// if no parallel execution existed, just delegate to super class.
performance = new ParallelConnectionPerformance(this);
}
this.connectorName = connectorName;
this.lineStyle = lineStyle;
this.metaName = metaName;
this.monitorConnection = monitorConnection;
resuming = new ConnectionResuming(this);
if (lineStyle.hasConnectionCategory(IConnectionCategory.FLOW)) {
trace = new ConnectionTrace(this);
createTraceParamters();
IComponent component = ComponentsFactoryProvider.getInstance().get("tFlowMeter", //$NON-NLS-1$
ComponentCategory.CATEGORY_4_DI.getName());
if (component != null) {
// only if tFlowMeter is available and not M/R job
IProcess process = source.getProcess();
if (process instanceof IProcess2) {
IProcess2 process2 = (IProcess2) process;
if (!ComponentCategory.CATEGORY_4_MAPREDUCE.getName().equals(process2.getComponentsType())) {
createMeterParameters(process2);
}
}
}
}
setName(linkName);
if (trace != null) {
trace.setOffset(label.getOffset());
}
if (resuming != null) {
resuming.setOffset(label.getOffset());
}
if (source.getProcess().getComponentsType().equals(ComponentCategory.CATEGORY_4_DI.getName()) && ComponentsFactoryProvider.getInstance().get("tPartitioner", ComponentCategory.CATEGORY_4_DI.getName()) != null) {
this.source = source;
createParallelizeParameters();
}
reconnect(source, target, lineStyle);
updateName();
if (lineStyle.equals(EConnectionType.RUN_IF)) {
ElementParameter param = new ElementParameter(this);
switch(LanguageManager.getCurrentLanguage()) {
case JAVA:
param.setFieldType(EParameterFieldType.MEMO_JAVA);
break;
default:
param.setFieldType(EParameterFieldType.MEMO_PERL);
}
param.setCategory(EComponentCategory.BASIC);
//$NON-NLS-1$
param.setValue("");
param.setNbLines(5);
param.setName(EParameterName.CONDITION.getName());
param.setDisplayName(EParameterName.CONDITION.getDisplayName());
param.setShow(true);
param.setNumRow(1);
param.setDefaultValue(param.getValue());
addElementParameter(param);
}
if (lineStyle.equals(EConnectionType.ROUTE_WHEN)) {
String[] strList = { "constant", "el", "groovy", "header", "javaScript", "jxpath", "mvel", "ognl", "php", "property", "python", "ruby", "simple", "spel", "sql", "xpath", "xquery" };
IElementParameter supportedLanguages = source.getElementParameter("ROUTE_WHEN_LANGUAGES");
if (supportedLanguages != null) {
Object[] values = supportedLanguages.getListItemsValue();
if (values != null) {
strList = new String[values.length];
System.arraycopy(values, 0, strList, 0, values.length);
}
}
IElementParameter param = new ElementParameter(this);
param.setCategory(EComponentCategory.BASIC);
param.setName(EParameterName.ROUTETYPE.getName());
param.setDisplayName(EParameterName.ROUTETYPE.getDisplayName());
param.setListItemsValue(strList);
param.setListItemsDisplayName(strList);
param.setListItemsDisplayCodeName(strList);
param.setNbLines(1);
param.setFieldType(EParameterFieldType.CLOSED_LIST);
param.setValue(supportedLanguages.getValue());
param.setShow(true);
param.setNumRow(1);
addElementParameter(param);
param = new ElementParameter(this);
switch(LanguageManager.getCurrentLanguage()) {
case JAVA:
param.setFieldType(EParameterFieldType.MEMO_JAVA);
break;
default:
param.setFieldType(EParameterFieldType.MEMO_PERL);
}
param.setCategory(EComponentCategory.BASIC);
//$NON-NLS-1$
param.setValue("");
param.setNbLines(5);
param.setName(EParameterName.CONDITION.getName());
param.setDisplayName(EParameterName.CONDITION.getDisplayName());
param.setShow(true);
param.setNumRow(2);
addElementParameter(param);
// TESB-8043
if ("cMessageRouter".equals(source.getComponent().getName())) {
param = new ElementParameter(this);
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.BASIC);
//$NON-NLS-1$
param.setValue("false");
param.setName(EParameterName.ENDOFCHOICE.getName());
param.setDisplayName(EParameterName.ENDOFCHOICE.getDisplayName());
param.setShow(true);
param.setNumRow(1);
addElementParameter(param);
param = new ElementParameter(this);
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.BASIC);
param.setValue("false");
param.setName(EParameterName.USE_NAMESPACES.getName());
param.setDisplayName(EParameterName.USE_NAMESPACES.getDisplayName());
param.setShowIf(EParameterName.ROUTETYPE.getName() + "=='xpath'");
param.setShow(true);
param.setNumRow(17);
addElementParameter(param);
param = new ElementParameter(this);
param.setFieldType(EParameterFieldType.TABLE);
param.setCategory(EComponentCategory.BASIC);
param.setName(EParameterName.NAMESPACES.getName());
param.setDisplayName(EParameterName.NAMESPACES.getDisplayName());
param.setShow(true);
param.setShowIf("(" + EParameterName.ROUTETYPE.getName() + "=='xpath') AND (" + EParameterName.USE_NAMESPACES.getName() + " == 'true')");
param.setNumRow(18);
String[] columns = new String[] { EParameterName.PREFIX.getName(), EParameterName.URI.getName() };
param.setListItemsDisplayCodeName(columns);
param.setListItemsDisplayName(new String[] { EParameterName.PREFIX.getDisplayName(), EParameterName.URI.getName() });
ElementParameter p = new ElementParameter(this);
p.setFieldType(EParameterFieldType.TEXT);
p.setName(EParameterName.PREFIX.getName());
ElementParameter p1 = new ElementParameter(this);
p1.setFieldType(EParameterFieldType.TEXT);
p1.setName(EParameterName.URI.getName());
param.setListItemsValue(new ElementParameter[] { p, p1 });
param.setValue(new ArrayList<Map<String, Object>>());
addElementParameter(param);
param = new ElementParameter(this);
param.setFieldType(EParameterFieldType.LABEL);
param.setCategory(EComponentCategory.BASIC);
param.setName("WARNING");
param.setDisplayName(EParameterName.LANGUAGEWARNING.getDisplayName());
param.setShow(true);
param.setShowIf("(" + EParameterName.ROUTETYPE.getName() + "=='xpath') AND (" + EParameterName.USE_NAMESPACES.getName() + " == 'true')");
param.setValue(EParameterName.LANGUAGEWARNING.getDisplayName());
param.setNumRow(19);
addElementParameter(param);
}
}
if (lineStyle.equals(EConnectionType.ROUTE_CATCH)) {
IElementParameter param = new ElementParameter(this);
param.setCategory(EComponentCategory.BASIC);
param.setName(EParameterName.EXCEPTIONLIST.getName());
param.setDisplayName(EParameterName.EXCEPTIONLIST.getDisplayName());
param.setNbLines(5);
param.setFieldType(EParameterFieldType.TEXT);
param.setShow(true);
param.setNumRow(1);
addElementParameter(param);
}
if (lineStyle.equals(EConnectionType.ITERATE)) {
IElementParameter param = new ElementParameter(this);
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.BASIC);
param.setValue(Boolean.FALSE);
param.setName(ENABLE_PARALLEL);
//$NON-NLS-1$
param.setDisplayName(Messages.getString("Connection.enableParallel"));
param.setShow(true);
param.setNumRow(1);
addElementParameter(param);
param = new ElementParameter(this);
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.BASIC);
// param.setListItemsDisplayName(new String[] { "2", "3", "4" });
// param.setListItemsDisplayCodeName(new String[] { "2", "3", "4" });
// param.setListItemsValue(new String[] { "2", "3", "4" });
//$NON-NLS-1$
param.setValue("2");
param.setName(NUMBER_PARALLEL);
//$NON-NLS-1$
param.setDisplayName(Messages.getString("Connection.numberParallel"));
param.setShow(true);
//$NON-NLS-1$
param.setShowIf("ENABLE_PARALLEL == 'true'");
param.setNumRow(1);
param.setRequired(true);
addElementParameter(param);
}
// add activate parameter
ElementParameter param = new ElementParameter(this);
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.TECHNICAL);
param.setValue(Boolean.TRUE);
param.setName(EParameterName.ACTIVATE.getName());
param.setDisplayName(EParameterName.ACTIVATE.getDisplayName());
param.setShow(false);
param.setNumRow(1);
param.setDefaultValue(param.getValue());
addElementParameter(param);
param = new ElementParameter(this);
param.setName(EParameterName.UNIQUE_NAME.getName());
param.setValue(this.getUniqueName());
param.setDisplayName(EParameterName.UNIQUE_NAME.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.ADVANCED);
param.setNumRow(1);
param.setReadOnly(true);
param.setShow(false);
addElementParameter(param);
param = new ElementParameter(this);
param.setName(EParameterName.UPDATE_COMPONENTS.getName());
param.setValue(Boolean.FALSE);
param.setDisplayName(EParameterName.UPDATE_COMPONENTS.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.BASIC);
param.setNumRow(5);
param.setReadOnly(true);
param.setRequired(false);
param.setShow(false);
addElementParameter(param);
if (lineStyle.hasConnectionCategory(IConnectionCategory.FLOW)) {
initTraceParamters();
}
if (PluginChecker.isTeamEdition()) {
boolean isLocalRepository = (ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider() instanceof ILocalRepositoryFactory);
param = new ElementParameter(this);
param.setName(EParameterName.RESUMING_CHECKPOINT.getName());
param.setValue(Boolean.FALSE);
param.setGroupDisplayName(EParameterName.RESUMING_CHECKPOINT.getDisplayName());
param.setDisplayName(EParameterName.RESUMING_CHECKPOINT.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.RESUMING);
param.setGroup(RESUMING_CHECKPOINT);
param.setNumRow(2);
param.setShow(true);
param.setReadOnly(isLocalRepository);
param.setDefaultValue(param.getValue());
addElementParameter(param);
param = new ElementParameter(this);
param.setName(EParameterName.RESUMLABEL.getName());
param.setDisplayName(EParameterName.RESUMLABEL.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.RESUMING);
param.setGroup(RESUMING_CHECKPOINT);
param.setValue("");
param.setNumRow(3);
param.setShow(true);
param.setReadOnly(isLocalRepository);
param.setDefaultValue(param.getValue());
addElementParameter(param);
param = new ElementParameter(this);
param.setName(EParameterName.FAILURE_INSTRUCTIONS.getName());
param.setDisplayName(EParameterName.FAILURE_INSTRUCTIONS.getDisplayName());
param.setFieldType(EParameterFieldType.MEMO);
param.setCategory(EComponentCategory.RESUMING);
param.setGroup(RESUMING_CHECKPOINT);
param.setNbLines(5);
param.setNumRow(4);
param.setShow(true);
param.setReadOnly(isLocalRepository);
param.setDefaultValue(param.getValue());
addElementParameter(param);
// breakpoint
if (lineStyle.hasConnectionCategory(IConnectionCategory.FLOW) || lineStyle.hasConnectionCategory(IConnectionCategory.MERGE)) {
param = new ElementParameter(this);
param.setName(EParameterName.ACTIVEBREAKPOINT.getName());
param.setDisplayName(EParameterName.ACTIVEBREAKPOINT.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.BREAKPOINT);
param.setNumRow(13);
param.setValue(false);
param.setContextMode(false);
param.setDefaultValue(param.getValue());
param.setShow(true);
addElementParameter(param);
IComponent component = ComponentsFactoryProvider.getInstance().get("tFilterRow", ComponentCategory.CATEGORY_4_DI.getName());
Node tmpNode = new Node(component, (Process) source.getProcess());
tmpNode.setTemplate(source.isTemplate());
tmpNode.setGeneratedByJobscriptBool(source.isGeneratedByJobscriptBool());
tmpNode.addInput(this);
ElementParameter tmpParam = (ElementParameter) tmpNode.getElementParameter("LOGICAL_OP");
if (tmpParam != null) {
tmpParam.setElement(this);
tmpParam.setCategory(EComponentCategory.BREAKPOINT);
tmpParam.setNumRow(14);
tmpParam.setDefaultValue(tmpParam.getValue());
addElementParameter(tmpParam);
}
tmpParam = (ElementParameter) tmpNode.getElementParameter("CONDITIONS");
if (tmpParam != null) {
tmpParam.setElement(this);
tmpParam.setCategory(EComponentCategory.BREAKPOINT);
tmpParam.setNumRow(15);
ColumnListController.updateColumnList(tmpNode, null, true);
tmpParam.setDefaultValue(tmpParam.getValue());
addElementParameter(tmpParam);
}
tmpParam = (ElementParameter) tmpNode.getElementParameter("USE_ADVANCED");
if (tmpParam != null) {
tmpParam.setElement(this);
tmpParam.setCategory(EComponentCategory.BREAKPOINT);
tmpParam.setNumRow(16);
tmpParam.setDefaultValue(tmpParam.getValue());
addElementParameter(tmpParam);
}
tmpParam = (ElementParameter) tmpNode.getElementParameter("ADVANCED_COND");
if (tmpParam != null) {
tmpParam.setElement(this);
tmpParam.setCategory(EComponentCategory.BREAKPOINT);
tmpParam.setNumRow(17);
tmpParam.setDefaultValue(tmpParam.getValue());
addElementParameter(tmpParam);
}
}
}
}
use of org.talend.core.model.process.IElementParameter in project tdi-studio-se by Talend.
the class PropertyChangeCommand method execute.
@Override
public void execute() {
IElementParameter currentParam = elem.getElementParameter(propName);
changeMetadataCommands.clear();
oldElementValues.clear();
if (currentParam == null) {
return;
}
if (currentParam instanceof ElementParameter) {
((ElementParameter) currentParam).setTaggedValue(UpdatesConstants.CHANGED_BY_USER, true);
}
if (currentParam.isRepositoryValueUsed()) {
if (currentParam.getFieldType() == EParameterFieldType.MEMO_SQL) {
Object queryStoreValue = elem.getPropertyValue(EParameterName.QUERYSTORE_TYPE.getName());
if (!EmfComponent.BUILTIN.equals(queryStoreValue) || !EmfComponent.TNS_FILE.equals(queryStoreValue)) {
elem.setPropertyValue(EParameterName.QUERYSTORE_TYPE.getName(), EmfComponent.BUILTIN);
}
currentParam.setRepositoryValueUsed(false);
} else {
toUpdate = true;
Object value = elem.getPropertyValue(propName);
if (value == null || (!value.toString().endsWith("xsd") && !value.toString().endsWith("xsd\""))) {
elem.setPropertyValue(propertyTypeName, EmfComponent.BUILTIN);
}
for (IElementParameter param : elem.getElementParameters()) {
if (param.getRepositoryProperty() == null || param.getRepositoryProperty().equals(currentParam.getName())) {
param.setRepositoryValueUsed(false);
}
}
}
repositoryValueWasUsed = true;
} else {
repositoryValueWasUsed = false;
}
oldValue = elem.getPropertyValue(propName);
elem.setPropertyValue(propName, newValue);
if (currentParam.getFieldType().equals(EParameterFieldType.CONNECTION_LIST) && currentParam.getContext() != null && (elem instanceof Node)) {
String connParaname = currentParam.getContext() + ":" + currentParam.getName();
if (connParaname.equals(propName)) {
IConnection selectedConn = null;
for (IConnection conn : ((Node) elem).getIncomingConnections()) {
if (conn.getUniqueName().equals(newValue)) {
selectedConn = conn;
break;
}
}
if (selectedConn != null && getTakeSchema()) {
((Node) selectedConn.getSource()).takeSchemaFrom((Node) elem, currentParam.getContext());
}
}
}
if ("ELT_TABLE_NAME".equals(propName) || "ELT_SCHEMA_NAME".equals(propName)) {
//$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-1$
String oldELTValue = "";
//$NON-NLS-1$
String newELTValue = "";
String oldParamValue = TalendQuoteUtils.removeQuotes((String) oldValue);
String newParamValue = TalendQuoteUtils.removeQuotes((String) newValue);
if ("ELT_TABLE_NAME".equals(propName)) {
//$NON-NLS-1$
//$NON-NLS-1$
String schemaName = TalendQuoteUtils.removeQuotes((String) elem.getPropertyValue("ELT_SCHEMA_NAME"));
if (schemaName == null || "".equals(schemaName.trim())) {
//$NON-NLS-1$
oldELTValue = oldParamValue;
newELTValue = newParamValue;
} else {
//$NON-NLS-1$
oldELTValue = schemaName + "." + oldParamValue;
//$NON-NLS-1$
newELTValue = schemaName + "." + newParamValue;
}
} else {
//$NON-NLS-1$
String tableName = TalendQuoteUtils.removeQuotes((String) elem.getPropertyValue("ELT_TABLE_NAME"));
if (oldParamValue != null && !"".equals(oldParamValue.trim())) {
//$NON-NLS-1$
oldELTValue = oldParamValue + ".";
}
if (newParamValue != null && !"".equals(newParamValue.trim())) {
//$NON-NLS-1$
newELTValue = newParamValue + ".";
}
// $NON-NLS-1$
oldELTValue = oldELTValue + tableName;
// $NON-NLS-1$
newELTValue = newELTValue + tableName;
}
List<? extends IConnection> connections = ((Node) elem).getOutgoingConnections();
for (IConnection connection : connections) {
INode targetNode = connection.getTarget();
String componentName = targetNode.getComponent().getName();
if (componentName.matches("tELT.+Map")) {
//$NON-NLS-1$
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDbMapDesignerService.class)) {
IDbMapDesignerService service = (IDbMapDesignerService) GlobalServiceRegister.getDefault().getService(IDbMapDesignerService.class);
updateELTMapComponentCommand = service.getUpdateELTMapComponentCommand(targetNode, connection, oldELTValue, newELTValue);
updateELTMapComponentCommand.execute();
}
}
}
}
// add for bug TDI-26632 by fwang in 11 July, 2013. can't edit parameters if use repository connection.
IElementParameter propertyTypeParam = elem.getElementParameter(EParameterName.PROPERTY_TYPE.getName());
IElementParameter repositoryTypeParam = elem.getElementParameter(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
if (("USE_EXISTING_CONNECTION").equals(propName) && elem instanceof Node && propertyTypeParam != null && "REPOSITORY".equals(propertyTypeParam.getValue()) && repositoryTypeParam != null && !("").equals(repositoryTypeParam.getValue())) {
Node node = (Node) elem;
for (IElementParameter param : node.getElementParameters()) {
String repositoryValue = param.getRepositoryValue();
if ((repositoryValue != null) && (!param.getName().equals(EParameterName.PROPERTY_TYPE.getName())) && param.getFieldType() != EParameterFieldType.MEMO_SQL && !("tMDMReceive".equals(node.getComponent().getName()) && "XPATH_PREFIX".equals(//$NON-NLS-1$ //$NON-NLS-2$
param.getRepositoryValue())) && !("tSAPOutput".equals(node.getComponent().getName()) && param.getName().equals(UpdatesConstants.MAPPING)) && !("tFileInputEBCDIC".equals(node.getComponent().getName()) && "DATA_FILE".equals(repositoryValue))) {
param.setRepositoryValueUsed(true);
if (!(EParameterName.DB_VERSION.getName()).equals(param.getName())) {
param.setReadOnly(true);
}
}
}
}
// feature 19312
if (propName.contains(EParameterName.USE_DYNAMIC_JOB.getName()) && newValue.equals(false)) {
IElementParameter processParam = elem.getElementParameter(EParameterName.PROCESS.getName());
IElementParameter processTypeParameter = elem.getElementParameter(EParameterName.PROCESS_TYPE_PROCESS.getName());
//$NON-NLS-1$
final String parentName = processParam.getName() + ":";
//$NON-NLS-1$
elem.setPropertyValue(parentName + processTypeParameter.getName(), "");
//$NON-NLS-1$
elem.setPropertyValue(processParam.getName(), "");
}
if (propName.contains(EParameterName.PROCESS_TYPE_PROCESS.getName())) {
boolean isSelectUseDynamic = false;
IElementParameter useDynamicJobParameter = elem.getElementParameter(EParameterName.USE_DYNAMIC_JOB.getName());
if (useDynamicJobParameter != null && useDynamicJobParameter instanceof IElementParameter) {
Object useDynamicJobValue = useDynamicJobParameter.getValue();
if (useDynamicJobValue != null && useDynamicJobValue instanceof Boolean) {
isSelectUseDynamic = (Boolean) useDynamicJobValue;
}
}
if (isSelectUseDynamic) {
StringBuffer labels = new StringBuffer("");
if (newValue != null) {
String[] strValues = newValue.toString().split(";");
for (int i = 0; i < strValues.length; i++) {
String strValue = strValues[i];
// newValue is the id of the job
ProcessItem processItem = ItemCacheManager.getProcessItem(strValue);
if (processItem != null) {
String label = processItem.getProperty().getLabel();
if (i > 0) {
labels.append(";");
}
labels.append(label);
}
}
}
currentParam.getParentParameter().setValue(labels.toString());
} else {
// newValue is the id of the job
ProcessItem processItem = ItemCacheManager.getProcessItem((String) newValue);
if (processItem != null) {
currentParam.getParentParameter().setValue(processItem.getProperty().getLabel());
}
}
}
if (propName.contains(EParameterName.PROCESS_TYPE_VERSION.getName())) {
// newValue is the id of the job
// hywang add for feature 6549
// 1.to see current component if is a jobletComponent by "elem"
boolean isJobletComponent = false;
// Node jobletNode = null;
IJobletProviderService service = null;
if (PluginChecker.isJobLetPluginLoaded()) {
service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
}
if (elem instanceof Node) {
// jobletNode = (Node) elem;
if (service != null) {
isJobletComponent = service.isJobletComponent((Node) elem);
}
}
if (isJobletComponent) {
// 2.if it is a jobletcomponent,reload the component by the version
String id = service.getJobletComponentItem((Node) elem).getId();
String version = (String) newValue;
IComponent newComponent = service.setPropertyForJobletComponent(id, version);
reloadNode((Node) elem, newComponent);
} else {
IElementParameter processIdParam = currentParam.getParentParameter().getChildParameters().get(EParameterName.PROCESS_TYPE_PROCESS.getName());
ProcessItem processItem = ItemCacheManager.getProcessItem((String) processIdParam.getValue(), (String) newValue);
if (processItem != null) {
currentParam.getParentParameter().setValue(processItem.getProperty().getLabel());
}
}
}
if (propName.contains(EParameterName.PROCESS_TYPE_CONTEXT.getName())) {
if (elem instanceof Node) {
Node node = (Node) elem;
List<IContext> listContext = node.getProcess().getContextManager().getListContext();
List<String> values = new ArrayList<String>();
for (IContext context : listContext) {
values.add(context.getName());
}
currentParam.setListItemsDisplayName(values.toArray(new String[0]));
currentParam.setListItemsValue(values.toArray(new String[0]));
currentParam.setValue(newValue);
}
}
if (propName.equals(EParameterName.VALIDATION_RULES.getName())) {
if (elem instanceof INode) {
ValidationRulesUtil.createRejectConnector((INode) elem);
ValidationRulesUtil.updateRejectMetatable((INode) elem, null);
if (newValue != null && (!(Boolean) newValue)) {
ValidationRulesUtil.removeRejectConnector((INode) elem);
ValidationRulesUtil.removeRejectConnection((INode) elem);
}
}
}
String dbType = "";
if (newValue instanceof String) {
dbType = (String) newValue;
}
IElementParameter schemaParameter = null;
if (propName.equals(EParameterName.DB_TYPE.getName())) {
IElementParameter elementParameter = elem.getElementParameter(EParameterName.DB_VERSION.getName());
schemaParameter = elem.getElementParameter(EParameterName.SCHEMA_DB.getName());
JobSettingVersionUtil.setDbVersion(elementParameter, dbType, true);
DesignerUtilities.setSchemaDB(schemaParameter, newValue);
} else if (propName.equals(JobSettingsConstants.getExtraParameterName(EParameterName.DB_TYPE.getName()))) {
IElementParameter elementParameter = elem.getElementParameter(JobSettingsConstants.getExtraParameterName(EParameterName.DB_VERSION.getName()));
schemaParameter = elem.getElementParameter(JobSettingsConstants.getExtraParameterName(EParameterName.SCHEMA_DB.getName()));
JobSettingVersionUtil.setDbVersion(elementParameter, dbType, true);
DesignerUtilities.setSchemaDB(schemaParameter, newValue);
}
// Some DB not need fill the schema parameter for the JobSetting View "Extra" ,"Stats&Logs"
if (schemaParameter != null && !schemaParameter.isShow(elem.getElementParameters()) && !schemaParameter.getValue().equals("")) {
schemaParameter.setValue("");
}
if (!toUpdate && (currentParam.getFieldType().equals(EParameterFieldType.RADIO) || currentParam.getFieldType().equals(EParameterFieldType.CLOSED_LIST) || currentParam.getFieldType().equals(EParameterFieldType.OPENED_LIST) || currentParam.getFieldType().equals(EParameterFieldType.CHECK) || currentParam.getFieldType().equals(EParameterFieldType.AS400_CHECK) || currentParam.getFieldType().equals(EParameterFieldType.COMPONENT_LIST))) {
toUpdate = false;
setDefaultValues(currentParam, elem);
}
if (currentParam.getName().equals(EParameterName.PROCESS_TYPE_PROCESS.getName())) {
toUpdate = true;
}
if (toUpdate) {
elem.setPropertyValue(updataComponentParamName, Boolean.TRUE);
}
// see bug 9151:100% CPU when typing text.
if (getNewValue() instanceof String && elem instanceof INode) {
INode curNode = (INode) elem;
String uniqueName = curNode.getUniqueName();
IProcess process = curNode.getProcess();
if (process != null && process instanceof IProcess2) {
IProcess2 process2 = (IProcess2) process;
List<? extends INode> generatingNodes = null;
if (process2.isProcessModified()) {
process2.setProcessModified(false);
generatingNodes = process2.getGeneratingNodes();
if (generatingNodes != null) {
for (INode genNode : new ArrayList<INode>(generatingNodes)) {
if (genNode.getUniqueName().equals(uniqueName)) {
IElementParameter genParam = genNode.getElementParameter(propName);
if (genParam != null) {
genParam.setValue(newValue);
break;
}
}
}
}
process2.setProcessModified(true);
codeViewUpdater.startIfExecutable(elem);
}
}
}
updateRelativeNodesIfNeeded(currentParam);
checkProcess.startIfExecutable(elem);
// See feature 3902
if (needUpdateMonitorConnection()) {
((Connection) elem).setMonitorConnection((Boolean) currentParam.getValue());
}
refreshMR(propName);
}
Aggregations