use of org.talend.dataprofiler.core.model.TableIndicator in project tdq-studio-se by Talend.
the class BusinessRuleAnalysisDetailsPage method recomputeIndicators.
public void recomputeIndicators() {
analysisHandler = new TableAnalysisHandler();
analysisHandler.setAnalysis(getCurrentModelElement());
stringDataFilter = analysisHandler.getStringDataFilter();
EList<ModelElement> analyzedTables = analysisHandler.getAnalyzedTables();
List<TableIndicator> tableIndicatorList = new ArrayList<TableIndicator>();
for (ModelElement element : analyzedTables) {
NamedColumnSet set = SwitchHelpers.NAMED_COLUMN_SET_SWITCH.doSwitch(element);
if (set == null) {
continue;
}
TableIndicator currentTableIndicator = new TableIndicator(set);
Collection<Indicator> indicatorList = analysisHandler.getIndicators(set);
currentTableIndicator.setIndicators(indicatorList.toArray(new Indicator[indicatorList.size()]));
tableIndicatorList.add(currentTableIndicator);
}
currentTableIndicators = tableIndicatorList.toArray(new TableIndicator[tableIndicatorList.size()]);
}
use of org.talend.dataprofiler.core.model.TableIndicator in project tdq-studio-se by Talend.
the class AnalysisTableTreeViewer method setInput.
/**
* DOC xqliu Comment method "setInput".
*
* @param objs
*/
@Override
public void setInput(Object[] objs) {
List<DBTableRepNode> tableNodeList = RepositoryNodeHelper.getTableNodeList(objs);
List<TableIndicator> tableIndicatorList = new ArrayList<TableIndicator>();
// MOD by zshen for 2011.06.13 add the support for the view.
List<DBViewRepNode> viewNodeList = RepositoryNodeHelper.getViewNodeList(objs);
if (tableNodeList.size() == 0 && viewNodeList.size() == 0) {
// feature 22206 : fixed another bug, when deselect all, the view is not changed
this.tableIndicators = tableIndicatorList.toArray(new TableIndicator[tableIndicatorList.size()]);
this.setElements(tableIndicators);
return;
}
List<RepositoryNode> setList = new ArrayList<RepositoryNode>();
Connection tdProvider = null;
for (DBTableRepNode tableNode : tableNodeList) {
if (tdProvider == null) {
tdProvider = ConnectionHelper.getTdDataProvider(TableHelper.getParentCatalogOrSchema(tableNode.getTdTable()));
}
if (tdProvider == null) {
MessageUI.openError(DefaultMessagesImpl.getString("AnalysisTableTreeViewer.TableProviderIsNull", // $NON-NLS-1$
tableNode.getLabel()));
} else if (this.getAnalysis().getContext().getConnection() != null && !tdProvider.equals(this.getAnalysis().getContext().getConnection())) {
MessageUI.openError(DefaultMessagesImpl.getString("AnalysisTableTreeViewer.TableDataProviderIsInvalid", // $NON-NLS-1$
tableNode.getLabel()));
} else {
setList.add(tableNode);
}
}
for (DBViewRepNode tableNode : viewNodeList) {
if (tdProvider == null) {
tdProvider = ConnectionHelper.getTdDataProvider(TableHelper.getParentCatalogOrSchema(tableNode.getTdView()));
}
if (tdProvider == null) {
MessageUI.openError(DefaultMessagesImpl.getString("AnalysisTableTreeViewer.TableProviderIsNull", // $NON-NLS-1$
tableNode.getLabel()));
} else if (this.getAnalysis().getContext().getConnection() != null && !tdProvider.equals(this.getAnalysis().getContext().getConnection())) {
MessageUI.openError(DefaultMessagesImpl.getString("AnalysisTableTreeViewer.TableDataProviderIsInvalid", // $NON-NLS-1$
tableNode.getLabel()));
} else {
setList.add(tableNode);
}
}
for (TableIndicator tableIndicator : tableIndicators) {
// ADDED yyin 20120606 TDQ-5343
NamedColumnSet selectedTable = tableIndicator.getColumnSet();
DQRepositoryNode tableNode = null;
if (selectedTable instanceof TdTable) {
tableNode = RepositoryNodeHelper.recursiveFindTdTable(((TdTable) selectedTable));
} else if (selectedTable instanceof TdView) {
tableNode = RepositoryNodeHelper.recursiveFindTdView(((TdView) selectedTable));
}
// ~
if (setList.contains(tableNode)) {
tableIndicatorList.add(tableIndicator);
setList.remove(tableNode);
}
}
for (RepositoryNode set : setList) {
TableIndicator tableIndicator = null;
if (set instanceof DBViewRepNode) {
tableIndicator = TableIndicator.createTableIndicatorWithRowCountIndicator(((DBViewRepNode) set).getTdView());
} else if (set instanceof DBTableRepNode) {
tableIndicator = TableIndicator.createTableIndicatorWithRowCountIndicator(((DBTableRepNode) set).getTdTable());
} else {
continue;
}
tableIndicatorList.add(tableIndicator);
}
this.tableIndicators = tableIndicatorList.toArray(new TableIndicator[tableIndicatorList.size()]);
this.setElements(tableIndicators);
}
use of org.talend.dataprofiler.core.model.TableIndicator in project tdq-studio-se by Talend.
the class AnalysisTableTreeViewer method canDrop.
@Override
public boolean canDrop(NamedColumnSet set) {
Connection tdProvider = ConnectionHelper.getTdDataProvider(TableHelper.getParentCatalogOrSchema(set));
if (tdProvider == null) {
return false;
} else if (this.getAnalysis().getContext().getConnection() != null && !tdProvider.equals(this.getAnalysis().getContext().getConnection())) {
return false;
}
List<NamedColumnSet> existSets = new ArrayList<NamedColumnSet>();
for (TableIndicator tableIndicator : getTableIndicator()) {
existSets.add(tableIndicator.getColumnSet());
}
if (existSets.contains(set)) {
return false;
}
return true;
}
use of org.talend.dataprofiler.core.model.TableIndicator in project tdq-studio-se by Talend.
the class AnalysisTableTreeViewer method getOwnedWhereRuleNodes.
/**
* DOC xqliu Comment method "getOwnedWhereRuleFiles". ADD xqliu 2009-04-30 bug 6808
*
* @param tableIndicator
* @param whereRuleFolder
* @return
*/
private Object[] getOwnedWhereRuleNodes(TableIndicator tableIndicator) {
ArrayList<RuleRepNode> ret = new ArrayList<RuleRepNode>();
Indicator[] indicators = tableIndicator.getIndicators();
for (Indicator indicator : indicators) {
if (IndicatorHelper.isWhereRuleIndicator(indicator)) {
Object obj = indicator.getIndicatorDefinition();
if (obj != null && obj instanceof WhereRule) {
WhereRule wr = (WhereRule) obj;
RuleRepNode recursiveFindRuleSql = RepositoryNodeHelper.recursiveFindRuleSql(wr);
if (recursiveFindRuleSql != null) {
ret.add(recursiveFindRuleSql);
}
}
}
}
return ret.toArray();
}
use of org.talend.dataprofiler.core.model.TableIndicator in project tdq-studio-se by Talend.
the class AnalysisTableTreeViewer method deleteTableItems.
private void deleteTableItems(TableIndicator deleteTableIndiciator) {
TableIndicator[] remainIndicators = new TableIndicator[tableIndicators.length - 1];
int i = 0;
for (TableIndicator indicator : tableIndicators) {
if (deleteTableIndiciator.equals(indicator)) {
continue;
} else {
remainIndicators[i] = indicator;
i++;
}
}
this.tableIndicators = remainIndicators;
}
Aggregations