Search in sources :

Example 1 with DQRepositoryNode

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

the class RepositoryNodeHelper method getAnalysisConComboDisplayName.

/**
 * get the connection node display name in the connection combo list of analysis editor.
 *
 * @param conNode
 * @return displayName
 */
public static String getAnalysisConComboDisplayName(IRepositoryNode conNode) {
    String displayName = conNode.getObject().getProperty().getDisplayName();
    // TDQ-10655: make the format of display is: label+(@reference project name)
    DQRepositoryNode dqRepositoryNode = (DQRepositoryNode) conNode;
    if (!dqRepositoryNode.getProject().isMainProject()) {
        displayName += dqRepositoryNode.getDisplayProjectName();
    }
    return displayName;
}
Also used : DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode)

Example 2 with DQRepositoryNode

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

the class RepositoryNodeHelper method recursiveFindFile.

/**
 * DOC msjian Comment method "recursiveFindFile".
 *
 * @param file
 * @return
 */
public static DQRepositoryNode recursiveFindFile(IFile file) {
    if (file == null) {
        return null;
    }
    String fileName = file.getName();
    List<?> fileRepNodes = null;
    if (fileName.toLowerCase().endsWith(PluginConstant.JRXML_STRING)) {
        fileRepNodes = getJrxmlFileRepNodes(getLibrariesFolderNode(EResourceConstant.JRXML_TEMPLATE), true);
    } else if (fileName.toLowerCase().endsWith(PluginConstant.SQL_STRING)) {
        fileRepNodes = getSourceFileRepNodes(getLibrariesFolderNode(EResourceConstant.SOURCE_FILES), true);
    }
    if (fileRepNodes != null) {
        for (int i = 0; i < fileRepNodes.size(); i++) {
            DQRepositoryNode childNode = (DQRepositoryNode) fileRepNodes.get(i);
            String childNodeFileName = PluginConstant.EMPTY_STRING;
            if (childNode instanceof JrxmlTempleteRepNode) {
                childNodeFileName = childNode.getObject().getProperty().eResource().getURI().lastSegment().replaceAll(PluginConstant.PROPERTIES_STRING, PluginConstant.JRXML_STRING);
            } else if (childNode instanceof SourceFileRepNode) {
                childNodeFileName = childNode.getObject().getProperty().eResource().getURI().lastSegment().replaceAll(PluginConstant.PROPERTIES_STRING, PluginConstant.SQL_STRING);
            }
            if (fileName.equals(childNodeFileName)) {
                return childNode;
            }
        }
    }
    return null;
}
Also used : DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode) JrxmlTempleteRepNode(org.talend.dq.nodes.JrxmlTempleteRepNode) SourceFileRepNode(org.talend.dq.nodes.SourceFileRepNode)

Example 3 with DQRepositoryNode

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

the class ResourceViewContentProvider method createNewRepNode.

private DQRepositoryNode createNewRepNode(ERepositoryObjectType type, org.talend.core.model.general.Project inWhichProject) {
    IRepositoryViewObject viewObject = null;
    FolderItem folderItem = ProxyRepositoryFactory.getInstance().getFolderItem(inWhichProject, type, Path.EMPTY);
    if (folderItem == null) {
        String folderName = ERepositoryObjectType.getFolderName(type);
        viewObject = new Folder(folderName, folderName);
    } else {
        viewObject = new Folder(folderItem.getProperty(), type);
    }
    DQRepositoryNode node = new DQRepositoryNode(viewObject, null, ENodeType.SYSTEM_FOLDER, inWhichProject);
    if (ERepositoryObjectType.CONTEXT == type) {
        node = new ContextFolderRepNode(viewObject, null, ENodeType.SYSTEM_FOLDER, inWhichProject);
    }
    viewObject.setRepositoryNode(node);
    return node;
}
Also used : DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode) FolderItem(org.talend.core.model.properties.FolderItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) Folder(org.talend.core.model.repository.Folder) IFolder(org.eclipse.core.resources.IFolder) ContextFolderRepNode(org.talend.dq.nodes.ContextFolderRepNode)

Example 4 with DQRepositoryNode

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

the class ResourceViewContentProvider method getRepositoryNodeChildren.

/**
 * DOC talend Comment method "getRepositoryNodeChildren".
 *
 * @param element
 * @param instance
 * @return
 * @throws PersistenceException
 * @throws CoreException
 */
