Search in sources :

Example 1 with AnalysisRepNode

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

the class DuplicateResourceProvider method shouldShowMenu.

/**
 * DOC xqliu Comment method "shouldShowMenu".
 *
 * @param array
 * @return
 */
private boolean shouldShowMenu(Object[] array) {
    List<ENodeType> nodeTypes = new ArrayList<ENodeType>();
    nodeTypes.add(ENodeType.REPOSITORY_ELEMENT);
    nodeTypes.add(ENodeType.TDQ_REPOSITORY_ELEMENT);
    List<IRepositoryNode> repositoryNodeList = RepositoryNodeHelper.getRepositoryNodeList(array, nodeTypes);
    if (repositoryNodeList.size() == 0) {
        return false;
    }
    List<ERepositoryObjectType> objectTypes = new ArrayList<ERepositoryObjectType>();
    objectTypes.add(ERepositoryObjectType.TDQ_ANALYSIS_ELEMENT);
    objectTypes.add(ERepositoryObjectType.TDQ_REPORT_ELEMENT);
    objectTypes.add(ERepositoryObjectType.TDQ_INDICATOR_ELEMENT);
    objectTypes.add(ERepositoryObjectType.TDQ_RULES_SQL);
    objectTypes.add(ERepositoryObjectType.TDQ_RULES);
    objectTypes.add(ERepositoryObjectType.TDQ_RULES_PARSER);
    objectTypes.add(ERepositoryObjectType.TDQ_PATTERN_ELEMENT);
    objectTypes.add(ERepositoryObjectType.TDQ_JRAXML_ELEMENT);
    objectTypes.add(ERepositoryObjectType.TDQ_SOURCE_FILE_ELEMENT);
    objectTypes.add(ERepositoryObjectType.METADATA_CONNECTIONS);
    objectTypes.add(ERepositoryObjectType.TDQ_RULES_MATCHER);
    objectTypes.add(ERepositoryObjectType.CONTEXT);
    for (IRepositoryNode node : repositoryNodeList) {
        // MOD qiongli 2011-2-12.filter elements in recycle bin.
        if (RepositoryNodeHelper.isStateDeleted(node)) {
            return false;
        }
        ERepositoryObjectType contentType = node.getObjectType();
        if (contentType == null || (!objectTypes.contains(contentType) && !ConnectionUtils.isTcompJdbc(contentType.getLabel()))) {
            return false;
        }
        RepositoryNode parent = node.getParent();
        if ((parent instanceof ReportSubFolderRepNode) && (node instanceof AnalysisRepNode)) {
            return false;
        }
        if (node instanceof ReportFileRepNode || node instanceof ReportAnalysisRepNode) {
            return false;
        }
    }
    return true;
}
Also used : ReportAnalysisRepNode(org.talend.dq.nodes.ReportAnalysisRepNode) AnalysisRepNode(org.talend.dq.nodes.AnalysisRepNode) ReportFileRepNode(org.talend.dq.nodes.ReportFileRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ArrayList(java.util.ArrayList) ENodeType(org.talend.repository.model.IRepositoryNode.ENodeType) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) ReportSubFolderRepNode(org.talend.dq.nodes.ReportSubFolderRepNode) ReportAnalysisRepNode(org.talend.dq.nodes.ReportAnalysisRepNode)

Example 2 with AnalysisRepNode

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

the class RepositoryNodeHelperTest method testGetIFile2.

/**
 * Test method for
 * {@link org.talend.dq.helper.RepositoryNodeHelper#getIFile(org.talend.repository.model.IRepositoryNode)}.
 */
@Test
public void testGetIFile2() {
    // test for ModelElement node, such as Analysis, Report, etc.
    AnalysisRepNode analysisNodeMock = mock(AnalysisRepNode.class);
    ModelElement meMock = mock(ModelElement.class);
    // $NON-NLS-1$
    stub(method(RepositoryNodeHelper.class, "getModelElementFromRepositoryNode", AnalysisRepNode.class)).toReturn(meMock);
    PowerMockito.mockStatic(ResourcesPlugin.class);
    IWorkspace workspaceMock = mock(IWorkspace.class);
    when(ResourcesPlugin.getWorkspace()).thenReturn(workspaceMock);
    IWorkspaceRoot workspaceRootMock = mock(IWorkspaceRoot.class);
    when(workspaceMock.getRoot()).thenReturn(workspaceRootMock);
    Resource resourceMock = mock(Resource.class);
    when(meMock.eResource()).thenReturn(resourceMock);
    String itemPathStr = "/Talend/Talend_All_trunk/runtime/TDQEE_runtime/P0518/TDQ_Data Profiling/Analyses/a1_0.1.ana";
    URI uri = URI.createFileURI(itemPathStr);
    when(resourceMock.getURI()).thenReturn(uri);
    IFile fileMock = mock(IFile.class);
    when(workspaceRootMock.getFile((Path) any())).thenReturn(fileMock);
    IFile iFile = RepositoryNodeHelper.getIFile(analysisNodeMock);
    assertEquals(fileMock, iFile);
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) AnalysisRepNode(org.talend.dq.nodes.AnalysisRepNode) IFile(org.eclipse.core.resources.IFile) IWorkspaceRoot(org.eclipse.core.resources.IWorkspaceRoot) IWorkspace(org.eclipse.core.resources.IWorkspace) Resource(org.eclipse.emf.ecore.resource.Resource) URI(org.eclipse.emf.common.util.URI) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 3 with AnalysisRepNode

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

