Search in sources :

Example 36 with BusinessException

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;
}
Also used : BusinessException(org.talend.commons.exception.BusinessException)

Example 37 with 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());
}
Also used : BusinessException(org.talend.commons.exception.BusinessException) IFile(org.eclipse.core.resources.IFile)

Example 38 with BusinessException

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);
    }
}
Also used : BusinessException(org.talend.commons.exception.BusinessException) ArrayList(java.util.ArrayList) MatchKeyDefinition(org.talend.dataquality.rules.MatchKeyDefinition) MatchRule(org.talend.dataquality.rules.MatchRule) HashMap(java.util.HashMap) Map(java.util.Map)

Example 39 with BusinessException

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);
    }
}
Also used : BusinessException(org.talend.commons.exception.BusinessException) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RepositoryWorkUnit(org.talend.repository.RepositoryWorkUnit) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject)

Example 40 with BusinessException

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);
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) BusinessException(org.talend.commons.exception.BusinessException) IFile(org.eclipse.core.resources.IFile) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) ChangePerspectiveAction(org.talend.dataprofiler.core.ui.perspective.ChangePerspectiveAction) PartInitException(org.eclipse.ui.PartInitException)

Aggregations

BusinessException (org.talend.commons.exception.BusinessException)46 PersistenceException (org.talend.commons.exception.PersistenceException)21 IPath (org.eclipse.core.runtime.IPath)9 Path (org.eclipse.core.runtime.Path)9 Project (org.talend.core.model.general.Project)9 Item (org.talend.core.model.properties.Item)9 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)9 ArrayList (java.util.ArrayList)8 ProxyRepositoryFactory (org.talend.core.repository.model.ProxyRepositoryFactory)8 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)7 IFile (org.eclipse.core.resources.IFile)6 IProject (org.eclipse.core.resources.IProject)6 MDMServerObjectItem (org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem)5 File (java.io.File)4 HashMap (java.util.HashMap)4 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)4 ReturnCode (org.talend.utils.sugars.ReturnCode)4 IOException (java.io.IOException)3 IWorkspace (org.eclipse.core.resources.IWorkspace)3 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)3