Search in sources :

Example 1 with MapperTableEntry

use of org.talend.designer.mapper.model.emf.mapper.MapperTableEntry in project tdi-studio-se by Talend.

the class MapperComponent method getExternalEntities.

private List<ExternalMapperTableEntry> getExternalEntities(List<MapperTableEntry> pEntities) {
    List<ExternalMapperTableEntry> entityList = new ArrayList<ExternalMapperTableEntry>();
    if (pEntities != null && !pEntities.isEmpty()) {
        for (MapperTableEntry pEntity : pEntities) {
            ExternalMapperTableEntry externalEntity = new ExternalMapperTableEntry();
            externalEntity.setExpression(pEntity.getExpression());
            externalEntity.setName(pEntity.getName());
            externalEntity.setNullable(pEntity.isNullable());
            externalEntity.setType(pEntity.getType());
            externalEntity.setOperator(pEntity.getOperator());
            entityList.add(externalEntity);
        }
        return entityList;
    } else {
        // fix for tuj tMap_01_basics_04 , need to return null if no entity
        return null;
    }
}
Also used : ExternalMapperTableEntry(org.talend.designer.mapper.external.data.ExternalMapperTableEntry) MapperTableEntry(org.talend.designer.mapper.model.emf.mapper.MapperTableEntry) ExternalMapperTableEntry(org.talend.designer.mapper.external.data.ExternalMapperTableEntry) ArrayList(java.util.ArrayList)

Example 2 with MapperTableEntry

use of org.talend.designer.mapper.model.emf.mapper.MapperTableEntry in project tdi-studio-se by Talend.

the class MapperHelper method getPersistentTableEntitys.

private static List<MapperTableEntry> getPersistentTableEntitys(List<ExternalMapperTableEntry> entities) {
    List<MapperTableEntry> persistentEntities = new ArrayList<MapperTableEntry>();
    for (ExternalMapperTableEntry entity : entities) {
        final MapperTableEntry emfMapperTableEntry = MapperFactory.eINSTANCE.createMapperTableEntry();
        emfMapperTableEntry.setExpression(entity.getExpression());
        emfMapperTableEntry.setName(entity.getName());
        emfMapperTableEntry.setNullable(entity.isNullable());
        emfMapperTableEntry.setType(entity.getType());
        emfMapperTableEntry.setOperator(entity.getOperator());
        persistentEntities.add(emfMapperTableEntry);
    }
    return persistentEntities;
}
Also used : ExternalMapperTableEntry(org.talend.designer.mapper.external.data.ExternalMapperTableEntry) MapperTableEntry(org.talend.designer.mapper.model.emf.mapper.MapperTableEntry) ExternalMapperTableEntry(org.talend.designer.mapper.external.data.ExternalMapperTableEntry) ArrayList(java.util.ArrayList)

Example 3 with MapperTableEntry

use of org.talend.designer.mapper.model.emf.mapper.MapperTableEntry in project tdi-studio-se by Talend.

the class MapperDataImplTest method test5.

private void test5() {
    MapperDataImpl mapData1 = new MapperDataImpl();
    MapperDataImpl mapData2 = new MapperDataImpl();
    assertTrue(mapData1.equals(mapData2));
    final VarTable persistentVarTable = MapperFactory.eINSTANCE.createVarTable();
    persistentVarTable.setMinimized(false);
    persistentVarTable.setName("name1");
    persistentVarTable.setSizeState(SizeState.INTERMEDIATE);
    final MapperTableEntry emfMapperTableEntry = MapperFactory.eINSTANCE.createMapperTableEntry();
    emfMapperTableEntry.setExpression("expression1");
    emfMapperTableEntry.setName("ss");
    emfMapperTableEntry.setNullable(true);
    emfMapperTableEntry.setType("dd");
    emfMapperTableEntry.setOperator("oo");
    persistentVarTable.getMapperTableEntries().add(emfMapperTableEntry);
    mapData1.getVarTables().add(persistentVarTable);
    final VarTable persistentVarTable2 = MapperFactory.eINSTANCE.createVarTable();
    persistentVarTable2.setMinimized(false);
    persistentVarTable2.setName("name1");
    persistentVarTable2.setSizeState(SizeState.INTERMEDIATE);
    final MapperTableEntry emfMapperTableEntry2 = MapperFactory.eINSTANCE.createMapperTableEntry();
    emfMapperTableEntry2.setExpression("expression1");
    emfMapperTableEntry2.setName("ss");
    emfMapperTableEntry2.setNullable(true);
    emfMapperTableEntry2.setType("dd");
    emfMapperTableEntry2.setOperator("oo");
    persistentVarTable2.getMapperTableEntries().add(emfMapperTableEntry2);
    mapData2.getVarTables().add(persistentVarTable2);
    assertTrue(mapData1.equals(mapData2));
}
Also used : VarTable(org.talend.designer.mapper.model.emf.mapper.VarTable) MapperTableEntry(org.talend.designer.mapper.model.emf.mapper.MapperTableEntry)

