View Javadoc

1   /*
2    * Copyright  2004-2005 Stefan Reuter
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   *
16   */
17  package net.sf.asterisk.manager.event;
18  
19  /***
20   * A QueueMemberAddedEvent is triggered when a queue member is added to a queue.<br>
21   * It is implemented in <code>apps/app_queue.c</code>.<br>
22   * Available since Asterisk 1.2
23   * 
24   * @author srt
25   * @version $Id: QueueMemberAddedEvent.java,v 1.1 2005/08/28 09:45:19 srt Exp $
26   * @since 0.2
27   */
28  public class QueueMemberAddedEvent extends AbstractQueueMemberEvent
29  {
30      /***
31       * Serial version identifier.
32       */
33      private static final long serialVersionUID = 2108033737226142194L;
34  
35      private String membership;
36      private Integer penalty;
37      private Integer callsTaken;
38      private Long lastCall;
39      private Integer status;
40      private Boolean paused;
41  
42      public QueueMemberAddedEvent(Object source)
43      {
44          super(source);
45      }
46  
47      /***
48       * Returns if the added member is a dynamic or static queue member.
49       * 
50       * @return "dynamic" if the added member is a dynamic queue member, "static"
51       *         if the added member is a static queue member.
52       */
53      public String getMembership()
54      {
55          return membership;
56      }
57  
58      /***
59       * Sets if the added member is a dynamic or static queue member.
60       * 
61       * @param membership "dynamic" if the added member is a dynamic queue
62       *            member, "static" if the added member is a static queue member.
63       */
64      public void setMembership(String membership)
65      {
66          this.membership = membership;
67      }
68  
69      /***
70       * Returns the penalty for the added member. When calls are distributed
71       * members with higher penalties are considered last.
72       * 
73       * @return the penalty for the added member.
74       */
75      public Integer getPenalty()
76      {
77          return penalty;
78      }
79  
80      /***
81       * Sets the penalty for this member.
82       * 
83       * @param penalty the penalty for this member.
84       */
85      public void setPenalty(Integer penalty)
86      {
87          this.penalty = penalty;
88      }
89  
90      /***
91       * Returns the number of calls answered by the member.
92       * 
93       * @return the number of calls answered by the member.
94       */
95      public Integer getCallsTaken()
96      {
97          return callsTaken;
98      }
99  
100     /***
101      * Sets the number of calls answered by the added member.
102      * 
103      * @param callsTaken the number of calls answered by the added member.
104      */
105     public void setCallsTaken(Integer callsTaken)
106     {
107         this.callsTaken = callsTaken;
108     }
109 
110     /***
111      * Returns the time the last successful call answered by the added member
112      * was hungup.
113      * 
114      * @return the time (in seconds since 01/01/1970) the last successful call
115      *         answered by the added member was hungup.
116      */
117     public Long getLastCall()
118     {
119         return lastCall;
120     }
121 
122     /***
123      * Sets the time the last successful call answered by this member was
124      * hungup.
125      * 
126      * @param lastCall the time (in seconds since 01/01/1970) the last
127      *            successful call answered by the added member was hungup.
128      */
129     public void setLastCall(Long lastCall)
130     {
131         this.lastCall = lastCall;
132     }
133 
134     /***
135      * Returns the status of this queue member.<br>
136      * Valid status codes are:
137      * <dl>
138      * <dt>AST_DEVICE_UNKNOWN (0)</dt>
139      * <dd>Queue member is available</dd>
140      * <dt>AST_DEVICE_NOT_INUSE (1)</dt>
141      * <dd>?</dd>
142      * <dt>AST_DEVICE_INUSE (2)</dt>
143      * <dd>?</dd>
144      * <dt>AST_DEVICE_BUSY (3)</dt>
145      * <dd>?</dd>
146      * <dt>AST_DEVICE_INVALID (4)</dt>
147      * <dd>?</dd>
148      * <dt>AST_DEVICE_UNAVAILABLE (5)</dt>
149      * <dd>?</dd>
150      * </dl>
151      * 
152      * @return the status of this queue member.
153      */
154     public Integer getStatus()
155     {
156         return status;
157     }
158 
159     /***
160      * Sets the status of this queue member.
161      * 
162      * @param the status of this queue member
163      */
164     public void setStatus(Integer status)
165     {
166         this.status = status;
167     }
168 
169     /***
170      * Returns if this queue member is paused (not accepting calls).<br>
171      * 
172      * @return <code>Boolean.TRUE</code> if this member has been paused or
173      *         <code>Boolean.FALSE</code> if not.
174      */
175     public Boolean getPaused()
176     {
177         return paused;
178     }
179 
180     /***
181      * Sets if this member is paused.
182      * 
183      * @param paused <code>Boolean.TRUE</code> if this member has been paused
184      *            or <code>Boolean.FALSE</code> if not.
185      */
186     public void setPaused(Boolean paused)
187     {
188         this.paused = paused;
189     }
190 }