本文整理汇总了Java中com.parse.ParseQuery.include方法的典型用法代码示例。如果您正苦于以下问题:Java ParseQuery.include方法的具体用法?Java ParseQuery.include怎么用?Java ParseQuery.include使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.parse.ParseQuery
的用法示例。
在下文中一共展示了ParseQuery.include方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateMessage
import com.parse.ParseQuery; //导入方法依赖的package包/类
/**
* Request a single message in a conversation to be updated.
*/
private void updateMessage(@NonNull String conversationId, @NonNull String messageId) {
ParseQuery<ParseObject> query = new ParseQuery<>(MessagesTable.NAME);
query.setCachePolicy(ParseQuery.CachePolicy.NETWORK_ONLY);
query.include(MessagesTable.Fields.IMAGE);
Log.d(TAG, "Updating message: " + messageId);
mParseHelper.get(query, messageId)
.map(in -> ParseUtils.from(in, mParseHelper))
.toList()
.subscribe(messages -> {
for (ExampleMessage message : messages) {
mUpdatePublisher.onNext(new Update<>(conversationId, Update.Action.UPDATED, null, message));
}
});
}
示例2: queryParseForLast24Hours
import com.parse.ParseQuery; //导入方法依赖的package包/类
private void queryParseForLast24Hours() {
final int myUpdateNumber = ++mMostRecentMapUpdate;
ParseQuery<Record> mapQuery = Record.getQuery();
mapQuery.include("user");
Date onDayAgo = getNowMinus24Hours();
mapQuery.whereGreaterThanOrEqualTo("createdAt", onDayAgo);
mapQuery.orderByDescending("createdAt");
mapQuery.setLimit(100);
// Kick off the query in the background
mapQuery.findInBackground(new FindCallback<Record>() {
@Override
public void done(List<Record> records, ParseException e) {
Log.e(TAG, "=== findInBackground === records = " + records);
if (e != null) {
Log.e(TAG, "=== findInBackground === records = " + records);
return;
}
/*
* Make sure we're processing results from
* the most recent update, in case there
* may be more than one in progress.
*/
if (myUpdateNumber != mMostRecentMapUpdate) {
return;
}
EventBus.getDefault()
.post(new LocationChangedEvent(records));
}
});
}
示例3: UserViewAdapter
import com.parse.ParseQuery; //导入方法依赖的package包/类
public UserViewAdapter(Context context) {
super(context, new ParseQueryAdapter.QueryFactory<Photo>() {
public ParseQuery<Photo> create() {
// Get the current user's photos
ParseQuery<Photo> photosFromCurrentUserQuery = new ParseQuery<Photo>("Photo");
photosFromCurrentUserQuery.whereEqualTo("user", ParseUser.getCurrentUser());
photosFromCurrentUserQuery.whereExists("thumbnail");
photosFromCurrentUserQuery.include("user");
photosFromCurrentUserQuery.orderByDescending("createdAt");
return photosFromCurrentUserQuery;
}
});
}
示例4: showFavorites
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void showFavorites() {
ParseQuery<Trainer> query = ParseQuery.getQuery("Trainer");
query.include("favorited_by");
query.whereEqualTo("favorited_by", SimpleUser.currentUserObject);
query.findInBackground(new FindCallback<Trainer>() {
public void done(List<Trainer> trainers, ParseException e) {
hideProgressWheel();
if (e == null) {
Log.d("DEBUG", "Retrieved " + trainers.size() + " trainers");
refreshFragment(trainers);
} else {
Log.d("DEBUG", "Error: " + e.getMessage());
}
}
});
}
示例5: alreadyBookedSlots
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void alreadyBookedSlots(final String trainerId, final String sDay, final String sDate, final Context context) {
arBookedSlots.clear();
ParseObject trainer = ParseObject.createWithoutData("Trainer", trainerId);
ParseQuery<ParseObject> query = ParseQuery.getQuery("BlockedSlots");
query.selectKeys(Arrays.asList("slot_time"));
query.include("trainer_id");
query.whereEqualTo("trainer_id", trainer);
query.whereEqualTo("slot_date", sDate);
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> bookedSlots, com.parse.ParseException e) {
if (e == null) {
for (ParseObject slots : bookedSlots) {
int slotTime = Integer.valueOf(slots.getString("slot_time"));
arBookedSlots.add(slotTime);
}
} else {
Log.d("DEBUG", "Error: " + e.getMessage());
}
populateAvailableSlots(trainerId, sDay, sDate, context);
}
});
}
示例6: populateTrainers
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void populateTrainers() {
final TrainersListFragment finalFragment = fragment;
ParseQuery<Trainer> query = ParseQuery.getQuery("Trainer");
query.include("favorited_by");
query.orderByDescending("createdAt");
query.findInBackground(new FindCallback<Trainer>() {
public void done(List<Trainer> trainers, ParseException e) {
hideProgressWheel();
if (e == null) {
hideProgressWheel();
Log.d("DEBUG", "Retrieved " + trainers.size() + " trainers");
refreshFragment(trainers);
} else {
Log.d("DEBUG", "Error: " + e.getMessage());
}
}
});
}
示例7: pullData
import com.parse.ParseQuery; //导入方法依赖的package包/类
void pullData()
{
sos_list.clear();
ParseQuery<ParseObject> pq = ParseQuery.getQuery("SOS_Users");
pq.whereEqualTo("UserID", ParseUser.getCurrentUser());
pq.whereEqualTo("hasAccepted", true);
pq.include("SOSid");
pq.include("SOSid.UserID");
pq.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> list, ParseException e) {
if (e != null) {
e.printStackTrace();
return;
}
//Log.d("Chatlist", String.valueOf(list.size()));
//Log.d("Chatlist", list.get(0).keySet().toString());
for (ParseObject psos : list) {
ParseObject sos = psos.getParseObject("SOSid");
if(!sos.getBoolean("isActive"))
continue;
sos.pinInBackground();
sos_list.add(sos);
}
MyAdapter adapter = new MyAdapter(sos_list, getActivity());
listView.setAdapter(adapter);
swipeRefreshLayout.setRefreshing(false);
}
});
}
示例8: loadInternal
import com.parse.ParseQuery; //导入方法依赖的package包/类
private Observable<LoadResult<ExampleMessage>> loadInternal(@NonNull String conversationId, @NonNull LoadQuery.Type type, long timestamp) {
final ParseQuery<ParseObject> parseQuery = new ParseQuery<>(MessagesTable.NAME);
parseQuery.whereEqualTo(MessagesTable.Fields.CHAT, ParseObject.createWithoutData(ChatTable.NAME, conversationId));
parseQuery.addDescendingOrder(MessagesTable.Fields.CREATED_AT);
if (type == Type.OLDER) {
parseQuery.whereLessThan(MessagesTable.Fields.CREATED_AT, new Date(timestamp));
}
else if (type == Type.NEWER) {
parseQuery.whereGreaterThan(MessagesTable.Fields.CREATED_AT, new Date(timestamp));
}
parseQuery.setLimit(MAX_CHUNK_SIZE);
parseQuery.include(MessagesTable.Fields.IMAGE);
return mParseHelper.find(parseQuery)
.doOnNext(mSortMessagesAscending)
.flatMap(Observable::from)
.map(in -> ParseUtils.from(in, mParseHelper))
.toList()
.map(messages -> {
final boolean canLoadOlder;
final boolean canLoadNewer;
if (type == Type.OLDER) {
canLoadOlder = !messages.isEmpty();
canLoadNewer = true; // This will be ignored in any case since we are loading older messages
}
else if (type == Type.NEWER) {
canLoadOlder = true; // This will be ignored in any case since we are loading newer messages
canLoadNewer = !messages.isEmpty();
}
else {
canLoadOlder = !messages.isEmpty();
canLoadNewer = !messages.isEmpty();
}
return new LoadResult<>(messages, canLoadOlder, canLoadNewer);
})
.subscribeOn(Schedulers.io());
}
示例9: getConversation
import com.parse.ParseQuery; //导入方法依赖的package包/类
private Observable<ExampleConversation> getConversation(@NonNull String chatId) {
final ParseQuery<ParseObject> parseQuery = new ParseQuery<>(ChatSubscriptionTable.NAME);
parseQuery.include(ChatSubscriptionTable.Fields.CHAT);
parseQuery.include(ChatSubscriptionTable.Fields.CHAT + "." + ChatTable.Fields.LAST_MESSAGE);
parseQuery.whereEqualTo(ChatSubscriptionTable.Fields.CHAT, ParseObject.createWithoutData(ChatTable.NAME, chatId));
parseQuery.whereEqualTo(ChatSubscriptionTable.Fields.USER, ParseObject.createWithoutData(UsersTable.NAME, mParseHelper.getCurrentUser().getObjectId()));
return mParseHelper.find(parseQuery)
.flatMap(Observable::from)
.map(in -> ParseUtils.conversationFromSubscription(in, mParseHelper))
.subscribeOn(Schedulers.io());
}
示例10: fetch
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void fetch(Context context, final ModelUpdater<DealModel> modelUpdater) {
// Setup the database Query
ParseQuery<RestaurantModel> localRestaurants = ParseQuery.getQuery(RestaurantModel.class);
localRestaurants.whereWithinMiles("location", mParams.getLocation(context), mParams.getRadiusMi());
ParseQuery<DealModel> localDeals = ParseQuery.getQuery(DealModel.class);
ParseQuery<DealModel> orLocalDeals = ParseQuery.getQuery(DealModel.class);
localDeals.whereMatchesQuery("restaurantId", localRestaurants);
orLocalDeals.whereMatchesQuery("restaurantId", localRestaurants);
localDeals.whereEqualTo("tags", mListType.toString().toLowerCase());
orLocalDeals.whereEqualTo("tags", mListType.toString().toLowerCase());
//localDeals = applyDayOfWeekForQuery(localDeals, orLocalDeals);
// All deals with
localDeals.whereMatches("recurrence1", getQueryRegexFromDayOfWeekMask(mParams.getDayOfWeekMask()));
Calendar cal = Calendar.getInstance();
int now = cal.get(Calendar.HOUR_OF_DAY)*100 + cal.get(Calendar.MINUTE);
localDeals.include("restaurantId");
//TODO remove logging
Log.v("Parse info", "Deal list query started");
localDeals.findInBackground(new FindCallback<DealModel>() {
@Override
public void done(List<DealModel> list, ParseException e) {
modelUpdater.onDataModelUpdate(list, e);
}
});
}
示例11: doneFetchingUserInterests
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void doneFetchingUserInterests(ArrayList<ParseObject> currentUserInterestsList) {
existingElement.clear();
if (currentUserInterestsList != null && !currentUserInterestsList.isEmpty())
{
for (int c = 0; c < currentUserInterestsList.size(); c++) {
if (!currentUserInterestsList.get(c).equals("") || !(currentUserInterestsList.get(c) == null)) {
ParseQuery<ParseUser> query = ParseUser.getQuery();
query.setCachePolicy(ParseQuery.CachePolicy.NETWORK_ELSE_CACHE);
query.include(ParseTables.Users.INTERESTS);
query.include(ParseTables.Users.INSTITUTE);
query.whereEqualTo(ParseTables.Users.INTERESTS, currentUserInterestsList.get(c));
query.findInBackground(new FindCallback<ParseUser>() {
public void done(final List<ParseUser> objects, ParseException e) {
if (e == null) {
doneFetchingPeople(objects);
} else {
// Something went wrong.
}
}
});
}
}
} else
{
progressBar.setVisibility(View.GONE);
}
}
示例12: HomeViewAdapter
import com.parse.ParseQuery; //导入方法依赖的package包/类
public HomeViewAdapter(Context context) {
super(context, new ParseQueryAdapter.QueryFactory<Photo>() {
public ParseQuery<Photo> create() {
// First, query for the friends whom the current user follows
ParseQuery<com.parse.anypic.Activity> followingActivitiesQuery = new ParseQuery<com.parse.anypic.Activity>("Activity");
followingActivitiesQuery.whereMatches("type", "follow");
followingActivitiesQuery.whereEqualTo("fromUser", ParseUser.getCurrentUser());
// Get the photos from the Users returned in the previous query
ParseQuery<Photo> photosFromFollowedUsersQuery = new ParseQuery<Photo>("Photo");
photosFromFollowedUsersQuery.whereMatchesKeyInQuery("user", "toUser", followingActivitiesQuery);
photosFromFollowedUsersQuery.whereExists("image");
// Get the current user's photos
ParseQuery<Photo> photosFromCurrentUserQuery = new ParseQuery<Photo>("Photo");
photosFromCurrentUserQuery.whereEqualTo("user", ParseUser.getCurrentUser());
photosFromCurrentUserQuery.whereExists("image");
// We create a final compound query that will find all of the photos that were
// taken by the user's friends or by the user
ParseQuery<Photo> query = ParseQuery.or(Arrays.asList( photosFromFollowedUsersQuery, photosFromCurrentUserQuery ));
query.include("user");
query.orderByDescending("createdAt");
return query;
}
});
}
示例13: getDaysBetweenDates
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void getDaysBetweenDates(final Date startdate, final Date enddate, String trainerId) {
ParseObject trainer = ParseObject.createWithoutData("Trainer", trainerId);
ParseQuery<ParseObject> query = ParseQuery.getQuery("TrainerSlots");
query.selectKeys(Arrays.asList("day"));
query.include("trainer_id");
query.whereEqualTo("trainer_id", trainer);
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> trainerSlots, com.parse.ParseException e) {
if (e == null) {
listOfAvailableDays.clear();
for (ParseObject slots : trainerSlots) {
String availableDay = slots.getString("day");
listOfAvailableDays.add(availableDay);
}
ArrayList<Date> unAvailableDates = new ArrayList<Date>();
Calendar calendar = new GregorianCalendar();
calendar.setTime(startdate);
while (calendar.getTime().before(enddate)) {
Date result = calendar.getTime();
for (int i = 0; i < listOfAvailableDays.size(); i++) {
if (listOfAvailableDays.contains(simpleDayFormat.format(result))) {
caldroidFragment.setBackgroundResourceForDate(R.color.availableSlotColor, result);
caldroidFragment.setTextColorForDate(R.color.white, result);
} else {
unAvailableDates.add(result);
}
}
calendar.add(Calendar.DATE, 1);
}
caldroidFragment.setDisableDates(unAvailableDates);
caldroidFragment.refreshView();
} else {
Log.d("DEBUG", "Error: " + e.getMessage());
}
}
});
}
示例14: getTrainerGym
import com.parse.ParseQuery; //导入方法依赖的package包/类
private void getTrainerGym() {
ParseQuery<Gym> query = ParseQuery.getQuery("Gym");
query.whereEqualTo("trainers", m_trainer);
query.include("address");
query.findInBackground(new FindCallback<Gym>() {
public void done(List<Gym> gyms, com.parse.ParseException e) {
// Associate the gym with the trainer
m_trainer.setGym(gyms.get(0));
// Get all the reviews for the trainer
getReviewsAndSetupViews(m_trainer.getObjectId());
}
});
}
开发者ID:fitness-buddy,项目名称:Fitness-Buddy-Group-Project,代码行数:15,代码来源:TrainerDetailsAnimatedActivity.java
示例15: getReviewsAndSetupViews
import com.parse.ParseQuery; //导入方法依赖的package包/类
private void getReviewsAndSetupViews(String trainerId) {
ParseQuery<Review> query = ParseQuery.getQuery("Review");
query.whereEqualTo("reviewee", m_trainer);
query.include("reviewer");
query.include("reviewee");
query.findInBackground(new FindCallback<Review>() {
@Override
public void done(List<Review> reviews, com.parse.ParseException e) {
TrainerDetailsAnimatedActivity.this.reviews = new ArrayList<Review>(reviews);
setupTrainerView();
}
});
}
开发者ID:fitness-buddy,项目名称:Fitness-Buddy-Group-Project,代码行数:14,代码来源:TrainerDetailsAnimatedActivity.java