Search in sources :

Example 1 with PatternRegexFolderRepNode

use of org.talend.dq.nodes.PatternRegexFolderRepNode 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)

Example 2 with PatternRegexFolderRepNode

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

the class RepositoryNodeHelper method getPatternsRepositoryNodes.

public static List<IRepositoryNode> getPatternsRepositoryNodes(boolean withDeleted) {
    // .LIBRARIES.getName());
    RepositoryNode node = getRootNode(ERepositoryObjectType.TDQ_LIBRARIES);
    List<IRepositoryNode> patternsNodes = new ArrayList<IRepositoryNode>();
    if (node != null) {
        List<IRepositoryNode> childrens = node.getChildren();
        for (IRepositoryNode subNode : childrens) {
            if (EResourceConstant.PATTERNS.getName().equals((subNode.getObject().getLabel()))) {
                List<IRepositoryNode> subChildren = subNode.getChildren();
                for (IRepositoryNode patternsNode : subChildren) {
                    if (patternsNode instanceof PatternRegexFolderRepNode || patternsNode instanceof PatternSqlFolderRepNode) {
                        patternsNodes.addAll(getModelElementFromFolder(patternsNode, withDeleted));
                    }
                }
                return patternsNodes;
            }
        }
    }
    return patternsNodes;
}
Also used : PatternRegexFolderRepNode(org.talend.dq.nodes.PatternRegexFolderRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) PatternSqlFolderRepNode(org.talend.dq.nodes.PatternSqlFolderRepNode) ArrayList(java.util.ArrayList) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode)

Aggregations

ArrayList (java.util.ArrayList)2 DQRepositoryNode (org.talend.dq.nodes.DQRepositoryNode)2 PatternRegexFolderRepNode (org.talend.dq.nodes.PatternRegexFolderRepNode)2 PatternSqlFolderRepNode (org.talend.dq.nodes.PatternSqlFolderRepNode)2 IRepositoryNode (org.talend.repository.model.IRepositoryNode)2 RepositoryNode (org.talend.repository.model.RepositoryNode)2 AnalysisFolderRepNode (org.talend.dq.nodes.AnalysisFolderRepNode)1 PatternRegexSubFolderRepNode (org.talend.dq.nodes.PatternRegexSubFolderRepNode)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 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)1