Search in sources :

Example 1 with AddPropertyLoopTypeConversion

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

the class RenametFor method execute.

public ExecutionResult execute(Item item) {
    ProcessType processType = getProcessType(item);
    try {
        if (getProject().getLanguage().equals(ECodeLanguage.JAVA) && processType != null) {
            //$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;
    }
}
Also used : AddPropertyLoopTypeConversion(org.talend.core.model.components.conversions.AddPropertyLoopTypeConversion) 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) RenameComponentConversion(org.talend.core.model.components.conversions.RenameComponentConversion) IComponentConversion(org.talend.core.model.components.conversions.IComponentConversion)

Example 2 with AddPropertyLoopTypeConversion

use of org.talend.core.model.components.conversions.AddPropertyLoopTypeConversion 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;
    }
}
Also used : AddPropertyLoopTypeConversion(org.talend.core.model.components.conversions.AddPropertyLoopTypeConversion) 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) RenameComponentConversion(org.talend.core.model.components.conversions.RenameComponentConversion) IComponentConversion(org.talend.core.model.components.conversions.IComponentConversion)

Aggregations

AddPropertyLoopTypeConversion (org.talend.core.model.components.conversions.AddPropertyLoopTypeConversion)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