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