Search in sources :

Example 31 with IndicatorEnum

use of org.talend.dq.nodes.indicator.type.IndicatorEnum in project tdq-studio-se by Talend.

the class ModelElementIndicatorImpl method removeChildrenEnumMap.

private void removeChildrenEnumMap(IndicatorEnum indicatorEnum) {
    if (indicatorEnum.hasChildren()) {
        for (IndicatorEnum childEnum : indicatorEnum.getChildren()) {
            this.flatIndicatorEnumList.remove(childEnum);
            plainIndicatorUnitMap.remove(childEnum);
            this.removeChildrenEnumMap(childEnum);
        }
    }
}
Also used : IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum)

Example 32 with IndicatorEnum

use of org.talend.dq.nodes.indicator.type.IndicatorEnum in project tdq-studio-se by Talend.

the class ColumnWizard method composePredefinedColumnIndicator.

protected ModelElementIndicator[] composePredefinedColumnIndicator(IndicatorEnum[] allowedEnum) {
    List<IRepositoryNode> nodes;
    // from the right menu
    if (selectionPage == null) {
        nodes = Arrays.asList(((AnalysisLabelParameter) parameter).getColumnNodes());
    } else {
        // TDQ-11240: get all the column nodes
        nodes = Arrays.asList(RepositoryNodeHelper.getAllColumnNodes(selectionPage.nodes.toArray(new IRepositoryNode[selectionPage.nodes.size()])));
    }
    ModelElementIndicator[] predefinedColumnIndicator = new ModelElementIndicator[nodes.size()];
    for (int i = 0; i < nodes.size(); i++) {
        IRepositoryNode columnNode = nodes.get(i);
        ModelElementIndicator columnIndicator = ModelElementIndicatorHelper.createModelElementIndicator(columnNode);
        for (IndicatorEnum oneEnum : allowedEnum) {
            columnIndicator.addTempIndicatorEnum(oneEnum);
            if (oneEnum.getChildren() != null) {
                for (IndicatorEnum childEnum : oneEnum.getChildren()) {
                    // MOD by zshen:need language to decide DatePatternFrequencyIndicator whether can be choose by
                    // user.
                    IRepositoryViewObject object = columnNode.getObject();
                    ModelElement element = null;
                    if (object instanceof MetadataColumnRepositoryObject) {
                        element = ((MetadataColumnRepositoryObject) object).getTdColumn();
                    } else if (object instanceof MetadataXmlElementTypeRepositoryObject) {
                        element = ((MetadataXmlElementTypeRepositoryObject) object).getModelElement();
                    }
                    if (element != null && ModelElementIndicatorRule.patternRule(childEnum, element, ExecutionLanguage.SQL)) {
                        columnIndicator.addTempIndicatorEnum(childEnum);
                    }
                }
            }
        }
        columnIndicator.storeTempIndicator();
        predefinedColumnIndicator[i] = columnIndicator;
    }
    return predefinedColumnIndicator;
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) IRepositoryNode(org.talend.repository.model.IRepositoryNode) IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) MetadataXmlElementTypeRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataXmlElementTypeRepositoryObject) AnalysisLabelParameter(org.talend.dq.analysis.parameters.AnalysisLabelParameter) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 33 with IndicatorEnum

use of org.talend.dq.nodes.indicator.type.IndicatorEnum in project tdq-studio-se by Talend.

the class CreateDateAnalysisAction method getPredefinedColumnIndicator.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataprofiler.core.ui.action.AbstractPredefinedAnalysisAction#getPredefinedColumnIndicator()
     */
@Override
protected ModelElementIndicator[] getPredefinedColumnIndicator() {
    int count = 5;
    if (isTimeType()) {
        count = 3;
    }
    IndicatorEnum[] allwedEnumes = new IndicatorEnum[count];
    allwedEnumes[0] = IndicatorEnum.CountsIndicatorEnum;
    allwedEnumes[1] = IndicatorEnum.MinValueIndicatorEnum;
    allwedEnumes[2] = IndicatorEnum.MaxValueIndicatorEnum;
    if (count == 5) {
        allwedEnumes[3] = IndicatorEnum.LowFrequencyIndicatorEnum;
        allwedEnumes[4] = IndicatorEnum.FrequencyIndicatorEnum;
    }
    ModelElementIndicator[] returnColumnIndicator = composePredefinedColumnIndicator(allwedEnumes);
    if (parameters != null) {
        for (ModelElementIndicator columnIndicator : returnColumnIndicator) {
            for (Indicator indicator : columnIndicator.getIndicators()) {
                if (indicator instanceof FrequencyIndicator) {
                    if (indicator.getParameters().getDateParameters() != null) {
                        // TODO If we will never use the
                        // "parameters" parameter, why we
                        // add TimeSliceOptionPage and have
                        // this loop
                        indicator.getParameters().getDateParameters().setDateAggregationType(parameters.getDateParameters().getDateAggregationType());
                    }
                }
            }
        }
    }
    return returnColumnIndicator;
}
Also used : IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum) FrequencyIndicator(org.talend.dataquality.indicators.FrequencyIndicator) Indicator(org.talend.dataquality.indicators.Indicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) FrequencyIndicator(org.talend.dataquality.indicators.FrequencyIndicator)

Aggregations

IndicatorEnum (org.talend.dq.nodes.indicator.type.IndicatorEnum)33 ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)10 IndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit)7 Indicator (org.talend.dataquality.indicators.Indicator)7 ArrayList (java.util.ArrayList)6 TableIndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit)4 RangeIndicator (org.talend.dataquality.indicators.RangeIndicator)4 RowCountIndicator (org.talend.dataquality.indicators.RowCountIndicator)4 TalendGridItem (org.eclipse.nebula.widgets.grid.TalendGridItem)3 Point (org.eclipse.swt.graphics.Point)3 TreeItem (org.eclipse.swt.widgets.TreeItem)3 BoxIndicator (org.talend.dataquality.indicators.BoxIndicator)3 CountsIndicator (org.talend.dataquality.indicators.CountsIndicator)3 IQRIndicator (org.talend.dataquality.indicators.IQRIndicator)3 PhoneNumbStatisticsIndicator (org.talend.dataquality.indicators.PhoneNumbStatisticsIndicator)3 IIndicatorNode (org.talend.dq.nodes.indicator.IIndicatorNode)3 IRepositoryNode (org.talend.repository.model.IRepositoryNode)3 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)2 MetadataXmlElementTypeRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataXmlElementTypeRepositoryObject)2