Search in sources :

Example 1 with LengthIndicator

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

the class DrillDownEditorInput method filterAdaptDataList.

/**
 * @return get the data which will be displayed on the drill down editor.
 */
public List<Object[]> filterAdaptDataList() {
    // get columnValue
    List<Object[]> newColumnElementList = new ArrayList<Object[]>();
    AnalyzedDataSet analysisDataSet = this.getAnalysis().getResults().getIndicToRowMap().get(currIndicator);
    // TDQ-10545 : when restart studio and without run analysis, analysisDataSet is null
    if (analysisDataSet == null) {
        return newColumnElementList;
    }
    // TDQ-10545~
    if (analysisDataSet.getData() != null && analysisDataSet.getData().size() > 0) {
        List<Object[]> dataList = analysisDataSet.getData();
        newColumnElementList.addAll(getDesignatedData(dataList));
    } else if (analysisDataSet.getFrequencyData() != null && analysisDataSet.getFrequencyData().size() > 0) {
        String selectValue = this.getSelectValue();
        if (currIndicator instanceof LengthIndicator) {
            selectValue = ((LengthIndicator) currIndicator).getLength().toString();
        }
        // MOD yyi 2011-12-14 TDQ-4166:View rows for Date Pattern Frequency Indicator.
        if (currIndicator instanceof DatePatternFreqIndicator) {
            for (Object expression : analysisDataSet.getFrequencyData().keySet()) {
                if (Pattern.matches(((DatePatternFreqIndicator) currIndicator).getRegex(selectValue), expression.toString())) {
                    newColumnElementList.addAll(analysisDataSet.getFrequencyData().get(expression));
                }
            }
        } else {
            // MOD msjian TDQ-4617 2012-2-8: fixed a NPE
            List<Object[]> list = analysisDataSet.getFrequencyData().get(selectValue);
            if (list != null && list.size() > 0) {
                newColumnElementList.addAll(list);
            }
        // TDQ-4617 ~
        }
    } else if (analysisDataSet.getPatternData() != null && analysisDataSet.getPatternData().size() > 0) {
        if (DrillDownUtils.judgeMenuType(getMenuType(), DrillDownUtils.MENU_INVALID_TYPE)) {
            newColumnElementList.addAll(getDesignatedData((List<Object[]>) analysisDataSet.getPatternData().get(AnalyzedDataSetImpl.INVALID_VALUE)));
        } else if (DrillDownUtils.judgeMenuType(getMenuType(), DrillDownUtils.MENU_VALID_TYPE)) {
            newColumnElementList.addAll(getDesignatedData((List<Object[]>) analysisDataSet.getPatternData().get(AnalyzedDataSetImpl.VALID_VALUE)));
        }
    }
    return newColumnElementList;
}
Also used : AnalyzedDataSet(org.talend.dataquality.analysis.AnalyzedDataSet) DatePatternFreqIndicator(org.talend.dataquality.indicators.DatePatternFreqIndicator) ArrayList(java.util.ArrayList) EObject(org.eclipse.emf.ecore.EObject) LengthIndicator(org.talend.dataquality.indicators.LengthIndicator) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 EObject (org.eclipse.emf.ecore.EObject)1 AnalyzedDataSet (org.talend.dataquality.analysis.AnalyzedDataSet)1 DatePatternFreqIndicator (org.talend.dataquality.indicators.DatePatternFreqIndicator)1 LengthIndicator (org.talend.dataquality.indicators.LengthIndicator)1