Search in sources :

Example 1 with UpdatePropertyTruncateOptionConversion

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

the class MigrationTaskForIssue4449 method execute.

@Override
public ExecutionResult execute(Item item) {
    ProcessType processType = getProcessType(item);
    if (getProject().getLanguage() != ECodeLanguage.JAVA || processType == null) {
        return ExecutionResult.NOTHING_TO_DO;
    }
    String[] componentsName = new String[] { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    "tMSSqlOutput", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    "tMaxDBOutput", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    "tMysqlOutput", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    "tInformixOutput", "tOracleOutput", "tPostgresqlOutput", "tPostgresPlusOutput", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    "tSybaseOutput" };
    IComponentConversion updateTableActionOption = new UpdatePropertyTruncateOptionConversion();
    for (String name : componentsName) {
        //$NON-NLS-1$
        IComponentFilter filter = new NameComponentFilter(name);
        try {
            ModifyComponentsAction.searchAndModify(item, processType, filter, Arrays.<IComponentConversion>asList(updateTableActionOption));
        } catch (PersistenceException e) {
            // TODO Auto-generated catch block
            ExceptionHandler.process(e);
            return ExecutionResult.FAILURE;
        }
    }
    return ExecutionResult.SUCCESS_WITH_ALERT;
}
Also used : ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) UpdatePropertyTruncateOptionConversion(org.talend.core.model.components.conversions.UpdatePropertyTruncateOptionConversion) IComponentFilter(org.talend.core.model.components.filters.IComponentFilter) PersistenceException(org.talend.commons.exception.PersistenceException) NameComponentFilter(org.talend.core.model.components.filters.NameComponentFilter) IComponentConversion(org.talend.core.model.components.conversions.IComponentConversion)

Aggregations

PersistenceException (org.talend.commons.exception.PersistenceException)1 IComponentConversion (org.talend.core.model.components.conversions.IComponentConversion)1 UpdatePropertyTruncateOptionConversion (org.talend.core.model.components.conversions.UpdatePropertyTruncateOptionConversion)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