the class RepositoryNodeHelper method recursiveFindAnalysis.

public static AnalysisRepNode recursiveFindAnalysis(Analysis analysis) {
    if (analysis == null) {
        return null;
    }
    String uuid = getUUID(analysis);
    if (uuid == null) {
        return null;
    }
    IRepositoryNode DataProfilingAnalysisFolderNode = getDataProfilingAnalysisFolderNode(analysis);
    // MOD qiongli 2011-4-6,bug 20218,add parameter withDeleted(true), contain child is in recycle bin.
    List<AnalysisRepNode> analysisRepNodes = getAnalysisRepNodes(DataProfilingAnalysisFolderNode, true, true);
    if (analysisRepNodes.size() > 0) {
        for (AnalysisRepNode childNode : analysisRepNodes) {
            if (uuid.equals(getUUID(childNode.getAnalysis()))) {
                return childNode;
            }
        }
    }
    return null;
}
Also used : ReportAnalysisRepNode(org.talend.dq.nodes.ReportAnalysisRepNode) AnalysisRepNode(org.talend.dq.nodes.AnalysisRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode)

Example 4 with AnalysisRepNode

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

Example 5 with AnalysisRepNode

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

the class ImageLib method getImageNameByRepositoryNode.

public static String getImageNameByRepositoryNode(IRepositoryNode node) {
    String imageName = null;
    IRepositoryViewObject viewObject = node.getObject();
    ENodeType type = node.getType();
    if (node instanceof ReportAnalysisRepNode) {
        imageName = ImageLib.ANALYSIS_OBJECT;
    } else if (node instanceof RecycleBinRepNode) {
        imageName = ImageLib.RECYCLEBIN_EMPTY;
    } else if (type.equals(ENodeType.SYSTEM_FOLDER)) {
        String label = viewObject.getLabel();
        if (label.equals(EResourceConstant.DATA_PROFILING.getName())) {
            imageName = ImageLib.DATA_PROFILING;
        } else if (label.equals(EResourceConstant.METADATA.getName())) {
            imageName = ImageLib.METADATA;
        } else if (node instanceof DBConnectionFolderRepNode) {
            imageName = ImageLib.CONNECTION;
        } else if (label.equals(EResourceConstant.FILEDELIMITED.getName())) {
            imageName = ImageLib.FILE_DELIMITED;
        } else if (label.equals(EResourceConstant.HADOOP_CLUSTER.getName())) {
            imageName = ImageLib.HADOOP_CLUSTER;
        } else if (label.equals(EResourceConstant.LIBRARIES.getName())) {
            imageName = ImageLib.LIBRARIES;
        } else if (label.equals(EResourceConstant.EXCHANGE.getName())) {
            imageName = ImageLib.EXCHANGE;
        } else {
            imageName = ImageLib.FOLDERNODE_IMAGE;
        }
    } else if (type.equals(ENodeType.SIMPLE_FOLDER)) {
        imageName = ImageLib.FOLDERNODE_IMAGE;
    } else if (type.equals(ENodeType.REPOSITORY_ELEMENT)) {
        if (node instanceof DBConnectionRepNode) {
            imageName = ImageLib.TD_DATAPROVIDER;
        } else if (node instanceof DFConnectionRepNode) {
            imageName = ImageLib.FILE_DELIMITED;
        } else if (node instanceof AnalysisRepNode) {
            imageName = ImageLib.ANALYSIS_OBJECT;
        } else if (node instanceof ReportRepNode) {
            imageName = ImageLib.REPORT_OBJECT;
        } else if (node instanceof SysIndicatorDefinitionRepNode) {
            imageName = ImageLib.IND_DEFINITION;
        } else if (node instanceof PatternRepNode) {
            imageName = ImageLib.PATTERN_REG;
        } else if (node instanceof RuleRepNode) {
            imageName = ImageLib.DQ_RULE;
        } else if (node instanceof SourceFileRepNode) {
            imageName = ImageLib.SOURCE_FILE;
        } else if (node instanceof ExchangeCategoryRepNode || node instanceof ExchangeComponentRepNode) {
            imageName = ImageLib.EXCHANGE;
        } else if (node instanceof JrxmlTempleteRepNode) {
            imageName = ImageLib.JRXML_ICON;
        }
    } else if (type.equals(ENodeType.TDQ_REPOSITORY_ELEMENT)) {
        if (node instanceof DBCatalogRepNode) {
            imageName = ImageLib.CATALOG;
        } else if (node instanceof DBSchemaRepNode) {
            imageName = ImageLib.SCHEMA;
        } else if (node instanceof DBTableFolderRepNode) {
            imageName = ImageLib.FOLDERNODE_IMAGE;
        } else if (node instanceof DBViewFolderRepNode) {
            imageName = ImageLib.FOLDERNODE_IMAGE;
        } else if (node instanceof DBTableRepNode || node instanceof DFTableRepNode) {
            imageName = ImageLib.TABLE;
        } else if (node instanceof DBViewRepNode) {
            imageName = ImageLib.VIEW;
        } else if (node instanceof DBColumnRepNode) {
            if (((DBColumnRepNode) node).isKey()) {
                imageName = ImageLib.PK_COLUMN;
            } else {
                imageName = ImageLib.TD_COLUMN;
            }
        } else if (node instanceof DFColumnRepNode) {
            imageName = ImageLib.TD_COLUMN;
        } else if (node instanceof DBColumnFolderRepNode || node instanceof DFColumnFolderRepNode) {
            imageName = ImageLib.FOLDERNODE_IMAGE;
        }
    }
    return imageName;
}
Also used : DBConnectionRepNode(org.talend.dq.nodes.DBConnectionRepNode) DBColumnRepNode(org.talend.dq.nodes.DBColumnRepNode) SourceFileRepNode(org.talend.dq.nodes.SourceFileRepNode) DBViewFolderRepNode(org.talend.dq.nodes.DBViewFolderRepNode) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) ReportRepNode(org.talend.dq.nodes.ReportRepNode) ExchangeComponentRepNode(org.talend.dataprofiler.core.ui.exchange.ExchangeComponentRepNode) SysIndicatorDefinitionRepNode(org.talend.dq.nodes.SysIndicatorDefinitionRepNode) DFTableRepNode(org.talend.dq.nodes.DFTableRepNode) DBConnectionFolderRepNode(org.talend.dq.nodes.DBConnectionFolderRepNode) DBViewRepNode(org.talend.dq.nodes.DBViewRepNode) PatternRepNode(org.talend.dq.nodes.PatternRepNode) DBTableFolderRepNode(org.talend.dq.nodes.DBTableFolderRepNode) DFColumnFolderRepNode(org.talend.dq.nodes.DFColumnFolderRepNode) DBSchemaRepNode(org.talend.dq.nodes.DBSchemaRepNode) RuleRepNode(org.talend.dq.nodes.RuleRepNode) JrxmlTempleteRepNode(org.talend.dq.nodes.JrxmlTempleteRepNode) RecycleBinRepNode(org.talend.dq.nodes.RecycleBinRepNode) DBColumnFolderRepNode(org.talend.dq.nodes.DBColumnFolderRepNode) DFColumnRepNode(org.talend.dq.nodes.DFColumnRepNode) DBTableRepNode(org.talend.dq.nodes.DBTableRepNode) ReportAnalysisRepNode(org.talend.dq.nodes.ReportAnalysisRepNode) AnalysisRepNode(org.talend.dq.nodes.AnalysisRepNode) ExchangeCategoryRepNode(org.talend.dataprofiler.core.ui.exchange.ExchangeCategoryRepNode) DFConnectionRepNode(org.talend.dq.nodes.DFConnectionRepNode) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ENodeType(org.talend.repository.model.IRepositoryNode.ENodeType) ReportAnalysisRepNode(org.talend.dq.nodes.ReportAnalysisRepNode)

