Search in sources :

Example 1 with IndicatorCategoryNode

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

the class IndicatorTreeModelBuilder method getNestFolderNodes.

/**
 * Create IIndicatorNode for every folder or file which is valid
 *
 * @param folder
 * @param indiEnum
 * @param resourceMap
 * @return nodes if folder is not empty else return empty array
 */
public static IIndicatorNode[] getNestFolderNodes(IFolder folder, IndicatorEnum indiEnum, ResourceFileMap resourceMap) {
    List<IIndicatorNode> chilren = new ArrayList<IIndicatorNode>();
    try {
        if (UDIHelper.isUDILibFolder(folder)) {
            return new IIndicatorNode[0];
        }
        for (IResource resource : folder.members()) {
            if (resource instanceof IFile) {
                IFile iFile = (IFile) resource;
                // TDQ-11217: ignore ".gitkeep" file under the git remote project's folders
                if (iFile.getName().equalsIgnoreCase(FilesUtils.GITKEEP)) {
                    continue;
                }
                // TDQ-11217~
                ModelElement modelElement = resourceMap.getModelElement(iFile);
                if (modelElement == null) {
                    continue;
                }
                Property property = PropertyHelper.getProperty(modelElement);
                if (property == null) {
                    continue;
                }
                IIndicatorNode indicatorNode = createLeafNode(property.getDisplayName(), indiEnum, modelElement);
                if (indicatorNode == null) {
                    continue;
                }
                chilren.add(indicatorNode);
            } else {
                ICategoryNode indicatorCateNode = new IndicatorCategoryNode(resource.getName());
                IIndicatorNode[] nestFolderNodes = getNestFolderNodes((IFolder) resource, indiEnum, resourceMap);
                if (nestFolderNodes.length > 0) {
                    indicatorCateNode.setChildren(nestFolderNodes);
                    chilren.add(indicatorCateNode);
                }
            }
        }
    } catch (CoreException e) {
    }
    return chilren.toArray(new IIndicatorNode[chilren.size()]);
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) IFile(org.eclipse.core.resources.IFile) CoreException(org.eclipse.core.runtime.CoreException) ArrayList(java.util.ArrayList) Property(org.talend.core.model.properties.Property) IResource(org.eclipse.core.resources.IResource) IndicatorCategoryNode(org.talend.dq.nodes.indicator.impl.IndicatorCategoryNode)

Example 2 with IndicatorCategoryNode

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

the class IndicatorTreeModelBuilder method buildIndicatorCategory.

/**
 * build Indicator Category. we DO NOT use the CACHE here, because sometimes, when the indicator definitions become
 * to Proxy, we can not get its property to get Label display on the select indicator dialog(can prefer to TDQ-8857)
 *
 * @return
 */
