use of orgomg.cwm.resource.relational.NamedColumnSet 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 orgomg.cwm.resource.relational.NamedColumnSet in project tdq-studio-se by Talend.
the class AnalysisTableTreeViewer method dropTables.
@Override
public void dropTables(List<NamedColumnSet> sets, int index) {
int size = sets.size();
TableIndicator[] tIndicators = new TableIndicator[size];
for (int i = 0; i < size; i++) {
NamedColumnSet set = sets.get(i);
TableIndicator tableIndicator = TableIndicator.createTableIndicatorWithRowCountIndicator(set);
tIndicators[i] = tableIndicator;
}
this.addElements(tIndicators);
}
use of orgomg.cwm.resource.relational.NamedColumnSet in project tdq-studio-se by Talend.
the class AnalysisTableTreeViewer method isExpressionNull.
private String isExpressionNull(TreeItem item) {
String expressContent = null;
TableIndicatorUnit indicatorUnit = (TableIndicatorUnit) item.getData(INDICATOR_UNIT_KEY);
TableIndicator tableIndicator = (TableIndicator) item.getData(TABLE_INDICATOR_KEY);
NamedColumnSet set = tableIndicator.getColumnSet();
Connection dataprovider = ConnectionHelper.getTdDataProvider(ColumnSetHelper.getParentCatalogOrSchema(set));
DbmsLanguage dbmsLang = DbmsLanguageFactory.createDbmsLanguage(dataprovider);
Expression expression = dbmsLang.getInstantiatedExpression(indicatorUnit.getIndicator());
if (expression != null) {
expressContent = expression.getBody();
}
return expressContent;
}
use of orgomg.cwm.resource.relational.NamedColumnSet in project tdq-studio-se by Talend.
the class AbstractPredefinedTableAnalysisAction method composePredefinedTableIndicator.
protected TableIndicator[] composePredefinedTableIndicator(IndicatorEnum[] allowedEnum) {
NamedColumnSet[] tablesAndViews = getTablesAndViews();
TableIndicator[] predefinedTableIndicator = new TableIndicator[tablesAndViews.length];
for (int i = 0; i < tablesAndViews.length; i++) {
NamedColumnSet tableOrView = tablesAndViews[i];
TableIndicator tableIndicator = new TableIndicator(tableOrView);
predefinedTableIndicator[i] = tableIndicator;
}
return predefinedTableIndicator;
}
use of orgomg.cwm.resource.relational.NamedColumnSet in project tdq-studio-se by Talend.
the class TableAnalysisWizard method initCWMResourceBuilder.
@Override
public ModelElement initCWMResourceBuilder() {
Analysis analysis = (Analysis) super.initCWMResourceBuilder();
NamedColumnSet[] ncss = getNamedColumnSet();
Connection tdp = getTdDataProvider();
if (ncss != null && getAnalysisBuilder() != null) {
List<Indicator> indicatorList = new ArrayList<Indicator>();
WhereRule[] whereRules = getWhereRules(dqruleSelectPage.getCViewer().getCheckedElements());
for (NamedColumnSet ncs : ncss) {
// add RowCountIndicator
RowCountIndicator rowCountIndicator = IndicatorsFactory.eINSTANCE.createRowCountIndicator();
DefinitionHandler.getInstance().setDefaultIndicatorDefinition(rowCountIndicator);
rowCountIndicator.setAnalyzedElement(ncs);
indicatorList.add(rowCountIndicator);
// add user selected WhereRuleIndicator
if (whereRules != null) {
for (WhereRule whereRule : whereRules) {
WhereRuleIndicator[] compositeWhereRuleIndicator = DQRuleUtilities.createCompositeWhereRuleIndicator(ncs, whereRule);
indicatorList.addAll(Arrays.asList(compositeWhereRuleIndicator));
}
}
}
getAnalysisBuilder().addElementsToAnalyze(ncss, indicatorList.toArray(new Indicator[indicatorList.size()]));
getAnalysisBuilder().setAnalysisConnection(tdp);
}
return analysis;
}
Aggregations