Search in sources :

Example 1 with AnalysisFolderRepNode

use of org.talend.dq.nodes.AnalysisFolderRepNode 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;
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) ReportFolderRepNode(org.talend.dq.nodes.ReportFolderRepNode) ArrayList(java.util.ArrayList) AnalysisFolderRepNode(org.talend.dq.nodes.AnalysisFolderRepNode) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode)

Example 2 with AnalysisFolderRepNode

use of org.talend.dq.nodes.AnalysisFolderRepNode 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 3 with AnalysisFolderRepNode

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

the class TestComparisonLevelFactoryTest method testCreatComparisonLevelObject_8.

// other type
@Test
public void testCreatComparisonLevelObject_8() {
    Project tProject = ProjectManager.getInstance().getCurrentProject();
    if (tProject != null && tProject.getEmfProject() != null && tProject.getAuthor() != null) {
        IRepositoryViewObject viewObject = UnitTestBuildHelper.buildRepositoryViewObjectSystemFolder(tProject.getEmfProject(), tProject.getAuthor(), ERepositoryObjectType.TDQ_ANALYSIS_ELEMENT);
        RepositoryNode node = new RepositoryNode(viewObject, null, ENodeType.SYSTEM_FOLDER);
        viewObject.setRepositoryNode(node);
        AnalysisFolderRepNode AnalysisFolderRepNode = new AnalysisFolderRepNode(viewObject, null, ENodeType.SYSTEM_FOLDER, tProject);
        IComparisonLevel level = ComparisonLevelFactory.creatComparisonLevel(AnalysisFolderRepNode);
        Assert.assertNull(level);
    }
}
Also used : Project(org.talend.core.model.general.Project) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) AnalysisFolderRepNode(org.talend.dq.nodes.AnalysisFolderRepNode) RepositoryNode(org.talend.repository.model.RepositoryNode) Test(org.junit.Test)

Example 4 with AnalysisFolderRepNode

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

the class DQRepositoryViewLabelProviderWithFilter method getText.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataprofiler.core.ui.views.provider.DQRepositoryViewLabelProvider#getText(java.lang.Object)
     */
@Override
public String getText(Object element) {
    if (element instanceof AnalysisFolderRepNode) {
        AnalysisFolderRepNode subFolderNode = (AnalysisFolderRepNode) element;
        String label = StringUtils.EMPTY;
        if (subFolderNode.getObject() != null) {
            label = subFolderNode.getObject().getLabel();
        } else {
            label = subFolderNode.getLabel();
        }
        // $NON-NLS-1$ //$NON-NLS-2$
        return label + "(" + subFolderNode.getChildrenAll(false, filter).size() + ")";
    }
    return super.getText(element);
}
Also used : AnalysisFolderRepNode(org.talend.dq.nodes.AnalysisFolderRepNode)

Example 5 with AnalysisFolderRepNode

use of org.talend.dq.nodes.AnalysisFolderRepNode 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;
}
Also used : DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode) IndicatorFolderRepNode(org.talend.dq.nodes.IndicatorFolderRepNode) SourceFileFolderRepNode(org.talend.dq.nodes.SourceFileFolderRepNode) JrxmlTempFolderRepNode(org.talend.dq.nodes.JrxmlTempFolderRepNode) HadoopClusterFolderRepNode(org.talend.dq.nodes.hadoopcluster.HadoopClusterFolderRepNode) PatternFolderRepNode(org.talend.dq.nodes.PatternFolderRepNode) RulesFolderRepNode(org.talend.dq.nodes.RulesFolderRepNode) ReportFolderRepNode(org.talend.dq.nodes.ReportFolderRepNode) AnalysisFolderRepNode(org.talend.dq.nodes.AnalysisFolderRepNode) ExchangeFolderRepNode(org.talend.dataprofiler.core.ui.exchange.ExchangeFolderRepNode) DBConnectionFolderRepNode(org.talend.dq.nodes.DBConnectionFolderRepNode) DFConnectionFolderRepNode(org.talend.dq.nodes.DFConnectionFolderRepNode)

Aggregations

AnalysisFolderRepNode (org.talend.dq.nodes.AnalysisFolderRepNode)6 RepositoryNode (org.talend.repository.model.RepositoryNode)4 DQRepositoryNode (org.talend.dq.nodes.DQRepositoryNode)3 ReportFolderRepNode (org.talend.dq.nodes.ReportFolderRepNode)3 ArrayList (java.util.ArrayList)2 IRepositoryNode (org.talend.repository.model.IRepositoryNode)2 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 Test (org.junit.Test)1 Project (org.talend.core.model.general.Project)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 CreateNewAnalysisAction (org.talend.dataprofiler.core.ui.action.actions.CreateNewAnalysisAction)1 ExchangeFolderRepNode (org.talend.dataprofiler.core.ui.exchange.ExchangeFolderRepNode)1 AnalysisSubFolderRepNode (org.talend.dq.nodes.AnalysisSubFolderRepNode)1 DBConnectionFolderRepNode (org.talend.dq.nodes.DBConnectionFolderRepNode)1 DFConnectionFolderRepNode (org.talend.dq.nodes.DFConnectionFolderRepNode)1 IndicatorFolderRepNode (org.talend.dq.nodes.IndicatorFolderRepNode)1 JrxmlTempFolderRepNode (org.talend.dq.nodes.JrxmlTempFolderRepNode)1 PatternFolderRepNode (org.talend.dq.nodes.PatternFolderRepNode)1 PatternRegexFolderRepNode (org.talend.dq.nodes.PatternRegexFolderRepNode)1 PatternRegexSubFolderRepNode (org.talend.dq.nodes.PatternRegexSubFolderRepNode)1