use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class ColumnSetAnalysisDetailsPage method refreshIndicatorsSection.
/**
* refresh the Indicators Section.
*/
public void refreshIndicatorsSection() {
// when there have pattern, show allmatchindicator
ModelElementIndicator[] modelElementIndicator = treeViewer.getModelElementIndicator();
if (modelElementIndicator != null) {
for (ModelElementIndicator modelElementInd : modelElementIndicator) {
Indicator[] inds = modelElementInd.getPatternIndicators();
for (Indicator ind : inds) {
if (ind instanceof RegexpMatchingIndicator) {
indicatorsViewer.setInput(simpleStatIndicator, allMatchIndicator);
return;
}
}
}
}
indicatorsViewer.setInput(simpleStatIndicator);
}
use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class ColumnSetAnalysisDetailsPage method recomputeIndicators.
public void recomputeIndicators() {
columnSetAnalysisHandler = new ColumnSetAnalysisHandler();
columnSetAnalysisHandler.setAnalysis(getCurrentModelElement());
stringDataFilter = columnSetAnalysisHandler.getStringDataFilter();
analyzedColumns = columnSetAnalysisHandler.getAnalyzedColumns();
if (columnSetAnalysisHandler.getSimpleStatIndicator() == null || columnSetAnalysisHandler.getSimpleStatIndicator().eIsProxy()) {
ColumnsetFactory columnsetFactory = ColumnsetFactory.eINSTANCE;
simpleStatIndicator = columnsetFactory.createSimpleStatIndicator();
simpleStatIndicator.setRowCountIndicator(IndicatorsFactory.eINSTANCE.createRowCountIndicator());
simpleStatIndicator.setDistinctCountIndicator(IndicatorsFactory.eINSTANCE.createDistinctCountIndicator());
simpleStatIndicator.setDuplicateCountIndicator(IndicatorsFactory.eINSTANCE.createDuplicateCountIndicator());
simpleStatIndicator.setUniqueCountIndicator(IndicatorsFactory.eINSTANCE.createUniqueCountIndicator());
} else {
simpleStatIndicator = (SimpleStatIndicator) columnSetAnalysisHandler.getSimpleStatIndicator();
}
if (columnSetAnalysisHandler.getAllmatchIndicator() == null) {
ColumnsetFactory columnsetFactory = ColumnsetFactory.eINSTANCE;
allMatchIndicator = columnsetFactory.createAllMatchIndicator();
DefinitionHandler.getInstance().setDefaultIndicatorDefinition(allMatchIndicator);
} else {
allMatchIndicator = (AllMatchIndicator) columnSetAnalysisHandler.getAllmatchIndicator();
}
initializeIndicator(simpleStatIndicator);
List<ModelElementIndicator> meIndicatorList = new ArrayList<ModelElementIndicator>();
ModelElementIndicator currentIndicator = null;
for (ModelElement element : analyzedColumns) {
// MOD yyi 2011-02-16 17871:delimitefile
MetadataColumn mdColumn = SwitchHelpers.METADATA_COLUMN_SWITCH.doSwitch(element);
TdColumn tdColumn = SwitchHelpers.COLUMN_SWITCH.doSwitch(element);
if (tdColumn == null && mdColumn == null) {
continue;
}
if (tdColumn == null && mdColumn != null) {
currentIndicator = ModelElementIndicatorHelper.createDFColumnIndicator(RepositoryNodeHelper.recursiveFind(mdColumn));
} else if (tdColumn != null) {
RepositoryNode recursiveFind = RepositoryNodeHelper.recursiveFind(tdColumn);
if (recursiveFind == null) {
recursiveFind = RepositoryNodeHelper.createRepositoryNode(tdColumn);
}
currentIndicator = ModelElementIndicatorHelper.createModelElementIndicator(recursiveFind);
}
DataminingType dataminingType = MetadataHelper.getDataminingType(element);
MetadataHelper.setDataminingType(dataminingType == null ? DataminingType.NOMINAL : dataminingType, element);
Collection<Indicator> indicatorList = columnSetAnalysisHandler.getRegexMathingIndicators(element);
if (null != currentIndicator) {
currentIndicator.setIndicators(indicatorList.toArray(new Indicator[indicatorList.size()]));
meIndicatorList.add(currentIndicator);
}
}
currentModelElementIndicators = meIndicatorList.toArray(new ModelElementIndicator[meIndicatorList.size()]);
}
use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class ColumnAnalysisResultPage method createResultSection.
@Override
protected void createResultSection(Composite parent) {
resultSection = createSection(form, parent, DefaultMessagesImpl.getString("ColumnAnalysisResultPage.analysisResult"), // $NON-NLS-1$
null);
// TDQ-11525 msjian: Add "expand all" and "fold all" icon buttons in the "Analysis Results" section
Composite collapseExpandComposite = toolkit.createComposite(resultSection);
GridLayout gdLayout = new GridLayout();
gdLayout.numColumns = 2;
collapseExpandComposite.setLayout(gdLayout);
createCollapseAllLink(collapseExpandComposite);
createExpandAllLink(collapseExpandComposite);
resultSection.setTextClient(collapseExpandComposite);
// TDQ-11525
Composite chartTableComposite = toolkit.createComposite(resultSection);
chartTableComposite.setLayout(new GridLayout());
chartTableComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
final ModelElementIndicator[] modelElementIndicatores = masterPage.getCurrentModelElementIndicators();
// ~ MOD mzhao 2009-04-20, Do pagination. Bug 6512.
uiPagination = new UIPagination(toolkit, chartTableComposite);
int pageSize = IndicatorPaginationInfo.getPageSize();
int totalPages = modelElementIndicatores.length / pageSize;
List<ModelElementIndicator> modelElementIndLs = null;
for (int index = 0; index < totalPages; index++) {
modelElementIndLs = new ArrayList<ModelElementIndicator>();
for (int idx = 0; idx < pageSize; idx++) {
modelElementIndLs.add(modelElementIndicatores[index * pageSize + idx]);
}
IndicatorPaginationInfo pginfo = new ResultPaginationInfo(form, modelElementIndLs, masterPage, uiPagination);
uiPagination.addPage(pginfo);
}
int left = modelElementIndicatores.length % pageSize;
if (left != 0) {
modelElementIndLs = new ArrayList<ModelElementIndicator>();
for (int leftIdx = 0; leftIdx < left; leftIdx++) {
modelElementIndLs.add(modelElementIndicatores[totalPages * pageSize + leftIdx]);
}
IndicatorPaginationInfo pginfo = new ResultPaginationInfo(form, modelElementIndLs, masterPage, uiPagination);
uiPagination.addPage(pginfo);
}
chartComposite = toolkit.createComposite(chartTableComposite);
chartComposite.setLayout(new GridLayout());
chartComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
// ~
resultSection.setClient(chartTableComposite);
uiPagination.setChartComposite(chartComposite);
uiPagination.init();
chartComposite.layout();
chartComposite.pack();
}
use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class AbstractAnalysisMetadataPage method getSelectedColumns.
/**
* DOC talend Comment method "getSelectedColumns".
*
* @return
*/
protected ModelElement[] getSelectedColumns() {
ModelElement[] selectedColumns = new ModelElement[this.currentModelElementIndicators.length];
int index = 0;
for (ModelElementIndicator modelElemIndi : this.currentModelElementIndicators) {
IRepositoryNode modelElementRepositoryNode = modelElemIndi.getModelElementRepositoryNode();
if (modelElementRepositoryNode != null) {
IRepositoryViewObject currentObject = modelElementRepositoryNode.getObject();
if (ISubRepositoryObject.class.isInstance(currentObject)) {
selectedColumns[index++] = ((ISubRepositoryObject) currentObject).getModelElement();
}
}
}
return selectedColumns;
}
use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class UnitTestBuildHelper method createModelElementIndicator.
public static ModelElementIndicator createModelElementIndicator() {
TdColumn tdColumn = RelationalFactory.eINSTANCE.createTdColumn();
TdTable createTdTable = RelationalFactory.eINSTANCE.createTdTable();
tdColumn.setOwner(createTdTable);
TdSqlDataType dataType = RelationalFactory.eINSTANCE.createTdSqlDataType();
dataType.setJavaDataType(Types.VARCHAR);
tdColumn.setSqlDataType(dataType);
MetadataColumnRepositoryObject columnObject = new MetadataColumnRepositoryObject(null, tdColumn);
IRepositoryNode columnRepNode = new DBColumnRepNode(columnObject, new RepositoryNode(null, null, null), ENodeType.REPOSITORY_ELEMENT, null);
ModelElementIndicator modelElementIndicator = new ColumnIndicatorImpl(columnRepNode);
return modelElementIndicator;
}
Aggregations