@capgo/capacitor-data-storage-sqlite 6.0.59 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/CapgoCapacitorDataStorageSqlite.podspec +2 -2
  2. package/Package.swift +30 -0
  3. package/README.md +724 -0
  4. package/android/build.gradle +11 -11
  5. package/android/src/main/java/com/jeep/plugin/capacitor/capgocapacitordatastoragesqlite/CapgoCapacitorDataStorageSqlite.java +290 -320
  6. package/android/src/main/java/com/jeep/plugin/capacitor/capgocapacitordatastoragesqlite/CapgoCapacitorDataStorageSqlitePlugin.java +373 -388
  7. package/android/src/main/java/com/jeep/plugin/capacitor/capgocapacitordatastoragesqlite/RetHandler.java +97 -97
  8. package/android/src/main/java/com/jeep/plugin/capacitor/capgocapacitordatastoragesqlite/cdssUtils/Data.java +3 -3
  9. package/android/src/main/java/com/jeep/plugin/capacitor/capgocapacitordatastoragesqlite/cdssUtils/Global.java +2 -2
  10. package/android/src/main/java/com/jeep/plugin/capacitor/capgocapacitordatastoragesqlite/cdssUtils/ImportExportJson/JsonStore.java +108 -110
  11. package/android/src/main/java/com/jeep/plugin/capacitor/capgocapacitordatastoragesqlite/cdssUtils/ImportExportJson/JsonTable.java +78 -80
  12. package/android/src/main/java/com/jeep/plugin/capacitor/capgocapacitordatastoragesqlite/cdssUtils/ImportExportJson/JsonValue.java +62 -64
  13. package/android/src/main/java/com/jeep/plugin/capacitor/capgocapacitordatastoragesqlite/cdssUtils/StorageDatabaseHelper.java +557 -624
  14. package/android/src/main/java/com/jeep/plugin/capacitor/capgocapacitordatastoragesqlite/cdssUtils/UtilsSQLCipher.java +103 -144
  15. package/dist/docs.json +0 -64
  16. package/dist/esm/definitions.d.ts +0 -19
  17. package/dist/esm/definitions.js.map +1 -1
  18. package/dist/esm/index.d.ts +2 -2
  19. package/dist/esm/index.js +5 -6
  20. package/dist/esm/index.js.map +1 -1
  21. package/dist/esm/web-utils/StorageDatabaseHelper.d.ts +2 -2
  22. package/dist/esm/web-utils/StorageDatabaseHelper.js +8 -8
  23. package/dist/esm/web-utils/StorageDatabaseHelper.js.map +1 -1
  24. package/dist/esm/web-utils/json-utils.js +15 -18
  25. package/dist/esm/web-utils/json-utils.js.map +1 -1
  26. package/dist/esm/web.d.ts +2 -3
  27. package/dist/esm/web.js +37 -44
  28. package/dist/esm/web.js.map +1 -1
  29. package/dist/plugin.cjs.js +56 -67
  30. package/dist/plugin.cjs.js.map +1 -1
  31. package/dist/plugin.js +56 -67
  32. package/dist/plugin.js.map +1 -1
  33. package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/CapgoCapacitorDataStorageSqlitePlugin.swift +27 -10
  34. package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/StorageDatabaseHelper.swift +1 -1
  35. package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/Utils/UtilsFile.swift +1 -1
  36. package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/Utils/UtilsSQLCipher.swift +3 -3
  37. package/ios/Tests/CapgoCapacitorDataStorageSqlitePluginTests/CapacitorDataStorageSqlitePluginTests.swift +13 -0
  38. package/package.json +34 -38
  39. package/electron/dist/plugin.js +0 -1044
  40. package/electron/dist/plugin.js.map +0 -1
  41. package/ios/Plugin/CapgoCapacitorDataStorageSqlitePlugin.h +0 -10
  42. package/ios/Plugin/CapgoCapacitorDataStorageSqlitePlugin.m +0 -29
  43. package/ios/Plugin/Info.plist +0 -24
  44. package/readme.md +0 -210
  45. /package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/CapgoCapacitorDataStorageSqlite.swift +0 -0
  46. /package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/Data.swift +0 -0
  47. /package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/Global.swift +0 -0
  48. /package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/ImportExportJson/JsonStore.swift +0 -0
  49. /package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/ReturnHandler.swift +0 -0
  50. /package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/Utils/Blob.swift +0 -0
  51. /package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/Utils/UtilsBinding.swift +0 -0
  52. /package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/Utils/UtilsEncryption.swift +0 -0
