Search in sources :

Example 1 with AddPropertyUniqueKeyFortUniqRowConversion

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

the class UpgradetUniqRowMigrationTask method execute.

public ExecutionResult execute(Item item) {
    ProcessType processType = getProcessType(item);
    if (getProject().getLanguage() != ECodeLanguage.PERL || processType == null) {
        return ExecutionResult.NOTHING_TO_DO;
    }
    try {
        //$NON-NLS-1$
        IComponentFilter filter1 = new NameComponentFilter("tUniqRow");
        //$NON-NLS-1$
        IComponentConversion removeProperty = new RemovePropertyComponentConversion("CASE_SENSITIVE");
        //$NON-NLS-1$ //$NON-NLS-2$
        IComponentConversion addProperty = new AddPropertyUniqueKeyFortUniqRowConversion("UNIQUE_KEY", "TABLE");
        ModifyComponentsAction.searchAndModify(item, processType, filter1, Arrays.<IComponentConversion>asList(removeProperty, addProperty));
        return ExecutionResult.SUCCESS_NO_ALERT;
    } catch (Exception e) {
        ExceptionHandler.process(e);
        return ExecutionResult.FAILURE;
    }
}
Also used : ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) AddPropertyUniqueKeyFortUniqRowConversion(org.talend.core.model.components.conversions.AddPropertyUniqueKeyFortUniqRowConversion) IComponentFilter(org.talend.core.model.components.filters.IComponentFilter) RemovePropertyComponentConversion(org.talend.core.model.components.conversions.RemovePropertyComponentConversion) NameComponentFilter(org.talend.core.model.components.filters.NameComponentFilter) IComponentConversion(org.talend.core.model.components.conversions.IComponentConversion)

Aggregations

AddPropertyUniqueKeyFortUniqRowConversion (org.talend.core.model.components.conversions.AddPropertyUniqueKeyFortUniqRowConversion)1 IComponentConversion (org.talend.core.model.components.conversions.IComponentConversion)1 RemovePropertyComponentConversion (org.talend.core.model.components.conversions.RemovePropertyComponentConversion)1 IComponentFilter (org.talend.core.model.components.filters.IComponentFilter)1 NameComponentFilter (org.talend.core.model.components.filters.NameComponentFilter)1 ProcessType (org.talend.designer.core.model.utils.emf.talendfile.ProcessType)1