-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathIDataStore.java
More file actions
235 lines (142 loc) · 9.8 KB
/
IDataStore.java
File metadata and controls
235 lines (142 loc) · 9.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
/*
* ********************************************************************************************************************
* <p/>
* BACKENDLESS.COM CONFIDENTIAL
* <p/>
* ********************************************************************************************************************
* <p/>
* Copyright 2012 BACKENDLESS.COM. All Rights Reserved.
* <p/>
* NOTICE: All information contained herein is, and remains the property of Backendless.com and its suppliers,
* if any. The intellectual and technical concepts contained herein are proprietary to Backendless.com and its
* suppliers and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade secret
* or copyright law. Dissemination of this information or reproduction of this material is strictly forbidden
* unless prior written permission is obtained from Backendless.com.
* <p/>
* ********************************************************************************************************************
*/
package com.backendless;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.backendless.async.callback.AsyncCallback;
import com.backendless.exceptions.BackendlessException;
import com.backendless.persistence.DataQueryBuilder;
import com.backendless.persistence.LoadRelationsQueryBuilder;
import com.backendless.persistence.offline.OfflineAwareCallback;
import com.backendless.persistence.offline.SyncCompletionCallback;
import com.backendless.rt.data.EventHandler;
import java.util.Collection;
import java.util.List;
import java.util.Map;
public interface IDataStore<E>
{
List<String> create( List<E> objects ) throws BackendlessException;
void create( List<E> objects, AsyncCallback<List<String>> responder ) throws BackendlessException;
E save( E entity ) throws BackendlessException;
void save( E entity, AsyncCallback<E> responder );
Long remove( E entity ) throws BackendlessException;
void remove( E entity, AsyncCallback<Long> responder );
int remove( String whereClause ) throws BackendlessException;
void remove( String whereClause, AsyncCallback<Integer> responder ) throws BackendlessException;
int update( String whereClause, Map<String, Object> changes ) throws BackendlessException;
void update( String whereClause, Map<String, Object> changes, AsyncCallback<Integer> responder ) throws BackendlessException;
E findFirst() throws BackendlessException;
E findFirst( Integer relationsDepth ) throws BackendlessException;
E findFirst( List<String> relations ) throws BackendlessException;
E findFirst( List<String> relations, Integer relationsDepth, Integer relationsPageSize ) throws BackendlessException;
void findFirst( AsyncCallback<E> responder );
void findFirst( Integer relationsDepth, AsyncCallback<E> responder );
void findFirst( List<String> relations, AsyncCallback<E> responder );
void findFirst( List<String> relations, Integer relationsDepth, Integer relationsPageSize, final AsyncCallback<E> responder );
E findLast() throws BackendlessException;
E findLast( Integer relationsDepth ) throws BackendlessException;
E findLast( List<String> relations ) throws BackendlessException;
E findLast( List<String> relations, Integer relationsDepth, Integer relationsPageSize ) throws BackendlessException;
void findLast( AsyncCallback<E> responder );
void findLast( Integer relationsDepth, AsyncCallback<E> responder );
void findLast( List<String> relations, AsyncCallback<E> responder );
void findLast( List<String> relations, Integer relationsDepth, Integer relationsPageSize, final AsyncCallback<E> responder );
List<E> find() throws BackendlessException;
List<E> find( DataQueryBuilder dataQueryBuilder ) throws BackendlessException;
void find( AsyncCallback<List<E>> responder );
void find( DataQueryBuilder dataQueryBuilder, AsyncCallback<List<E>> responder );
E findById( String id ) throws BackendlessException;
E findById( String id, List<String> relations ) throws BackendlessException;
E findById( String id, Integer relationsDepth ) throws BackendlessException;
E findById( String id, List<String> relations, Integer relationsDepth ) throws BackendlessException;
E findById( String id, DataQueryBuilder queryBuilder ) throws BackendlessException;
E findById( E entity ) throws BackendlessException;
E findById( E entity, List<String> relations ) throws BackendlessException;
E findById( E entity, Integer relationsDepth ) throws BackendlessException;
E findById( E entity, List<String> relations, Integer relationsDepth ) throws BackendlessException;
E findById( E entity, DataQueryBuilder queryBuilder ) throws BackendlessException;
int getObjectCount();
int getObjectCount( DataQueryBuilder dataQueryBuilder );
void findById( String id, AsyncCallback<E> responder );
void findById( String id, List<String> relations, AsyncCallback<E> responder );
void findById( String id, Integer relationsDepth, AsyncCallback<E> responder );
void findById( String id, List<String> relations, Integer relationsDepth, AsyncCallback<E> responder );
void findById( String id, DataQueryBuilder queryBuilder, AsyncCallback<E> responder );
void findById( E entity, AsyncCallback<E> responder );
void findById( E entity, List<String> relations, AsyncCallback<E> responder );
void findById( E entity, Integer relationsDepth, AsyncCallback<E> responder );
void findById( E entity, List<String> relations, Integer relationsDepth, AsyncCallback<E> responder );
void findById( E entity, DataQueryBuilder queryBuilder, AsyncCallback<E> responder );
/**
* @see com.backendless.persistence.LoadRelationsQueryBuilder
*
* @param objectId parentObjectId
* @param <R> child relation type
*/
<R> List<R> loadRelations( String objectId, LoadRelationsQueryBuilder<R> queryBuilder );
/**
* @see com.backendless.persistence.LoadRelationsQueryBuilder
*
* @param objectId parentObjectId
* @param <R> child relation type
* @param responder asynchronous callback
*/
<R> void loadRelations( String objectId, LoadRelationsQueryBuilder<R> queryBuilder, AsyncCallback<List<R>> responder );
void getObjectCount( AsyncCallback<Integer> responder );
void getObjectCount( DataQueryBuilder dataQueryBuilder, AsyncCallback<Integer> responder );
<R> int addRelation( E parent, String relationColumnName, Collection<R> children );
<R> void addRelation( E parent, String relationColumnName, Collection<R> children, AsyncCallback<Integer> callback );
int addRelation( E parent, String relationColumnName, String whereClause );
void addRelation( E parent, String relationColumnName, String whereClause, AsyncCallback<Integer> callback );
<R> int setRelation( E parent, String relationColumnName, Collection<R> children );
<R> void setRelation( E parent, String relationColumnName, Collection<R> children, AsyncCallback<Integer> callback );
int setRelation( E parent, String relationColumnName, String whereClause );
void setRelation( E parent, String relationColumnName, String whereClause, AsyncCallback<Integer> callback );
<R> int deleteRelation( E parent, String relationColumnName, Collection<R> children );
<R> void deleteRelation( E parent, String relationColumnName, Collection<R> children, AsyncCallback<Integer> callback );
int deleteRelation( E parent, String relationColumnName, String whereClause );
void deleteRelation( E parent, String relationColumnName, String whereClause, AsyncCallback<Integer> callback );
<R> int addRelation( @NonNull String parentObjectId, @NonNull String relationColumnName, @NonNull Collection<String> childrenObjectIds );
<R> void addRelation( @NonNull String parentObjectId, @NonNull String relationColumnName, @NonNull Collection<String> childrenObjectIds, AsyncCallback<Integer> callback );
int addRelation( @NonNull String parentObjectId, @NonNull String relationColumnName, @NonNull String whereClause );
void addRelation( @NonNull String parentObjectId, @NonNull String relationColumnName, @NonNull String whereClause, AsyncCallback<Integer> callback );
<R> int setRelation( @NonNull String parentObjectId, @NonNull String relationColumnName, @NonNull Collection<String> childrenObjectIds );
<R> void setRelation( @NonNull String parentObjectId, @NonNull String relationColumnName, @NonNull Collection<String> childrenObjectIds, AsyncCallback<Integer> callback );
int setRelation( @NonNull String parentObjectId, @NonNull String relationColumnName, @NonNull String whereClause );
void setRelation( @NonNull String parentObjectId, @NonNull String relationColumnName, @NonNull String whereClause, AsyncCallback<Integer> callback );
<R> int deleteRelation( @NonNull String parentObjectId, @NonNull String relationColumnName, @NonNull Collection<String> childrenObjectIds );
<R> void deleteRelation(@NonNull String parentObjectId, @NonNull String relationColumnName, @NonNull Collection<String> childrenObjectIds, AsyncCallback<Integer> callback );
int deleteRelation( @NonNull String parentObjectId, @NonNull String relationColumnName, @NonNull String whereClause );
void deleteRelation( @NonNull String parentObjectId, @NonNull String relationColumnName, @NonNull String whereClause, AsyncCallback<Integer> callback );
EventHandler<E> rt();
/*
TODO: OFFLINE SECTION
*/
void initLocalDatabase(@Nullable String whereClause, AsyncCallback<Integer> responder);
void clearLocalDatabase();
void saveEventually(E entity);
void saveEventually(E entity, OfflineAwareCallback<E> responder );
void removeEventually(E entity);
void removeEventually(E entity, OfflineAwareCallback<E> responder );
void onSave(AsyncCallback<E> responder);
void onRemove(AsyncCallback<E> responder);
void enableAutoSync();
void disableAutoSync();
boolean isAutoSyncEnabled();
void startOfflineSync(SyncCompletionCallback responder);
}