Search in sources :

Example 76 with IComponentConversion

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

the class RenametDBInputToMssqlMigrationTask 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("tMSSqlInput");
        //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        IComponentFilter filter1 = new PropertyComponentFilter("tDBInput", "TYPE", "mssql");
        ModifyComponentsAction.searchAndModify(item, processType, filter1, Arrays.<IComponentConversion>asList(renameComponentConversion, removePropertyComponentConversion));
        //$NON-NLS-1$
        renameComponentConversion.setNewName("tMSSqlOutput");
        //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        IComponentFilter filter2 = new PropertyComponentFilter("tDBOutput", "TYPE", "mssql");
        ModifyComponentsAction.searchAndModify(item, processType, filter2, Arrays.<IComponentConversion>asList(renameComponentConversion, removePropertyComponentConversion));
        //$NON-NLS-1$
        renameComponentConversion.setNewName("tMSSqlRow");
        //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        IComponentFilter filter3 = new PropertyComponentFilter("tDBSQLRow", "TYPE", "mssql");
        ModifyComponentsAction.searchAndModify(item, processType, filter3, Arrays.<IComponentConversion>asList(renameComponentConversion, removePropertyComponentConversion));
        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) RemovePropertyComponentConversion(org.talend.core.model.components.conversions.RemovePropertyComponentConversion) PropertyComponentFilter(org.talend.core.model.components.filters.PropertyComponentFilter) RenameComponentConversion(org.talend.core.model.components.conversions.RenameComponentConversion) IComponentConversion(org.talend.core.model.components.conversions.IComponentConversion)

Example 77 with IComponentConversion

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

the class RenametDBInputToOracleMigrationTask 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("tOracleInput");
        //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        IComponentFilter filter1 = new PropertyComponentFilter("tDBInput", "TYPE", "oracle");
        ModifyComponentsAction.searchAndModify(item, processType, filter1, Arrays.<IComponentConversion>asList(renameComponentConversion, removePropertyComponentConversion));
        //$NON-NLS-1$
        renameComponentConversion.setNewName("tOracleOutput");
        //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        IComponentFilter filter2 = new PropertyComponentFilter("tDBOutput", "TYPE", "oracle");
        ModifyComponentsAction.searchAndModify(item, processType, filter2, Arrays.<IComponentConversion>asList(renameComponentConversion, removePropertyComponentConversion));
        //$NON-NLS-1$
        renameComponentConversion.setNewName("tOracleRow");
        //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        IComponentFilter filter3 = new PropertyComponentFilter("tDBSQLRow", "TYPE", "oracle");
        ModifyComponentsAction.searchAndModify(item, processType, filter3, Arrays.<IComponentConversion>asList(renameComponentConversion, removePropertyComponentConversion));
        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) RemovePropertyComponentConversion(org.talend.core.model.components.conversions.RemovePropertyComponentConversion) PropertyComponentFilter(org.talend.core.model.components.filters.PropertyComponentFilter) RenameComponentConversion(org.talend.core.model.components.conversions.RenameComponentConversion) IComponentConversion(org.talend.core.model.components.conversions.IComponentConversion)

Example 78 with IComponentConversion

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

the class RenametDBInputToPostgresqlMigrationTask 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("tPostgresqlInput");
        //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        IComponentFilter filter1 = new PropertyComponentFilter("tDBInput", "TYPE", "postgresql");
        ModifyComponentsAction.searchAndModify(item, processType, filter1, Arrays.<IComponentConversion>asList(renameComponentConversion, removePropertyComponentConversion));
        //$NON-NLS-1$
        renameComponentConversion.setNewName("tPostgresqlOutput");
        //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        IComponentFilter filter2 = new PropertyComponentFilter("tDBOutput", "TYPE", "postgresql");
        ModifyComponentsAction.searchAndModify(item, processType, filter2, Arrays.<IComponentConversion>asList(renameComponentConversion, removePropertyComponentConversion));
        //$NON-NLS-1$
        renameComponentConversion.setNewName("tPostgresqlRow");
        //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        IComponentFilter filter3 = new PropertyComponentFilter("tDBSQLRow", "TYPE", "postgresql");
        ModifyComponentsAction.searchAndModify(item, processType, filter3, Arrays.<IComponentConversion>asList(renameComponentConversion, removePropertyComponentConversion));
        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) RemovePropertyComponentConversion(org.talend.core.model.components.conversions.RemovePropertyComponentConversion) PropertyComponentFilter(org.talend.core.model.components.filters.PropertyComponentFilter) RenameComponentConversion(org.talend.core.model.components.conversions.RenameComponentConversion) IComponentConversion(org.talend.core.model.components.conversions.IComponentConversion)

