Search in sources :

Example 1 with RulesSQLFolderRepNode

use of org.talend.dq.nodes.RulesSQLFolderRepNode in project tdq-studio-se by Talend.

the class RepositoryNodeHelper method getModelElementRepNodes.

/**
 * get RepositoryNode which contains a ModelElment(include: Analysis, Report, IndicatorDefinition, Pattern, DqRule)
 * under the parentNode.
 *
 * @param parentNode
 * @param recursive
 * @return
 */
public static List<RepositoryNode> getModelElementRepNodes(RepositoryNode parentNode, boolean recursive) {
    List<RepositoryNode> result = new ArrayList<RepositoryNode>();
    List<IRepositoryNode> children = parentNode.getChildren();
    for (IRepositoryNode node : children) {
        ModelElement modelElementFromRepositoryNode = RepositoryNodeHelper.getModelElementFromRepositoryNode(node);
        if (modelElementFromRepositoryNode != null) {
            result.add((RepositoryNode) node);
        } else {
            boolean isFolder = false;
            if (node instanceof AnalysisFolderRepNode) {
                AnalysisFolderRepNode anaFolderRepNode = (AnalysisFolderRepNode) node;
                isFolder = !anaFolderRepNode.isVirtualFolder();
            } else if (node instanceof ReportFolderRepNode) {
                ReportFolderRepNode repFolderRepNode = (ReportFolderRepNode) node;
                isFolder = !repFolderRepNode.isVirtualFolder();
            } else if (node instanceof UserDefIndicatorFolderRepNode || node instanceof PatternRegexFolderRepNode || node instanceof PatternRegexSubFolderRepNode || node instanceof PatternSqlFolderRepNode || node instanceof PatternSqlSubFolderRepNode || node instanceof RulesSQLFolderRepNode) {
                isFolder = true;
            }
            if (isFolder && recursive) {
                result.addAll(getModelElementRepNodes((RepositoryNode) node, recursive));
            }
        }
    }
    return result;
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) ReportFolderRepNode(org.talend.dq.nodes.ReportFolderRepNode) PatternSqlSubFolderRepNode(org.talend.dq.nodes.PatternSqlSubFolderRepNode) ArrayList(java.util.ArrayList) UserDefIndicatorFolderRepNode(org.talend.dq.nodes.UserDefIndicatorFolderRepNode) AnalysisFolderRepNode(org.talend.dq.nodes.AnalysisFolderRepNode) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode) RulesSQLFolderRepNode(org.talend.dq.nodes.RulesSQLFolderRepNode) ModelElement(orgomg.cwm.objectmodel.core.ModelElement) PatternRegexFolderRepNode(org.talend.dq.nodes.PatternRegexFolderRepNode) PatternSqlFolderRepNode(org.talend.dq.nodes.PatternSqlFolderRepNode) PatternRegexSubFolderRepNode(org.talend.dq.nodes.PatternRegexSubFolderRepNode)

Aggregations

ArrayList (java.util.ArrayList)1 AnalysisFolderRepNode (org.talend.dq.nodes.AnalysisFolderRepNode)1 DQRepositoryNode (org.talend.dq.nodes.DQRepositoryNode)1 PatternRegexFolderRepNode (org.talend.dq.nodes.PatternRegexFolderRepNode)1 PatternRegexSubFolderRepNode (org.talend.dq.nodes.PatternRegexSubFolderRepNode)1 PatternSqlFolderRepNode (org.talend.dq.nodes.PatternSqlFolderRepNode)1 PatternSqlSubFolderRepNode (org.talend.dq.nodes.PatternSqlSubFolderRepNode)1 ReportFolderRepNode (org.talend.dq.nodes.ReportFolderRepNode)1 RulesSQLFolderRepNode (org.talend.dq.nodes.RulesSQLFolderRepNode)1 UserDefIndicatorFolderRepNode (org.talend.dq.nodes.UserDefIndicatorFolderRepNode)1 IRepositoryNode (org.talend.repository.model.IRepositoryNode)1 RepositoryNode (org.talend.repository.model.RepositoryNode)1 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)1