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