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;
}
}
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;
}
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));
}
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);
}
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);
}
Aggregations