本文整理汇总了Java中com.parse.ParseQuery.fromLocalDatastore方法的典型用法代码示例。如果您正苦于以下问题:Java ParseQuery.fromLocalDatastore方法的具体用法?Java ParseQuery.fromLocalDatastore怎么用?Java ParseQuery.fromLocalDatastore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.parse.ParseQuery
的用法示例。
在下文中一共展示了ParseQuery.fromLocalDatastore方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: delete
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void delete(final String id) {
ParseQuery<ParseObject> query = ParseQuery.getQuery("Slice");
if (!NetworkStatus.isConnected)
query.fromLocalDatastore();
query.whereEqualTo("UUID", "" + id);
query.getFirstInBackground(new GetCallback<ParseObject>() {
public void done(ParseObject parseSlice, ParseException e) {
if (parseSlice == null) {
Log.i("Slice", "Deleted: The getFirst request failed.");
} else {
Log.i("Slice", "Slice " + id + " is deleted");
parseSlice.put("deleted", true);
parseSlice.pinInBackground();
parseSlice.saveInBackground();
}
}
});
}
示例2: read
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void read(String UUID, ParseObject parseLine, final List<Slice> sliceList) {
ParseQuery<ParseObject> query = ParseQuery.getQuery("Point");
if (!NetworkStatus.isConnected)
query.fromLocalDatastore();
query.whereEqualTo("UUID", UUID);
query.getFirstInBackground(new GetCallback<ParseObject>() {
public void done(ParseObject parsePoint, ParseException e) {
if (parsePoint == null) {
Log.i("Point", "Read: The getFirst request failed.");
} else {
// try {
Log.i("Point", "Starting read");
// parsePoint.fetch();
Point point = new Point(parsePoint.getDouble("x"), parsePoint.getDouble("y"));
point.setObjectId(parsePoint.getString("UUID"));
onresult.onResult(point, sliceList);
// } catch (ParseException e1) {
// Log.d("Point", "Read: object not nul, but" + e1);
// e1.printStackTrace();
// }
}
}
});
}
示例3: getSelectedChannel
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void getSelectedChannel() {
ParseQuery<ParseObject> query = ParseQuery.getQuery(Constants.PARSE_CLASS_CHANNEL);
query.fromLocalDatastore();
query.findInBackground(new FindCallback<ParseObject>() {
@Override public void done(List<ParseObject> list, ParseException e) {
if (e == null) {
Log.e(LOG_TAG, "Channels retrieved from localDataStore - list size: " + list.size());
} else {
Log.e(LOG_TAG, "Error on retrieving Channels from localDataStore");
}
if (list.size() == 0) {
retrieveChannels();
} else {
mSelectedChannel = (Channel) list.get(0);
Log.e(LOG_TAG, "Found channel selected: " + mSelectedChannel.toString());
}
}
});
}
示例4: fetch
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void fetch(Context context, final ModelUpdater<RestaurantModel> modelUpdater) {
ParseQuery<RestaurantModel> restaurantQuery = ParseQuery.getQuery(RestaurantModel.class);
restaurantQuery.fromLocalDatastore();
Log.v("Parse info:", "Started restaurant query");
restaurantQuery.getInBackground(restaurantId, new GetCallback<RestaurantModel>() {
public void done(RestaurantModel res, ParseException e) {
Log.v("Parse info:", "Restaurant query returned");
List<RestaurantModel> result = new ArrayList<RestaurantModel>();
result.add(res);
modelUpdater.onDataModelUpdate(result, e);
}
});
}
示例5: fetch
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void fetch(Context context, final ModelUpdater<DealModel> modelUpdater) {
ParseQuery<DealModel> restaurantQuery = ParseQuery.getQuery(DealModel.class);
restaurantQuery.fromLocalDatastore();
Log.v("Parse info:", "Started deal query");
restaurantQuery.getInBackground(dealId, new GetCallback<DealModel>() {
public void done(DealModel res, ParseException e) {
Log.v("Parse info:", "Dealquery returned");
List<DealModel> result = new ArrayList<DealModel>();
result.add(res);
modelUpdater.onDataModelUpdate(result, e);
}
});
}
示例6: refreshAdapter
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void refreshAdapter(final boolean afterAdd){
ParseQuery<Guest> query = ParseQuery.getQuery("Guest");
query.whereEqualTo("partyID",id);
query.addDescendingOrder("createdAt");
if(afterAdd){
query.fromLocalDatastore();
}
query.findInBackground(new FindCallback<Guest>() {
@Override
public void done(List<Guest> parseObjects, ParseException e) {
if (e == null) {
Log.d("STATUS FINDING","SUCCESS " + parseObjects.size());
if(afterAdd){
Log.d("CLICK",click + "");
adapter.insert(parseObjects.get(parseObjects.size()-1),0);
}else {
adapter.clear();
adapter.addAll(parseObjects);
}
adapter.notifyDataSetChanged();
Log.d("LENGTH OF INFO", info.size() + "");
}
else{
Log.e("STATUS FINDING", "ERROR: " + e.getMessage());
}
}
});
}
示例7: checkSearchQueryExists
import com.parse.ParseQuery; //导入方法依赖的package包/类
public boolean checkSearchQueryExists(String text) {
ParseQuery<Search> query = Search.getQuery();
query.fromLocalDatastore();
query.whereEqualTo(Search.SEARCH_TEXT, text);
try {
if (query.getFirst() != null) {
return true;
}
} catch (ParseException e) {
Timber.e("Parse Exception.");
}
return false;
}
示例8: sync
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void sync(Table table) {
Log.i("Slice", "" + NetworkStatus.isConnected);
Log.i("Slice", "Slice synchronized start");
for (final Slice slice : table.getList()) {
if (slice.getId() == null) {
create(slice);
} else {
ParseQuery<ParseObject> query = ParseQuery.getQuery("Slice");
if (!NetworkStatus.isConnected)
query.fromLocalDatastore();
query.whereEqualTo("UUID", slice.getId());
query.getFirstInBackground(new GetCallback<ParseObject>() {
public void done(ParseObject parseSlice, ParseException e) {
if (parseSlice == null) {
Log.i("Slice", "Sync: The getFirst request failed.");
} else {
if (!slice.getUpdatedat().equals(parseSlice.getUpdatedAt()))// ----------
try {
update(slice);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Log.i("Slice", "Sync: update dont need");
}
}
});
}
}
}
示例9: update
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void update(final Point point) {
ParseQuery<ParseObject> query = ParseQuery.getQuery("Point");
if (!NetworkStatus.isConnected)
query.fromLocalDatastore();
query.whereEqualTo("UUID", point.getObjectId());
query.getFirstInBackground(new GetCallback<ParseObject>() {
public void done(ParseObject parsePoint, ParseException e) {
if (parsePoint == null) {
Log.i("Point", "Read: The getFirst request failed.");
} else {
try {
Log.i("Point", "Starting update");
parsePoint.fetch();
parsePoint.put("x", point.getX());
parsePoint.put("y", point.getY());
parsePoint.saveInBackground();
parsePoint.pinInBackground();
parsePoint.saveEventually();
} catch (ParseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
});
}
示例10: read
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void read(final String UUID, final List<Slice> sliceList) {
ParseQuery<ParseObject> query = ParseQuery.getQuery("Line");
if(!NetworkStatus.isConnected)
query.fromLocalDatastore();
query.whereEqualTo("UUID", UUID);
query.getFirstInBackground(new GetCallback<ParseObject>() {
public void done(ParseObject parseLine, ParseException e) {
if (parseLine == null) {
Log.i("Line", "Read: The getFirst request failed.");
} else {
// try {
Log.i("Line", "Starting read");
// parseLine.fetch();
Line line = new Line();
line.setId(parseLine.getString("UUID"));
line.setStartUUID(parseLine.getString("startUUID"));
line.setFinishUUID(parseLine.getString("finishUUID"));
PointCRUD pointCRUD = new PointCRUD();
pointCRUD.onresult = lineCRUD;
Log.i("Line", "Line id:" + line.getId());
for(Slice slice: sliceList)
if(slice.getLineUUID().equals(line.getId()))
slice.setPath(line);
pointCRUD.read(parseLine.getString("startUUID"),parseLine, sliceList);
pointCRUD.read(parseLine.getString("finishUUID"),parseLine, sliceList);
// } catch (ParseException e1) {
// TODO Auto-generated catch block
// e1.printStackTrace();
// }
}
}
});
}
示例11: update
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void update(final Slice slice) {
ParseQuery<ParseObject> query = ParseQuery.getQuery("Line");
if(!NetworkStatus.isConnected)
query.fromLocalDatastore();
query.whereEqualTo("UUID", slice.getPath().getId());
query.getFirstInBackground(new GetCallback<ParseObject>() {
public void done(ParseObject parseLine, ParseException e) {
if (parseLine == null) {
Log.i("Line", "Read: The getFirst request failed.");
} else {
try {
Log.i("Line", "Starting update");
parseLine.fetch();
parseLine.put("User", slice.getUser());
parseLine.put("UUID", ""+ slice.getPath().getId());
parseLine.put("startUUID", "" + slice.getPath().getStartUUID());
parseLine.put("finishUUID", "" + slice.getPath().getFinishUUID());
parseLine.saveInBackground();
parseLine.pinInBackground();
parseLine.saveEventually();
} catch (ParseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
});
}
示例12: onCreate
import com.parse.ParseQuery; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_trusted);
Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
setSupportActionBar(myToolbar);
// Get a support ActionBar corresponding to this toolbar
ActionBar ab = getSupportActionBar();
// Enable the Up button
ab.setDisplayHomeAsUpEnabled(true);
final ListView tcList = (ListView) findViewById(R.id.trusted);
final ListView rcList = (ListView) findViewById(R.id.requested);
tcList.setEmptyView(findViewById(R.id.emptyviewtxt));
ParseQuery<ParseObject> tquery = ParseQuery.getQuery("Trusted");
tquery.whereEqualTo("UserId", ParseUser.getCurrentUser());
//tquery.whereEqualTo("accepted", Boolean.TRUE);
Log.d("Trusted","Fetching");
tquery.fromLocalDatastore();
tquery.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> list, ParseException e) {
if (e == null) {
ptlist = list;
ContactAdapter ca = new ContactAdapter(ptlist, TrustedActivity.this);
tcList.setAdapter(ca);
}
Log.d("Trusted","Fetched");
// ParseQuery<ParseObject> rquery = ParseQuery.getQuery("Trusted");
// rquery.whereEqualTo("UserId", ParseUser.getCurrentUser());
// rquery.whereEqualTo("accepted", Boolean.FALSE);
// rquery.fromLocalDatastore();
// rquery.findInBackground(new FindCallback<ParseObject>() {
// @Override
// public void done(List<ParseObject> list, ParseException e) {
// if (e == null) {
// prlist = list;
// ContactAdapter ca = new ContactAdapter(prlist, TrustedActivity.this);
// rcList.setAdapter(ca);
// }
// }
// });
}
});
}
示例13: loadSearches
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void loadSearches(final LoadSearchesCallback callback) {
ParseQuery<Search> query = Search.getQuery();
query.fromLocalDatastore();
query.findInBackground((list, e) -> callback.onSearchesLoaded(list));
Timber.i("Loaded searches.");
}
示例14: loadFavorites
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void loadFavorites(final LoadFavoritesCallback callback) {
ParseQuery<Favorite> query = Favorite.getQuery();
query.fromLocalDatastore();
query.findInBackground((list, e) -> callback.onFavoritesLoaded(list));
Timber.i("Loaded favorites.");
}
示例15: update
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void update(final Slice slice) throws InterruptedException {
ParseQuery<ParseObject> query = ParseQuery.getQuery("Slice");
if (!NetworkStatus.isConnected)
query.fromLocalDatastore();
query.whereEqualTo("UUID", "" + slice.getId());
query.getFirstInBackground(new GetCallback<ParseObject>() {
public void done(ParseObject parseSlice, ParseException e) {
if (parseSlice == null) {
Log.i("SliceUpdate", "Update: The getFirst request failed.");
} else {
try {
parseSlice.fetch();
Log.i("SliceUpdate", "Starting update");
parseSlice.put("User", slice.getUser());
parseSlice.put("startDate", slice.getStartDate());
parseSlice.put("endDate", slice.getEndDate());
parseSlice.put("Description", slice.getDescription());
if (slice.getType().equals(SliceType.CALL))
parseSlice.put("SliceType", "CALL");
if (slice.getType().equals(SliceType.WALK))
parseSlice.put("SliceType", "WALK");
if (slice.getType().equals(SliceType.WORK))
parseSlice.put("SliceType", "WORK");
if (slice.getType().equals(SliceType.REST))
parseSlice.put("SliceType", "REST");
parseSlice.put("UUID", "" + UUID.randomUUID());
parseSlice.put("LineUUID", "" + slice.getPath().getId());
LineCRUD lineCRUD = new LineCRUD();
lineCRUD.update(slice);
PointCRUD pointCRUD = new PointCRUD();
pointCRUD.update(slice.getPath().getStart());
pointCRUD.update(slice.getPath().getFinish());
parseSlice.saveInBackground();
parseSlice.pinInBackground();
Log.i("Slice", "Slice is update, UUID:" + parseSlice.getString("UUID"));
parseSlice.saveEventually();
} catch (ParseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
});
}