KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sync4j > framework > core > Alert


1 /**
2  * Copyright (C) 2003-2005 Funambol
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18
19
20 package sync4j.framework.core;
21
22
23 /**
24  * Corresponds to <Alert> element in SyncML represent DTD
25  *
26  * @author Stefano Fornari @ Funambol
27  * @see AlertCode
28  *
29  * @version $Id: Alert.java,v 1.3 2005/03/02 20:57:37 harrie Exp $
30  */

31 public final class Alert
32 extends ItemizedCommand
33 implements java.io.Serializable JavaDoc {
34     
35     // --------------------------------------------------------------- Constants
36
public static String JavaDoc COMMAND_NAME = "Alert";
37     
38     // ------------------------------------------------------------ Private data
39
private int data;
40     
41     // ------------------------------------------------------------ Constructors
42

43     /** For serialization purposes */
44     protected Alert() {}
45     
46     /**
47      * Creates a new Alert object with the given command identifier,
48      * noResponse, authentication credential, alert code and array of item
49      *
50      * @param cmdID command identifier - NOT NULL
51      * @param noResp is true if no response is required
52      * @param cred the authentication credential
53      * @param data the code of Alert
54      * @param items the array of item - NOT NULL
55      *
56      */

57     public Alert(final CmdID cmdID,
58                  final boolean noResp,
59                  final Cred cred,
60                  final int data,
61                  final Item[] items) {
62         super(cmdID, items);
63         
64         this.noResp = (noResp) ? new Boolean JavaDoc(noResp) : null;
65         setCred(cred);
66         
67         this.data = data;
68     }
69
70     // ---------------------------------------------------------- Public methods
71

72     /**
73      * Gets the alert code
74      *
75      * @return the alert code
76      */

77     public int getData() {
78         return data;
79     }
80     
81     /**
82      * Sets the alert code
83      *
84      * @param data the alert code
85      */

86     public void setData(int data) {
87         this.data = data;
88     }
89     
90     /**
91      * Gets the command name property
92      *
93      * @return the command name property
94      */

95     public String JavaDoc getName() {
96         return Alert.COMMAND_NAME;
97     }
98 }
99
Popular Tags