Search in sources :

Example 6 with ColumnType

use of org.talend.designer.core.model.utils.emf.talendfile.ColumnType in project tdi-studio-se by Talend.

the class AddDdColumnMigrationTask method removeDbColumn.

private void removeDbColumn(Item item) throws PersistenceException {
    ProcessType processType = getProcessType(item);
    if (processType == null) {
        return;
    }
    ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
    boolean modified = false;
    for (Object o : processType.getNode()) {
        NodeType node = (NodeType) o;
        for (Object o2 : node.getMetadata()) {
            MetadataType metadata = (MetadataType) o2;
            for (Object o3 : metadata.getColumn()) {
                ColumnType column = (ColumnType) o3;
                if (column.getOriginalDbColumnName() != null) {
                    column.setOriginalDbColumnName(null);
                    modified = true;
                }
            }
        }
    }
    if (modified) {
        factory.save(item, true);
    }
}
Also used : ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) ProxyRepositoryFactory(org.talend.core.repository.model.ProxyRepositoryFactory) ColumnType(org.talend.designer.core.model.utils.emf.talendfile.ColumnType) NodeType(org.talend.designer.core.model.utils.emf.talendfile.NodeType) MetadataType(org.talend.designer.core.model.utils.emf.talendfile.MetadataType)

Example 7 with ColumnType

use of org.talend.designer.core.model.utils.emf.talendfile.ColumnType in project tdi-studio-se by Talend.

the class RenameCustomerColumnOftGenKey method changeCustomerColumn.

private void changeCustomerColumn(Item item) throws PersistenceException {
    ProcessType processType = getProcessType(item);
    if (processType == null) {
        return;
    }
    ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
    boolean modified = false;
    for (Object o : processType.getNode()) {
        NodeType node = (NodeType) o;
        for (Object o2 : node.getMetadata()) {
            MetadataType metadata = (MetadataType) o2;
            for (Object o3 : metadata.getColumn()) {
                ColumnType column = (ColumnType) o3;
                if ("T_WINDOW_KEY".equals(column.getName())) {
                    column.setName("T_GEN_KEY");
                    modified = true;
                }
            }
        }
    }
    if (modified) {
        factory.save(item, true);
    }
}
Also used : ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) ProxyRepositoryFactory(org.talend.core.repository.model.ProxyRepositoryFactory) ColumnType(org.talend.designer.core.model.utils.emf.talendfile.ColumnType) NodeType(org.talend.designer.core.model.utils.emf.talendfile.NodeType) MetadataType(org.talend.designer.core.model.utils.emf.talendfile.MetadataType)

Example 8 with ColumnType

use of org.talend.designer.core.model.utils.emf.talendfile.ColumnType in project tesb-studio-se by Talend.

the class RestRequestWrongCallMigrationTask method addColumn.

private void addColumn(EList columns, String name) {
    Iterator iterator = columns.iterator();
    while (iterator.hasNext()) {
        Object next = iterator.next();
        if (next instanceof ColumnType && name.equals(((ColumnType) next).getName())) {
            return;
        }
    }
    ColumnType columnType = TalendFileFactory.eINSTANCE.createColumnType();
    columnType.setKey(false);
    columnType.setName(name);
    columnType.setSourceType("");
    columnType.setType("id_String");
    columnType.setLength(255);
    columnType.setPrecision(0);
    columnType.setNullable(true);
    columns.add(columnType);
}
Also used : ColumnType(org.talend.designer.core.model.utils.emf.talendfile.ColumnType) Iterator(java.util.Iterator)

Example 9 with ColumnType

use of org.talend.designer.core.model.utils.emf.talendfile.ColumnType in project tesb-studio-se by Talend.

the class ConsumerFaultResponseMigrationTask method addColumn.

private void addColumn(EList column, String name) {
    Iterator<?> iterator = column.iterator();
    while (iterator.hasNext()) {
        Object next = iterator.next();
        if (next instanceof ColumnType) {
            ColumnType ct = (ColumnType) next;
            if (name.equals(ct.getName())) {
                return;
            }
        }
    }
    ColumnType columnType = TalendFileFactory.eINSTANCE.createColumnType();
    columnType.setDefaultValue("");
    columnType.setKey(false);
    columnType.setName(name);
    columnType.setSourceType("");
    columnType.setType("id_String");
    columnType.setLength(1024);
    columnType.setPrecision(0);
    columnType.setNullable(true);
    column.add(columnType);
}
Also used : ColumnType(org.talend.designer.core.model.utils.emf.talendfile.ColumnType)

Example 10 with ColumnType

use of org.talend.designer.core.model.utils.emf.talendfile.ColumnType in project tdi-studio-se by Talend.

the class RenametStandardizePhoneNumberColumnName method changeCustomerColumn.

private void changeCustomerColumn(Item item) throws PersistenceException {
    ProcessType processType = getProcessType(item);
    if (processType == null) {
        return;
    }
    ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
    boolean modified = false;
    for (Object o : processType.getNode()) {
        NodeType node = (NodeType) o;
        if ("tStandardizePhoneNumber".equalsIgnoreCase(node.getComponentName())) {
            for (Object o2 : node.getMetadata()) {
                MetadataType metadata = (MetadataType) o2;
                for (Object o3 : metadata.getColumn()) {
                    ColumnType column = (ColumnType) o3;
                    if ("IsPossiblePhoneNumber ".equals(column.getName())) {
                        column.setName("IsPossiblePhoneNumber");
                        modified = true;
                        break;
                    }
                }
            }
        }
    }
    if (modified) {
        factory.save(item, true);
    }
}
Also used : ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) ProxyRepositoryFactory(org.talend.core.repository.model.ProxyRepositoryFactory) ColumnType(org.talend.designer.core.model.utils.emf.talendfile.ColumnType) NodeType(org.talend.designer.core.model.utils.emf.talendfile.NodeType) MetadataType(org.talend.designer.core.model.utils.emf.talendfile.MetadataType)

Aggregations

ColumnType (org.talend.designer.core.model.utils.emf.talendfile.ColumnType)15 MetadataType (org.talend.designer.core.model.utils.emf.talendfile.MetadataType)10 NodeType (org.talend.designer.core.model.utils.emf.talendfile.NodeType)9 ProcessType (org.talend.designer.core.model.utils.emf.talendfile.ProcessType)8 EList (org.eclipse.emf.common.util.EList)4 ElementParameterType (org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType)4 PersistenceException (org.talend.commons.exception.PersistenceException)3 ProxyRepositoryFactory (org.talend.core.repository.model.ProxyRepositoryFactory)3 TalendFileFactory (org.talend.designer.core.model.utils.emf.talendfile.TalendFileFactory)3 ArrayList (java.util.ArrayList)2 Iterator (java.util.Iterator)2 IComponentConversion (org.talend.core.model.components.conversions.IComponentConversion)2 IComponentFilter (org.talend.core.model.components.filters.IComponentFilter)2 NameComponentFilter (org.talend.core.model.components.filters.NameComponentFilter)2 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)2 ConnectionType (org.talend.designer.core.model.utils.emf.talendfile.ConnectionType)2 Map (java.util.Map)1 EMap (org.eclipse.emf.common.util.EMap)1 EObject (org.eclipse.emf.ecore.EObject)1 Test (org.junit.Test)1