mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.1 to HEAD
13426: Support for fix to ETHREEOH-1157: Allow dialogs to propagate exceptions ___________________________________________________________________ Modified: svn:mergeinfo Merged /alfresco/BRANCHES/V3.1:r13426 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13541 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -47,6 +47,7 @@ import org.alfresco.web.bean.BrowseBean;
|
|||||||
import org.alfresco.web.bean.NavigationBean;
|
import org.alfresco.web.bean.NavigationBean;
|
||||||
import org.alfresco.web.bean.repository.Repository;
|
import org.alfresco.web.bean.repository.Repository;
|
||||||
import org.alfresco.web.config.DialogsConfigElement.DialogButtonConfig;
|
import org.alfresco.web.config.DialogsConfigElement.DialogButtonConfig;
|
||||||
|
import org.alfresco.web.ui.common.ReportedException;
|
||||||
import org.alfresco.web.ui.common.Utils;
|
import org.alfresco.web.ui.common.Utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,7 +125,7 @@ public abstract class BaseDialogBean implements IDialogBean, Serializable
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Execute
|
// Execute
|
||||||
outcome = txnHelper.doInTransaction(callback);
|
outcome = txnHelper.doInTransaction(callback, false, true);
|
||||||
|
|
||||||
// allow any subclasses to perform post commit processing
|
// allow any subclasses to perform post commit processing
|
||||||
// i.e. resetting state or setting status messages
|
// i.e. resetting state or setting status messages
|
||||||
@@ -138,9 +139,11 @@ public abstract class BaseDialogBean implements IDialogBean, Serializable
|
|||||||
{
|
{
|
||||||
// reset the flag so we can re-attempt the operation
|
// reset the flag so we can re-attempt the operation
|
||||||
isFinished = false;
|
isFinished = false;
|
||||||
|
|
||||||
Utils.addErrorMessage(formatErrorMessage(e), e);
|
|
||||||
outcome = getErrorOutcome(e);
|
outcome = getErrorOutcome(e);
|
||||||
|
if (e instanceof ReportedException == false)
|
||||||
|
{
|
||||||
|
Utils.addErrorMessage(formatErrorMessage(e), e);
|
||||||
|
}
|
||||||
ReportedException.throwIfNecessary(e);
|
ReportedException.throwIfNecessary(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -353,7 +356,7 @@ public abstract class BaseDialogBean implements IDialogBean, Serializable
|
|||||||
* @return The outcome
|
* @return The outcome
|
||||||
*/
|
*/
|
||||||
protected abstract String finishImpl(FacesContext context, String outcome)
|
protected abstract String finishImpl(FacesContext context, String outcome)
|
||||||
throws Exception;
|
throws Throwable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs any post commit processing subclasses may want to provide
|
* Performs any post commit processing subclasses may want to provide
|
||||||
|
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing"
|
||||||
|
*/
|
||||||
|
package org.alfresco.web.ui.common;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unchecked exception wrapping an already-reported exception. The dialog code can use this to
|
||||||
|
* detect whether or not to report further to the user.
|
||||||
|
*
|
||||||
|
* @author Derek Hulley
|
||||||
|
* @since 3.1
|
||||||
|
*/
|
||||||
|
public class ReportedException extends RuntimeException
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = -4179045854462002741L;
|
||||||
|
|
||||||
|
public ReportedException(Throwable e)
|
||||||
|
{
|
||||||
|
super(e);
|
||||||
|
}
|
||||||
|
}
|
@@ -44,6 +44,7 @@ import javax.faces.el.EvaluationException;
|
|||||||
import javax.faces.el.MethodBinding;
|
import javax.faces.el.MethodBinding;
|
||||||
import javax.faces.event.AbortProcessingException;
|
import javax.faces.event.AbortProcessingException;
|
||||||
import javax.faces.event.ActionEvent;
|
import javax.faces.event.ActionEvent;
|
||||||
|
import javax.transaction.UserTransaction;
|
||||||
|
|
||||||
import org.alfresco.config.ConfigElement;
|
import org.alfresco.config.ConfigElement;
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
@@ -56,6 +57,7 @@ import org.alfresco.jlan.server.filesys.FilesystemsConfigSection;
|
|||||||
import org.alfresco.model.ApplicationModel;
|
import org.alfresco.model.ApplicationModel;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||||
|
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||||
import org.alfresco.repo.webdav.WebDAVServlet;
|
import org.alfresco.repo.webdav.WebDAVServlet;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
import org.alfresco.service.cmr.model.FileFolderService;
|
import org.alfresco.service.cmr.model.FileFolderService;
|
||||||
@@ -814,6 +816,20 @@ public final class Utils extends StringUtils
|
|||||||
*/
|
*/
|
||||||
public static void addErrorMessage(String msg, Throwable err)
|
public static void addErrorMessage(String msg, Throwable err)
|
||||||
{
|
{
|
||||||
|
UserTransaction txn = RetryingTransactionHelper.getActiveUserTransaction();
|
||||||
|
if (txn != null)
|
||||||
|
{
|
||||||
|
// We're in a transaction and need to ensure that we ONLY rollback
|
||||||
|
try
|
||||||
|
{
|
||||||
|
txn.setRollbackOnly();
|
||||||
|
}
|
||||||
|
catch (Throwable e)
|
||||||
|
{
|
||||||
|
// Ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FacesContext context = FacesContext.getCurrentInstance( );
|
FacesContext context = FacesContext.getCurrentInstance( );
|
||||||
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
|
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
|
||||||
context.addMessage(null, facesMsg);
|
context.addMessage(null, facesMsg);
|
||||||
|
Reference in New Issue
Block a user