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 SetVarAction sets the value of a global or local channel variable.<br>
21   * Setting global variables is supported since Asterisk 1.2.
22   * 
23   * @author Asteria Solutions Group, Inc. <http://www.asteriasgi.com>
24   * @author srt
25   * @version $Id: SetVarAction.java,v 1.4 2005/11/08 11:37:22 srt Exp $
26   */
27  public class SetVarAction extends AbstractManagerAction
28  {
29      /***
30       * Serial version identifier
31       */
32      private static final long serialVersionUID = 3978144348493591607L;
33  
34      /***
35       * The channel on which to set the variable.
36       */
37      public String channel;
38  
39      /***
40       * The name of the variable to set.
41       */
42      public String variable;
43  
44      /***
45       * The value to store.
46       */
47      public String value;
48  
49      /***
50       * Creates a new empty SetVarAction.
51       */
52      public SetVarAction()
53      {
54  
55      }
56  
57      /***
58       * Creates a new SetVarAction that sets the given global variable to a new value.
59       * 
60       * @param variable the name of the global variable to set
61       * @param value the new value
62       * @since 0.2
63       */
64      public SetVarAction(String variable, String value)
65      {
66          this.variable = variable;
67          this.value = value;
68      }
69      
70      /***
71       * Creates a new SetVarAction that sets the given channel variable of the
72       * given channel to a new value.
73       * 
74       * @param channel the name of the channel to set the variable on
75       * @param variable the name of the channel variable
76       * @param value the new value
77       * @since 0.2
78       */
79      public SetVarAction(String channel, String variable, String value)
80      {
81          this.channel = channel;
82          this.variable = variable;
83          this.value = value;
84      }
85  
86      /***
87       * Returns the name of this action, i.e. "SetVar".
88       * 
89       * @return the name of this action
90       */
91      public String getAction()
92      {
93          return "SetVar";
94      }
95  
96      /***
97       * Returns the name of the channel.
98       * 
99       * @return the name of channel.
100      */
101     public String getChannel()
102     {
103         return channel;
104     }
105 
106     /***
107      * Sets the name of the channel.
108      * 
109      * @param channel the name of the channel to set.
110      */
111     public void setChannel(String channel)
112     {
113         this.channel = channel;
114     }
115 
116     /***
117      * Returns the name of the variable to set.
118      * 
119      * @return the name of the variable to set.
120      */
121     public String getVariable()
122     {
123         return variable;
124     }
125 
126     /***
127      * Sets the name of the variable to set.
128      * 
129      * @param variable the name of the variable to set.
130      */
131     public void setVariable(String variable)
132     {
133         this.variable = variable;
134     }
135 
136     /***
137      * Returns the value to store.
138      * 
139      * @return the value to store.
140      */
141     public String getValue()
142     {
143         return value;
144     }
145 
146     /***
147      * Sets the value to store.
148      * 
149      * @param value the value to set.
150      */
151     public void setValue(String value)
152     {
153         this.value = value;
154     }
155 }