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 SetCDRUserFieldAction causes the user field of the call detail record for
21   * the given channel to be changed.<br>
22   * Depending on the value of the append property the value is appended or
23   * overwritten.<br>
24   * The SetCDRUserFieldAction is implemented in
25   * <code>apps/app_setcdruserfield.c</code>
26   * 
27   * @author srt
28   * @version $Id: SetCDRUserFieldAction.java,v 1.4 2005/08/07 16:43:29 srt Exp $
29   */
30  public class SetCDRUserFieldAction extends AbstractManagerAction
31  {
32      /***
33       * Serializable version identifier
34       */
35      private static final long serialVersionUID = -2024074141079750509L;
36      private String channel;
37      private String userField;
38      private Boolean append;
39  
40      /***
41       * Creates a new empty SetCDRUserFieldAction.
42       */
43      public SetCDRUserFieldAction()
44      {
45  
46      }
47  
48      /***
49       * Creates a new SetCDRUserFieldAction that sets the user field of the call
50       * detail record for the given channel to the given value.
51       * 
52       * @param channel the name of the channel
53       * @param userField the new value of the userfield
54       * @since 0.2
55       */
56      public SetCDRUserFieldAction(String channel, String userField)
57      {
58          this.channel = channel;
59          this.userField = userField;
60      }
61  
62      /***
63       * Creates a new SetCDRUserFieldAction that sets the user field of the call
64       * detail record for the given channel to the given value.
65       * 
66       * @param channel the name of the channel
67       * @param userField the new value of the userfield
68       * @param append true to append the value to the cdr user field or false to
69       *            overwrite
70       * @since 0.2
71       */
72      public SetCDRUserFieldAction(String channel, String userField,
73              Boolean append)
74      {
75          this.channel = channel;
76          this.userField = userField;
77          this.append = append;
78      }
79  
80      /***
81       * Returns the name of the action, i.e. "SetCDRUserField".
82       */
83      public String getAction()
84      {
85          return "SetCDRUserField";
86      }
87  
88      /***
89       * Returns the name of the channel to set the cdr user field on.
90       */
91      public String getChannel()
92      {
93          return channel;
94      }
95  
96      /***
97       * Sets the name of the channel to set the cdr user field on.<br>
98       * This property is mandatory.
99       */
100     public void setChannel(String channel)
101     {
102         this.channel = channel;
103     }
104 
105     /***
106      * Returns the value of the cdr user field to set or append.
107      */
108     public String getUserField()
109     {
110         return userField;
111     }
112 
113     /***
114      * Sets the value of the cdr user field to set or append.<br>
115      * This property is mandatory.
116      */
117     public void setUserField(String userField)
118     {
119         this.userField = userField;
120     }
121 
122     /***
123      * Returns if the value of the cdr user field is appended or overwritten.
124      */
125     public Boolean getAppend()
126     {
127         return append;
128     }
129 
130     /***
131      * Set to true to append the value to the cdr user field or false to
132      * overwrite.
133      */
134     public void setAppend(Boolean append)
135     {
136         this.append = append;
137     }
138 }