1    package com.instantbank.lettertemplate.control.event;
2    
3    import java.io.Serializable;
4    import java.util.ArrayList;
5    
6    /**
7     *  Letter Templates usecase: This event is sent from the web tier to the EJB
8     *  Controller to notify the EJB Controller that an action needs to be made in
9     *  the letter Templates model data.
10    *
11    * @author Instant-bank (Jorge Cardenas)
12    * @created August 2002
13    */
14   public class TemplatesEvent extends LetterTemplateEventSupport {
15   
16     // possible actions on templates model data:
17     /**
18      *  action constant of getting the templates list of the current company
19      */
20     public static final int LIST_TEMPLATES_NAMES = 0;
21     /**
22      *  action constant of changing the templates list of the current company
23      */
24     public static final int UPDATE_TEMPLATES_NAMES = 1;
25   
26     // attributes: necesary data for executing the operations
27     /**
28      *  action requested by the user
29      */
30     private int actionType;
31     /**
32      *  current company
33      */
34     private String companyId;
35     /**
36      *  current user
37      */
38     private Long userId;
39     /**
40      *  items for changing the templates list of the current company
41      */
42     private ArrayList items;
43   
44   
45     /**
46      *  constructor: initializes attributes
47      *
48      * @param actionType action requested by the user
49      * @param companyId current company
50      * @param userId current user
51      * @param items for changing the templates list of the current
52      *      company
53      */
54     public TemplatesEvent(int actionType, String companyId, Long userId,
55                           ArrayList items) {
56       this.actionType = actionType;
57       this.companyId = companyId;
58       this.userId = userId;
59       this.items = items;
60     }
61   
62   
63     /**
64      *  get method for actionType
65      *
66      * @return The actionType value
67      */
68     public int getActionType() {
69       return actionType;
70     }
71   
72   
73     /**
74      *  get method for companyId
75      *
76      * @return The companyId value
77      */
78     public String getCompanyId() {
79       return companyId;
80     }
81   
82   
83     /**
84      *  get method for userId
85      *
86      * @return The userId value
87      */
88     public Long getUserId() {
89       return userId;
90     }
91   
92   
93     /**
94      *  get method for items
95      *
96      * @return The items value
97      */
98     public ArrayList getItems() {
99       return items;
100    }
101  
102  
103    /**
104     *  String representation of the event
105     *
106     * @return text of event
107     */
108    public String toString() {
109      return "TemplatesEvent("
110        + String.valueOf(actionType) + ", "
111        + companyId + ", "
112        + userId.toString() +
113        ")";
114    }
115  
116  
117    /**
118     *  JNDI name for the event: LetterTemplateController EJB registers this env variable
119     *
120     * @return The eventName value
121     */
122    public String getEventName() {
123      return "java:comp/env/templatesEvent";
124    }
125  }
126