Search in sources :

Example 6 with ModelElementIndicator

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);
}
Also used : RegexpMatchingIndicator(org.talend.dataquality.indicators.RegexpMatchingIndicator) RegexpMatchingIndicator(org.talend.dataquality.indicators.RegexpMatchingIndicator) AllMatchIndicator(org.talend.dataquality.indicators.columnset.AllMatchIndicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) Indicator(org.talend.dataquality.indicators.Indicator) CompositeIndicator(org.talend.dataquality.indicators.CompositeIndicator) SimpleStatIndicator(org.talend.dataquality.indicators.columnset.SimpleStatIndicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 7 with ModelElementIndicator

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()]);
}
Also used : DataminingType(org.talend.dataquality.indicators.DataminingType) ModelElement(orgomg.cwm.objectmodel.core.ModelElement) MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) ColumnSetAnalysisHandler(org.talend.dq.analysis.ColumnSetAnalysisHandler) TdColumn(org.talend.cwm.relational.TdColumn) ArrayList(java.util.ArrayList) ColumnsetFactory(org.talend.dataquality.indicators.columnset.ColumnsetFactory) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RegexpMatchingIndicator(org.talend.dataquality.indicators.RegexpMatchingIndicator) AllMatchIndicator(org.talend.dataquality.indicators.columnset.AllMatchIndicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) Indicator(org.talend.dataquality.indicators.Indicator) CompositeIndicator(org.talend.dataquality.indicators.CompositeIndicator) SimpleStatIndicator(org.talend.dataquality.indicators.columnset.SimpleStatIndicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 8 with ModelElementIndicator

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();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) UIPagination(org.talend.dataprofiler.core.ui.utils.pagination.UIPagination) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) GridData(org.eclipse.swt.layout.GridData) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 9 with ModelElementIndicator

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;
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) IRepositoryNode(org.talend.repository.model.IRepositoryNode) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 10 with ModelElementIndicator

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;
}
Also used : ColumnIndicatorImpl(org.talend.dataprofiler.core.model.impl.ColumnIndicatorImpl) TdColumn(org.talend.cwm.relational.TdColumn) TdTable(org.talend.cwm.relational.TdTable) IRepositoryNode(org.talend.repository.model.IRepositoryNode) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) DBColumnRepNode(org.talend.dq.nodes.DBColumnRepNode) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) TdSqlDataType(org.talend.cwm.relational.TdSqlDataType) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Aggregations

ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)58 IRepositoryNode (org.talend.repository.model.IRepositoryNode)22 ArrayList (java.util.ArrayList)16 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)16 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)16 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)15 Indicator (org.talend.dataquality.indicators.Indicator)13 IndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit)12 TreeItem (org.eclipse.swt.widgets.TreeItem)11 RepositoryNode (org.talend.repository.model.RepositoryNode)10 IndicatorEnum (org.talend.dq.nodes.indicator.type.IndicatorEnum)9 MetadataXmlElementTypeRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataXmlElementTypeRepositoryObject)7 Connection (org.talend.core.model.metadata.builder.connection.Connection)6 CompositeIndicator (org.talend.dataquality.indicators.CompositeIndicator)6 MetadataTableRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject)5 TreeEditor (org.eclipse.swt.custom.TreeEditor)4 MouseAdapter (org.eclipse.swt.events.MouseAdapter)4 MouseEvent (org.eclipse.swt.events.MouseEvent)4 Composite (org.eclipse.swt.widgets.Composite)4 Label (org.eclipse.swt.widgets.Label)4