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: JoramUserForm.java 7248 2005-08-16 15:13:13Z danesa $
023: * --------------------------------------------------------------------------
024: */package org.objectweb.jonas.webapp.jonasadmin.joramplatform;
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 JoramUserForm extends ActionForm {
037:
038: // --------------------------------------------------------- Constants
039:
040: // --------------------------------------------------------- Properties variables
041:
042: private String name = null;
043: private String password = null;
044: private int serverId;
045:
046: // --------------------------------------------------------- Public Methods
047:
048: /**
049: * Reset all properties to their default values.
050: *
051: * @param mapping The mapping used to select this instance
052: * @param request The servlet request we are processing
053: */
054:
055: public void reset(ActionMapping mapping, HttpServletRequest request) {
056: name = null;
057: password = null;
058: }
059:
060: /**
061: * Validate the properties that have been set from this HTTP request,
062: * and return an <code>ActionErrors</code> object that encapsulates any
063: * validation errors that have been found. If no errors are found, return
064: * <code>null</code> or an <code>ActionErrors</code> object with no
065: * recorded error messages.
066: *
067: * @param mapping The mapping used to select this instance
068: * @param request The servlet request we are processing
069: * @return List of errors
070: */
071: public ActionErrors validate(ActionMapping mapping,
072: HttpServletRequest request) {
073: ActionErrors oErrors = new ActionErrors();
074: if ((getName() == null) || (getName().length() == 0)) {
075: oErrors.add("name", new ActionMessage(
076: "error.resource.jms.create.name.required"));
077: }
078: if (getPassword() == null) {
079: oErrors.add("password", new ActionMessage(
080: "error.resource.jms.create.password.required"));
081: }
082: return oErrors;
083: }
084:
085: // --------------------------------------------------------- Properties Methods
086:
087: public String getName() {
088: return name;
089: }
090:
091: public void setName(String name) {
092: this .name = name;
093: }
094:
095: public String getPassword() {
096: return password;
097: }
098:
099: public void setPassword(String password) {
100: this .password = password;
101: }
102:
103: /**
104: * @return Returns the serverId.
105: */
106: public int getServerId() {
107: return serverId;
108: }
109:
110: /**
111: * @param serverId The serverId to set.
112: */
113: public void setServerId(int serverId) {
114: this.serverId = serverId;
115: }
116:
117: }
|