private Object[] getRepositoryNodeChildren(Object element) throws PersistenceException, CoreException {
    final DQRepositoryNode node = (DQRepositoryNode) element;
    // MOD gdbu 2011-7-20 bug : 23220
    DQRepositoryNode.setIsReturnAllNodesWhenFiltering(false);
    List<IRepositoryNode> children = node.getChildren();
    DQRepositoryNode.setIsReturnAllNodesWhenFiltering(true);
    if ((node instanceof DBTableFolderRepNode || node instanceof DBViewFolderRepNode || node instanceof DBColumnFolderRepNode) && !DQRepositoryNode.isOnFilterring()) {
        if (0 < children.size()) {
            try {
                StructuredSelection structSel = new StructuredSelection(node);
                if (null != treeViewer) {
                    ISelection tempSelection = treeViewer.getSelection();
                    treeViewer.setSelection(structSel);
                    TreeItem[] selectionItems = treeViewer.getTree().getSelection();
                    if (0 != selectionItems.length) {
                        selectionItems[0].setText(node.getLabel());
                        treeViewer.setSelection(tempSelection);
                    }
                } else {
                    ISelection dqTreeSelection = RepositoryNodeHelper.getDQCommonViewer().getSelection();
                    RepositoryNodeHelper.getDQCommonViewer().setSelection(structSel);
                    TreeItem[] selections = RepositoryNodeHelper.getDQCommonViewer().getTree().getSelection();
                    if (0 != selections.length) {
                        selections[0].setText(node.getLabel());
                    }
                    RepositoryNodeHelper.getDQCommonViewer().setSelection(dqTreeSelection);
                }
            } catch (Exception e) {
                log.error(e.toString());
            }
        }
    }
    if (children.size() <= 0) {
        // ~23220
        List<EResourceConstant> resContants = new ArrayList<EResourceConstant>();
        IRepositoryViewObject viewObject = node.getObject();
        String label = viewObject == null ? null : viewObject.getLabel();
        if (EResourceConstant.DATA_PROFILING.getName().equals(label)) {
            resContants.add(EResourceConstant.ANALYSIS);
            if (PluginChecker.isTDQLoaded()) {
                resContants.add(EResourceConstant.REPORTS);
            }
        } else if (EResourceConstant.LIBRARIES.getName().equals(label)) {
            // MOD TDQ-10933 msjian 20150915: Hide the Exchange node
            if (!TalendPropertiesUtil.isHideExchange()) {
                resContants.add(EResourceConstant.EXCHANGE);
            }
            // TDQ-10933~
            resContants.add(EResourceConstant.INDICATORS);
            if (PluginChecker.isTDQLoaded()) {
                resContants.add(EResourceConstant.JRXML_TEMPLATE);
            }
            resContants.add(EResourceConstant.PATTERNS);
            resContants.add(EResourceConstant.RULES);
            resContants.add(EResourceConstant.SOURCE_FILES);
        } else if (EResourceConstant.METADATA.getName().equals(label)) {
            resContants.add(EResourceConstant.DB_CONNECTIONS);
            resContants.add(EResourceConstant.FILEDELIMITED);
            if (PluginChecker.isTDQLoaded() && HadoopClusterUtils.getDefault().isServiceInstalled()) {
                resContants.add(EResourceConstant.HADOOP_CLUSTER);
            }
        }
        if (resContants.size() > 0) {
            RepositoryNodeBuilder.getInstance().createRepositoryNodeSystemFolders(node, resContants, node.getProject());
        }
    } else {
        // to avoid can not get reference project nodes when open the select udi/pattern/rule dialog
        if (EResourceConstant.REFERENCED_PROJECT.getName().equals(node.getProperties(EProperties.LABEL))) {
            if (!ProxyRepositoryManager.getInstance().isMergeRefProject()) {
                for (IRepositoryNode refProjectNode : node.getChildren()) {
                    for (IRepositoryNode refProjectItemNode : refProjectNode.getChildren()) {
                        getRepositoryNodeChildren(refProjectItemNode);
                    }
                }
            }
        }
    }
    if (node instanceof ContextFolderRepNode) {
        children = ((ContextFolderRepNode) node).getChildren();
    }
    return sortRepositoryNode(children.toArray());
}
Also used : DBTableFolderRepNode(org.talend.dq.nodes.DBTableFolderRepNode) EResourceConstant(org.talend.resource.EResourceConstant) IRepositoryNode(org.talend.repository.model.IRepositoryNode) TreeItem(org.eclipse.swt.widgets.TreeItem) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) ArrayList(java.util.ArrayList) DBViewFolderRepNode(org.talend.dq.nodes.DBViewFolderRepNode) DBColumnFolderRepNode(org.talend.dq.nodes.DBColumnFolderRepNode) CoreException(org.eclipse.core.runtime.CoreException) MissingDriverException(org.talend.utils.exceptions.MissingDriverException) PersistenceException(org.talend.commons.exception.PersistenceException) DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode) ISelection(org.eclipse.jface.viewers.ISelection) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ContextFolderRepNode(org.talend.dq.nodes.ContextFolderRepNode)

