Search in sources :

Example 1 with IndicatorCategory

use of org.talend.dataquality.indicators.definition.IndicatorCategory in project tdq-studio-se by Talend.

the class UDIMasterPage method updateIndicatorCategoryDetail.

/**
 * update Indicator Category Detail(yyi 2009-09-23 Feature 9059).
 */
protected void updateIndicatorCategoryDetail() {
    String categoryLabel = comboCategory.getText();
    if (StringUtils.isNotBlank(categoryLabel)) {
        IndicatorCategory ic = DefinitionHandler.getInstance().getIndicatorCategoryByLabel(categoryLabel);
        if (ic != null) {
            String purposeString = PluginConstant.EMPTY_STRING;
            String descriptionString = PluginConstant.EMPTY_STRING;
            for (TaggedValue value : ic.getTaggedValue()) {
                if ("Purpose".equals(value.getTag())) {
                    // $NON-NLS-1$
                    // $NON-NLS-1$
                    purposeString = DefaultMessagesImpl.getString("IndicatorDefinitionMaterPage.Purpose") + value.getValue();
                } else if ("Description".equals(value.getTag())) {
                    // $NON-NLS-1$
                    descriptionString = // $NON-NLS-1$
                    DefaultMessagesImpl.getString("IndicatorDefinitionMaterPage.Description") + value.getValue();
                }
            }
            labelDetail.setText(// $NON-NLS-1$//$NON-NLS-2$
            purposeString + System.getProperty("line.separator") + System.getProperty("line.separator") + descriptionString);
        }
    }
}
Also used : TaggedValue(orgomg.cwm.objectmodel.core.TaggedValue) IndicatorCategory(org.talend.dataquality.indicators.definition.IndicatorCategory)

Example 2 with IndicatorCategory

use of org.talend.dataquality.indicators.definition.IndicatorCategory in project tdq-studio-se by Talend.

the class CompositeIndicator method getIndicatorComposite.