Example 4 with MapperTableEntry

use of org.talend.designer.mapper.model.emf.mapper.MapperTableEntry in project tdi-studio-se by Talend.

the class DesignerMapperService method createAutoMappedNode.

public void createAutoMappedNode(INode node, IConnection inputConnection, IConnection outputConnection) {
    MapperData data = (MapperData) node.getExternalNode().getExternalEmfData();
    data.setUiProperties(MapperFactory.eINSTANCE.createUiProperties());
    data.getUiProperties().setShellMaximized(true);
    data.getInputTables().clear();
    InputTable inputTable = MapperFactory.eINSTANCE.createInputTable();
    data.getInputTables().add(inputTable);
    inputTable.setName(inputConnection.getName());
    for (IMetadataColumn column : inputConnection.getMetadataTable().getListColumns()) {
        MapperTableEntry tableEntry = MapperFactory.eINSTANCE.createMapperTableEntry();
        tableEntry.setName(column.getLabel());
        tableEntry.setType(column.getTalendType());
        tableEntry.setNullable(column.isNullable());
        inputTable.getMapperTableEntries().add(tableEntry);
    }
    data.getOutputTables().clear();
    OutputTable outputTable = MapperFactory.eINSTANCE.createOutputTable();
    data.getOutputTables().add(outputTable);
    outputTable.setName(outputConnection.getName());
    for (IMetadataColumn column : outputConnection.getMetadataTable().getListColumns()) {
        MapperTableEntry tableEntry = MapperFactory.eINSTANCE.createMapperTableEntry();
        tableEntry.setName(column.getLabel());
        tableEntry.setType(column.getTalendType());
        tableEntry.setNullable(column.isNullable());
        tableEntry.setExpression(inputConnection.getName() + "." + column.getLabel());
        outputTable.getMapperTableEntries().add(tableEntry);
    }
    ((MapperComponent) node.getExternalNode()).buildExternalData(data);
}
Also used : InputTable(org.talend.designer.mapper.model.emf.mapper.InputTable) MapperTableEntry(org.talend.designer.mapper.model.emf.mapper.MapperTableEntry) ExternalMapperTableEntry(org.talend.designer.mapper.external.data.ExternalMapperTableEntry) ExternalMapperData(org.talend.designer.mapper.external.data.ExternalMapperData) MapperData(org.talend.designer.mapper.model.emf.mapper.MapperData) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) OutputTable(org.talend.designer.mapper.model.emf.mapper.OutputTable)

Example 5 with MapperTableEntry

use of org.talend.designer.mapper.model.emf.mapper.MapperTableEntry in project tdi-studio-se by Talend.

the class InputTableImpl method equals.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated not
     */
@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    InputTableImpl other = (InputTableImpl) obj;
    if (this.innerJoin != other.innerJoin) {
        return false;
    }
    if (this.persistent != other.persistent) {
        return false;
    }
    if (this.lookupMode == null) {
        if (other.lookupMode != null) {
            return false;
        }
    } else if (!this.lookupMode.equals(other.lookupMode)) {
        return false;
    }
    if (this.matchingMode == null) {
        if (other.matchingMode != null) {
            return false;
        }
    } else if (!this.matchingMode.equals(other.matchingMode)) {
        return false;
    }
    EList<MapperTableEntry> otherEntries = other.getGlobalMapKeysValues();
    if (getGlobalMapKeysValues().size() != otherEntries.size()) {
        return false;
    }
    for (MapperTableEntry entry : getGlobalMapKeysValues()) {
        boolean found = false;
        for (MapperTableEntry otherEntry : otherEntries) {
            if (entry.getName().equals(otherEntry.getName())) {
                found = true;
                if (!entry.equals(otherEntry)) {
                    return false;
                }
                break;
            }
        }
        if (found == false) {
            return false;
        }
    }
    return super.equals(obj);
}
Also used : MapperTableEntry(org.talend.designer.mapper.model.emf.mapper.MapperTableEntry)

Aggregations

MapperTableEntry (org.talend.designer.mapper.model.emf.mapper.MapperTableEntry)11 ExternalMapperTableEntry (org.talend.designer.mapper.external.data.ExternalMapperTableEntry)3 InputTable (org.talend.designer.mapper.model.emf.mapper.InputTable)3 OutputTable (org.talend.designer.mapper.model.emf.mapper.OutputTable)3 ArrayList (java.util.ArrayList)2 VarTable (org.talend.designer.mapper.model.emf.mapper.VarTable)2 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)1 ExternalMapperData (org.talend.designer.mapper.external.data.ExternalMapperData)1 MapperData (org.talend.designer.mapper.model.emf.mapper.MapperData)1