KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nextime > ion > backoffice > form > CreatePublicationForm


1 package org.nextime.ion.backoffice.form;
2
3 import javax.servlet.http.HttpServletRequest JavaDoc;
4
5 import org.apache.struts.action.ActionError;
6 import org.apache.struts.action.ActionErrors;
7 import org.apache.struts.action.ActionForm;
8 import org.apache.struts.action.ActionMapping;
9
10 public class CreatePublicationForm extends ActionForm {
11     
12     private String JavaDoc name;
13     private String JavaDoc type;
14     private String JavaDoc workflow;
15     
16     /**
17      * @see org.apache.struts.action.ActionForm#validate(ActionMapping, HttpServletRequest)
18      */

19     public ActionErrors myValidate(HttpServletRequest JavaDoc request) {
20         ActionErrors errors = new ActionErrors();
21         if( "".equals(getName()) ) {
22             ActionError error = new ActionError("error.createPublication.nameMissing");
23             errors.add("name",error);
24         }
25         if( "".equals(getType()) ) {
26             ActionError error = new ActionError("error.createPublication.typeMissing");
27             errors.add("type",error);
28         }
29         if( "".equals(getWorkflow()) ) {
30             ActionError error = new ActionError("error.general.missingField");
31             errors.add("workflow",error);
32         }
33         return errors;
34     }
35
36
37     /**
38      * @see org.apache.struts.action.ActionForm#reset(ActionMapping, HttpServletRequest)
39      */

40     public void reset(ActionMapping arg0, HttpServletRequest JavaDoc arg1) {
41         setName(null);
42         setType(null);
43         setWorkflow(null);
44     }
45
46
47     /**
48      * Returns the name.
49      * @return String
50      */

51     public String JavaDoc getName() {
52         return name;
53     }
54
55
56     /**
57      * Returns the type.
58      * @return String
59      */

60     public String JavaDoc getType() {
61         return type;
62     }
63
64
65     /**
66      * Sets the name.
67      * @param name The name to set
68      */

69     public void setName(String JavaDoc name) {
70         this.name = name;
71     }
72
73
74     /**
75      * Sets the type.
76      * @param type The type to set
77      */

78     public void setType(String JavaDoc type) {
79         this.type = type;
80     }
81
82
83     /**
84      * Returns the workflow.
85      * @return String
86      */

87     public String JavaDoc getWorkflow() {
88         return workflow;
89     }
90
91     /**
92      * Sets the workflow.
93      * @param workflow The workflow to set
94      */

95     public void setWorkflow(String JavaDoc workflow) {
96         this.workflow = workflow;
97     }
98
99 }
100
101
Popular Tags