Example 5 with DQRepositoryNode

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

the class IndicatorSettingsPage method openAnalysesSelectionDialog.

/**
 * DOC qzhang Comment method "openAnalysesSelectionDialog".
 */
protected void openAnalysesSelectionDialog(boolean isLowCase) {
    SpecialLimitFrequencyAnalysisFilter limitFilter = new SpecialLimitFrequencyAnalysisFilter(isLowCase ? 0 : freResultLimit, isLowCase ? lowFreResultLimit : 0);
    CheckedTreeSelectionDialog checkedTreeSelectionDialog = new CheckedTreeSelectionDialog(this.getShell(), new DQRepositoryViewLabelProviderWithFilter(limitFilter), new ResourceViewContentProvider());
    // $NON-NLS-1$
    checkedTreeSelectionDialog.setTitle(DefaultMessagesImpl.getString("IndicatorSettingsPage.analysisSelectDialog.title"));
    checkedTreeSelectionDialog.setMessage(// $NON-NLS-1$
    DefaultMessagesImpl.getString("IndicatorSettingsPage.analysisSelectDialog.message"));
    checkedTreeSelectionDialog.setContainerMode(true);
    checkedTreeSelectionDialog.addFilter(new SelectAnalysisDialogNodeFilter());
    checkedTreeSelectionDialog.addFilter(limitFilter);
    DQRepositoryNode analysisSelectDialogInputData = AnalysisUtils.getAnalysisSelectDialogInputDataWithoutRef(EResourceConstant.ANALYSIS);
    checkedTreeSelectionDialog.setInput(analysisSelectDialogInputData);
    if (checkedTreeSelectionDialog.open() == Dialog.OK) {
        Object[] result = checkedTreeSelectionDialog.getResult();
        for (Object obj : result) {
            if (obj instanceof AnalysisRepNode) {
                AnalysisRepNode anaNode = (AnalysisRepNode) obj;
                modifyAndSaveLimit(anaNode, isLowCase);
            }
        }
    }
}
Also used : DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode) AnalysisRepNode(org.talend.dq.nodes.AnalysisRepNode) CheckedTreeSelectionDialog(org.eclipse.ui.dialogs.CheckedTreeSelectionDialog) SpecialLimitFrequencyAnalysisFilter(org.talend.dataprofiler.core.ui.filters.SpecialLimitFrequencyAnalysisFilter) SelectAnalysisDialogNodeFilter(org.talend.dataprofiler.core.ui.filters.SelectAnalysisDialogNodeFilter) ResourceViewContentProvider(org.talend.dataprofiler.core.ui.views.provider.ResourceViewContentProvider) DQRepositoryViewLabelProviderWithFilter(org.talend.dataprofiler.core.ui.views.provider.DQRepositoryViewLabelProviderWithFilter)

Aggregations

DQRepositoryNode (org.talend.dq.nodes.DQRepositoryNode)24 IRepositoryNode (org.talend.repository.model.IRepositoryNode)11 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)8 ArrayList (java.util.ArrayList)7 Project (org.talend.core.model.general.Project)5 IPath (org.eclipse.core.runtime.IPath)4 Connection (org.talend.core.model.metadata.builder.connection.Connection)4 ConnectionItem (org.talend.core.model.properties.ConnectionItem)4 RepositoryNode (org.talend.repository.model.RepositoryNode)4 List (java.util.List)3 IProject (org.eclipse.core.resources.IProject)3 TreeItem (org.eclipse.swt.widgets.TreeItem)3 IEditorInput (org.eclipse.ui.IEditorInput)3 Item (org.talend.core.model.properties.Item)3 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)3 TdTable (org.talend.cwm.relational.TdTable)3 IndicatorDefinition (org.talend.dataquality.indicators.definition.IndicatorDefinition)3 AnalysisRepNode (org.talend.dq.nodes.AnalysisRepNode)3 DBTableRepNode (org.talend.dq.nodes.DBTableRepNode)3 DBViewRepNode (org.talend.dq.nodes.DBViewRepNode)3