Example 79 with IComponentConversion

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

the class RenametFTPToFTPGetMigrationTask method execute.

public ExecutionResult execute(Item item) {
    ProcessType processType = getProcessType(item);
    try {
        if (getProject().getLanguage().equals(ECodeLanguage.JAVA) && processType != null) {
            //$NON-NLS-1$
            IComponentConversion removePropertyComponentConversion = new RemovePropertyComponentConversion("TYPE");
            //$NON-NLS-1$
            RenameComponentConversion renameComponentConversion = new RenameComponentConversion("tFTPGet");
            //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            IComponentFilter filter1 = new PropertyComponentFilter("tFTP", "ACTION", "get");
            ModifyComponentsAction.searchAndModify(item, processType, filter1, Arrays.<IComponentConversion>asList(renameComponentConversion, removePropertyComponentConversion));
            //$NON-NLS-1$
            renameComponentConversion.setNewName("tFTPPut");
            //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            IComponentFilter filter2 = new PropertyComponentFilter("tFTP", "ACTION", "put");
            ModifyComponentsAction.searchAndModify(item, processType, filter2, Arrays.<IComponentConversion>asList(renameComponentConversion, removePropertyComponentConversion));
            //$NON-NLS-1$
            renameComponentConversion.setNewName("tFTPDelete");
            //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            IComponentFilter filter3 = new PropertyComponentFilter("tFTP", "ACTION", "delete");
            ModifyComponentsAction.searchAndModify(item, processType, filter3, Arrays.<IComponentConversion>asList(renameComponentConversion, removePropertyComponentConversion));
            //$NON-NLS-1$
            renameComponentConversion.setNewName("tFTPRename");
            //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            IComponentFilter filter4 = new PropertyComponentFilter("tFTP", "ACTION", "rename");
            ModifyComponentsAction.searchAndModify(item, processType, filter4, Arrays.<IComponentConversion>asList(renameComponentConversion, removePropertyComponentConversion));
            return ExecutionResult.SUCCESS_WITH_ALERT;
        } else {
            // do nothing
            return ExecutionResult.NOTHING_TO_DO;
        }
    } 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) RemovePropertyComponentConversion(org.talend.core.model.components.conversions.RemovePropertyComponentConversion) PropertyComponentFilter(org.talend.core.model.components.filters.PropertyComponentFilter) RenameComponentConversion(org.talend.core.model.components.conversions.RenameComponentConversion) IComponentConversion(org.talend.core.model.components.conversions.IComponentConversion)

Example 80 with IComponentConversion

use of org.talend.core.model.components.conversions.IComponentConversion 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)

Aggregations

IComponentConversion (org.talend.core.model.components.conversions.IComponentConversion)154 ProcessType (org.talend.designer.core.model.utils.emf.talendfile.ProcessType)154 IComponentFilter (org.talend.core.model.components.filters.IComponentFilter)150 NameComponentFilter (org.talend.core.model.components.filters.NameComponentFilter)142 NodeType (org.talend.designer.core.model.utils.emf.talendfile.NodeType)111 ElementParameterType (org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType)85 PersistenceException (org.talend.commons.exception.PersistenceException)77 ElementValueType (org.talend.designer.core.model.utils.emf.talendfile.ElementValueType)15 RenameComponentConversion (org.talend.core.model.components.conversions.RenameComponentConversion)12 ArrayList (java.util.ArrayList)11 RemovePropertyComponentConversion (org.talend.core.model.components.conversions.RemovePropertyComponentConversion)9 List (java.util.List)7 PropertyComponentFilter (org.talend.core.model.components.filters.PropertyComponentFilter)6 ConnectionType (org.talend.designer.core.model.utils.emf.talendfile.ConnectionType)5 HashMap (java.util.HashMap)3 EConnectionType (org.talend.core.model.process.EConnectionType)3 MetadataType (org.talend.designer.core.model.utils.emf.talendfile.MetadataType)3 ComponentProperties (org.talend.components.api.properties.ComponentProperties)2 AddPropertyCSVOptionConversion (org.talend.core.model.components.conversions.AddPropertyCSVOptionConversion)2 AddPropertyLoopTypeConversion (org.talend.core.model.components.conversions.AddPropertyLoopTypeConversion)2