Aggregations

AnalysisRepNode (org.talend.dq.nodes.AnalysisRepNode)17 IRepositoryNode (org.talend.repository.model.IRepositoryNode)10 ReportAnalysisRepNode (org.talend.dq.nodes.ReportAnalysisRepNode)8 ReportRepNode (org.talend.dq.nodes.ReportRepNode)6 RepositoryNode (org.talend.repository.model.RepositoryNode)6 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)5 Analysis (org.talend.dataquality.analysis.Analysis)5 PatternRepNode (org.talend.dq.nodes.PatternRepNode)5 DBTableRepNode (org.talend.dq.nodes.DBTableRepNode)4 DBViewRepNode (org.talend.dq.nodes.DBViewRepNode)4 DFConnectionRepNode (org.talend.dq.nodes.DFConnectionRepNode)4 DQRepositoryNode (org.talend.dq.nodes.DQRepositoryNode)4 RuleRepNode (org.talend.dq.nodes.RuleRepNode)4 SysIndicatorDefinitionRepNode (org.talend.dq.nodes.SysIndicatorDefinitionRepNode)4 ENodeType (org.talend.repository.model.IRepositoryNode.ENodeType)4 IPath (org.eclipse.core.runtime.IPath)3 PersistenceException (org.talend.commons.exception.PersistenceException)3 ExchangeComponentRepNode (org.talend.dataprofiler.core.ui.exchange.ExchangeComponentRepNode)3 TDQAnalysisItem (org.talend.dataquality.properties.TDQAnalysisItem)3 DBCatalogRepNode (org.talend.dq.nodes.DBCatalogRepNode)3