use of org.talend.dq.nodes.ReportFolderRepNode in project tdq-studio-se by Talend.
the class UnitTestBuildHelper method createRealReportSubFolderRepNode.
/**
* create a real ReportSubFolderRepNode.
*
* @param parentNode the parent node
* @param folderName the folder name
* @return
*/
public static ReportSubFolderRepNode createRealReportSubFolderRepNode(RepositoryNode parentNode, String folderName) {
ReportSubFolderRepNode folderNode = null;
// create the sub folder
IFolder iFolder = RepositoryNodeHelper.getIFolder(parentNode);
createRealFolder(iFolder, folderName);
// get the ReportSubFolderRepNode
List<IRepositoryNode> subFolders = new ArrayList<IRepositoryNode>();
if (parentNode instanceof ReportFolderRepNode) {
subFolders = ((ReportFolderRepNode) parentNode).getChildren(false);
} else if (parentNode instanceof ReportSubFolderRepNode) {
subFolders = ((ReportSubFolderRepNode) parentNode).getChildren(false);
}
if (!subFolders.isEmpty()) {
for (IRepositoryNode node : subFolders) {
if (node instanceof ReportSubFolderRepNode) {
ReportSubFolderRepNode subNode = (ReportSubFolderRepNode) node;
if (folderName.equals(subNode.getLabel())) {
folderNode = subNode;
break;
}
}
}
}
return folderNode;
}
use of org.talend.dq.nodes.ReportFolderRepNode in project tdq-studio-se by Talend.
the class RepositoryNodeHelper method getDataProfilingRepositoryNodes.
public static List<IRepositoryNode> getDataProfilingRepositoryNodes(boolean withDeleted) {
// t.DATA_PROFILING.getName());
RepositoryNode node = getRootNode(ERepositoryObjectType.TDQ_DATA_PROFILING);
List<IRepositoryNode> dataProfilingNodes = new ArrayList<IRepositoryNode>();
if (node != null) {
List<IRepositoryNode> childrens = node.getChildren();
for (IRepositoryNode subNode : childrens) {
if (subNode instanceof AnalysisFolderRepNode || subNode instanceof ReportFolderRepNode) {
dataProfilingNodes.addAll(getModelElementFromFolder(subNode, withDeleted));
}
}
}
return dataProfilingNodes;
}
use of org.talend.dq.nodes.ReportFolderRepNode 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.ReportFolderRepNode in project tdq-studio-se by Talend.
the class RepositoryNodeBuilder method createRepositoryNode.
private RepositoryNode createRepositoryNode(IRepositoryViewObject folder, RepositoryNode parentNode, EResourceConstant resConstant, org.talend.core.model.general.Project inWhichProject) throws PersistenceException {
DQRepositoryNode subFolderNode = null;
switch(resConstant) {
case ANALYSIS:
AnalysisFolderRepNode anaFolderNode = new AnalysisFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(anaFolderNode);
parentNode.getChildren().add(anaFolderNode);
return anaFolderNode;
case REPORTS:
ReportFolderRepNode repFolderNode = new ReportFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(repFolderNode);
parentNode.getChildren().add(repFolderNode);
return repFolderNode;
case INDICATORS:
IndicatorFolderRepNode indicatorFolderRepNode = new IndicatorFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(indicatorFolderRepNode);
parentNode.getChildren().add(indicatorFolderRepNode);
return indicatorFolderRepNode;
case JRXML_TEMPLATE:
JrxmlTempFolderRepNode jrxmlFolderNode = new JrxmlTempFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(jrxmlFolderNode);
parentNode.getChildren().add(jrxmlFolderNode);
return jrxmlFolderNode;
case SOURCE_FILES:
SourceFileFolderRepNode sourceFileFolder = new SourceFileFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(sourceFileFolder);
parentNode.getChildren().add(sourceFileFolder);
return sourceFileFolder;
case PATTERNS:
PatternFolderRepNode patternFolder = new PatternFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(patternFolder);
parentNode.getChildren().add(patternFolder);
return patternFolder;
case RULES:
RulesFolderRepNode ruleFolder = new RulesFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(ruleFolder);
parentNode.getChildren().add(ruleFolder);
return ruleFolder;
case DB_CONNECTIONS:
DBConnectionFolderRepNode dbFolder = new DBConnectionFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(dbFolder);
parentNode.getChildren().add(dbFolder);
return dbFolder;
case FILEDELIMITED:
DFConnectionFolderRepNode dfmFolder = new DFConnectionFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(dfmFolder);
parentNode.getChildren().add(dfmFolder);
return dfmFolder;
case HADOOP_CLUSTER:
if (HadoopClusterUtils.getDefault().isServiceInstalled()) {
HadoopClusterFolderRepNode hcFolder = new HadoopClusterFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(hcFolder);
parentNode.getChildren().add(hcFolder);
return hcFolder;
}
case EXCHANGE:
ExchangeFolderRepNode exchangeFolder = new ExchangeFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(exchangeFolder);
parentNode.getChildren().add(exchangeFolder);
return exchangeFolder;
default:
subFolderNode = new DQRepositoryNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
folder.setRepositoryNode(subFolderNode);
parentNode.getChildren().add(subFolderNode);
if (resConstant.equals(EResourceConstant.PATTERNS)) {
// MOD gdbu 2011-8-26 bug 23303 : initialization regex and sql folder when initialization pattern folder
createRepositoryNodeSubSystemFolder(subFolderNode, EResourceConstant.PATTERN_REGEX, inWhichProject);
createRepositoryNodeSubSystemFolder(subFolderNode, EResourceConstant.PATTERN_SQL, inWhichProject);
}
break;
}
return subFolderNode;
}
use of org.talend.dq.nodes.ReportFolderRepNode in project tdq-studio-se by Talend.
the class UnitTestBuildHelper method createRealReportFolderRepNode.
/**
* create the real ReportFolderRepNode.
*
* @param parentNode
* @return
*/
public static ReportFolderRepNode createRealReportFolderRepNode(RepositoryNode parentNode) {
ReportFolderRepNode node = null;
RepositoryNodeBuilder instance = RepositoryNodeBuilder.getInstance();
try {
node = (ReportFolderRepNode) instance.createRepositoryNodeSystemFolder(instance.getFolderHelper(), parentNode, EResourceConstant.REPORTS);
} catch (PersistenceException e) {
Assert.fail(e.getMessage());
}
return node;
}
Aggregations