use of org.talend.dq.nodes.PatternSqlFolderRepNode 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;
}
use of org.talend.dq.nodes.PatternSqlFolderRepNode 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;
}
Aggregations