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.action;
18  
19  /***
20   * The QueueAddAction adds a new member to a queue.<br>
21   * It is implemented in <code>apps/app_queue.c</code>
22   * 
23   * @author srt
24   * @version $Id: QueueAddAction.java,v 1.6 2005/08/28 09:28:59 srt Exp $
25   */
26  public class QueueAddAction extends AbstractManagerAction
27  {
28      /***
29       * Serializable version identifier
30       */
31      private static final long serialVersionUID = -7022129266332219953L;
32      private String queue;
33      private String iface;
34      private Integer penalty;
35      private Boolean paused;
36  
37      /***
38       * Creates a new empty QueueAddAction.
39       */
40      public QueueAddAction()
41      {
42  
43      }
44  
45      /***
46       * Creates a new QueueAddAction that adds a new member on the given
47       * interface to the given queue.
48       * 
49       * @param queue the name of the queue the new member will be added to
50       * @param iface Sets the interface to add. To add a specific channel just
51       *            use the channel name, e.g. "SIP/1234".
52       * @since 0.2
53       */
54      public QueueAddAction(String queue, String iface)
55      {
56          this.queue = queue;
57          this.iface = iface;
58      }
59  
60      /***
61       * Creates a new QueueAddAction that adds a new member on the given
62       * interface to the given queue with the given penalty.
63       * 
64       * @param queue the name of the queue the new member will be added to
65       * @param iface Sets the interface to add. To add a specific channel just
66       *            use the channel name, e.g. "SIP/1234".
67       * @param penalty the penalty for this member. The penalty must be a
68       *            positive integer or 0 for no penalty. When calls are
69       *            distributed members with higher penalties are considered last.
70       * @since 0.2
71       */
72      public QueueAddAction(String queue, String iface, Integer penalty)
73      {
74          this.queue = queue;
75          this.iface = iface;
76          this.penalty = penalty;
77      }
78  
79      /***
80       * Returns the name of this action, i.e. "QueueAdd".
81       */
82      public String getAction()
83      {
84          return "QueueAdd";
85      }
86  
87      /***
88       * Returns the name of the queue the new member will be added to.
89       */
90      public String getQueue()
91      {
92          return queue;
93      }
94  
95      /***
96       * Sets the name of the queue the new member will be added to.<br>
97       * This property is mandatory.
98       */
99      public void setQueue(String queue)
100     {
101         this.queue = queue;
102     }
103 
104     /***
105      * Returns the interface to add.
106      */
107     public String getInterface()
108     {
109         return iface;
110     }
111 
112     /***
113      * Sets the interface to add.<br>
114      * To add a specific channel just use the channel name, e.g. "SIP/1234".<br>
115      * This property is mandatory.
116      */
117     public void setInterface(String iface)
118     {
119         this.iface = iface;
120     }
121 
122     /***
123      * Returns the penalty for this member.
124      */
125     public Integer getPenalty()
126     {
127         return penalty;
128     }
129 
130     /***
131      * Sets the penalty for this member.<br>
132      * The penalty must be a positive integer or 0 for no penalty. If it is
133      * not set 0 is assumed.<br>
134      * When calls are distributed members with higher penalties are considered
135      * last.
136      */
137     public void setPenalty(Integer penalty)
138     {
139         this.penalty = penalty;
140     }
141 
142     /***
143      * Returns if the queue member should be paused when added.
144      * 
145      * @return Boolean.TRUE if the queue member should be paused when added.
146      * @since 0.2
147      */
148     public Boolean getPaused()
149     {
150         return paused;
151     }
152 
153     /***
154      * Sets if the queue member should be paused when added.
155      * 
156      * @param paused Boolean.TRUE if the queue member should be paused when
157      *            added.
158      * @since 0.2
159      */
160     public void setPaused(Boolean paused)
161     {
162         this.paused = paused;
163     }
164 }