OSDN Git Service

NeverNote 0.88.
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / sql / requests / TagRequest.java
1 /*\r
2  * This file is part of NeverNote \r
3  * Copyright 2009 Randy Baumgarte\r
4  * \r
5  * This file may be licensed under the terms of of the\r
6  * GNU General Public License Version 2 (the ``GPL'').\r
7  *\r
8  * Software distributed under the License is distributed\r
9  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either\r
10  * express or implied. See the GPL for the specific language\r
11  * governing rights and limitations.\r
12  *\r
13  * You should have received a copy of the GPL along with this\r
14  * program. If not, go to http://www.gnu.org/licenses/gpl.html\r
15  * or write to the Free Software Foundation, Inc.,\r
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
17  *\r
18 */\r
19 \r
20 package cx.fbn.nevernote.sql.requests;\r
21 \r
22 import java.util.ArrayList;\r
23 import java.util.List;\r
24 \r
25 import com.evernote.edam.type.Tag;\r
26 \r
27 public class TagRequest extends DBRunnerRequest {\r
28         public static int Create_Table                          = 1;\r
29         public static int Drop_Table                            = 2;\r
30         public static int Add_Tag                                       = 3;\r
31         public static int Delete_Tag                            = 4;\r
32         public static int Get_All                                       = 5;\r
33         public static int Get_Tag                                       = 6;\r
34         public static int Update_Tag                            = 7;\r
35         public static int Expunge_Tag                           = 8;\r
36         public static int Update_Parent                         = 9;\r
37         public static int Save_Tags                                     = 10;\r
38         public static int Update_Tag_Sequence           = 11;\r
39         public static int Update_Tag_Guid                       = 12;\r
40         public static int Get_Dirty                                     = 13;\r
41         public static int Find_Tag_By_Name                      = 14;\r
42         public static int Exists                                        = 15;\r
43         public static int Reset_Dirty_Flag                      = 16;\r
44         public static int Sync_Tag                                      = 17;\r
45 \r
46         public volatile String                  string1;\r
47         public volatile String                  string2;        \r
48         public volatile boolean                 bool1;\r
49         public volatile int                             int1;\r
50 \r
51         public volatile Tag                             tag;\r
52         public volatile List<Tag>               tags;\r
53         \r
54         public volatile List<Tag>               responseTags;\r
55         public volatile Tag                             responseTag;\r
56         public volatile String                  responseString;\r
57         public volatile boolean                 responseBool;\r
58         \r
59         public TagRequest() {\r
60                 category = TAG;\r
61         }\r
62         \r
63         public TagRequest copy() {\r
64                 TagRequest request = new TagRequest();\r
65                 \r
66                 request.requestor_id = requestor_id;\r
67                 request.type = type;\r
68                 request.category = category;\r
69                 request.int1 = int1;\r
70                 if (string1 != null)\r
71                         request.string1 = new String(string1);\r
72                 if (string2 != null)\r
73                         request.string2 = new String(string2);\r
74                 if (tag != null)\r
75                         request.tag = tag;\r
76                 request.bool1 = bool1;\r
77                 if (tags != null && tags.size() > 0) {\r
78                         for (int i=0; i<tags.size(); i++)\r
79                                 request.tags.add(tags.get(i));\r
80                 }\r
81                 \r
82                 responseBool = request.responseBool;\r
83                 if (responseString != null) {\r
84                         request.responseString = new String(responseString);\r
85                 }\r
86                 \r
87                 if (responseTag != null)\r
88                         request.responseTag = responseTag.deepCopy();\r
89                 \r
90                 if (responseTags != null) {\r
91                         request.responseTags = new ArrayList<Tag>();\r
92                         for (int i =0; i<responseTags.size(); i++)\r
93                                 request.responseTags.add(responseTags.get(i).deepCopy());\r
94                 }\r
95                 \r
96                 return request;\r
97         }\r
98         \r
99 }