001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: DestinationForm.java 6599 2005-04-21 08:59:54Z kemlerp $
023: * --------------------------------------------------------------------------
024: */package org.objectweb.jonas.webapp.jonasadmin.resource;
025:
026: import javax.servlet.http.HttpServletRequest;
027:
028: import org.apache.struts.action.ActionMessage;
029: import org.apache.struts.action.ActionErrors;
030: import org.apache.struts.action.ActionForm;
031: import org.apache.struts.action.ActionMapping;
032:
033: /**
034: * @author Adriana Danes
035: */
036: public class DestinationForm extends ActionForm {
037:
038: // --------------------------------------------------------- Constants
039:
040: // --------------------------------------------------------- Properties variables
041:
042: private String name = null;
043: private String type = null;
044:
045: // --------------------------------------------------------- Public Methods
046:
047: /**
048: * Reset all properties to their default values.
049: *
050: * @param mapping The mapping used to select this instance
051: * @param request The servlet request we are processing
052: */
053:
054: public void reset(ActionMapping mapping, HttpServletRequest request) {
055: name = null;
056: type = null;
057: }
058:
059: /**
060: * Validate the properties that have been set from this HTTP request,
061: * and return an <code>ActionErrors</code> object that encapsulates any
062: * validation errors that have been found. If no errors are found, return
063: * <code>null</code> or an <code>ActionErrors</code> object with no
064: * recorded error messages.
065: *
066: * @param mapping The mapping used to select this instance
067: * @param request The servlet request we are processing
068: * @return List of errors
069: */
070: public ActionErrors validate(ActionMapping mapping,
071: HttpServletRequest request) {
072: ActionErrors oErrors = new ActionErrors();
073: if ((getName() == null) || (getName().length() == 0)) {
074: oErrors.add("name", new ActionMessage(
075: "error.resource.jms.create.name.required"));
076: }
077: if (getType() == null) {
078: oErrors.add("type", new ActionMessage(
079: "error.resource.jms.create.type.required"));
080: }
081: return oErrors;
082: }
083:
084: // --------------------------------------------------------- Properties Methods
085:
086: public String getName() {
087: return name;
088: }
089:
090: public void setName(String name) {
091: this .name = name;
092: }
093:
094: public String getType() {
095: return type;
096: }
097:
098: public void setType(String type) {
099: this.type = type;
100: }
101:
102: }
|