public Map<EIndicatorChartType, List<IndicatorUnit>> getIndicatorComposite(ModelElementIndicator modelElementIndicator) {
    this.clear();
    List<IndicatorUnit> tempList = new ArrayList<IndicatorUnit>();
    this.indicatorUnits = initChildIndicatorUnits(tempList, modelElementIndicator.getIndicatorUnits());
    for (IndicatorUnit one : indicatorUnits) {
        switch(one.getType()) {
            case RowCountIndicatorEnum:
            case NullCountIndicatorEnum:
            case DistinctCountIndicatorEnum:
            case UniqueIndicatorEnum:
            case DuplicateCountIndicatorEnum:
            case BlankCountIndicatorEnum:
            case DefValueCountIndicatorEnum:
                simpleList.add(one);
                break;
            case MinLengthIndicatorEnum:
            case MinLengthWithNullIndicatorEnum:
            case MinLengthWithBlankIndicatorEnum:
            case MinLengthWithBlankNullIndicatorEnum:
            case MaxLengthIndicatorEnum:
            case MaxLengthWithNullIndicatorEnum:
            case MaxLengthWithBlankIndicatorEnum:
            case MaxLengthWithBlankNullIndicatorEnum:
            case AverageLengthIndicatorEnum:
            case AverageLengthWithNullIndicatorEnum:
            case AverageLengthWithBlankIndicatorEnum:
            case AverageLengthWithNullBlankIndicatorEnum:
                textList.add(one);
                break;
            case FrequencyIndicatorEnum:
                frequencyList.add(one);
                break;
            // MOD yyi 2010-10-08 16081
            case WeekFrequencyIndicatorEnum:
                weekFrequencyList.add(one);
                break;
            case MonthFrequencyIndicatorEnum:
                monthFrequencyList.add(one);
                break;
            case QuarterFrequencyIndicatorEnum:
                quarterFrequencyList.add(one);
                break;
            case YearFrequencyIndicatorEnum:
                yearFrequencyList.add(one);
                break;
            case DateFrequencyIndicatorEnum:
                dateFrequencyList.add(one);
                break;
            case BinFrequencyIndicatorEnum:
                binFrequencyList.add(one);
                break;
            case LowFrequencyIndicatorEnum:
                lowFrequencyList.add(one);
                break;
            case WeekLowFrequencyIndicatorEnum:
                weekLowFrequencyList.add(one);
                break;
            case MonthLowFrequencyIndicatorEnum:
                monthLowFrequencyList.add(one);
                break;
            case QuarterLowFrequencyIndicatorEnum:
                quarterLowFrequencyList.add(one);
                break;
            case YearLowFrequencyIndicatorEnum:
                yearLowFrequencyList.add(one);
                break;
            case DateLowFrequencyIndicatorEnum:
                dateLowFrequencyList.add(one);
                break;
            // ~
            case BinLowFrequencyIndicatorEnum:
                binLowFrequencyList.add(one);
                break;
            // ~ MOD mzhao 2009-03-23 Feature 6307
            case SoundexIndicatorEnum:
                soundexFrequencyList.add(one);
                break;
            case SoundexLowIndicatorEnum:
                soundexLowFrequencyList.add(one);
                break;
            // ~
            case PatternFreqIndicatorEnum:
                patternFrequencylist.add(one);
                break;
            case PatternLowFreqIndicatorEnum:
                patternLowFrequencyList.add(one);
                break;
            case EastAsiaPatternFreqIndicatorEnum:
                eastAsiaPatternFrequencylist.add(one);
                break;
            case EastAsiaPatternLowFreqIndicatorEnum:
                eastAsiaPatternLowFrequencyList.add(one);
                break;
            case DatePatternFreqIndicatorEnum:
                datePatternFrequencyList.add(one);
                break;
            case IQRIndicatorEnum:
            case RangeIndicatorEnum:
            case MeanIndicatorEnum:
            case MinValueIndicatorEnum:
            case MaxValueIndicatorEnum:
            case MedianIndicatorEnum:
            case LowerQuartileIndicatorEnum:
            case UpperQuartileIndicatorEnum:
                summaryList.add(one);
                break;
            case RegexpMatchingIndicatorEnum:
                patternList.add(one);
                break;
            case SqlPatternMatchingIndicatorEnum:
                sqlPatternList.add(one);
                break;
            case ModeIndicatorEnum:
                modelIndicatorList.add(one);
                break;
            case UserDefinedIndicatorEnum:
                IndicatorCategory ic = UDIUtils.getUDICategory(one);
                if (DefinitionHandler.getInstance().getUserDefinedCountIndicatorCategory().equals(ic)) {
                    udiCountList.add(one);
                } else if (DefinitionHandler.getInstance().getUserDefinedMatchIndicatorCategory().equals(ic)) {
                    udiMatchingList.add(one);
                } else if (DefinitionHandler.getInstance().getUserDefinedFrequencyIndicatorCategory().equals(ic)) {
                    udiFrequencyList.add(one);
                } else if (DefinitionHandler.getInstance().getUserDefinedRealValueIndicatorCategory().equals(ic)) {
                    udiRealValueList.add(one);
                }
                break;
            case ValidPhoneCountIndicatorEnum:
            case PossiblePhoneCountIndicatorEnum:
            case ValidRegCodeCountIndicatorEnum:
            case InvalidRegCodeCountIndicatorEnum:
            case WellFormE164PhoneCountIndicatorEnum:
            case WellFormIntePhoneCountIndicatorEnum:
            case WellFormNationalPhoneCountIndicatorEnum:
                phoneNumbList.add(one);
                break;
            case FormatFreqPieIndictorEnum:
                formatFreqList.add(one);
                break;
            case BenfordLawFrequencyIndicatorEnum:
                fraudList.add(one);
                break;
            default:
        }
    }
    separatedMap.put(EIndicatorChartType.SIMPLE_STATISTICS, simpleList);
    separatedMap.put(EIndicatorChartType.TEXT_STATISTICS, textList);
    separatedMap.put(EIndicatorChartType.FREQUENCE_STATISTICS, frequencyList);
    separatedMap.put(EIndicatorChartType.LOW_FREQUENCE_STATISTICS, lowFrequencyList);
    // MOD klliu 2010-08-06 bug 14695
    separatedMap.put(EIndicatorChartType.BIN_FREQUENCE_STATISTICS, binFrequencyList);
    separatedMap.put(EIndicatorChartType.BIN_LOW_FREQUENCE_STATISTICS, binLowFrequencyList);
    // MOD yyi 2010-10-08 16081
    separatedMap.put(EIndicatorChartType.DATE_FREQUENCE_STATISTICS, dateFrequencyList);
    separatedMap.put(EIndicatorChartType.DATE_LOW_FREQUENCE_STATISTICS, dateLowFrequencyList);
    separatedMap.put(EIndicatorChartType.WEEK_FREQUENCE_STATISTICS, weekFrequencyList);
    separatedMap.put(EIndicatorChartType.WEEK_LOW_FREQUENCE_STATISTICS, weekLowFrequencyList);
    separatedMap.put(EIndicatorChartType.MONTH_FREQUENCE_STATISTICS, monthFrequencyList);
    separatedMap.put(EIndicatorChartType.MONTH_LOW_FREQUENCE_STATISTICS, monthLowFrequencyList);
    separatedMap.put(EIndicatorChartType.QUARTER_FREQUENCE_STATISTICS, quarterFrequencyList);
    separatedMap.put(EIndicatorChartType.QUARTER_LOW_FREQUENCE_STATISTICS, quarterLowFrequencyList);
    separatedMap.put(EIndicatorChartType.YEAR_FREQUENCE_STATISTICS, yearFrequencyList);
    separatedMap.put(EIndicatorChartType.YEAR_LOW_FREQUENCE_STATISTICS, yearLowFrequencyList);
    // ~
    separatedMap.put(EIndicatorChartType.SOUNDEX_FREQUENCY_TABLE, soundexFrequencyList);
    separatedMap.put(EIndicatorChartType.SOUNDEX_LOW_FREQUENCY_TABLE, soundexLowFrequencyList);
    separatedMap.put(EIndicatorChartType.PATTERN_FREQUENCE_STATISTICS, patternFrequencylist);
    separatedMap.put(EIndicatorChartType.PATTERN_LOW_FREQUENCE_STATISTICS, patternLowFrequencyList);
    separatedMap.put(EIndicatorChartType.EAST_ASIA_PATTERN_FREQUENCE_STATISTICS, eastAsiaPatternFrequencylist);
    separatedMap.put(EIndicatorChartType.EAST_ASIA_PATTERN_LOW_FREQUENCE_STATISTICS, eastAsiaPatternLowFrequencyList);
    separatedMap.put(EIndicatorChartType.DATE_PATTERN_FREQUENCE_STATISTICS, datePatternFrequencyList);
    separatedMap.put(EIndicatorChartType.SUMMARY_STATISTICS, summaryList);
    separatedMap.put(EIndicatorChartType.PATTERN_MATCHING, patternList);
    separatedMap.put(EIndicatorChartType.SQL_PATTERN_MATCHING, sqlPatternList);
    separatedMap.put(EIndicatorChartType.MODE_INDICATOR, modelIndicatorList);
    separatedMap.put(EIndicatorChartType.UDI_COUNT, udiCountList);
    separatedMap.put(EIndicatorChartType.UDI_FREQUENCY, udiFrequencyList);
    separatedMap.put(EIndicatorChartType.UDI_MATCHING, udiMatchingList);
    separatedMap.put(EIndicatorChartType.UDI_REALVALUE, udiRealValueList);
    separatedMap.put(EIndicatorChartType.PHONE_NUMBER_STATISTICS, phoneNumbList);
    separatedMap.put(EIndicatorChartType.FORMAT_FREQ_PIE_STATISTICS, formatFreqList);
    separatedMap.put(EIndicatorChartType.BENFORD_LAW_STATISTICS, fraudList);
    return separatedMap;
}
Also used : ArrayList(java.util.ArrayList) IndicatorCategory(org.talend.dataquality.indicators.definition.IndicatorCategory)

Example 3 with IndicatorCategory

use of org.talend.dataquality.indicators.definition.IndicatorCategory in project tdq-studio-se by Talend.

the class SimpleStatisticsExplorer method getQueryForViewRows.

/**
 * get Query For View Rows.
 *
 * @param indicatorDefinition
 * @return
 */
private String getQueryForViewRows(IndicatorDefinition indicatorDefinition) {
    String sql = PluginConstant.EMPTY_STRING;
    IndicatorCategory category = IndicatorCategoryHelper.getCategory(indicatorDefinition);
    EList<TdExpression> list = ((UDIndicatorDefinition) indicatorDefinition).getViewRowsExpression();
    TdExpression tdExp = DbmsLanguage.getSqlExpression(indicatorDefinition, dbmsLanguage.getDbmsName(), list, dbmsLanguage.getDbVersion());
    sql = tdExp.getBody();
    String dataFilterClause = getDataFilterClause();
    if (!dataFilterClause.equals(PluginConstant.EMPTY_STRING)) {
        // $NON-NLS-1$ //$NON-NLS-2$
        sql = sql.replace(GenericSQLHandler.WHERE_CLAUSE, dbmsLanguage.where() + "(" + dataFilterClause + ")");
        // $NON-NLS-1$ //$NON-NLS-2$
        sql = sql.replace(GenericSQLHandler.AND_WHERE_CLAUSE, dbmsLanguage.and() + "(" + dataFilterClause + ")");
    } else {
        sql = sql.replace(GenericSQLHandler.WHERE_CLAUSE, PluginConstant.EMPTY_STRING);
        sql = sql.replace(GenericSQLHandler.AND_WHERE_CLAUSE, PluginConstant.EMPTY_STRING);
    }
    String tableName = getFullyQualifiedTableName(this.indicator.getAnalyzedElement());
    sql = sql.replace(GenericSQLHandler.TABLE_NAME, tableName);
    // TDQ-12398 msjian: add quote for the column
    sql = sql.replace(GenericSQLHandler.COLUMN_NAMES, dbmsLanguage.quote(this.indicator.getAnalyzedElement().getName()));
    if (sql.indexOf(GenericSQLHandler.UDI_INDICATOR_VALUE) != -1) {
        if (IndicatorCategoryHelper.isUserDefRealValue(category)) {
            // replace <%=__INDICATOR_VALUE__%>
            Double realValue = this.indicator.getRealValue();
            // $NON-NLS-1$
            sql = sql.replace(GenericSQLHandler.UDI_INDICATOR_VALUE, realValue == null ? "0" : realValue.toString());
        } else {
            sql = sql.replace(GenericSQLHandler.UDI_INDICATOR_VALUE, (String.valueOf(this.indicator.getIntegerValue().intValue())));
        }
    }
    return sql;
}
Also used : TdExpression(org.talend.cwm.relational.TdExpression) UDIndicatorDefinition(org.talend.dataquality.indicators.definition.userdefine.UDIndicatorDefinition) IndicatorCategory(org.talend.dataquality.indicators.definition.IndicatorCategory)

Example 4 with IndicatorCategory

use of org.talend.dataquality.indicators.definition.IndicatorCategory in project tdq-studio-se by Talend.

the class DqRuleBuilder method initializeDqRuleBuilder.

public boolean initializeDqRuleBuilder(String ruleName) {
    if (initialized) {
        // $NON-NLS-1$
        log.warn(Messages.getString("DqRuleBuilder.Initialized"));
        return false;
    }
    this.whereRule = RulesFactory.eINSTANCE.createWhereRule();
    whereRule.setName(ruleName);
    IndicatorCategory ruleIndicatorCategory = DefinitionHandler.getInstance().getDQRuleIndicatorCategory();
    if (ruleIndicatorCategory != null) {
        whereRule.getCategories().add(ruleIndicatorCategory);
    }
    return true;
}
Also used : IndicatorCategory(org.talend.dataquality.indicators.definition.IndicatorCategory)

Example 5 with IndicatorCategory

use of org.talend.dataquality.indicators.definition.IndicatorCategory in project tdq-studio-se by Talend.

the class DqRuleBuilder method initializeParserRuleBuilder.

public boolean initializeParserRuleBuilder(String ruleName) {
    if (initialized) {
        // $NON-NLS-1$
        log.warn(Messages.getString("DqRuleBuilder.Initialized"));
        return false;
    }
    this.parserRule = RulesFactory.eINSTANCE.createParserRule();
    parserRule.setName(ruleName);
    IndicatorCategory ruleIndicatorCategory = DefinitionHandler.getInstance().getDQRuleIndicatorCategory();
    if (ruleIndicatorCategory != null) {
        parserRule.getCategories().add(ruleIndicatorCategory);
    }
    return true;
}
Also used : IndicatorCategory(org.talend.dataquality.indicators.definition.IndicatorCategory)

Aggregations

IndicatorCategory (org.talend.dataquality.indicators.definition.IndicatorCategory)17 TdExpression (org.talend.cwm.relational.TdExpression)5 ArrayList (java.util.ArrayList)4 IFolder (org.eclipse.core.resources.IFolder)3 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 IndicatorDefinition (org.talend.dataquality.indicators.definition.IndicatorDefinition)2 UDIndicatorDefinition (org.talend.dataquality.indicators.definition.userdefine.UDIndicatorDefinition)2 ParserRule (org.talend.dataquality.rules.ParserRule)2 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 List (java.util.List)1 CoreException (org.eclipse.core.runtime.CoreException)1 EList (org.eclipse.emf.common.util.EList)1 LoginException (org.talend.commons.exception.LoginException)1 PersistenceException (org.talend.commons.exception.PersistenceException)1 Property (org.talend.core.model.properties.Property)1 Folder (org.talend.core.model.repository.Folder)1 BusinessRuleItemEditorInput (org.talend.dataprofiler.core.ui.editor.dqrules.BusinessRuleItemEditorInput)1 DQRuleEditor (org.talend.dataprofiler.core.ui.editor.dqrules.DQRuleEditor)1 AverageLengthIndicator (org.talend.dataquality.indicators.AverageLengthIndicator)1