use of org.talend.utils.sugars.ReturnCode in project tdq-studio-se by Talend.
the class ExportConnectionToTOSAction method fillCatalogSchema.
/**
* DOC gdbu Comment method "fillCatalogSchema".
*
* @deprecated Won't be used.
* @param tdDataProvider
*/
@Deprecated
protected DatabaseConnection fillCatalogSchema(IMetadataConnection newMetadataConn) {
MetadataFillFactory instance = MetadataFillFactory.getDBInstance(newMetadataConn);
ReturnCode rc = instance.createConnection(newMetadataConn);
DatabaseConnection dbConn = null;
if (rc.isOk()) {
dbConn = (DatabaseConnection) instance.fillUIConnParams(newMetadataConn, null);
DatabaseMetaData dbMetadata = null;
java.sql.Connection sqlConn = null;
try {
if (rc instanceof TypedReturnCode) {
Object sqlConnObject = ((TypedReturnCode) rc).getObject();
if (sqlConnObject instanceof java.sql.Connection) {
sqlConn = (java.sql.Connection) sqlConnObject;
dbMetadata = ExtractMetaDataUtils.getInstance().getConnectionMetadata(sqlConn);
}
}
List<String> packageFilterCatalog = MetadataConnectionUtils.getPackageFilter(dbConn, dbMetadata, true);
instance.fillCatalogs(dbConn, dbMetadata, packageFilterCatalog);
List<String> packageFilterSchema = MetadataConnectionUtils.getPackageFilter(dbConn, dbMetadata, false);
instance.fillSchemas(dbConn, dbMetadata, packageFilterSchema);
} catch (SQLException e) {
log.error(e, e);
} finally {
if (sqlConn != null) {
ConnectionUtils.closeConnection(sqlConn);
}
}
} else {
log.error(rc.getMessage());
}
return dbConn;
}
use of org.talend.utils.sugars.ReturnCode in project tdq-studio-se by Talend.
the class BlockingKeySection method refreshChart.
/*
* (non-Javadoc)
*
* @see org.talend.dataquality.record.linkage.ui.section.AbstractMatchTableSection#RefreshChart()
*/
@Override
public void refreshChart() {
if (getBlockKeyDefinitionList().size() <= 0) {
MessageDialogWithToggle.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), DefaultMessagesImpl.getString("BlockingKeySection.RefreshChartError"), // $NON-NLS-1$ //$NON-NLS-2$
DefaultMessagesImpl.getString("BlockingKeySection.NoBlockKey"));
return;
}
ReturnCode checkResultStatus = checkResultStatus();
if (!checkResultStatus.isOk()) {
if (checkResultStatus.getMessage() != null && !checkResultStatus.getMessage().equals(StringUtils.EMPTY)) {
MessageDialogWithToggle.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), DefaultMessagesImpl.getString("BlockingKeySection.RefreshChartError"), // $NON-NLS-1$
checkResultStatus.getMessage());
}
return;
}
listeners.firePropertyChange(MatchAnalysisConstant.NEED_REFRESH_DATA, true, false);
BlockingKeyHandler executeGenerateBlockingAction = computeResult();
if (executeGenerateBlockingAction.getResultDataList().size() == 0) {
return;
}
blockingKeyDataChart.refresh(executeGenerateBlockingAction.getResultDatas());
MatchRuleAnlaysisUtils.refreshDataTable(analysis, executeGenerateBlockingAction.getResultDataList());
executeGenerateBlockingAction.getResultDatas().clear();
}
use of org.talend.utils.sugars.ReturnCode in project tdq-studio-se by Talend.
the class MatchingKeySection method refreshChart.
public void refreshChart(boolean needCompute) {
if (!hasMatchKey(true)) {
MessageDialogWithToggle.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), DefaultMessagesImpl.getString("BlockingKeySection.RefreshChartError"), // $NON-NLS-1$ //$NON-NLS-2$
DefaultMessagesImpl.getString("MatchMasterDetailsPage.NoMatchKey"));
return;
}
ReturnCode checkResultStatus = checkResultStatus();
if (!checkResultStatus.isOk()) {
MessageDialogWithToggle.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), DefaultMessagesImpl.getString("BlockingKeySection.RefreshChartError"), // $NON-NLS-1$
checkResultStatus.getMessage());
return;
}
listeners.firePropertyChange(MatchAnalysisConstant.NEED_REFRESH_DATA, true, false);
List<Object[]> results;
// MOD TDQ-9741: "chart" button will compute, "hide group" will not compute
if (needCompute) {
TypedReturnCode<RecordMatchingIndicator> computeMatchResult = computeMatchResult();
if (!computeMatchResult.isOk()) {
if (computeMatchResult.getMessage() != null && !computeMatchResult.getMessage().equals(StringUtils.EMPTY)) {
MessageDialogWithToggle.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), DefaultMessagesImpl.getString("RunAnalysisAction.runAnalysis"), // $NON-NLS-1$
computeMatchResult.getMessage());
}
return;
}
RecordMatchingIndicator recordMatchingIndicator = computeMatchResult.getObject();
matchRuleChartComp.refresh(recordMatchingIndicator.getGroupSize2groupFrequency());
// sort the result before refresh
results = MatchRuleAnlaysisUtils.sortResultByGID(recordMatchingIndicator.getMatchRowSchema(), this.getTableResult());
} else {
// for "hide group" , get the result from the last "chart" directly.
matchRuleChartComp.refresh(getChartResult());
results = getTableResult();
}
// refresh related table
MatchRuleAnlaysisUtils.refreshDataTable(analysis, results);
// Clear the match row data.
matchRows.clear();
}
use of org.talend.utils.sugars.ReturnCode in project tdq-studio-se by Talend.
the class DefaultSurvivorshipDefinitionSection method checkResultStatus.
@Override
public ReturnCode checkResultStatus() {
ReturnCode returnCode = new ReturnCode(true);
for (DefaultSurvivorshipDefinition dsd : matchRuleDef.getDefaultSurvivorshipDefinitions()) {
String algorithmType = dsd.getFunction().getAlgorithmType();
if (!MatchRuleAnlaysisUtils.isSurvivorShipFunctionConsistentWithType(algorithmType, dsd.getDataType())) {
returnCode.setOk(false);
String message = DefaultMessagesImpl.getString(// $NON-NLS-1$
"DefaultSurvivorshipDefinitionSection.survivorshipFunctionNotMatch", // $NON-NLS-1$
dsd.getDataType(), SurvivorShipAlgorithmEnum.getTypeBySavedValue(algorithmType).getValue());
returnCode.setMessage(// $NON-NLS-1$
DefaultMessagesImpl.getString(// $NON-NLS-1$
"MatchingKeySection.invalidSurvivorshipFunction", getSectionName(), message));
return returnCode;
}
}
return returnCode;
}
use of org.talend.utils.sugars.ReturnCode in project tdq-studio-se by Talend.
the class DataSampleTable method reDrawTable.
/**
* Redraw the table by special columns and reload the data if needed
*
* @param columns New input columns
* @param withData where need to reload data with same time
*/
public void reDrawTable(ModelElement[] columns, boolean withData) {
if (tablePanel != null && !tablePanel.isDisposed()) {
tablePanel.dispose();
}
needLoadData = withData;
List<Object[]> listOfData = null;
try {
listOfData = getPreviewData(columns, withData);
isDataAvailable = new ReturnCode();
} catch (SQLException e) {
isDataAvailable.setMessage(e.getMessage());
isDataAvailable.setOk(false);
needLoadData = false;
}
createNatTable(listOfData, drawCanvas, columns);
drawCanvas.setVisible(columns != null && columns.length > 0);
drawCanvas.layout();
}
Aggregations