Search in sources :

Example 6 with RemovePropertyComponentConversion

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

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

the class RenametDBInputToMySQLMigrationTask 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("tMysqlInput");
        //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        IComponentFilter filter1 = new PropertyComponentFilter("tDBInput", "TYPE", "mysql");
        ModifyComponentsAction.searchAndModify(item, processType, filter1, Arrays.<IComponentConversion>asList(renameComponentConversion, removePropertyComponentConversion));
        //$NON-NLS-1$
        renameComponentConversion.setNewName("tMysqlOutput");
        //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        IComponentFilter filter2 = new PropertyComponentFilter("tDBOutput", "TYPE", "mysql");
        ModifyComponentsAction.searchAndModify(item, processType, filter2, Arrays.<IComponentConversion>asList(renameComponentConversion, removePropertyComponentConversion));
        //$NON-NLS-1$
        renameComponentConversion.setNewName("tMysqlRow");
        //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        IComponentFilter filter3 = new PropertyComponentFilter("tDBSQLRow", "TYPE", "mysql");
        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 8 with RemovePropertyComponentConversion

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

Example 9 with RemovePropertyComponentConversion

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

the class RenametFTPToFTPGetMigrationTaskForPerl method execute.

public ExecutionResult execute(Item item) {
    ProcessType processType = getProcessType(item);
    if (processType == null) {
        return ExecutionResult.NOTHING_TO_DO;
    }
    try {
        ECodeLanguage projectLanguage = getProject().getLanguage();
        if (projectLanguage.equals(ECodeLanguage.PERL)) {
            //$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) ECodeLanguage(org.talend.core.language.ECodeLanguage) IComponentConversion(org.talend.core.model.components.conversions.IComponentConversion)

Aggregations

IComponentConversion (org.talend.core.model.components.conversions.IComponentConversion)9 RemovePropertyComponentConversion (org.talend.core.model.components.conversions.RemovePropertyComponentConversion)9 IComponentFilter (org.talend.core.model.components.filters.IComponentFilter)9 ProcessType (org.talend.designer.core.model.utils.emf.talendfile.ProcessType)9 RenameComponentConversion (org.talend.core.model.components.conversions.RenameComponentConversion)6 PropertyComponentFilter (org.talend.core.model.components.filters.PropertyComponentFilter)6 NameComponentFilter (org.talend.core.model.components.filters.NameComponentFilter)3 ArrayList (java.util.ArrayList)2 ElementValueType (org.talend.designer.core.model.utils.emf.talendfile.ElementValueType)2 NodeType (org.talend.designer.core.model.utils.emf.talendfile.NodeType)2 ECodeLanguage (org.talend.core.language.ECodeLanguage)1 AddPropertyUniqueKeyFortUniqRowConversion (org.talend.core.model.components.conversions.AddPropertyUniqueKeyFortUniqRowConversion)1