use of org.talend.core.model.metadata.builder.connection.MetadataColumn in project tdq-studio-se by Talend.
the class ColumnSetMultiValueIndicatorImpl method isSameMiningType.
private Boolean isSameMiningType(ModelElement column, DataminingType type) {
// 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);
if (tdColumn == null && mdColumn == null) {
if (column == null) {
log.error("The list of analyzed column contains a null column");
} else {
log.error("Analyzed element should be a TdColumn instead of a Column. Analyzed element is " + column.getName());
}
// Column which is null is not a nominal type.
return false;
}
// MOD qiongli 2011-3-8.fetature 19192,add mdColumn for MetadataColumn(delimited file)
DataminingType dataminingType = MetadataHelper.getDataminingType(column);
if (dataminingType != null && type == dataminingType) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}
use of org.talend.core.model.metadata.builder.connection.MetadataColumn 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.core.model.metadata.builder.connection.MetadataColumn 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.core.model.metadata.builder.connection.MetadataColumn 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.core.model.metadata.builder.connection.MetadataColumn in project tdq-studio-se by Talend.
the class UnitTestBuildHelper method initColumns.
/**
* init the file's related metadata table with columns: name, company, city,country, comment. and add all columns as
* analyzed elements.
*
* @param context
*/
public MetadataColumn initColumns(AnalysisContext context, MetadataTable metadataTable) {
List<ModelElement> anaElements = context.getAnalysedElements();
// // Name
MetadataColumn name = ConnectionPackage.eINSTANCE.getConnectionFactory().createMetadataColumn();
// $NON-NLS-1$
name.setName("name");
// $NON-NLS-1$
name.setLabel("name");
anaElements.add(name);
metadataTable.getColumns().add(name);
// Company
MetadataColumn company = ConnectionPackage.eINSTANCE.getConnectionFactory().createMetadataColumn();
// $NON-NLS-1$
company.setName("company");
// $NON-NLS-1$
company.setLabel("company");
anaElements.add(company);
metadataTable.getColumns().add(company);
// City
MetadataColumn city = ConnectionPackage.eINSTANCE.getConnectionFactory().createMetadataColumn();
// $NON-NLS-1$
city.setName("city");
// $NON-NLS-1$
city.setLabel("city");
anaElements.add(city);
metadataTable.getColumns().add(city);
// Country
MetadataColumn country = ConnectionPackage.eINSTANCE.getConnectionFactory().createMetadataColumn();
// $NON-NLS-1$
country.setName("country");
// $NON-NLS-1$
country.setLabel("country");
anaElements.add(country);
metadataTable.getColumns().add(country);
// comment
MetadataColumn comment = ConnectionPackage.eINSTANCE.getConnectionFactory().createMetadataColumn();
// $NON-NLS-1$
comment.setName("comment");
// $NON-NLS-1$
comment.setLabel("comment");
anaElements.add(comment);
metadataTable.getColumns().add(comment);
return name;
}
Aggregations