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 AgentLogoffAction sets an agent as no longer logged in.<br>
21   * Available since Asterisk 1.2
22   * 
23   * @author srt
24   * @version $Id: AgentLogoffAction.java,v 1.4 2005/08/26 21:58:48 srt Exp $
25   * @since 0.2
26   */
27  public class AgentLogoffAction extends AbstractManagerAction
28  {
29      /***
30       * Serializable version identifier
31       */
32      private static final long serialVersionUID = 5239805071977668779L;
33      private String agent;
34      private Boolean soft;
35  
36      /***
37       * Creates a new empty AgentLogoffAction.
38       */
39      public AgentLogoffAction()
40      {
41  
42      }
43  
44      /***
45       * Creates a new AgentLogoffAction that logs off the given agent
46       * 
47       * @param agent the name of the agent to log off.
48       */
49      public AgentLogoffAction(String agent)
50      {
51          this.agent = agent;
52      }
53  
54      /***
55       * Creates a new AgentLogoffAction that logs off the given agent
56       * 
57       * @param agent the name of the agent to log off.
58       * @param soft Boolean.TRUE if exisiting calls should not be hung up on
59       *            logout.
60       */
61      public AgentLogoffAction(String agent, Boolean soft)
62      {
63          this(agent);
64          this.soft = soft;
65      }
66  
67      /***
68       * Returns the name of this action, i.e. "AgentLogoff".
69       * 
70       * @return the name of this action
71       */
72      public String getAction()
73      {
74          return "AgentLogoff";
75      }
76  
77      /***
78       * Returns the name of the agent to log off, for example "1002".
79       * 
80       * @return the name of the agent to log off
81       */
82      public String getAgent()
83      {
84          return agent;
85      }
86  
87      /***
88       * Sets the name of the agent to log off, for example "1002".<br>
89       * This is property is mandatory.
90       * 
91       * @param agent the name of the agent to log off
92       */
93      public void setAgent(String agent)
94      {
95          this.agent = agent;
96      }
97  
98      /***
99       * Returns whether to hangup existing calls or not.<br>
100      * Default is to hangup existing calls on logoff.
101      * 
102      * @return Boolean.TRUE if existing calls should not be hung up,
103      *         Boolean.FALSE otherwise. <code>null</code> if default should be
104      *         used.
105      */
106     public Boolean getSoft()
107     {
108         return soft;
109     }
110 
111     /***
112      * Sets whether existing calls should be hung up or not.<br>
113      * Default is to hangup existing calls on logoff.
114      * 
115      * @param soft Boolean.TRUE if existing calls should not be hung up,
116      *            Boolean.FALSE otherwise. <code>null</code> if default should
117      *            be used.
118      */
119     public void setSoft(Boolean soft)
120     {
121         this.soft = soft;
122     }
123 }