public static IIndicatorNode[] buildIndicatorCategory() {
    // if (indicatorCategoryNodes != null) {
    // return indicatorCategoryNodes;
    // }
    // build Basic Statistic categoryNode
    IndicatorCategoryNode simpleCategoryNode = new IndicatorCategoryNode(SIMPLE_LABEL, IndicatorEnum.CountsIndicatorEnum);
    // build Text statistics categoryNode
    IndicatorCategoryNode textCategoryNode = new IndicatorCategoryNode(TEXT_LABEL, IndicatorEnum.TextIndicatorEnum);
    // build Summary Statistic categoryNode
    IndicatorCategoryNode boxCategoryNode = new IndicatorCategoryNode(SUMMARY_LABEL, IndicatorEnum.BoxIIndicatorEnum);
    // build Pattern Frequency Statistics categoryNode
    IndicatorEnum[] patternFinderEnums = new IndicatorEnum[] { IndicatorEnum.PatternFreqIndicatorEnum, IndicatorEnum.PatternLowFreqIndicatorEnum, IndicatorEnum.EastAsiaPatternFreqIndicatorEnum, IndicatorEnum.EastAsiaPatternLowFreqIndicatorEnum, IndicatorEnum.DatePatternFreqIndicatorEnum };
    IndicatorCategoryNode patternFinderCategoryNode = new IndicatorCategoryNode(PATTERN_LABEL, patternFinderEnums);
    // MOD mzhao 2009-03-05 build Soundex Statistic categoryNode
    IndicatorEnum[] soundexIndicatorEnums = new IndicatorEnum[] { IndicatorEnum.SoundexIndicatorEnum, IndicatorEnum.SoundexLowIndicatorEnum };
    IndicatorCategoryNode soundexCategoryNode = new IndicatorCategoryNode(SOUNDEX_LABEL, soundexIndicatorEnums);
    IndicatorCategoryNode phoneCategoryNode = new IndicatorCategoryNode(PHONE_NUMBER_LABEL, IndicatorEnum.PhoneNumbStatisticsIndicatorEnum);
    // build Nominal Statistic categoryNode
    IndicatorEnum[] advanceIndicatorEnums = new IndicatorEnum[] { IndicatorEnum.ModeIndicatorEnum, IndicatorEnum.FrequencyIndicatorEnum, IndicatorEnum.DateFrequencyIndicatorEnum, IndicatorEnum.WeekFrequencyIndicatorEnum, IndicatorEnum.MonthFrequencyIndicatorEnum, IndicatorEnum.QuarterFrequencyIndicatorEnum, IndicatorEnum.YearFrequencyIndicatorEnum, IndicatorEnum.BinFrequencyIndicatorEnum, IndicatorEnum.LowFrequencyIndicatorEnum, IndicatorEnum.DateLowFrequencyIndicatorEnum, IndicatorEnum.WeekLowFrequencyIndicatorEnum, IndicatorEnum.MonthLowFrequencyIndicatorEnum, IndicatorEnum.QuarterLowFrequencyIndicatorEnum, IndicatorEnum.YearLowFrequencyIndicatorEnum, IndicatorEnum.BinLowFrequencyIndicatorEnum };
    IndicatorCategoryNode advanceCategoryNode = new IndicatorCategoryNode(ADVANCED_LABEL, advanceIndicatorEnums);
    // Added yyin 20120827, TDQ-5076, build Fraud Detection category and SIndicator
    IndicatorEnum[] fraudIndicatorEnums = new IndicatorEnum[] { IndicatorEnum.BenfordLawFrequencyIndicatorEnum };
    IndicatorCategoryNode fraudCategoryNode = new IndicatorCategoryNode(FRAUD_LABEL, fraudIndicatorEnums);
    // Add UDIEnums
    IndicatorCategoryNode UDICategoryNode = new IndicatorCategoryNode(UDI_LABEL);
    UDICategoryNode.setChildren(createUDIChildrens());
    // Add PatternEnums
    IndicatorCategoryNode regexPatternCategoryNode = new IndicatorCategoryNode(REGEX_PATTERN);
    regexPatternCategoryNode.setChildren(createRegexPatternChildrens());
    // new
    IndicatorCategoryNode sqlPatternCategoryNode = new IndicatorCategoryNode(SQL_PATTERN);
    // IndicatorEnum[]
    sqlPatternCategoryNode.setChildren(createSqlPatternChildrens());
    // {IndicatorEnum.SqlPatternMatchingIndicatorEnum
    // });
    IndicatorCategoryNode patternCategoryNode = new IndicatorCategoryNode(PATTERN, new IndicatorEnum[] { IndicatorEnum.PatternIndicatorEnum });
    patternCategoryNode.setChildren(new IIndicatorNode[] { sqlPatternCategoryNode, regexPatternCategoryNode });
    indicatorCategoryNodes = new IndicatorCategoryNode[] { simpleCategoryNode, textCategoryNode, boxCategoryNode, advanceCategoryNode, patternFinderCategoryNode, soundexCategoryNode, phoneCategoryNode, fraudCategoryNode, UDICategoryNode, patternCategoryNode };
    return indicatorCategoryNodes;
}
Also used : IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum) IndicatorCategoryNode(org.talend.dq.nodes.indicator.impl.IndicatorCategoryNode)

Example 3 with IndicatorCategoryNode

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

the class IndicatorTreeModelBuilder method getRootNode.

/**
 * Get the root node
 *
 * @return
 */
public static IIndicatorNode getRootNode() {
    // $NON-NLS-1$
    IndicatorCategoryNode rootNode = new IndicatorCategoryNode("root");
    rootNode.setChildren(buildIndicatorCategory());
    return rootNode;
}
Also used : IndicatorCategoryNode(org.talend.dq.nodes.indicator.impl.IndicatorCategoryNode)

Aggregations

IndicatorCategoryNode (org.talend.dq.nodes.indicator.impl.IndicatorCategoryNode)3 ArrayList (java.util.ArrayList)1 IFile (org.eclipse.core.resources.IFile)1 IResource (org.eclipse.core.resources.IResource)1 CoreException (org.eclipse.core.runtime.CoreException)1 Property (org.talend.core.model.properties.Property)1 IndicatorEnum (org.talend.dq.nodes.indicator.type.IndicatorEnum)1 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)1