Search in sources :

Example 1 with AddPropertyCSVOptionConversion

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

the class RenametFileInputCSVMigrationTask method execute.

public ExecutionResult execute(Item item) {
    ProcessType processType = getProcessType(item);
    if (processType == null) {
        return ExecutionResult.NOTHING_TO_DO;
    }
    try {
        //$NON-NLS-1$
        IComponentFilter filter1 = new NameComponentFilter("tFileInputCSV");
        IComponentConversion addProperty = new AddPropertyCSVOptionConversion();
        //$NON-NLS-1$
        IComponentConversion renameComponent = new RenameComponentConversion("tFileInputDelimited");
        ModifyComponentsAction.searchAndModify(item, processType, filter1, Arrays.<IComponentConversion>asList(addProperty, renameComponent));
        return ExecutionResult.SUCCESS_WITH_ALERT;
    } catch (Exception e) {
        ExceptionHandler.process(e);
        return ExecutionResult.FAILURE;
    }
}
Also used : ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) IComponentFilter(org.talend.core.model.components.filters.IComponentFilter) NameComponentFilter(org.talend.core.model.components.filters.NameComponentFilter) AddPropertyCSVOptionConversion(org.talend.core.model.components.conversions.AddPropertyCSVOptionConversion) RenameComponentConversion(org.talend.core.model.components.conversions.RenameComponentConversion) IComponentConversion(org.talend.core.model.components.conversions.IComponentConversion)

Example 2 with AddPropertyCSVOptionConversion

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

the class RenametFileOutputCSVMigrationTask method execute.

public ExecutionResult execute(Item item) {
    ProcessType processType = getProcessType(item);
    if (processType == null) {
        return ExecutionResult.NOTHING_TO_DO;
    }
    try {
        //$NON-NLS-1$
        IComponentFilter filter1 = new NameComponentFilter("tFileOutputCSV");
        IComponentConversion addProperty = new AddPropertyCSVOptionConversion();
        //$NON-NLS-1$
        IComponentConversion renameComponent = new RenameComponentConversion("tFileOutputDelimited");
        ModifyComponentsAction.searchAndModify(item, processType, filter1, Arrays.<IComponentConversion>asList(addProperty, renameComponent));
        return ExecutionResult.SUCCESS_WITH_ALERT;
    } catch (Exception e) {
        ExceptionHandler.process(e);
        return ExecutionResult.FAILURE;
    }
}
Also used : ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) IComponentFilter(org.talend.core.model.components.filters.IComponentFilter) NameComponentFilter(org.talend.core.model.components.filters.NameComponentFilter) AddPropertyCSVOptionConversion(org.talend.core.model.components.conversions.AddPropertyCSVOptionConversion) RenameComponentConversion(org.talend.core.model.components.conversions.RenameComponentConversion) IComponentConversion(org.talend.core.model.components.conversions.IComponentConversion)

Aggregations

AddPropertyCSVOptionConversion (org.talend.core.model.components.conversions.AddPropertyCSVOptionConversion)2 IComponentConversion (org.talend.core.model.components.conversions.IComponentConversion)2 RenameComponentConversion (org.talend.core.model.components.conversions.RenameComponentConversion)2 IComponentFilter (org.talend.core.model.components.filters.IComponentFilter)2 NameComponentFilter (org.talend.core.model.components.filters.NameComponentFilter)2 ProcessType (org.talend.designer.core.model.utils.emf.talendfile.ProcessType)2