use of orgomg.cwm.foundation.softwaredeployment.DataManager in project tdq-studio-se by Talend.
the class AbstractColumnDropTree method initializedConnection.
/**
* DOC msjian Comment method "initializedConnection". for 6560
*
* @param indicators
*/
void initializedConnection(ModelElementIndicator[] indicators) {
Analysis analysis = getMasterPage().getAnalysisHandler().getAnalysis();
DataManager connection = analysis.getContext().getConnection();
// Connection tdDataProvider = null;
boolean enableWhereClauseFlag = true;
boolean enableExecuteLanguageFlag = false;
// ~
if (indicators != null && indicators.length > 0) {
if (connection == null) {
connection = ModelElementIndicatorHelper.getTdDataProvider(indicators[0]);
analysis.getContext().setConnection(connection);
}
if (connection != null && getMasterPage().getExecCombo() != null) {
if (ConnectionUtils.isDelimitedFileConnection((DataProvider) connection)) {
getMasterPage().setWhereClauseDisabled();
// when the selected column is not DB type,will disable the execute engine combobox.
getMasterPage().changeExecuteLanguageToJava(true);
enableWhereClauseFlag = false;
enableExecuteLanguageFlag = false;
} else {
// when the selected column is back to DB type, should enable the execute engine combobox again.
getMasterPage().enableExecuteLanguage();
}
}
}
// MOD klliu if default ExecutionLanguage is java,it is not changed to SQL.2011-11-21
String execLang = analysis.getParameters().getExecutionLanguage().getLiteral();
if (execLang != null && ExecutionLanguage.JAVA.getLiteral().equals(execLang) && (ConnectionUtils.isDelimitedFileConnection((DataProvider) connection))) {
enableExecuteLanguageFlag = false;
}
if (enableWhereClauseFlag) {
getMasterPage().setWhereClauseEnable();
}
if (enableExecuteLanguageFlag) {
getMasterPage().changeExecuteLanguageToSql(true);
}
}
use of orgomg.cwm.foundation.softwaredeployment.DataManager in project tdq-studio-se by Talend.
the class AbstractPagePart method updateBindConnection.
/**
* ADD mzhao 2009-05-05 bug:6587.
*/
protected void updateBindConnection(AbstractAnalysisMetadataPage masterPage, Tree tree) {
if (!isAnalyzedColumnsEmpty(tree)) {
DataManager dataManager = masterPage.getCurrentModelElement().getContext().getConnection();
if (dataManager == null) {
if (tree.getData() instanceof AnalysisColumnNominalIntervalTreeViewer) {
AnalysisColumnNominalIntervalTreeViewer treeViewer = (AnalysisColumnNominalIntervalTreeViewer) tree.getData();
RepositoryNode repositoryNode = treeViewer.getColumnSetMultiValueList().get(0);
dataManager = ((ConnectionItem) repositoryNode.getObject().getProperty().getItem()).getConnection();
} else if (tree.getData() instanceof AnalysisColumnSetTreeViewer) {
AnalysisColumnSetTreeViewer treeViewer = (AnalysisColumnSetTreeViewer) tree.getData();
IRepositoryNode reposNode = treeViewer.getColumnSetMultiValueList().get(0);
dataManager = ((ConnectionItem) reposNode.getObject().getProperty().getItem()).getConnection();
}
}
setConnectionState(masterPage, dataManager);
}
}
use of orgomg.cwm.foundation.softwaredeployment.DataManager in project tdq-studio-se by Talend.
the class PatternMouseAdapter method mouseDown.
@Override
public void mouseDown(MouseEvent e) {
DataManager dm = analysis.getContext().getConnection();
if (dm == null) {
masterPage.doSave(null);
}
// MOD gdbu 2011-8-26 bug : TDQ-2169
IRepositoryNode patternFolderNode = getPatternSelectDialogInputData();
if (patternFolderNode == null) {
return;
}
CheckedTreeSelectionDialog dialog = PatternUtilities.createPatternCheckedTreeSelectionDialog(patternFolderNode);
if (null != filters) {
for (ViewerFilter filter : filters) {
dialog.addFilter(filter);
}
}
// ~TDQ-2169
Object[] selectedRepNodes = PatternUtilities.getPatternRepNodesByIndicator(meIndicator);
dialog.setInitialSelections(selectedRepNodes);
dialog.create();
if (dialog.open() == Window.OK) {
// MOD qiongli 2012-10-17 TDQ-5923,just remove some deselected indicatorUnit,just create new indicatorUnit
// for some new added pattern nodes.
List<PatternRepNode> allSelectedPatternNodes = new ArrayList<PatternRepNode>();
Set<String> allSelectedNodeNames = new HashSet<String>();
for (Object obj : dialog.getResult()) {
if (obj instanceof PatternRepNode) {
PatternRepNode patternNode = (PatternRepNode) obj;
allSelectedPatternNodes.add(patternNode);
allSelectedNodeNames.add(patternNode.getLabel());
}
}
Set<String> oldSelectedNodeNames = new HashSet<String>();
Map<String, IndicatorUnit> oldSelectedUnits = new HashMap<String, IndicatorUnit>();
for (IndicatorUnit indicatorUnit : meIndicator.getIndicatorUnits()) {
Indicator indicator = indicatorUnit.getIndicator();
if (indicator instanceof PatternMatchingIndicator) {
if (!allSelectedNodeNames.contains(indicator.getName())) {
// this method will deal dependency with same time
columnDropTree.deleteIndicatorItems(meIndicator, indicatorUnit);
if (!columnDropTree.isDirty()) {
columnDropTree.setDirty(true);
}
} else {
oldSelectedNodeNames.add(indicator.getName());
oldSelectedUnits.put(indicator.getName(), indicatorUnit);
}
}
}
// Added yyin 20121121 TDQ-6329: after remove all, should also add the old selected patterns
// because the columnset does not have pagination, can not refresh automatically
boolean addOldSelected = false;
if (masterPage instanceof ColumnSetAnalysisDetailsPage) {
addOldSelected = true;
}
if (addOldSelected) {
for (TreeItem child : treeItem.getItems()) {
masterPage.getTreeViewer().removeItemBranch(child);
}
}
// ~
treeItem.removeAll();
for (PatternRepNode patternNode : allSelectedPatternNodes) {
if (oldSelectedNodeNames.contains(patternNode.getLabel()) && !addOldSelected) {
continue;
}
TypedReturnCode<IndicatorUnit> trc = PatternUtilities.createIndicatorUnit(patternNode.getPattern(), meIndicator, analysis);
if (trc.isOk()) {
createOneUnit(trc.getObject());
// TDQ-8860 add msjian 2014-4-30:check whether show allmatchindicator in the indicators section
if (masterPage instanceof ColumnSetAnalysisDetailsPage) {
EventManager.getInstance().publish(analysis, EventEnum.DQ_COLUMNSET_SHOW_MATCH_INDICATORS, null);
}
// TDQ-8860~
}
}
treeItem.setExpanded(true);
if (masterPage instanceof ColumnAnalysisDetailsPage) {
ColumnAnalysisDetailsPage page = (ColumnAnalysisDetailsPage) masterPage;
page.refreshTheTree(page.getCurrentModelElementIndicators());
}
}
}
use of orgomg.cwm.foundation.softwaredeployment.DataManager in project tdq-studio-se by Talend.
the class AbstractSchemaEvaluator method dbms.
protected DbmsLanguage dbms() {
if (this.dbmsLanguage == null) {
DataManager dm = this.getDataManager();
if (dm == null) {
// $NON-NLS-1$
throw new RuntimeException("No data manager found.");
}
this.dbmsLanguage = DbmsLanguageFactory.createDbmsLanguage(dm);
}
return this.dbmsLanguage;
}
use of orgomg.cwm.foundation.softwaredeployment.DataManager in project tdq-studio-se by Talend.
the class RespositoryDetailView method createAnaysisDetail.
private void createAnaysisDetail(Analysis ana) {
if (ana == null) {
return;
}
createName(ana);
createPurpose(ana);
createDescription(ana);
AnalysisParameters parameters = ana.getParameters();
String description = parameters == null ? null : parameters.getAnalysisType().getLiteral();
// $NON-NLS-1$
newLabelAndText(gContainer, DefaultMessagesImpl.getString("RespositoryDetailView.otherType"), description);
AnalysisContext context = ana.getContext();
int numn = context == null ? 0 : context.getAnalysedElements().size();
newLabelAndText(gContainer, DefaultMessagesImpl.getString("RespositoryDetailView.numberOfAnalyzedElements"), // $NON-NLS-1$
String.valueOf(numn));
DataManager connection = context == null ? null : context.getConnection();
if (connection == null) {
description = null;
} else {
description = connection.getName();
}
// $NON-NLS-1$
newLabelAndText(gContainer, DefaultMessagesImpl.getString("RespositoryDetailView.connection"), description);
}
Aggregations