KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sync4j > syncclient > spds > event > SyncItemEvent


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 package sync4j.syncclient.spds.event;
20
21 import sync4j.syncclient.spds.engine.SyncItemKey;
22
23 /**
24  * Is used to notify the listeners
25  * when a item is added / updated / deleted
26  * by a command received from the server
27  * or when a item is added / updated / deleted
28  * on by the client
29  *
30  * @author Fabio Maggi
31  *
32  * @version $Id: SyncItemEvent.java,v 1.2 2005/01/19 11:18:36 fabius Exp $
33  */

34 public class SyncItemEvent {
35
36     // -------------------------------------------------------- Constants
37

38     /** A new item is added on the client */
39     public static final int ITEM_ADDED_BY_SERVER = 0 ;
40
41     /** An item is deleted on the client */
42     public static final int ITEM_DELETED_BY_SERVER = 1 ;
43
44     /** An item is updated on the client */
45     public static final int ITEM_UPDATED_BY_SERVER = 2 ;
46
47     /** A new item is added by the client */
48     public static final int ITEM_ADDED_BY_CLIENT = 3 ;
49
50     /** An item is deleted by the client */
51     public static final int ITEM_DELETED_BY_CLIENT = 4 ;
52
53     /** An item is updated by the client */
54     public static final int ITEM_UPDATED_BY_CLIENT = 5 ;
55
56     // -------------------------------------------------------- Private data
57

58     private SyncItemKey itemKey = null ;
59     private String JavaDoc sourceUri = null ;
60     private int type = 0 ;
61
62     // -------------------------------------------------------- Constructors
63

64     /**
65      * Creates a SyncItemEvent
66      *
67      * @param type the event type
68      * @param sourceUri the source the item belong to
69      * @param itemKey the item key
70      */

71     public SyncItemEvent(int type ,
72                          String JavaDoc sourceUri ,
73                          SyncItemKey itemKey ) {
74
75         this.type = type ;
76         this.sourceUri = sourceUri ;
77         this.itemKey = itemKey ;
78
79     }
80
81     // -------------------------------------------------------- Public methods
82

83     public SyncItemKey getItemKey () {
84         return itemKey;
85     }
86
87     public String JavaDoc getSourceUri () {
88         return sourceUri;
89     }
90
91     public int getType () {
92         return type;
93     }
94
95     public void setItemKey (SyncItemKey itemKey ) {
96         this.itemKey = itemKey ;
97     }
98
99     public void setSourceUri (String JavaDoc sourceUri ) {
100         this.sourceUri = sourceUri ;
101     }
102
103     public void setType (int type ) {
104         this.type = type ;
105     }
106
107     // -------------------------------------------------------- Private methods
108

109 }
Popular Tags