use of org.talend.designer.mapper.model.tableentry.AbstractInOutTableEntry in project tdi-studio-se by Talend.
the class MapperManager method retrieveTableViewerCreator.
public TableViewerCreator retrieveTableViewerCreator(ITableEntry dataMapTableEntry) {
DataMapTableView view = retrieveDataMapTableView(dataMapTableEntry);
TableViewerCreator tableViewerCreator = null;
if (view != null) {
if (dataMapTableEntry instanceof AbstractInOutTableEntry || dataMapTableEntry instanceof VarTableEntry) {
tableViewerCreator = view.getTableViewerCreatorForColumns();
} else if (dataMapTableEntry instanceof FilterTableEntry) {
tableViewerCreator = view.getTableViewerCreatorForFilters();
}
}
return tableViewerCreator;
}
use of org.talend.designer.mapper.model.tableentry.AbstractInOutTableEntry in project tdi-studio-se by Talend.
the class ExpressionProposalProvider method getVariables.
public List<Variable> getVariables() {
List<Variable> variables = new ArrayList<Variable>();
for (IDataMapTable table : this.tables) {
List<IColumnEntry> dataMapTableEntries = table.getColumnEntries();
for (IColumnEntry entrySource : dataMapTableEntries) {
String variable = null;
if (table instanceof VarsTable) {
variable = entrySource.getExpression();
} else {
variable = LanguageProvider.getCurrentLanguage().getLocation(entrySource.getParentName(), entrySource.getName());
}
String talendType = null;
boolean nullable = true;
if (entrySource instanceof AbstractInOutTableEntry) {
talendType = ((AbstractInOutTableEntry) entrySource).getMetadataColumn().getTalendType();
nullable = ((AbstractInOutTableEntry) entrySource).getMetadataColumn().isNullable();
} else if (entrySource instanceof VarTableEntry) {
talendType = ((VarTableEntry) entrySource).getType();
nullable = ((VarTableEntry) entrySource).isNullable();
}
if (talendType != null) {
if (LanguageManager.getCurrentLanguage() == ECodeLanguage.JAVA) {
boolean exist = false;
for (Variable v : variables) {
if (variable != null && v.getName() != null && v.getName().trim().equals(variable.trim())) {
exist = true;
break;
}
}
if (!exist) {
variables.add(new Variable(variable, JavaTypesManager.getDefaultValueFromJavaIdType(talendType, nullable).toString(), talendType, nullable));
}
} else {
//$NON-NLS-1$
variables.add(new Variable(variable, "", talendType, nullable));
}
}
}
}
return variables;
}
use of org.talend.designer.mapper.model.tableentry.AbstractInOutTableEntry in project tdi-studio-se by Talend.
the class ExternalDataConverter method loadInExternalData.
private void loadInExternalData(Collection<? extends AbstractDataMapTable> tables) {
for (IDataMapTable table : tables) {
ExternalMapperTable externalMapperTable = new ExternalMapperTable();
fillExternalTable(table, externalMapperTable);
ArrayList<ExternalMapperTableEntry> perTableEntries = new ArrayList<ExternalMapperTableEntry>();
boolean isVarTable = table instanceof VarsTable;
boolean isInputTable = table instanceof InputTable;
for (ITableEntry dataMapTableEntry : table.getColumnEntries()) {
ExternalMapperTableEntry externalMapperTableEntry = new ExternalMapperTableEntry();
externalMapperTableEntry.setExpression(dataMapTableEntry.getExpression());
externalMapperTableEntry.setName(dataMapTableEntry.getName());
if (isVarTable) {
externalMapperTableEntry.setType(((VarTableEntry) dataMapTableEntry).getType());
externalMapperTableEntry.setNullable(((VarTableEntry) dataMapTableEntry).isNullable());
} else {
externalMapperTableEntry.setType(((AbstractInOutTableEntry) dataMapTableEntry).getMetadataColumn().getTalendType());
externalMapperTableEntry.setNullable(((AbstractInOutTableEntry) dataMapTableEntry).getMetadataColumn().isNullable());
}
if (isInputTable) {
externalMapperTableEntry.setOperator(((InputColumnTableEntry) dataMapTableEntry).getOperator());
}
perTableEntries.add(externalMapperTableEntry);
}
externalMapperTable.setMetadataTableEntries(perTableEntries);
}
}
use of org.talend.designer.mapper.model.tableentry.AbstractInOutTableEntry in project tdi-studio-se by Talend.
the class ExternalDataConverter method loadInExternalData.
private void loadInExternalData(List<? extends AbstractDataMapTable> tables, List<? extends AbstractDataMapTable> intables) {
// for (int i = 0; i < tables.size(); i++) {
if (tables.size() <= 0 || intables.size() <= 0) {
return;
}
IDataMapTable outtable = tables.get(0);
IDataMapTable intable = intables.get(0);
ExternalMapperTable externalMapperTable = new ExternalMapperTable();
fillExternalTable(outtable, externalMapperTable);
ArrayList<ExternalMapperTableEntry> perTableEntries = new ArrayList<ExternalMapperTableEntry>();
List<IMetadataColumn> columnList = null;
if (mapperManager != null && mapperManager.getAbstractMapComponent() != null) {
List<? extends IConnection> connList = mapperManager.getAbstractMapComponent().getOutgoingConnections();
if (connList != null && connList.size() >= 1) {
List<IMetadataTable> metaList = connList.get(0).getTarget().getMetadataList();
if (metaList != null && metaList.size() >= 1) {
columnList = metaList.get(0).getListColumns();
}
}
}
for (ITableEntry dataMapTableEntry : intable.getColumnEntries()) {
if (columnList != null) {
boolean find = false;
for (IMetadataColumn column : columnList) {
if (dataMapTableEntry.getName().equals(column.getLabel())) {
find = true;
break;
}
}
if (find) {
ExternalMapperTableEntry externalMapperTableEntry = new ExternalMapperTableEntry();
externalMapperTableEntry.setExpression(intable.getName() + "." + dataMapTableEntry.getName());
externalMapperTableEntry.setName(dataMapTableEntry.getName());
externalMapperTableEntry.setType(((AbstractInOutTableEntry) dataMapTableEntry).getMetadataColumn().getTalendType());
externalMapperTableEntry.setNullable(((AbstractInOutTableEntry) dataMapTableEntry).getMetadataColumn().isNullable());
perTableEntries.add(externalMapperTableEntry);
}
} else {
ExternalMapperTableEntry externalMapperTableEntry = new ExternalMapperTableEntry();
externalMapperTableEntry.setExpression(intable.getName() + "." + dataMapTableEntry.getName());
externalMapperTableEntry.setName(dataMapTableEntry.getName());
externalMapperTableEntry.setType(((AbstractInOutTableEntry) dataMapTableEntry).getMetadataColumn().getTalendType());
externalMapperTableEntry.setNullable(((AbstractInOutTableEntry) dataMapTableEntry).getMetadataColumn().isNullable());
perTableEntries.add(externalMapperTableEntry);
}
}
externalMapperTable.setMetadataTableEntries(perTableEntries);
// }
}
use of org.talend.designer.mapper.model.tableentry.AbstractInOutTableEntry in project tdi-studio-se by Talend.
the class AbstractInOutTable method updateTableEntries.
private void updateTableEntries(List<IMetadataColumn> columns, Map<String, ExternalMapperTableEntry> nameToPerTabEntry) {
for (IMetadataColumn column : columns) {
AbstractInOutTableEntry columnEntry = getNewTableEntry(column);
ExternalMapperTableEntry externalMapperTableEntry = nameToPerTabEntry.get(columnEntry.getMetadataColumn().getLabel());
if (externalMapperTableEntry != null) {
columnEntry.setExpression(externalMapperTableEntry.getExpression());
if (columnEntry instanceof InputColumnTableEntry) {
InputColumnTableEntry entry = (InputColumnTableEntry) columnEntry;
entry.setOperator(externalMapperTableEntry.getOperator());
}
// mapperManager.getProblemsManager().checkProblemsForTableEntry(columnEntry, false);
}
dataMapTableEntries.add(columnEntry);
}
}
Aggregations