當前位置: 首頁>>代碼示例>>Java>>正文


Java ParseQuery.find方法代碼示例

本文整理匯總了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;
}
 
開發者ID:AleksandarIlic,項目名稱:ParseQueryLoader,代碼行數:31,代碼來源:ParseQueryLoader.java

示例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;
}
 
開發者ID:cfudge,項目名稱:ClassDiscuss,代碼行數:17,代碼來源:OtherUsers.java

示例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;
    }
}
 
開發者ID:emivaljr,項目名稱:hojenaoapp,代碼行數:20,代碼來源:CityAsyncTask.java

示例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;
}
 
開發者ID:CompetentGroove,項目名稱:quoteit_android,代碼行數:21,代碼來源:BaseActivity.java

示例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
}
 
開發者ID:stuartsoft,項目名稱:PingIT,代碼行數:14,代碼來源:PingsPageFragment.java

示例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();
        }
    }
}
 
開發者ID:stuartsoft,項目名稱:PingIT,代碼行數:18,代碼來源:ClearPingsDialogPreference.java

示例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
}
 
開發者ID:stuartsoft,項目名稱:PingIT,代碼行數:14,代碼來源:FAQPageFragment.java

示例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;
}
 
開發者ID:SalmanTKhan,項目名稱:MyAnimeViewer,代碼行數:16,代碼來源:ParseManager.java

示例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;
}
 
開發者ID:donniepropst,項目名稱:note.cntxt,代碼行數:15,代碼來源:DataSync.java

示例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;
}
 
開發者ID:donniepropst,項目名稱:note.cntxt,代碼行數:13,代碼來源:DataSync.java

示例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;
}
 
開發者ID:pagesjaunes,項目名稱:androidMobileDeviceManager,代碼行數:18,代碼來源:BootstrapService.java

示例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.");
}
 
開發者ID:greenrobot,項目名稱:android-database-performance,代碼行數:34,代碼來源:PerfTestParse.java

示例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");
}
 
開發者ID:cfudge,項目名稱:ClassDiscuss,代碼行數:14,代碼來源:ParseDatabase.java

示例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;
}
 
開發者ID:safakesberk,項目名稱:Cloud_Base-To-Do-App,代碼行數:14,代碼來源:MyNotes.java

示例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();
    }
}
 
開發者ID:safakesberk,項目名稱:Cloud_Base-To-Do-App,代碼行數:12,代碼來源:MyNotes.java


注:本文中的com.parse.ParseQuery.find方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。