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.fastagi.command;
18  
19  /***
20   * Deletes an entry in the Asterisk database for a given family and key.<br>
21   * Returns 1 if successful, 0 otherwise.
22   * 
23   * @author srt
24   * @version $Id: DatabaseDelTreeCommand.java,v 1.2 2005/03/08 16:48:34 srt Exp $
25   */
26  public class DatabaseDelTreeCommand extends AGICommand
27  {
28      /***
29       * Serial version identifier.
30       */
31      private static final long serialVersionUID = 3256719598056387384L;
32  
33      /***
34       * The family of the key to delete.
35       */
36      private String family;
37  
38      /***
39       * The key to delete.
40       */
41      private String key;
42  
43      /***
44       * Creates a new DatabaseDelCommand.
45       * 
46       * @param family the family of the key to delete.
47       * @param key the key to delete.
48       */
49      public DatabaseDelTreeCommand(String family, String key)
50      {
51          this.family = family;
52          this.key = key;
53      }
54  
55      /***
56       * Returns the family of the key to delete.
57       * 
58       * @return the family of the key to delete.
59       */
60      public String getFamily()
61      {
62          return family;
63      }
64  
65      /***
66       * Sets the family of the key to delete.
67       * 
68       * @param family the family of the key to delete.
69       */
70      public void setFamily(String family)
71      {
72          this.family = family;
73      }
74  
75      /***
76       * Returns the the key to delete.
77       * 
78       * @return the key to delete.
79       */
80      public String getKey()
81      {
82          return key;
83      }
84  
85      /***
86       * Sets the key to delete.
87       * 
88       * @param key the key to delete.
89       */
90      public void setKey(String key)
91      {
92          this.key = key;
93      }
94  
95      public String buildCommand()
96      {
97          return "DATABASE DEL " + escapeAndQuote(family) + " "
98                  + escapeAndQuote(key);
99      }
100 }