use of org.talend.cwm.relational.TdColumn in project tdq-studio-se by Talend.
the class AnalysisColumnCompareTreeViewer method setColumnABForMatchingIndicator.
/**
* DOC rli Comment method "setColumnAB".
*/
public void setColumnABForMatchingIndicator(RowMatchingIndicator rowMatchingIndicator, List<RepositoryNode> columnsA, List<RepositoryNode> columnsB) {
if (columnsA.size() != 0 && columnsA.get(0).getObject() instanceof MetadataColumnRepositoryObject) {
RepositoryNode node = columnsA.get(0);
MetadataColumnRepositoryObject columnObject = (MetadataColumnRepositoryObject) node.getObject();
TdColumn column = ((TdColumn) columnObject.getTdColumn());
ColumnSet columnSetOwner = ColumnHelper.getColumnOwnerAsColumnSet(column);
rowMatchingIndicator.setAnalyzedElement(columnSetOwner);
}
rowMatchingIndicator.getColumnSetA().clear();
for (RepositoryNode reposNode : columnsA) {
rowMatchingIndicator.getColumnSetA().add((TdColumn) ((MetadataColumnRepositoryObject) reposNode.getObject()).getTdColumn());
}
rowMatchingIndicator.getColumnSetB().clear();
for (RepositoryNode reposNode : columnsB) {
rowMatchingIndicator.getColumnSetB().add((TdColumn) ((MetadataColumnRepositoryObject) reposNode.getObject()).getTdColumn());
}
}
use of org.talend.cwm.relational.TdColumn 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.cwm.relational.TdColumn 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.cwm.relational.TdColumn in project tdq-studio-se by Talend.
the class RowMatchExplorer method getRowsNotMatchStatement.
/**
* get Rows for NotMatched Statement.
*
* @return
*/
public String getRowsNotMatchStatement() {
ColumnSet tablea = (ColumnSet) indicator.getAnalyzedElement();
String tableA = tablea.getName();
// $NON-NLS-1$
String query = "SELECT A.*" + dbmsLanguage.from();
if (ColumnsetPackage.eINSTANCE.getRowMatchingIndicator() == indicator.eClass()) {
ColumnSet tableb = ColumnHelper.getColumnOwnerAsColumnSet(((RowMatchingIndicator) indicator).getColumnSetB().get(0));
String tableB = tableb.getName();
EList<TdColumn> columnSetA = ((RowMatchingIndicator) indicator).getColumnSetA();
EList<TdColumn> columnSetB = ((RowMatchingIndicator) indicator).getColumnSetB();
// $NON-NLS-1$
String clauseA = " (SELECT *" + dbmsLanguage.from() + getFullyQualifiedTableName(tablea);
// $NON-NLS-1$
String clauseB = " (SELECT *" + dbmsLanguage.from() + getFullyQualifiedTableName(tableb);
String where = null;
// $NON-NLS-1$
String onClause = " ON ";
String realWhereClause = dbmsLanguage.where();
for (int i = 0; i < columnSetA.size(); i++) {
where = dbmsLanguage.and();
if (i == 0) {
where = dbmsLanguage.where();
} else {
onClause += where;
realWhereClause += where;
}
realWhereClause += // $NON-NLS-1$
" B" + dbmsLanguage.getDelimiter() + dbmsLanguage.quote(columnSetB.get(i).getName()) + dbmsLanguage.isNull();
onClause += // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
" (A" + dbmsLanguage.getDelimiter() + dbmsLanguage.quote(columnSetA.get(i).getName()) + "=" + " B" + dbmsLanguage.getDelimiter() + dbmsLanguage.quote(columnSetB.get(i).getName()) + // $NON-NLS-1$
") ";
}
clauseA += (tableA.equals(tableB) ? whereDataFilter(tableA, (getdataFilterIndex(null) == AnalysisHelper.DATA_FILTER_A ? AnalysisHelper.DATA_FILTER_A : AnalysisHelper.DATA_FILTER_B)) : whereDataFilter(tableA, null)) + // $NON-NLS-1$
") A";
clauseB += (tableB.equals(tableA) ? whereDataFilter(tableB, (getdataFilterIndex(null) == AnalysisHelper.DATA_FILTER_A ? AnalysisHelper.DATA_FILTER_B : AnalysisHelper.DATA_FILTER_A)) : whereDataFilter(tableB, null)) + // $NON-NLS-1$
") B";
// MOD qiongli 2012-8-14 TDQ-5907.
if (dbmsLanguage instanceof HiveDbmsLanguage) {
// $NON-NLS-1$
query += clauseA + " LEFT OUTER JOIN " + clauseB + onClause + realWhereClause;
} else {
// $NON-NLS-1$
query += clauseA + " LEFT JOIN " + clauseB + onClause + realWhereClause;
}
}
return getComment(MENU_VIEW_NOT_MATCH_ROWS) + query;
}
use of org.talend.cwm.relational.TdColumn in project tdq-studio-se by Talend.
the class SummaryStastictisExplorer method getInvalidRowsStatement.
/**
* zqin use this method in a menu ".
*
* View invalid rows" Method "getInvalidRowsStatement".
*
* @return the query to get the invalid rows (or null when all rows are valid)
*/
private String getInvalidRowsStatement() {
double value = Double.valueOf(entity.getValue());
String whereClause = null;
TdColumn column = (TdColumn) indicator.getAnalyzedElement();
IndicatorParameters parameters = indicator.getParameters();
if (parameters != null) {
String where1 = null;
Domain domain = parameters.getIndicatorValidDomain();
if (domain != null) {
where1 = getWhereInvalidClause(value, domain);
}
String where2 = null;
domain = parameters.getDataValidDomain();
if (domain != null) {
where2 = getWhereInvalidClause(value, domain);
}
if (where1 != null) {
whereClause = where1;
if (where2 != null) {
whereClause += dbmsLanguage.or() + where2;
}
} else if (where2 != null) {
whereClause = where2;
}
}
// add the data filter where clause
return whereClause != null ? SELECT_ALL + dbmsLanguage.from() + getFullyQualifiedTableName(column) + dbmsLanguage.where() + inBrackets(whereClause) + andDataFilterClause() : null;
}
Aggregations