1    package com.instantbank.lettertemplate.control.event;
2    
3    import java.io.Serializable;
4    import java.util.ArrayList;
5    import com.instantbank.component.job.model.JobModel;
6    import com.instantbank.common.utilcomponents.Debug;
7    
8    /**
9     *  Set Letter job usecase: This event is sent from the web tier to the EJB
10    *  Controller to notify the EJB Controller that an action needs to be made in
11    *  the letter Jobs model data.
12    *
13    * @author Instant-bank (Consuelo Franky)
14    * @created November 2002
15    */
16   public class SetLetterJobEvent extends LetterTemplateEventSupport {
17   
18     // possible actions on Jobs model data:
19   
20     /**
21      *  action constant of getting the jobs list of the current company
22      */
23     public static final int LIST_JOBS = 0;
24     /**
25      *  action constant of getting the fields of a letter template
26      */
27     public static final int GET_TEMPLATE_FIELDS = 1;
28     /**
29      *  action constant of getting a job
30      */
31     public static final int GET_JOB = 2;
32     /**
33      *  action constant of saving a job
34      */
35     public static final int SAVE_JOB = 3;
36     /**
37      *  action constant of removing a job
38      */
39     public static final int REMOVE_JOB = 4;
40   
41     // attributes: necesary data for executing the operations
42     /**
43      *  action requested by the user
44      */
45     private int actionType;
46     /**
47      *  current company
48      */
49     private String companyId;
50     /**
51      *  current user
52      */
53     private Long userId;
54     /**
55      *  template identifier associated to the job
56      */
57     private Long templateId;
58     /**
59      *  job identifier
60      */
61     private Long jobId;
62     /**
63      *  job Model corresponding to the job to save
64      */
65     private JobModel jobModel;
66   
67     private Debug debug = null;
68   
69   
70     /**
71      *  constructor: initializes attributes
72      *
73      * @param actionType action requested by the user
74      * @param companyId current company
75      * @param userId current user
76      * @param templateId template identifier associated to the job
77      * @param jobId job identifier
78      * @param jobModel job Model corresponding to the job to save
79      */
80     public SetLetterJobEvent(int actionType, String companyId, Long userId,
81                              Long templateId, Long jobId, JobModel jobModel) {
82       debug = new Debug();
83       debug.setDebugginOn(true);
84       debug.setPreMessage("** SetLetterJobEvent: ");
85   
86       this.actionType = actionType;
87       this.companyId = companyId;
88       this.userId = userId;
89       this.templateId = templateId;
90       this.jobId = jobId;
91       this.jobModel = jobModel;
92     }
93   
94   
95     /**
96      *  get method for actionType
97      *
98      * @return The actionType value
99      */
100    public int getActionType() {
101      return actionType;
102    }
103  
104  
105    /**
106     *  get method for companyId
107     *
108     * @return The companyId value
109     */
110    public String getCompanyId() {
111      return companyId;
112    }
113  
114  
115    /**
116     *  get method for userId
117     *
118     * @return The userId value
119     */
120    public Long getUserId() {
121      return userId;
122    }
123  
124  
125    /**
126     *  get method for templateId
127     *
128     * @return The templateId value
129     */
130    public Long getTemplateId() {
131      return templateId;
132    }
133  
134  
135    /**
136     *  get method for jobId
137     *
138     * @return The jobId value
139     */
140    public Long getJobId() {
141      return jobId;
142    }
143  
144  
145    /**
146     *  get method for jobModel
147     *
148     * @return The jobModel value
149     */
150    public JobModel getJobModel() {
151      return jobModel;
152    }
153  
154  
155    /**
156     *  String representation of the event
157     *
158     * @return text of event
159     */
160    public String toString() {
161      return "SetLetterJobEvent("
162        + String.valueOf(actionType) + ", "
163        + companyId + ", "
164        + userId +
165        ")";
166    }
167  
168  
169    /**
170     *  JNDI name for the event: Controller EJB registers this env variable
171     *
172     * @return The eventName value
173     */
174    public String getEventName() {
175      return "java:comp/env/setLetterJobEvent";
176    }
177  }
178  
179