use of org.talend.core.model.metadata.builder.connection.MetadataTable in project tdq-studio-se by Talend.
the class DrillDownEditorInput method getDesignatedData.
/**
* DOC zshen Comment method "getDesignatedData".
*
* @return make column mapping with data
*/
private List<Object[]> getDesignatedData(List<Object[]> dataList) {
ModelElement analysisElement = currIndicator.getAnalyzedElement();
List<Object[]> returnDataList = new ArrayList<Object[]>();
if (dataList == null || dataList.size() < 0) {
return returnDataList;
}
if (DrillDownUtils.judgeMenuType(this.getMenuType(), DrillDownUtils.MENU_VALUE_TYPE)) {
int offset = 0;
// MOD qiongli 2011-3-3 feature 19192 drill down for columnSet with jave engine.
if (analysisElement == null && currIndicator.eContainer() instanceof SimpleStatIndicator) {
returnDataList = dataList;
} else {
if (analysisElement instanceof MetadataColumn) {
MetadataTable mTable = ColumnHelper.getColumnOwnerAsMetadataTable((MetadataColumn) analysisElement);
List<MetadataColumn> columnElementList = mTable.getColumns();
offset = columnElementList.indexOf(analysisElement);
}
// Added yyin 20120608 TDQ-3589
if (currIndicator instanceof DuplicateCountIndicator) {
for (Object obj : ((DuplicateCountIndicator) currIndicator).getDuplicateValues()) {
Object[] newObj = new Object[1];
newObj[0] = obj;
returnDataList.add(newObj);
}
return returnDataList;
}
// ~
for (Object[] obj : dataList) {
Object[] newObj = new Object[1];
newObj[0] = obj[offset];
returnDataList.add(newObj);
}
}
} else {
returnDataList = dataList;
}
return returnDataList;
}
use of org.talend.core.model.metadata.builder.connection.MetadataTable in project tdq-studio-se by Talend.
the class DrillDownEditorInput method getColumnIndexArray.
/**
* Get index of column whiche will be used on the dirll down. Note that One indicator only belong one column so that
* the array of retrun value just contain one element.
*
* And if we create new map for view values menu rather than used same map with view rows menu then method can be
* removed
*
* @return
*/
public Integer[] getColumnIndexArray() {
if (!DrillDownUtils.judgeMenuType(this.getMenuType(), DrillDownUtils.MENU_VALUE_TYPE) || !UniqueCountIndicator.class.isInstance(currIndicator)) {
return null;
}
List<Integer> indexArray = new ArrayList<Integer>();
Indicator indicator = this.getCurrIndicator();
ModelElement analysisElement = indicator.getAnalyzedElement();
int index = 0;
if (analysisElement instanceof TdColumn) {
List<TdColumn> columns = getColumnsByTdColumn((TdColumn) analysisElement);
for (TdColumn column : columns) {
if (column.getName().equals(analysisElement.getName())) {
indexArray.add(index);
// break at here.
break;
}
index++;
}
} else if (analysisElement instanceof MetadataColumn) {
MetadataTable mTable = ColumnHelper.getColumnOwnerAsMetadataTable((MetadataColumn) analysisElement);
for (MetadataColumn mColumn : mTable.getColumns()) {
if (mColumn.getLabel().equals(analysisElement.getName())) {
indexArray.add(index);
// break at here.
break;
}
index++;
}
}
return indexArray.toArray(new Integer[indexArray.size()]);
}
use of org.talend.core.model.metadata.builder.connection.MetadataTable in project tdq-studio-se by Talend.
the class DrillDownEditorInput method filterAdaptColumnHeader.
/**
* DOC zshen Comment method "filterAdaptColumnHeader".
*
* @returnget the name of column which will be displayed on the drill down editor.
*/
public List<String> filterAdaptColumnHeader() {
// get columnHeader
Indicator indicator = this.getCurrIndicator();
ModelElement analysisElement = indicator.getAnalyzedElement();
String menuType = this.getMenuType();
List<String> columnElementList = new ArrayList<String>();
// MOD qiongli 2011-3-3,feature 19192 ,drill down for columnSet with java engine .
if (analysisElement == null && indicator.eContainer() instanceof SimpleStatIndicator) {
columnElementList = columnHeaderForColumnSet((SimpleStatIndicator) indicator.eContainer());
} else {
// MOD qiongli 2011-1-9 feature 16796
if (DrillDownUtils.judgeMenuType(menuType, DrillDownUtils.MENU_VALUE_TYPE)) {
columnElementList.add(ModelElementHelper.getName(indicator.getAnalyzedElement()));
} else if (analysisElement instanceof TdColumn) {
for (TdColumn column : getColumnsByTdColumn((TdColumn) analysisElement)) {
columnElementList.add(column.getName());
}
} else if (analysisElement instanceof MetadataColumn) {
MetadataTable mTable = ColumnHelper.getColumnOwnerAsMetadataTable((MetadataColumn) analysisElement);
for (MetadataColumn mColumn : mTable.getColumns()) {
columnElementList.add(mColumn.getLabel());
}
}
}
return columnElementList;
}
use of org.talend.core.model.metadata.builder.connection.MetadataTable in project tdq-studio-se by Talend.
the class RepositoryNodeHelper method getAnalyzeDataNames.
/**
* Get selected names and split with "/". .e.g,onnection/catalog/schema/table.
*
* @param columnNode
* @return
*/
public static String getAnalyzeDataNames(IRepositoryNode columnNode) {
ModelElement mod = RepositoryNodeHelper.getModelElementFromRepositoryNode(columnNode);
if (mod == null) {
return PluginConstant.EMPTY_STRING;
}
MetadataColumn metadataColumn = SwitchHelpers.METADATA_COLUMN_SWITCH.doSwitch(mod);
if (metadataColumn == null) {
return PluginConstant.EMPTY_STRING;
}
List<String> nameLs = new ArrayList<String>();
EObject eContainer = metadataColumn.eContainer();
MetadataTable mdTable = SwitchHelpers.METADATA_TABLE_SWITCH.doSwitch(eContainer);
if (mdTable != null) {
nameLs.add(mdTable.getLabel());
Package parentCatalogOrSchema = ColumnSetHelper.getParentCatalogOrSchema(mdTable);
Connection conn = null;
// DelimitedFile conn doesn't have Catalog and Schema.
if (parentCatalogOrSchema == null) {
conn = ConnectionHelper.getTdDataProvider(mdTable);
} else {
conn = ConnectionHelper.getTdDataProvider(parentCatalogOrSchema);
Schema schema = SwitchHelpers.SCHEMA_SWITCH.doSwitch(parentCatalogOrSchema);
Catalog catalog = SwitchHelpers.CATALOG_SWITCH.doSwitch(parentCatalogOrSchema);
if (schema != null) {
nameLs.add(schema.getName());
catalog = CatalogHelper.getParentCatalog(schema);
if (catalog != null) {
nameLs.add(catalog.getName());
}
} else if (catalog != null) {
nameLs.add(catalog.getName());
}
}
if (conn != null) {
nameLs.add(conn.getName());
}
}
return sortNames(nameLs, PluginConstant.SLASH_STRING);
}
use of org.talend.core.model.metadata.builder.connection.MetadataTable in project tdq-studio-se by Talend.
the class FileMetadataTableComparisonLevel method getTempTableFromOldFile.
/*
* find the same name metadata in the old provider, and give the new columns to it.
*/
private EObject getTempTableFromOldFile() throws ReloadCompareException {
MetadataTable[] metadataTables = ConnectionHelper.getTables(tempReloadProvider).toArray(new MetadataTable[0]);
String tableName = ((MetadataTable) selectedObj).getLabel();
for (MetadataTable table : metadataTables) {
if (table.getLabel().equals(tableName)) {
// the temp table is the old one in file connection before schema changed
tempMetadataTable = table;
// use this temp list to store the compared result.
comparedColumns.addAll(table.getColumns());
break;
}
}
util.saveResource(tempMetadataTable.eResource());
return tempMetadataTable;
}
Aggregations