@@ -11,437 +11,422 @@ import com.getcapacitor.annotation.CapacitorPlugin;
11
11
  @CapacitorPlugin(name = "CapgoCapacitorDataStorageSqlite")
12
12
  public class CapgoCapacitorDataStorageSqlitePlugin extends Plugin {
13
13
 
14
- private CapgoCapacitorDataStorageSqlite implementation;
15
- private RetHandler rHandler = new RetHandler();
16
- private Context context;
14
+ private CapgoCapacitorDataStorageSqlite implementation;
15
+ private RetHandler rHandler = new RetHandler();
16
+ private Context context;
17
17
 
18
- /**
19
- * Load Method
20
- * Load the context
21
- */
22
- public void load() {
23
- context = getContext();
24
- implementation = new CapgoCapacitorDataStorageSqlite(context);
25
- }
26
-
27
- @PluginMethod
28
- public void echo(PluginCall call) {
29
- String value = call.getString("value");
30
-
31
- JSObject ret = new JSObject();
32
- ret.put("value", implementation.echo(value));
33
- call.resolve(ret);
34
- }
18
+ /**
19
+ * Load Method
20
+ * Load the context
21
+ */
22
+ public void load() {
23
+ context = getContext();
24
+ implementation = new CapgoCapacitorDataStorageSqlite(context);
25
+ }
35
26
 
36
- @PluginMethod
37
- public void openStore(PluginCall call) {
38
- String dbName = call.getString("database", "storage");
39
- String tableName = call.getString("table", "storage_table");
40
- Boolean encrypted = call.getBoolean("encrypted", false);
41
- String secret = null;
42
- String newsecret = null;
43
- String inMode = null;
27
+ @PluginMethod
28
+ public void openStore(PluginCall call) {
29
+ String dbName = call.getString("database", "storage");
30
+ String tableName = call.getString("table", "storage_table");
31
+ Boolean encrypted = call.getBoolean("encrypted", false);
32
+ String secret = null;
33
+ String newsecret = null;
34
+ String inMode = null;
44
35
 
45
- if (encrypted) {
46
- inMode = call.getString("mode", "no-encryption");
47
- if (
48
- !inMode.equals("no-encryption") &&
49
- !inMode.equals("encryption") &&
50
- !inMode.equals("secret") &&
51
- !inMode.equals("newsecret") &&
52
- !inMode.equals("wrongsecret")
53
- ) {
54
- String msg =
55
- "OpenStore: Error inMode must be in ['encryption','secret'," +
56
- "'newsecret']";
57
- rHandler.retResult(call, null, msg);
58
- return;
59
- }
60
- } else {
61
- inMode = "no-encryption";
36
+ if (encrypted) {
37
+ inMode = call.getString("mode", "no-encryption");
38
+ if (
39
+ !inMode.equals("no-encryption") &&
40
+ !inMode.equals("encryption") &&
41
+ !inMode.equals("secret") &&
42
+ !inMode.equals("newsecret") &&
43
+ !inMode.equals("wrongsecret")
44
+ ) {
45
+ String msg = "OpenStore: Error inMode must be in ['encryption','secret'," + "'newsecret']";
46
+ rHandler.retResult(call, null, msg);
47
+ return;
48
+ }
49
+ } else {
50
+ inMode = "no-encryption";
51
+ }
52
+ try {
53
+ implementation.openStore(dbName, tableName, encrypted, inMode, 1);
54
+ rHandler.retResult(call, null, null);
55
+ return;
56
+ } catch (Exception e) {
57
+ String msg = "OpenStore: " + e.getMessage();
58
+ rHandler.retResult(call, null, msg);
59
+ return;
60
+ }
62
61
  }
63
- try {
64
- implementation.openStore(dbName, tableName, encrypted, inMode, 1);
65
- rHandler.retResult(call, null, null);
66
- return;
67
- } catch (Exception e) {
68
- String msg = "OpenStore: " + e.getMessage();
69
- rHandler.retResult(call, null, msg);
70
- return;
71
- }
72
- }
73
62
 
74
- @PluginMethod
75
- public void closeStore(PluginCall call) {
76
- if (!call.getData().has("database")) {
77
- rHandler.retResult(call, false, "closeStore: Must provide a database");
78
- return;
79
- }
80
- String dbName = call.getString("database");
81
- try {
82
- implementation.closeStore(dbName);
83
- rHandler.retResult(call, null, null);
84
- return;
85
- } catch (Exception e) {
86
- String msg = "Close: " + e.getMessage();
87
- rHandler.retResult(call, null, msg);
88
- return;
63
+ @PluginMethod
64
+ public void closeStore(PluginCall call) {
65
+ if (!call.getData().has("database")) {
66
+ rHandler.retResult(call, false, "closeStore: Must provide a database");
67
+ return;
68
+ }
69
+ String dbName = call.getString("database");
70
+ try {
71
+ implementation.closeStore(dbName);
72
+ rHandler.retResult(call, null, null);
73
+ return;
74
+ } catch (Exception e) {
75
+ String msg = "Close: " + e.getMessage();
76
+ rHandler.retResult(call, null, msg);
77
+ return;
78
+ }
89
79
  }
90
- }
91
80
 
92
- @PluginMethod
93
- public void isStoreOpen(PluginCall call) {
94
- boolean ret = false;
95
- if (!call.getData().has("database")) {
96
- rHandler.retResult(call, false, "IsStoreOpen: Must provide a database");
97
- return;
81
+ @PluginMethod
82
+ public void isStoreOpen(PluginCall call) {
83
+ boolean ret = false;
84
+ if (!call.getData().has("database")) {
85
+ rHandler.retResult(call, false, "IsStoreOpen: Must provide a database");
86
+ return;
87
+ }
88
+ String dbName = call.getString("database");
89
+ try {
90
+ ret = implementation.isStoreOpen(dbName);
91
+ rHandler.retResult(call, ret, null);
92
+ return;
93
+ } catch (Exception e) {
94
+ String msg = "IsStoreOpen: " + e.getMessage();
95
+ rHandler.retResult(call, false, msg);
96
+ return;
97
+ }
98
98
  }
99
- String dbName = call.getString("database");
100
- try {
101
- ret = implementation.isStoreOpen(dbName);
102
- rHandler.retResult(call, ret, null);
103
- return;
104
- } catch (Exception e) {
105
- String msg = "IsStoreOpen: " + e.getMessage();
106
- rHandler.retResult(call, false, msg);
107
- return;
108
- }
109
- }
110
99
 
111
- @PluginMethod
112
- public void isStoreExists(PluginCall call) {
113
- boolean ret = false;
114
- if (!call.getData().has("database")) {
115
- rHandler.retResult(call, false, "IsStoreExists: Must provide a database");
116
- return;
117
- }
118
- String dbName = call.getString("database");
119
- try {
120
- ret = implementation.isStoreExists(dbName);
121
- rHandler.retResult(call, ret, null);
122
- return;
123
- } catch (Exception e) {
124
- String msg = "IsStoreExists: " + e.getMessage();
125
- rHandler.retResult(call, false, msg);
126
- return;
100
+ @PluginMethod
101
+ public void isStoreExists(PluginCall call) {
102
+ boolean ret = false;
103
+ if (!call.getData().has("database")) {
104
+ rHandler.retResult(call, false, "IsStoreExists: Must provide a database");
105
+ return;
106
+ }
107
+ String dbName = call.getString("database");
108
+ try {
109
+ ret = implementation.isStoreExists(dbName);
110
+ rHandler.retResult(call, ret, null);
111
+ return;
112
+ } catch (Exception e) {
113
+ String msg = "IsStoreExists: " + e.getMessage();
114
+ rHandler.retResult(call, false, msg);
115
+ return;
116
+ }
127
117
  }
128
- }
129
118
 
130
- @PluginMethod
131
- public void set(PluginCall call) {
132
- if (!call.getData().has("key")) {
133
- rHandler.retResult(call, null, "Set: Must provide a key");
134
- return;
135
- }
136
- String key = call.getString("key");
137
- if (!call.getData().has("value")) {
138
- rHandler.retResult(call, null, "Set: Must provide a value");
139
- return;
119
+ @PluginMethod
120
+ public void set(PluginCall call) {
121
+ if (!call.getData().has("key")) {
122
+ rHandler.retResult(call, null, "Set: Must provide a key");
123
+ return;
124
+ }
125
+ String key = call.getString("key");
126
+ if (!call.getData().has("value")) {
127
+ rHandler.retResult(call, null, "Set: Must provide a value");
128
+ return;
129
+ }
130
+ String value = call.getString("value");
131
+ try {
132
+ implementation.set(key, value);
133
+ rHandler.retResult(call, null, null);
134
+ return;
135
+ } catch (Exception e) {
136
+ String msg = "Set: " + e.getMessage();
137
+ rHandler.retResult(call, null, msg);
138
+ return;
139
+ }
140
140
  }
141
- String value = call.getString("value");
142
- try {
143
- implementation.set(key, value);
144
- rHandler.retResult(call, null, null);
145
- return;
146
- } catch (Exception e) {
147
- String msg = "Set: " + e.getMessage();
148
- rHandler.retResult(call, null, msg);
149
- return;
150
- }
151
- }
152
141
 
153
- @PluginMethod
154
- public void get(PluginCall call) {
155
- if (!call.getData().has("key")) {
156
- rHandler.retValue(call, null, "Get: Must provide a key");
157
- return;
158
- }
159
- String key = call.getString("key");
160
- try {
161
- String value = implementation.get(key);
162
- rHandler.retValue(call, value, null);
163
- return;
164
- } catch (Exception e) {
165
- String msg = "Get: " + e.getMessage();
166
- rHandler.retValue(call, null, msg);
167
- return;
142
+ @PluginMethod
143
+ public void get(PluginCall call) {
144
+ if (!call.getData().has("key")) {
145
+ rHandler.retValue(call, null, "Get: Must provide a key");
146
+ return;
147
+ }
148
+ String key = call.getString("key");
149
+ try {
150
+ String value = implementation.get(key);
151
+ rHandler.retValue(call, value, null);
152
+ return;
153
+ } catch (Exception e) {
154
+ String msg = "Get: " + e.getMessage();
155
+ rHandler.retValue(call, null, msg);
156
+ return;
157
+ }
168
158
  }
169
- }
170
159
 
171
- @PluginMethod
172
- public void remove(PluginCall call) {
173
- if (!call.getData().has("key")) {
174
- rHandler.retResult(call, null, "Remove: Must provide a key");
175
- return;
160
+ @PluginMethod
161
+ public void remove(PluginCall call) {
162
+ if (!call.getData().has("key")) {
163
+ rHandler.retResult(call, null, "Remove: Must provide a key");
164
+ return;
165
+ }
166
+ String key = call.getString("key");
167
+ try {
168
+ implementation.remove(key);
169
+ rHandler.retResult(call, null, null);
170
+ return;
171
+ } catch (Exception e) {
172
+ String msg = "Remove: " + e.getMessage();
173
+ rHandler.retResult(call, null, msg);
174
+ return;
175
+ }
176
176
  }
177
- String key = call.getString("key");
178
- try {
179
- implementation.remove(key);
180
- rHandler.retResult(call, null, null);
181
- return;
182
- } catch (Exception e) {
183
- String msg = "Remove: " + e.getMessage();
184
- rHandler.retResult(call, null, msg);
185
- return;
186
- }
187
- }
188
177
 
189
- @PluginMethod
190
- public void clear(PluginCall call) {
191
- try {
192
- implementation.clear();
193
- rHandler.retResult(call, null, null);
194
- return;
195
- } catch (Exception e) {
196
- String msg = "Clear: " + e.getMessage();
197
- rHandler.retResult(call, null, msg);
198
- return;
178
+ @PluginMethod
179
+ public void clear(PluginCall call) {
180
+ try {
181
+ implementation.clear();
182
+ rHandler.retResult(call, null, null);
183
+ return;
184
+ } catch (Exception e) {
185
+ String msg = "Clear: " + e.getMessage();
186
+ rHandler.retResult(call, null, msg);
187
+ return;
188
+ }
199
189
  }
200
- }
201
190
 
202
- @PluginMethod
203
- public void iskey(PluginCall call) {
204
- boolean ret = false;
205
- if (!call.getData().has("key")) {
206
- rHandler.retResult(call, false, "Iskey: Must provide a key");
207
- return;
208
- }
209
- String key = call.getString("key");
210
- try {
211
- ret = implementation.iskey(key);
212
- rHandler.retResult(call, ret, null);
213
- return;
214
- } catch (Exception e) {
215
- String msg = "Iskey: " + e.getMessage();
216
- rHandler.retResult(call, false, msg);
217
- return;
191
+ @PluginMethod
192
+ public void iskey(PluginCall call) {
193
+ boolean ret = false;
194
+ if (!call.getData().has("key")) {
195
+ rHandler.retResult(call, false, "Iskey: Must provide a key");
196
+ return;
197
+ }
198
+ String key = call.getString("key");
199
+ try {
200
+ ret = implementation.iskey(key);
201
+ rHandler.retResult(call, ret, null);
202
+ return;
203
+ } catch (Exception e) {
204
+ String msg = "Iskey: " + e.getMessage();
205
+ rHandler.retResult(call, false, msg);
206
+ return;
207
+ }
218
208
  }
219
- }
220
209
 
221
- @PluginMethod
222
- public void keys(PluginCall call) {
223
- try {
224
- String[] keyArray = implementation.keys();
225
- JSObject ret = new JSObject();
226
- ret.put("keys", new JSArray(keyArray));
227
- rHandler.retJSObject(call, ret, null);
228
- return;
229
- } catch (Exception e) {
230
- String msg = "Keys: " + e.getMessage();
231
- rHandler.retJSObject(call, new JSObject(), msg);
232
- return;
210
+ @PluginMethod
211
+ public void keys(PluginCall call) {
212
+ try {
213
+ String[] keyArray = implementation.keys();
214
+ JSObject ret = new JSObject();
215
+ ret.put("keys", new JSArray(keyArray));
216
+ rHandler.retJSObject(call, ret, null);
217
+ return;
218
+ } catch (Exception e) {
219
+ String msg = "Keys: " + e.getMessage();
220
+ rHandler.retJSObject(call, new JSObject(), msg);
221
+ return;
222
+ }
233
223
  }
234
- }
235
224
 
236
- @PluginMethod
237
- public void values(PluginCall call) {
238
- try {
239
- String[] valueArray = implementation.values();
240
- JSObject ret = new JSObject();
241
- ret.put("values", new JSArray(valueArray));
242
- rHandler.retJSObject(call, ret, null);
243
- return;
244
- } catch (Exception e) {
245
- String msg = "Values: " + e.getMessage();
246
- rHandler.retJSObject(call, new JSObject(), msg);
247
- return;
225
+ @PluginMethod
226
+ public void values(PluginCall call) {
227
+ try {
228
+ String[] valueArray = implementation.values();
229
+ JSObject ret = new JSObject();
230
+ ret.put("values", new JSArray(valueArray));
231
+ rHandler.retJSObject(call, ret, null);
232
+ return;
233
+ } catch (Exception e) {
234
+ String msg = "Values: " + e.getMessage();
235
+ rHandler.retJSObject(call, new JSObject(), msg);
236
+ return;
237
+ }
248
238
  }
249
- }
250
239
 
251
- @PluginMethod
252
- public void keysvalues(PluginCall call) {
253
- try {
254
- JSObject[] jsObjArray = implementation.keysvalues();
255
- JSObject ret = new JSObject();
256
- ret.put("keysvalues", new JSArray(jsObjArray));
257
- rHandler.retJSObject(call, ret, null);
258
- return;
259
- } catch (Exception e) {
260
- String msg = "KeysValues: " + e.getMessage();
261
- rHandler.retJSObject(call, new JSObject(), msg);
262
- return;
240
+ @PluginMethod
241
+ public void keysvalues(PluginCall call) {
242
+ try {
243
+ JSObject[] jsObjArray = implementation.keysvalues();
244
+ JSObject ret = new JSObject();
245
+ ret.put("keysvalues", new JSArray(jsObjArray));
246
+ rHandler.retJSObject(call, ret, null);
247
+ return;
248
+ } catch (Exception e) {
249
+ String msg = "KeysValues: " + e.getMessage();
250
+ rHandler.retJSObject(call, new JSObject(), msg);
251
+ return;
252
+ }
263
253
  }
264
- }
265
254
 
266
- @PluginMethod
267
- public void filtervalues(PluginCall call) {
268
- if (!call.getData().has("filter")) {
269
- rHandler.retJSObject(
270
- call,
271
- new JSObject(),
272
- "Filtervalues: Must provide a filter"
273
- );
274
- return;
275
- }
276
- String filter = call.getString("filter");
277
- try {
278
- String[] valueArray = implementation.filtervalues(filter);
279
- JSObject ret = new JSObject();
280
- ret.put("values", new JSArray(valueArray));
281
- rHandler.retJSObject(call, ret, null);
282
- return;
283
- } catch (Exception e) {
284
- String msg = "Filtervalues: " + e.getMessage();
285
- rHandler.retJSObject(call, new JSObject(), msg);
286
- return;
255
+ @PluginMethod
256
+ public void filtervalues(PluginCall call) {
257
+ if (!call.getData().has("filter")) {
258
+ rHandler.retJSObject(call, new JSObject(), "Filtervalues: Must provide a filter");
259
+ return;
260
+ }
261
+ String filter = call.getString("filter");
262
+ try {
263
+ String[] valueArray = implementation.filtervalues(filter);
264
+ JSObject ret = new JSObject();
265
+ ret.put("values", new JSArray(valueArray));
266
+ rHandler.retJSObject(call, ret, null);
267
+ return;
268
+ } catch (Exception e) {
269
+ String msg = "Filtervalues: " + e.getMessage();
270
+ rHandler.retJSObject(call, new JSObject(), msg);
271
+ return;
272
+ }
287
273
  }
288
- }
289
274
 
290
- @PluginMethod
291
- public void setTable(PluginCall call) {
292
- if (!call.getData().has("table")) {
293
- rHandler.retResult(call, false, "SetTable: Must provide a table");
294
- return;
275
+ @PluginMethod
276
+ public void setTable(PluginCall call) {
277
+ if (!call.getData().has("table")) {
278
+ rHandler.retResult(call, false, "SetTable: Must provide a table");
279
+ return;
280
+ }
281
+ String table = call.getString("table");
282
+ try {
283
+ implementation.setTable(table);
284
+ rHandler.retResult(call, null, null);
285
+ return;
286
+ } catch (Exception e) {
287
+ String msg = "SetTable: " + e.getMessage();
288
+ rHandler.retResult(call, null, msg);
289
+ return;
290
+ }
295
291
  }
296
- String table = call.getString("table");
297
- try {
298
- implementation.setTable(table);
299
- rHandler.retResult(call, null, null);
300
- return;
301
- } catch (Exception e) {
302
- String msg = "SetTable: " + e.getMessage();
303
- rHandler.retResult(call, null, msg);
304
- return;
305
- }
306
- }
307
292
 
308
- @PluginMethod
309
- public void isTable(PluginCall call) {
310
- boolean ret = false;
311
- if (!call.getData().has("table")) {
312
- rHandler.retResult(call, false, "IsTable: Must provide a table");
313
- return;
314
- }
315
- String table = call.getString("table");
316
- try {
317
- ret = implementation.isTable(table);
318
- rHandler.retResult(call, ret, null);
319
- return;
320
- } catch (Exception e) {
321
- String msg = "IsTable: " + e.getMessage();
322
- rHandler.retResult(call, false, msg);
323
- return;
293
+ @PluginMethod
294
+ public void isTable(PluginCall call) {
295
+ boolean ret = false;
296
+ if (!call.getData().has("table")) {
297
+ rHandler.retResult(call, false, "IsTable: Must provide a table");
298
+ return;
299
+ }
300
+ String table = call.getString("table");
301
+ try {
302
+ ret = implementation.isTable(table);
303
+ rHandler.retResult(call, ret, null);
304
+ return;
305
+ } catch (Exception e) {
306
+ String msg = "IsTable: " + e.getMessage();
307
+ rHandler.retResult(call, false, msg);
308
+ return;
309
+ }
324
310
  }
325
- }
326
311
 
327
- @PluginMethod
328
- public void tables(PluginCall call) {
329
- try {
330
- String[] tableArray = implementation.tables();
331
- JSObject ret = new JSObject();
332
- ret.put("tables", new JSArray(tableArray));
333
- rHandler.retJSObject(call, ret, null);
334
- return;
335
- } catch (Exception e) {
336
- String msg = "Tables: " + e.getMessage();
337
- rHandler.retJSObject(call, new JSObject(), msg);
338
- return;
312
+ @PluginMethod
313
+ public void tables(PluginCall call) {
314
+ try {
315
+ String[] tableArray = implementation.tables();
316
+ JSObject ret = new JSObject();
317
+ ret.put("tables", new JSArray(tableArray));
318
+ rHandler.retJSObject(call, ret, null);
319
+ return;
320
+ } catch (Exception e) {
321
+ String msg = "Tables: " + e.getMessage();
322
+ rHandler.retJSObject(call, new JSObject(), msg);
323
+ return;
324
+ }
339
325
  }
340
- }
341
326
 
342
- @PluginMethod
343
- public void deleteTable(PluginCall call) {
344
- if (!call.getData().has("table")) {
345
- rHandler.retResult(call, null, "DeleteTable: Must provide a table");
346
- return;
327
+ @PluginMethod
328
+ public void deleteTable(PluginCall call) {
329
+ if (!call.getData().has("table")) {
330
+ rHandler.retResult(call, null, "DeleteTable: Must provide a table");
331
+ return;
332
+ }
333
+ String table = call.getString("table");
334
+ try {
335
+ implementation.deleteTable(table);
336
+ rHandler.retResult(call, null, null);
337
+ return;
338
+ } catch (Exception e) {
339
+ String msg = "DeleteTable: " + e.getMessage();
340
+ rHandler.retResult(call, null, msg);
341
+ return;
342
+ }
347
343
  }
348
- String table = call.getString("table");
349
- try {
350
- implementation.deleteTable(table);
351
- rHandler.retResult(call, null, null);
352
- return;
353
- } catch (Exception e) {
354
- String msg = "DeleteTable: " + e.getMessage();
355
- rHandler.retResult(call, null, msg);
356
- return;
357
- }
358
- }
359
344
 
360
- @PluginMethod
361
- public void deleteStore(PluginCall call) {
362
- if (!call.getData().has("database")) {
363
- rHandler.retResult(call, null, "DeleteStore: Must provide a database");
364
- return;
365
- }
366
- String dbName = call.getString("database");
367
- try {
368
- implementation.deleteStore(dbName);
369
- rHandler.retResult(call, null, null);
370
- return;
371
- } catch (Exception e) {
372
- String msg = "DeleteStore: " + e.getMessage();
373
- rHandler.retResult(call, null, msg);
374
- return;
345
+ @PluginMethod
346
+ public void deleteStore(PluginCall call) {
347
+ if (!call.getData().has("database")) {
348
+ rHandler.retResult(call, null, "DeleteStore: Must provide a database");
349
+ return;
350
+ }
351
+ String dbName = call.getString("database");
352
+ try {
353
+ implementation.deleteStore(dbName);
354
+ rHandler.retResult(call, null, null);
355
+ return;
356
+ } catch (Exception e) {
357
+ String msg = "DeleteStore: " + e.getMessage();
358
+ rHandler.retResult(call, null, msg);
359
+ return;
360
+ }
375
361
  }
376
- }
377
362
 
378
- /**
379
- * IsJsonValid
380
- * Check the validity of a given Json object
381
- * @param call
382
- */
383
- @PluginMethod
384
- public void isJsonValid(PluginCall call) {
385
- if (!call.getData().has("jsonstring")) {
386
- String msg = "IsJsonValid: Must provide a Stringify Json Object";
387
- rHandler.retResult(call, false, msg);
388
- return;
363
+ /**
364
+ * IsJsonValid
365
+ * Check the validity of a given Json object
366
+ * @param call
367
+ */
368
+ @PluginMethod
369
+ public void isJsonValid(PluginCall call) {
370
+ if (!call.getData().has("jsonstring")) {
371
+ String msg = "IsJsonValid: Must provide a Stringify Json Object";
372
+ rHandler.retResult(call, false, msg);
373
+ return;
374
+ }
375
+ String parsingData = call.getString("jsonstring");
376
+ try {
377
+ Boolean res = implementation.isJsonValid(parsingData);
378
+ rHandler.retResult(call, res, null);
379
+ return;
380
+ } catch (Exception e) {
381
+ String msg = "isJsonValid: " + e.getMessage();
382
+ rHandler.retResult(call, false, msg);
383
+ return;
384
+ }
389
385
  }
390
- String parsingData = call.getString("jsonstring");
391
- try {
392
- Boolean res = implementation.isJsonValid(parsingData);
393
- rHandler.retResult(call, res, null);
394
- return;
395
- } catch (Exception e) {
396
- String msg = "isJsonValid: " + e.getMessage();
397
- rHandler.retResult(call, false, msg);
398
- return;
399
- }
400
- }
401
386
 
402
- /**
403
- * ImportFromJson Method
404
- * Import from a given Json object
405
- * @param call
406
- */
407
- @PluginMethod
408
- public void importFromJson(PluginCall call) {
409
- JSObject retRes = new JSObject();
410
- retRes.put("changes", Integer.valueOf(-1));
411
- if (!call.getData().has("jsonstring")) {
412
- String msg = "ImportFromJson: Must provide a Stringify Json Object";
413
- rHandler.retChanges(call, retRes, msg);
414
- return;
415
- }
416
- String parsingData = call.getString("jsonstring");
417
- try {
418
- JSObject res = implementation.importFromJson(parsingData);
419
- rHandler.retChanges(call, res, null);
420
- return;
421
- } catch (Exception e) {
422
- String msg = "ImportFromJson: " + e.getMessage();
423
- rHandler.retChanges(call, retRes, msg);
424
- return;
387
+ /**
388
+ * ImportFromJson Method
389
+ * Import from a given Json object
390
+ * @param call
391
+ */
392
+ @PluginMethod
393
+ public void importFromJson(PluginCall call) {
394
+ JSObject retRes = new JSObject();
395
+ retRes.put("changes", Integer.valueOf(-1));
396
+ if (!call.getData().has("jsonstring")) {
397
+ String msg = "ImportFromJson: Must provide a Stringify Json Object";
398
+ rHandler.retChanges(call, retRes, msg);
399
+ return;
400
+ }
401
+ String parsingData = call.getString("jsonstring");
402
+ try {
403
+ JSObject res = implementation.importFromJson(parsingData);
404
+ rHandler.retChanges(call, res, null);
405
+ return;
406
+ } catch (Exception e) {
407
+ String msg = "ImportFromJson: " + e.getMessage();
408
+ rHandler.retChanges(call, retRes, msg);
409
+ return;
410
+ }
425
411
  }
426
- }
427
412
 
428
- /**
429
- * ExportToJson Method
430
- * Export the database to Json Object
431
- * @param call
432
- */
433
- @PluginMethod
434
- public void exportToJson(PluginCall call) {
435
- JSObject retObj = new JSObject();
413
+ /**
414
+ * ExportToJson Method
415
+ * Export the database to Json Object
416
+ * @param call
417
+ */
418
+ @PluginMethod
419
+ public void exportToJson(PluginCall call) {
420
+ JSObject retObj = new JSObject();
436
421
 
437
- try {
438
- JSObject res = implementation.exportToJson();
439
- rHandler.retJsonObject(call, res, null);
440
- return;
441
- } catch (Exception e) {
442
- String msg = "ExportToJson: " + e.getMessage();
443
- rHandler.retJsonObject(call, retObj, msg);
444
- return;
422
+ try {
423
+ JSObject res = implementation.exportToJson();
424
+ rHandler.retJsonObject(call, res, null);
425
+ return;
426
+ } catch (Exception e) {
427
+ String msg = "ExportToJson: " + e.getMessage();
428
+ rHandler.retJsonObject(call, retObj, msg);
429
+ return;
430
+ }
445
431
  }
446
- }
447
432
  }