use of org.talend.cwm.relational.TdColumn in project tdq-studio-se by Talend.
the class ColumnSetMultiValueIndicatorImpl method getColumnHeaders.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public EList<String> getColumnHeaders() {
EList<String> headers = new BasicEList<String>();
// shuold keep the order of the columns, when show the data in result page need to follow the order
for (ModelElement column : analyzedColumns) {
if (isSameMiningType(column, DataminingType.INTERVAL)) {
// add numerical or date columns with formatted heander name if numeric or date functions defined in
// indicator definition.
final MetadataColumn mdColumn = SwitchHelpers.METADATA_COLUMN_SWITCH.doSwitch(column);
final TdColumn tdColumn = SwitchHelpers.COLUMN_SWITCH.doSwitch(column);
if (tdColumn != null) {
// For database items
addDBColumnToHeaderList(headers, column, tdColumn);
} else if (mdColumn != null) {
// For file items.
addFileColumnToHeaderList(headers, column, mdColumn);
} else {
// Never go here
log.error("invalid data mining type for " + column);
}
} else {
headers.add(column.getName());
}
}
headers.add(this.getCountAll());
return headers;
}
use of org.talend.cwm.relational.TdColumn in project tdq-studio-se by Talend.
the class ColumnSetMultiValueIndicatorImpl method getNumericColumns.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public EList<ModelElement> getNumericColumns() {
// bug 10578 by zshen,fix the
EList<ModelElement> computedColumns = new BasicElistExtend<ModelElement>();
// correlation analysis to be move
if (analyzedColumns != null) {
for (ModelElement column : analyzedColumns) {
// MOD yyi 2011-02-25 16660: edit connection, save it will get error
final MetadataColumn mdColumn = SwitchHelpers.METADATA_COLUMN_SWITCH.doSwitch(column);
final TdColumn tdColumn = SwitchHelpers.COLUMN_SWITCH.doSwitch(column);
// MOD qiongli 2011-3-8.fetature 19192,,add mdColumn for MetadataColumn(delimited file)
if (tdColumn != null) {
if (isSameMiningType(column, DataminingType.INTERVAL) && Java2SqlType.isNumbericInSQL(tdColumn.getSqlDataType().getJavaDataType())) {
computedColumns.add(column);
}
} else if (mdColumn != null) {
int javaType = TalendTypeConvert.convertToJDBCType(mdColumn.getTalendType());
if (isSameMiningType(column, DataminingType.INTERVAL) && Java2SqlType.isNumbericInSQL(javaType)) {
computedColumns.add(column);
}
}
}
}
return computedColumns;
}
use of org.talend.cwm.relational.TdColumn in project tdq-studio-se by Talend.
the class ColumnSetMultiValueIndicatorImpl method getDateColumns.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public EList<ModelElement> getDateColumns() {
EList<ModelElement> dateColumns = new BasicEList<ModelElement>();
if (analyzedColumns != null) {
for (ModelElement column : analyzedColumns) {
final MetadataColumn mdColumn = SwitchHelpers.METADATA_COLUMN_SWITCH.doSwitch(column);
final TdColumn tdColumn = SwitchHelpers.COLUMN_SWITCH.doSwitch(column);
if (tdColumn != null) {
if (isSameMiningType(column, DataminingType.INTERVAL) && Java2SqlType.isDateInSQL(tdColumn.getSqlDataType().getJavaDataType())) {
dateColumns.add(column);
}
} else if (mdColumn != null) {
int javaType = TalendTypeConvert.convertToJDBCType(mdColumn.getTalendType());
if (isSameMiningType(column, DataminingType.INTERVAL) && Java2SqlType.isDateInSQL(javaType)) {
dateColumns.add(column);
}
}
}
}
return dateColumns;
}
use of org.talend.cwm.relational.TdColumn in project tdq-studio-se by Talend.
the class UnitTestBuildHelper method createRealTdColumn.
public static TdColumn createRealTdColumn(String columnName, String tdSqlName, int javaType) {
TdTable table = org.talend.cwm.relational.RelationalFactory.eINSTANCE.createTdTable();
// $NON-NLS-1$
table.setName("TDQ_CALENDAR");
TdColumn column = org.talend.cwm.relational.RelationalFactory.eINSTANCE.createTdColumn();
column.setName(columnName);
TdSqlDataType tdsql = org.talend.cwm.relational.RelationalFactory.eINSTANCE.createTdSqlDataType();
tdsql.setName(tdSqlName);
tdsql.setJavaDataType(javaType);
column.setSqlDataType(tdsql);
table.getOwnedElement().add(column);
column.setOwner(table);
return column;
}
use of org.talend.cwm.relational.TdColumn in project tdi-studio-se by Talend.
the class TableNode method isNodeSameToColumn.
/**
* Check if ColumnNode and Column are the same.
*
* @param node ColumnNode
* @param column MetadataColumnImpl
* @return isNodeSameToColumn
* @exception
*/
private boolean isNodeSameToColumn(ColumnNode node, MetadataColumnImpl column) {
SessionTreeNode sessionTreeNode = node.getSession();
TableColumnInfo[] tableColumnInfo = null;
try {
tableColumnInfo = sessionTreeNode.getMetaData().getColumnInfo(ptableInfo);
} catch (SQLException e) {
SqlBuilderPlugin.log(e.getMessage(), e);
return false;
}
// Retrive metadataColumns from Database
IMetadataConnection iMetadataConnection = ConvertionHelper.convert(connection);
List<TdColumn> metadataColumns = new ArrayList<TdColumn>();
metadataColumns = ExtractMetaDataFromDataBase.returnMetadataColumnsFormTable(iMetadataConnection, getLabelText());
Iterator iterate = metadataColumns.iterator();
while (iterate.hasNext()) {
MetadataColumn metadataColumn = (MetadataColumn) iterate.next();
for (TableColumnInfo info : tableColumnInfo) {
if (metadataColumn.getLabel().equals(node.getLabelText()) && info.getColumnName().equals(node.getLabelText())) {
boolean divergency = isEquivalent(metadataColumn, column);
metadataColumn.setDivergency(divergency);
return divergency;
}
}
}
return true;
}
Aggregations