[UPDATE]
Die Verwendungen der FormValidationException durch die FormProcessExceptions ersetzt und angepasst. [DELETE] Die Klasse FormValidationException.java gelöscht. git-svn-id: https://svn.libreccm.org/ccm/trunk@3260 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
8317d67cba
commit
56d730bd68
|
|
@ -21,7 +21,6 @@ package com.arsdigita.cms.ui.type;
|
|||
import com.arsdigita.bebop.ColumnPanel;
|
||||
import com.arsdigita.bebop.FormData;
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.FormValidationException;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.SimpleContainer;
|
||||
|
|
@ -290,8 +289,8 @@ public class CreateType extends CMSForm
|
|||
String qname = parentObjectType.getModel().getName() + "." + name;
|
||||
MetadataRoot root = MetadataRoot.getMetadataRoot();
|
||||
if (root.getObjectType(qname) != null || root.hasTable(name)) {
|
||||
throw new FormValidationException(m_name, (String) GlobalizationUtil.globalize("cms.ui.type.duplicate_type",
|
||||
new Object[]{name}).localize());
|
||||
throw new FormProcessException(GlobalizationUtil.globalize(
|
||||
"cms.ui.type.duplicate_type", new Object[]{name}));
|
||||
}
|
||||
|
||||
//create a new dynamic object type with
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
package com.arsdigita.cms.ui.workflow;
|
||||
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.FormValidationException;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.event.FormInitListener;
|
||||
|
|
@ -159,7 +158,7 @@ public final class TaskFinishForm extends CommentAddForm {
|
|||
task.finish(Web.getWebContext().getUser());
|
||||
finishedTask = true;
|
||||
} catch (TaskException te) {
|
||||
throw new FormValidationException(te.toString());
|
||||
throw new FormProcessException(te);
|
||||
}
|
||||
} else {
|
||||
s_log.debug("The task is rejected; reenabling dependent "
|
||||
|
|
@ -188,7 +187,7 @@ public final class TaskFinishForm extends CommentAddForm {
|
|||
task.finish(Web.getWebContext().getUser());
|
||||
finishedTask = true;
|
||||
} catch (TaskException te) {
|
||||
throw new FormValidationException(te.toString());
|
||||
throw new FormProcessException(te);
|
||||
}
|
||||
}
|
||||
if (finishedTask) {
|
||||
|
|
|
|||
|
|
@ -359,16 +359,11 @@ public class FormModel implements Lockable {
|
|||
try {
|
||||
DeveloperSupport.startStage("Bebop Form Process");
|
||||
fireFormProcess(e);
|
||||
} catch (FormValidationException fve) {
|
||||
s_log.debug("A FormValidationException was thrown " +
|
||||
"while processing the form; storing the " +
|
||||
"error");
|
||||
} catch (FormProcessException fpe) {
|
||||
s_log.debug("A FormProcessException was thrown while " +
|
||||
"initializing the form; storing the error", fpe);
|
||||
|
||||
if (fve.getName() != null) {
|
||||
data.addError(fve.getName(), fve.getMessage());
|
||||
} else {
|
||||
data.addError(fve.getMessage());
|
||||
}
|
||||
data.addError("Initialization Aborted: " + fpe.getMessages());
|
||||
} finally {
|
||||
DeveloperSupport.endStage("Bebop Form Process");
|
||||
}
|
||||
|
|
@ -383,15 +378,6 @@ public class FormModel implements Lockable {
|
|||
try {
|
||||
DeveloperSupport.startStage("Bebop Form Init");
|
||||
fireFormInit(e);
|
||||
} catch (FormValidationException fve) {
|
||||
s_log.debug("A FormValidationException was thrown while " +
|
||||
"initializing the form; storing the error");
|
||||
|
||||
if (fve.getName() == null) {
|
||||
data.addError(fve.getMessage());
|
||||
} else {
|
||||
data.addError(fve.getName(), fve.getMessage());
|
||||
}
|
||||
} catch (FormProcessException fpe) {
|
||||
s_log.debug("A FormProcessException was thrown while " +
|
||||
"initializing the form; storing the error", fpe);
|
||||
|
|
|
|||
|
|
@ -1,77 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.bebop;
|
||||
|
||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||
import com.arsdigita.bebop.form.Widget;
|
||||
|
||||
/**
|
||||
* FormValidationException
|
||||
*
|
||||
* @author <a href="mailto:rhs@mit.edu">rhs@mit.edu</a>
|
||||
* @version $Id: FormValidationException.java 287 2005-02-22 00:29:02Z sskracic $
|
||||
*/
|
||||
|
||||
public class FormValidationException extends FormProcessException {
|
||||
|
||||
/** */
|
||||
private String m_name = null;
|
||||
|
||||
public FormValidationException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public FormValidationException(String name, String message) {
|
||||
super(message);
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
public FormValidationException(ParameterModel parameter, String message) {
|
||||
this(parameter.getName(), message);
|
||||
}
|
||||
|
||||
public FormValidationException(Widget widget, String message) {
|
||||
this(widget.getParameterModel(), message);
|
||||
}
|
||||
|
||||
public FormValidationException(String message, Throwable rootCause) {
|
||||
super(message, rootCause);
|
||||
}
|
||||
|
||||
public FormValidationException(String name, String message,
|
||||
Throwable rootCause) {
|
||||
super(message, rootCause);
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
public FormValidationException(ParameterModel parameter, String message,
|
||||
Throwable rootCause) {
|
||||
this(parameter.getName(), message, rootCause);
|
||||
}
|
||||
|
||||
public FormValidationException(Widget widget, String message,
|
||||
Throwable rootCause) {
|
||||
this(widget.getParameterModel(), message, rootCause);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return m_name;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -96,3 +96,5 @@ ui.folder.deletion_while_not_empty=Folders must be empty before they can be dele
|
|||
ui.error.unexpected=An unexpected error occurred
|
||||
ui.authoring.file_option_null=File option was null
|
||||
ui.unspecified_search_parameters=At least one search parameter must be specified
|
||||
ui.folder.name_not_unique=A folder with this name already exists
|
||||
ui.folder.choose_destination=Please choose a destination
|
||||
|
|
|
|||
|
|
@ -96,3 +96,5 @@ ui.folder.deletion_while_not_empty=Folders must be empty before they can be dele
|
|||
ui.error.unexpected=An unexpected error occurred
|
||||
ui.authoring.file_option_null=File option was null
|
||||
ui.unspecified_search_parameters=At least one search parameter must be specified
|
||||
ui.folder.name_not_unique=A folder with this name already exists
|
||||
ui.folder.choose_destination=Please choose a destination
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ package com.arsdigita.cms.docmgr.ui;
|
|||
import com.arsdigita.bebop.ColumnPanel;
|
||||
import com.arsdigita.bebop.Form;
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.FormValidationException;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.RequestLocal;
|
||||
|
|
@ -34,6 +33,7 @@ import com.arsdigita.cms.docmgr.DocFolder;
|
|||
import com.arsdigita.cms.docmgr.Repository;
|
||||
import com.arsdigita.cms.docmgr.Resource;
|
||||
import com.arsdigita.cms.docmgr.ResourceExistsException;
|
||||
import com.arsdigita.cms.docmgr.util.GlobalizationUtil;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.domain.DomainCollection;
|
||||
|
|
@ -189,8 +189,8 @@ class DestinationFolderForm extends Form
|
|||
try {
|
||||
String parent = (String) m_radioGroup.getValue(state);
|
||||
if (parent == null) {
|
||||
throw new FormValidationException
|
||||
("Please choose a destination.");
|
||||
throw new FormProcessException(GlobalizationUtil.globalize(
|
||||
"ui.folder.choose_destination"));
|
||||
}
|
||||
OID parentOID =
|
||||
new OID(DocFolder.BASE_DATA_OBJECT_TYPE,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import com.arsdigita.bebop.ColumnPanel;
|
|||
import com.arsdigita.bebop.Form;
|
||||
import com.arsdigita.bebop.FormData;
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.FormValidationException;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.SimpleContainer;
|
||||
|
|
@ -40,6 +39,7 @@ import com.arsdigita.bebop.parameters.StringParameter;
|
|||
import com.arsdigita.cms.docmgr.DocFolder;
|
||||
import com.arsdigita.cms.docmgr.ResourceExistsException;
|
||||
import com.arsdigita.cms.docmgr.Util;
|
||||
import com.arsdigita.cms.docmgr.util.GlobalizationUtil;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.KernelExcursion;
|
||||
|
|
@ -135,8 +135,8 @@ class FolderCreateForm extends Form
|
|||
try {
|
||||
folder.save();
|
||||
} catch (ResourceExistsException ree) {
|
||||
throw new FormValidationException
|
||||
("A folder with this name already exists.");
|
||||
throw new FormProcessException(GlobalizationUtil.globalize(
|
||||
"ui.folder.name_not_unique"));
|
||||
}
|
||||
|
||||
new KernelExcursion() {
|
||||
|
|
|
|||
|
|
@ -69,3 +69,8 @@ ui.workspace.search.title=Search
|
|||
ui.workspace.title=Workspace
|
||||
ui.fileinfo.upload.initialversion.description=Initial version
|
||||
ui.portlet.action.newresource=New Document
|
||||
ui.folder.name_not_unique=A folder with this name already exists
|
||||
ui.workspace.sign_out=Sign out
|
||||
ui.admin_view=View of the Admin
|
||||
ui.user_view=The view of the User
|
||||
ui.folder.choose_destination=Please choose a destination
|
||||
|
|
|
|||
|
|
@ -69,3 +69,8 @@ ui.workspace.search.title=Search
|
|||
ui.workspace.title=Workspace
|
||||
ui.fileinfo.upload.initialversion.description=Initial version
|
||||
ui.portlet.action.newresource=New Document
|
||||
ui.folder.name_not_unique=Ein Ordner mit diesem Namen existiert bereits
|
||||
ui.workspace.sign_out=Abmelden
|
||||
ui.admin_view=Ansicht des Admin
|
||||
ui.user_view=Die Ansicht des Benutzers
|
||||
ui.folder.choose_destination=Bitte w\u00e4hle ein Ziel
|
||||
|
|
|
|||
|
|
@ -69,3 +69,8 @@ ui.workspace.search.title=Search
|
|||
ui.workspace.title=Workspace
|
||||
ui.fileinfo.upload.initialversion.description=Initial version
|
||||
ui.portlet.action.newresource=New Document
|
||||
ui.folder.name_not_unique=A folder with this name already exists
|
||||
ui.workspace.sign_out=Sign out
|
||||
ui.admin_view=View of the Admin
|
||||
ui.user_view=The view of the User
|
||||
ui.folder.choose_destination=Please choose a destination
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ package com.arsdigita.docrepo.ui;
|
|||
import com.arsdigita.bebop.ColumnPanel;
|
||||
import com.arsdigita.bebop.Form;
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.FormValidationException;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.RequestLocal;
|
||||
|
|
@ -37,6 +36,7 @@ import com.arsdigita.docrepo.Folder;
|
|||
import com.arsdigita.docrepo.Repository;
|
||||
import com.arsdigita.docrepo.ResourceImpl;
|
||||
import com.arsdigita.docrepo.Util;
|
||||
import com.arsdigita.docrepo.util.GlobalizationUtil;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
|
|
@ -143,9 +143,8 @@ class DestinationFolderForm extends Form
|
|||
try {
|
||||
String parent = (String) m_radioGroup.getValue(state);
|
||||
if (parent == null) {
|
||||
throw new FormValidationException(
|
||||
"Please choose a destination."
|
||||
);
|
||||
throw new FormProcessException(GlobalizationUtil.globalize(
|
||||
"ui.folder.choose_destination"));
|
||||
}
|
||||
OID parentOID =
|
||||
new OID(ResourceImpl.BASE_DATA_OBJECT_TYPE,
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ class DocrepoBasePage extends Page {
|
|||
}
|
||||
|
||||
protected void buildGlobal(Container global) {
|
||||
Link link = new Link( new Label(GlobalizationUtil.globalize("cw.workspace.sign_out")), "/register/logout");
|
||||
Link link = new Link( new Label(GlobalizationUtil.globalize("ui.workspace.sign_out")), "/register/logout");
|
||||
|
||||
link.setClassAttr("signoutLink");
|
||||
|
||||
|
|
@ -190,12 +190,12 @@ class DocrepoBasePage extends Page {
|
|||
if (m_view != null) {
|
||||
if (m_view.equals("user")) {
|
||||
m_viewLink = new Link
|
||||
( new Label(GlobalizationUtil.globalize("cw.doc.ui.admin_view")), "./admin/index.jsp") {
|
||||
( new Label(GlobalizationUtil.globalize("ui.admin_view")), "./admin/index.jsp") {
|
||||
public boolean isVisible(PageState ps) {
|
||||
return userIsAdmin(ps);
|
||||
}};
|
||||
} else if (m_view.equals("admin")) {
|
||||
m_viewLink = new Link( new Label(GlobalizationUtil.globalize("cw.doc.ui.user_view")), "../index.jsp");
|
||||
m_viewLink = new Link( new Label(GlobalizationUtil.globalize("ui.user_view")), "../index.jsp");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
cw.docs.ui.=
|
||||
|
|
@ -25,7 +25,6 @@ import com.arsdigita.bebop.ColumnPanel;
|
|||
import com.arsdigita.bebop.Form;
|
||||
import com.arsdigita.bebop.FormData;
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.FormValidationException;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.SimpleContainer;
|
||||
|
|
@ -53,6 +52,7 @@ import com.arsdigita.docrepo.Util;
|
|||
import com.arsdigita.docrepo.Folder;
|
||||
import com.arsdigita.docrepo.ResourceExistsException;
|
||||
import com.arsdigita.docrepo.InvalidNameException;
|
||||
import com.arsdigita.docrepo.util.GlobalizationUtil;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
|
@ -147,8 +147,8 @@ class FolderCreateForm extends Form
|
|||
try {
|
||||
folder.save();
|
||||
} catch (ResourceExistsException ree) {
|
||||
throw new FormValidationException
|
||||
("A folder with this name already exists.");
|
||||
throw new FormProcessException(GlobalizationUtil.globalize(
|
||||
"ui.folder.name_not_unique"));
|
||||
}
|
||||
|
||||
new KernelExcursion() {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import com.arsdigita.globalization.GlobalizedMessage;
|
|||
public class GlobalizationUtil implements Globalized {
|
||||
|
||||
private static final String BUNDLE_NAME =
|
||||
"com.arsdigita.docrepo.ui.DocsResources";
|
||||
"com.arsdigita.docrepo.DRResources";
|
||||
|
||||
public static GlobalizedMessage globalize(String key) {
|
||||
return new GlobalizedMessage(key, BUNDLE_NAME);
|
||||
|
|
|
|||
|
|
@ -6,3 +6,4 @@ cw.faq.ui.text_type=Text Type:
|
|||
cw.faq.ui.user_view=User View
|
||||
cw.faq.ui.admin_view=Administration view
|
||||
faq.ui.admin.no_settings=No settings available
|
||||
faq.ui.faq.not_found_in_db=The object you are editing cannot be found in the database
|
||||
|
|
|
|||
|
|
@ -6,3 +6,4 @@ cw.faq.ui.text_type=Text Typ:
|
|||
cw.faq.ui.user_view=Benutzeransicht
|
||||
cw.faq.ui.admin_view=Administrationsansicht
|
||||
faq.ui.admin.no_settings=Keine Einstellungen verf\u00fcgbar
|
||||
faq.ui.faq.not_found_in_db=Das Object, welches Sie gerade bearbeiten, kann in der Datenbank nicht gefunden werden
|
||||
|
|
|
|||
|
|
@ -6,3 +6,4 @@ cw.faq.ui.text_type=Text Type:
|
|||
cw.faq.ui.user_view=User View
|
||||
cw.faq.ui.admin_view=Administration view
|
||||
faq.ui.admin.no_settings=
|
||||
faq.ui.faq.not_found_in_db=The object you are editing cannot be found in the database
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ import com.arsdigita.bebop.ColumnPanel;
|
|||
import com.arsdigita.bebop.Form;
|
||||
import com.arsdigita.bebop.FormData;
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.FormValidationException;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.RequestLocal;
|
||||
|
|
@ -182,9 +181,8 @@ public class FaqQuestionEntryForm extends Form
|
|||
pair = getQAPair(state);
|
||||
|
||||
if (pair == null) {
|
||||
throw new FormValidationException
|
||||
("The object you are editing cannot be found in the " +
|
||||
"database.");
|
||||
throw new FormProcessException(GlobalizationUtil.globalize(
|
||||
"faq.ui.faq.not_found_in_db"));
|
||||
}
|
||||
|
||||
pair.setQuestion((String) data.get("question"));
|
||||
|
|
|
|||
|
|
@ -303,10 +303,8 @@ public class PartyPermissionEdit extends CompoundComponent {
|
|||
if (targets.size() == 0) {
|
||||
widgets.setVisible(ps, false);
|
||||
m_cancel.setVisible(ps, true);
|
||||
throw new FormValidationException(
|
||||
"There are no objects that this " +
|
||||
"party can be granted permission on."
|
||||
);
|
||||
throw new FormProcessException(GlobalizationUtil.globalize(
|
||||
"cw.cw.permissions.no_objects"));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
cw.cw.permissions.=
|
||||
cw.cw.permissions.no_objects=There are no objects that this party can be granted permission on
|
||||
cw.cw.permissions.view_and_manage_specific_permissions=View and Manage Specific Permissions
|
||||
cw.cw.permissions.add_user_or_role=Add User or Role
|
||||
cw.cw.permissions.view_general_permissions=View General Permissions
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
cw.cw.permissions.=
|
||||
cw.cw.permissions.no_objects=Es gibt keine Objekte, f\u00fcr die dieser Gruppe Berechtigung gew\u00e4hrt werden kann
|
||||
cw.cw.permissions.view_and_manage_specific_permissions=View and Manage Specific Permissions
|
||||
cw.cw.permissions.add_user_or_role=Nutzer oder Rolle hinzuf\u00fcgen
|
||||
cw.cw.permissions.view_general_permissions=View General Permissions
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import com.arsdigita.bebop.BoxPanel;
|
|||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.bebop.CompoundComponent;
|
||||
import com.arsdigita.bebop.Form;
|
||||
import com.arsdigita.bebop.FormValidationException;
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.Page;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
|
|
@ -696,7 +696,7 @@ class PortletAddForm extends CompoundComponent {
|
|||
|
||||
f.addProcessListener(new FormProcessListener() {
|
||||
public void process(FormSectionEvent ev)
|
||||
throws FormValidationException {
|
||||
throws FormProcessException {
|
||||
PageState ps = ev.getPageState();
|
||||
|
||||
if (next.isSelected(ps)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue