本文整理汇总了Java中com.parse.ParseQuery.find方法的典型用法代码示例。如果您正苦于以下问题:Java ParseQuery.find方法的具体用法?Java ParseQuery.find怎么用?Java ParseQuery.find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.parse.ParseQuery
的用法示例。
在下文中一共展示了ParseQuery.find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findAll
import com.parse.ParseQuery; //导入方法依赖的package包/类
/**
* Finds all {@link ParseObject}s from given {@link ParseQuery}.
*
* @param parseQuery parse query to use for querying objects
* @return {@link List} with {@link ParseObject}s returned by given {@link ParseQuery}.
* Empty list in case of no results, never {@code null}.
* @throws ParseException
*/
@NonNull
private List<T> findAll(ParseQuery<T> parseQuery) throws ParseException {
int skip = 0;
List<T> allObjects = new LinkedList<T>();
parseQuery.setSkip(skip).setLimit(QUERY_LIMIT);
boolean hasMore = true;
while (hasMore) {
List<T> foundObjects = parseQuery.find();
allObjects.addAll(foundObjects);
// Incrementing skip
skip += QUERY_LIMIT;
parseQuery.setSkip(skip);
// If we have loaded as many objects as limit,
// there might be more objects to load
hasMore = foundObjects.size() == QUERY_LIMIT;
}
return allObjects;
}
示例2: getConnections
import com.parse.ParseQuery; //导入方法依赖的package包/类
public ArrayList<String> getConnections(String username) {
List<ParseObject> ob = null;
ArrayList<String> connectionList = new ArrayList<String>();
ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("Connection");
query.whereEqualTo("username", username);
try {
ob = query.find();
} catch (ParseException e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
for (ParseObject connection : ob) {
connectionList = (ArrayList<String>) connection.get("connections");
}
return connectionList;
}
示例3: doAsyncTask
import com.parse.ParseQuery; //导入方法依赖的package包/类
@Override
protected List<String> doAsyncTask(String... params) {
final List<String> lista = new ArrayList<String>();
state = params[0];
try {
ParseQuery<ParseObject> query = ParseQuery.getQuery("State");
query.whereEqualTo("name", state);
ParseObject parseObject = query.getFirst();
ParseQuery<ParseObject> queryCity = ParseQuery.getQuery("City");
queryCity.whereEqualTo("id_state", parseObject.getInt("id_state"));
List<ParseObject> parseObjects = queryCity.find();
for (ParseObject p : parseObjects){
lista.add(p.getString("name_city"));
}
return lista;
} catch (Exception e) {
return null;
}
}
示例4: getdata
import com.parse.ParseQuery; //导入方法依赖的package包/类
private ArrayList<QuotePojo> getdata( String s) {
final ArrayList<QuotePojo> data = new ArrayList<QuotePojo>();
ParseQuery<ParseObject> query = ParseQuery.getQuery("Quote");
query.whereEqualTo("user_id", s);
List<ParseObject> scoreList=null;
try {
scoreList = query.find();
} catch (ParseException e) {
e.printStackTrace();
}
finally {
if (scoreList!=null)
for (int i = 0; i < scoreList.size(); i++) {
data.add(new QuotePojo(scoreList.get(i).getString("quote"), scoreList.get(i).getString("author")
, null, null, 0));
}
}
return data;
}
示例5: doInBackground
import com.parse.ParseQuery; //导入方法依赖的package包/类
@Override
protected Integer doInBackground(String... params) {
if (!mNetworkCallback.checkNetworkStatus()){
return -1;
}
try { //Query Parse for the user's pings
ParseQuery<ParseObject> query = ParseQuery.getQuery("Pings");
query.whereEqualTo("User", user);
query.orderByDescending("createdAt");
pingsList = query.find();
} catch (ParseException e) {return e.getCode();}//return exception code
return 0;//no issues
}
示例6: onDialogClosed
import com.parse.ParseQuery; //导入方法依赖的package包/类
@Override
protected void onDialogClosed(boolean positiveResult) {
super.onDialogClosed(positiveResult);
if(positiveResult){
try {
ParseQuery<ParseObject> query = ParseQuery.getQuery("Pings");
query.whereEqualTo("User", ParseUser.getCurrentUser());
List<ParseObject>pingsList = query.find();
for(ParseObject p : pingsList) p.deleteInBackground();
Toast.makeText(getContext(), R.string.PingsCleared, Toast.LENGTH_SHORT).show();
} catch (Exception e){
Toast.makeText(getContext(), R.string.UnableToClearPings,Toast.LENGTH_LONG).show();
}
}
}
示例7: doInBackground
import com.parse.ParseQuery; //导入方法依赖的package包/类
@Override
protected Integer doInBackground(String... params) {
try { //Query Parse for the user's pings
ParseQuery<ParseObject> query = ParseQuery.getQuery("FAQ_Category");
categoryList = new ArrayList<ParseObject>(query.find());
for (ParseObject category: categoryList) {
ArrayList<ParseObject> questionQuery = new ArrayList<ParseObject>(category.getRelation("Questions").getQuery().find());
//Filler
questionsList.add(questionQuery);
}
} catch (ParseException e) {return e.getCode();}//return exception code
return 0;//no issues
}
示例8: getAnimeList
import com.parse.ParseQuery; //导入方法依赖的package包/类
public List<Anime> getAnimeList(int page) {
ArrayList<Anime> animeList = new ArrayList<>();
try {
ParseQuery<AnimeRecord> query = AnimeRecord.getQuery();
query.setSkip((page-1) * 100);
for (AnimeRecord record : query.find()) {
Anime anime = AnimeRecord.toAnime(record);
if (anime != null)
animeList.add(anime);
}
} catch (ParseException e) {
WriteLog.appendLogException(TAG, "getAnimeList failed", e);
}
return animeList;
}
示例9: refreshAllNotes
import com.parse.ParseQuery; //导入方法依赖的package包/类
public List<Note> refreshAllNotes(){
ParseQuery<Note> query = ParseQuery.getQuery(Note.class);
query.whereEqualTo("toUser", UserAccount.getInstance().getUser());
query.whereEqualTo("read", false);
try {
newNotes = query.find();
System.out.println("SIZE : " + newNotes.size());
} catch (ParseException e) {
e.printStackTrace();
} catch(NullPointerException n){
}
return newNotes;
}
示例10: checkForNotes
import com.parse.ParseQuery; //导入方法依赖的package包/类
public List<Note> checkForNotes(){
ParseQuery<Note> query = ParseQuery.getQuery(Note.class);
query.whereEqualTo("toUser", UserAccount.getInstance().getUser());
query.whereEqualTo("read", false);
query.whereEqualTo("isCached", false);
try {
newNotes = query.find();
} catch (ParseException e) {
e.printStackTrace();
}
return newNotes;
}
示例11: getDevices
import com.parse.ParseQuery; //导入方法依赖的package包/类
/**
* Get all bootstrap Checkins that exists on Parse.com
*/
public List<Device> getDevices()
{
//return getDeviceService().getDevices().getResults();
ParseQuery<Device> query = ParseQuery.getQuery("Device");
try
{
return query.find();
}
catch (ParseException e)
{
e.printStackTrace();
}
return null;
}
示例12: indexedStringEntityQueriesRun
import com.parse.ParseQuery; //导入方法依赖的package包/类
private void indexedStringEntityQueriesRun(int count) throws ParseException {
// create entities
List<IndexedStringEntity> entities = new ArrayList<>(count);
String[] fixedRandomStrings = StringGenerator.createFixedRandomStrings(count);
for (int i = 0; i < count; i++) {
IndexedStringEntity entity = new IndexedStringEntity();
entity.setIndexedString(fixedRandomStrings[i]);
entities.add(entity);
}
log("Built entities.");
// insert entities
ParseObject.pinAll(entities);
log("Inserted entities.");
// query for entities by indexed string at random
int[] randomIndices = StringGenerator.getFixedRandomIndices(QUERY_COUNT, count - 1);
startClock();
for (int i = 0; i < QUERY_COUNT; i++) {
int nextIndex = randomIndices[i];
ParseQuery<IndexedStringEntity> query = ParseQuery.getQuery(IndexedStringEntity.class);
query.whereEqualTo(IndexedStringEntity.INDEXED_STRING, fixedRandomStrings[nextIndex]);
//noinspection unused
List<IndexedStringEntity> result = query.find();
}
stopClock(Benchmark.Type.QUERY_INDEXED);
// delete all entities
ParseObject.unpinAll();
log("Deleted all entities.");
}
示例13: pullParseAndSetOtherUsersData
import com.parse.ParseQuery; //导入方法依赖的package包/类
public void pullParseAndSetOtherUsersData() {
ParseQuery<ParseUser> query = ParseUser.getQuery();
List<ParseUser> objects = null;
try {
objects = query.find();
} catch (ParseException e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
updateOtherUsersData(objects);
Log.d("score", "updated users info");
}
示例14: doInBackground
import com.parse.ParseQuery; //导入方法依赖的package包/类
@Override
protected Void doInBackground(Void... params) {
ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("ToDoApp");
query.orderByDescending("_created_at");
query.whereEqualTo("userID",currentUser.get("userID"));
try {
noteList = query.find();
} catch (ParseException e) {
Crouton.makeText(getActivity(), getString(R.string.wentWrong) + e.getMessage(), Style.ALERT).show();
}
return null;
}
示例15: initializeParseObject
import com.parse.ParseQuery; //导入方法依赖的package包/类
private void initializeParseObject(MenuItem item) {
final AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo)item.getMenuInfo();
ParseQuery<ParseObject> query = ParseQuery.getQuery("ToDoApp");
query.whereEqualTo("userID",currentUser.get("userID"));
query.whereEqualTo("note",adapter.getItem(info.position));
try {
noteList=query.find();
} catch (ParseException e) {
e.printStackTrace();
}
}