KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sync4j > syncclient > spds > engine > SyncOperation


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.engine;
20
21 import java.io.*;
22
23 import java.security.Principal JavaDoc;
24
25 /**
26  * This class represents a synchronization operation to perform on a
27  * <i>SyncSource</i>.
28  * <p>
29  * A <i>SyncOperation</i> can represent the following actions
30  * <ul>
31  * <li>new
32  * <li>delete
33  * <li>udate
34  * <li>conflict
35  * <li>nop (do nothing)
36  * </ul>
37  *
38  * @author Fabio Maggi
39  * @version $Id: SyncOperation.java,v 1.2 2005/01/19 11:18:36 fabius Exp $
40  */

41 public class SyncOperation {
42
43     public static final char NEW = 'N';
44     public static final char DELETE = 'D';
45     public static final char UPDATE = 'U';
46     public static final char CONFLICT = 'O';
47     public static final char NOP = '-';
48
49     private SyncItem syncItem = null;
50     private char operation = 0;
51
52     /**
53      * Rturns the item associated to the operation
54      *
55      * @return the <i>SyncItem</i> associated to the operation
56      */

57     public SyncItem getSyncItem() {
58         return this.syncItem;
59     }
60
61     /**
62      * Returns the operation this object represents.
63      *
64      * @return the operation this object represents.
65      */

66     public char getOperation() {
67         return this.operation;
68     }
69
70     /**
71      * Creates a new <i>SyncOperation</i> given the <i>SyncItem</i> and the
72      * operation.
73      *
74      * @param syncItem the syncItem
75      * @param operation the operation
76      */

77     public SyncOperation(SyncItem syncItem,
78                              char operation) {
79
80             this.syncItem = syncItem;
81             this.operation = operation;
82     }
83 }
Popular Tags