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;
}
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);
}
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;
}
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);
}
}
}
}
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;
}
Aggregations