Search in sources :

Example 6 with BusinessException

use of org.talend.commons.exception.BusinessException in project tdi-studio-se by Talend.

the class EmfEmittersPersistence method saveEmittersPool.

/**
     * DOC mhirt Comment method "saveEmittersPool".
     * 
     * @param pool
     * @throws BusinessException
     */
public void saveEmittersPool(List<LightJetBean> pool) throws BusinessException {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    ObjectOutputStream objectOut = null;
    try {
        objectOut = new ObjectOutputStream(out);
        objectOut.writeObject(pool);
        saveEmfPoolFactory(persistantFile, out.toByteArray());
    } catch (IOException e) {
        throw new BusinessException(e);
    } finally {
        try {
            out.close();
        } catch (Exception e) {
        // ignore me even if i'm null
        }
        try {
            objectOut.close();
        } catch (Exception e) {
        // ignore me even if i'm null
        }
    }
}
Also used : BusinessException(org.talend.commons.exception.BusinessException) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException) ObjectOutputStream(java.io.ObjectOutputStream) IOException(java.io.IOException) BusinessException(org.talend.commons.exception.BusinessException)

Example 7 with BusinessException

use of org.talend.commons.exception.BusinessException in project tmdm-studio-se by Talend.

the class RenameProcessAction method moveToOtherTypeNode.

public void moveToOtherTypeNode(IRepositoryViewObject parent, IRepositoryViewObject viewObj) {
    MDMServerObjectItem item = (MDMServerObjectItem) viewObj.getProperty().getItem();
    waitSomeTime(viewObj);
    IProxyRepositoryFactory factory = getFactory();
    try {
        if (factory.isEditableAndLockIfPossible(item)) {
            String path = item.getState().getPath();
            IPath ipath = new Path(path);
            factory.moveObject(viewObj, ipath);
            IRepositoryViewObject iRepositoryViewObject = ContainerCacheService.get(viewObj.getRepositoryObjectType(), path);
            commonViewer.refresh(parent);
            commonViewer.refresh(iRepositoryViewObject);
        }
    } catch (PersistenceException e) {
        log.error(e.getMessage(), e);
    } catch (BusinessException e) {
        log.error(e.getMessage(), e);
    } finally {
        try {
            factory.unlock(item);
        } catch (PersistenceException e) {
            log.error(e.getMessage(), e);
        } catch (LoginException e) {
            log.error(e.getMessage(), e);
        }
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) BusinessException(org.talend.commons.exception.BusinessException) IPath(org.eclipse.core.runtime.IPath) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) LoginException(org.talend.commons.exception.LoginException) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 8 with BusinessException

use of org.talend.commons.exception.BusinessException in project tmdm-studio-se by Talend.

the class RestoreAction method restoreServerObject.

private void restoreServerObject(IRepositoryViewObject viewObj) {
    Item item = viewObj.getProperty().getItem();
    try {
        factory.restoreObject(viewObj, new Path(item.getState().getPath()));
        if (RepositoryResourceUtil.isOpenedInEditor(viewObj) != null) {
            factory.lock(viewObj);
        }
        executeRestoreCommand(viewObj);
    } catch (PersistenceException e) {
        log.error(e.getMessage(), e);
    } catch (BusinessException e) {
        log.error(e.getMessage(), e);
    }
}
Also used : Path(org.eclipse.core.runtime.Path) Item(org.talend.core.model.properties.Item) BusinessException(org.talend.commons.exception.BusinessException) PersistenceException(org.talend.commons.exception.PersistenceException)

Example 9 with BusinessException

use of org.talend.commons.exception.BusinessException in project tmdm-studio-se by Talend.

the class MDMEditViewProcessPropertyAction method moveToOtherTypeNode.

private void moveToOtherTypeNode(IRepositoryViewObject viewObj, String oldPath, String newPath) {
    MDMServerObjectItem item = (MDMServerObjectItem) viewObj.getProperty().getItem();
    item.getState().setPath(newPath);
    waitSomeTime(viewObj);
    IProxyRepositoryFactory factory = getFactory();
    try {
        if (factory.isEditableAndLockIfPossible(item)) {
            IPath ipath = new Path(newPath);
            factory.moveObject(viewObj, ipath);
            ERepositoryObjectType type = viewObj.getRepositoryObjectType();
            refreshTree(type, oldPath);
            refreshTree(type, newPath);
        }
    } catch (PersistenceException e) {
        log.error(e.getMessage(), e);
    } catch (BusinessException e) {
        log.error(e.getMessage(), e);
    } finally {
        unlockItem(item);
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) BusinessException(org.talend.commons.exception.BusinessException) IPath(org.eclipse.core.runtime.IPath) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) PersistenceException(org.talend.commons.exception.PersistenceException) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 10 with BusinessException

use of org.talend.commons.exception.BusinessException in project tmdm-studio-se by Talend.

the class RemoveFromRepositoryAction method removeServerObject.

private void removeServerObject(IRepositoryViewObject viewObj) {
    if (removed.contains(viewObj.getId())) {
        return;
    }
    removed.add(viewObj.getId());
    try {
        Item item = viewObj.getProperty().getItem();
        IEditorReference ref = RepositoryResourceUtil.isOpenedInEditor(viewObj);
        if (ref != null) {
            RepositoryResourceUtil.closeEditor(ref, true);
        }
        factory.deleteObjectLogical(viewObj);
        if (item instanceof MDMServerObjectItem) {
            MDMServerObject serverObj = ((MDMServerObjectItem) item).getMDMServerObject();
            CommandManager.getInstance().pushCommand(ICommand.CMD_DELETE, viewObj.getId(), serverObj.getName());
        }
    } catch (BusinessException e) {
        MessageDialog.openError(getShell(), Messages.Common_Error, e.getMessage());
    } catch (Exception e) {
        log.error(e.getMessage(), e);
    }
}
Also used : TDQItem(org.talend.core.model.properties.TDQItem) Item(org.talend.core.model.properties.Item) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) FolderItem(org.talend.core.model.properties.FolderItem) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) BusinessException(org.talend.commons.exception.BusinessException) IEditorReference(org.eclipse.ui.IEditorReference) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) MDMServerObject(org.talend.mdm.repository.model.mdmserverobject.MDMServerObject) BusinessException(org.talend.commons.exception.BusinessException) PersistenceException(org.talend.commons.exception.PersistenceException)

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