use of org.talend.core.model.components.conversions.RenameComponentConversion in project tdi-studio-se by Talend.
the class RenametForForPerl method execute.
public ExecutionResult execute(Item item) {
ProcessType processType = getProcessType(item);
if (processType == null) {
return ExecutionResult.NOTHING_TO_DO;
}
try {
if (getProject().getLanguage().equals(ECodeLanguage.PERL)) {
//$NON-NLS-1$
IComponentFilter filter1 = new NameComponentFilter("tFor");
IComponentConversion addProperty = new AddPropertyLoopTypeConversion();
//$NON-NLS-1$
IComponentConversion renameComponent = new RenameComponentConversion("tLoop");
ModifyComponentsAction.searchAndModify(item, processType, filter1, Arrays.<IComponentConversion>asList(addProperty, renameComponent));
return ExecutionResult.SUCCESS_WITH_ALERT;
} else {
// do nothing
return ExecutionResult.NOTHING_TO_DO;
}
} catch (Exception e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
}
use of org.talend.core.model.components.conversions.RenameComponentConversion in project tdi-studio-se by Talend.
the class RenametDBInputToMySQLMigrationTask method execute.
public ExecutionResult execute(Item item) {
ProcessType processType = getProcessType(item);
if (processType == null) {
return ExecutionResult.NOTHING_TO_DO;
}
try {
//$NON-NLS-1$
IComponentConversion removePropertyComponentConversion = new RemovePropertyComponentConversion("TYPE");
//$NON-NLS-1$
RenameComponentConversion renameComponentConversion = new RenameComponentConversion("tMysqlInput");
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
IComponentFilter filter1 = new PropertyComponentFilter("tDBInput", "TYPE", "mysql");
ModifyComponentsAction.searchAndModify(item, processType, filter1, Arrays.<IComponentConversion>asList(renameComponentConversion, removePropertyComponentConversion));
//$NON-NLS-1$
renameComponentConversion.setNewName("tMysqlOutput");
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
IComponentFilter filter2 = new PropertyComponentFilter("tDBOutput", "TYPE", "mysql");
ModifyComponentsAction.searchAndModify(item, processType, filter2, Arrays.<IComponentConversion>asList(renameComponentConversion, removePropertyComponentConversion));
//$NON-NLS-1$
renameComponentConversion.setNewName("tMysqlRow");
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
IComponentFilter filter3 = new PropertyComponentFilter("tDBSQLRow", "TYPE", "mysql");
ModifyComponentsAction.searchAndModify(item, processType, filter3, Arrays.<IComponentConversion>asList(renameComponentConversion, removePropertyComponentConversion));
return ExecutionResult.SUCCESS_WITH_ALERT;
} catch (Exception e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
}
Aggregations