use of org.talend.commons.exception.BusinessException in project tdq-studio-se by Talend.
the class ExceptionFactory method createBusinessException.
public BusinessException createBusinessException(String fileName) {
BusinessException businessException = new BusinessException();
businessException.setAdditonalMessage(DefaultMessagesImpl.getString("ExceptionFactory.corrupted_file_error", fileName));
return businessException;
}
use of org.talend.commons.exception.BusinessException in project tdq-studio-se by Talend.
the class ExceptionFactory method createBusinessException.
public BusinessException createBusinessException(IRepositoryViewObject repViewObj) {
BusinessException businessException = new BusinessException();
IFile itemFile = PropertyHelper.getItemFile(repViewObj.getProperty());
return createBusinessException(itemFile.getName());
}
use of org.talend.commons.exception.BusinessException in project tdq-studio-se by Talend.
the class AnalysisRecordGroupingUtils method setRuleMatcher.
/**
* DOC zhao Comment method "setRuleMatcher".
*
* @param columnMap
* @param recordMatchingIndicator
* @param analysisMatchRecordGrouping
* @throws BusinessException
*/
public static void setRuleMatcher(Map<MetadataColumn, String> columnMap, RecordMatchingIndicator recordMatchingIndicator, AnalysisMatchRecordGrouping analysisMatchRecordGrouping) throws BusinessException {
List<MatchRule> matchRules = recordMatchingIndicator.getBuiltInMatchRuleDefinition().getMatchRules();
// Column index list store all the indices.
List<String> allColumnIndice = new ArrayList<String>();
for (MatchRule matcher : matchRules) {
if (matcher == null) {
continue;
}
List<Map<String, String>> currentRuleMatcher = new ArrayList<Map<String, String>>();
List<String> currentColumnIndice = new ArrayList<String>();
for (MatchKeyDefinition matchDef : matcher.getMatchKeys()) {
// column,throw exception, do not continue
if (matchDef.getColumn() == null || StringUtils.EMPTY.equals(matchDef.getColumn())) {
BusinessException businessException = new BusinessException();
businessException.setAdditonalMessage(// $NON-NLS-1$
Messages.getString(// $NON-NLS-1$
"MatchAnalysisExecutor.NoColumnInMatchKey", matchDef.getName()));
throw businessException;
}
String algorithmType = matchDef.getAlgorithm().getAlgorithmType();
Map<String, String> matchKeyMap = getMatchKeyMap(columnMap, matcher, matchDef, algorithmType);
addMatchKeyOrderbyColumnIdx(currentRuleMatcher, matchKeyMap);
currentColumnIndice.add(matchKeyMap.get(IRecordGrouping.COLUMN_IDX));
}
if (allColumnIndice.isEmpty()) {
for (Map<String, String> matchKey : currentRuleMatcher) {
String colIdx = matchKey.get(IRecordGrouping.COLUMN_IDX);
allColumnIndice.add(colIdx);
}
} else {
refineMatcherWithDummy(analysisMatchRecordGrouping, allColumnIndice, currentColumnIndice, currentRuleMatcher);
}
analysisMatchRecordGrouping.addRuleMatcher(currentRuleMatcher);
}
}
use of org.talend.commons.exception.BusinessException in project tdq-studio-se by Talend.
the class OpenItemEditorAction method run.
@Override
public void run() {
// method to method doRun().
if (repNodes != null) {
RepositoryWorkUnit<Object> workUnit = new // $NON-NLS-1$
RepositoryWorkUnit<Object>(// $NON-NLS-1$
"Open an DQ editor") {
@Override
protected void run() {
try {
for (IRepositoryNode repNode : repNodes) {
setImageDescriptor(ImageLib.getImageDescriptorByRepositoryNode(repNode));
duRun(repNode);
}
} catch (BusinessException e) {
org.talend.dataprofiler.core.exception.ExceptionHandler.process(e, Level.FATAL);
} catch (Throwable e) {
log.error(e, e);
}
}
};
workUnit.setAvoidUnloadResources(true);
ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(workUnit);
}
}
use of org.talend.commons.exception.BusinessException in project tdq-studio-se by Talend.
the class OpenSqlFileAction method run.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
try {
for (IFile file : folder) {
if (!file.exists()) {
BusinessException createBusinessException = ExceptionFactory.getInstance().createBusinessException(file.getName());
throw createBusinessException;
}
}
// ADD xqliu 2010-08-20 bug 13729
new ChangePerspectiveAction(PluginConstant.SE_ID).run();
// ~ 13729
IWorkbenchWindow aww = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage ap = aww.getActivePage();
for (IFile file : folder) {
try {
IDE.openEditor(ap, file, SqlExplorerUtils.SQLEDITOR_ID, true);
} catch (PartInitException e) {
log.error(e, e);
}
}
} catch (BusinessException e) {
ExceptionHandler.process(e, Level.FATAL);
}
}
Aggregations