Package com.db4o.query

Examples of com.db4o.query.Query.execute()


  public synchronized BoardThreadLink getThreadLink(final String threadID) throws NoSuchMessageException {
      final Query q = mDB.query();
        q.constrain(BoardThreadLink.class);
        q.descend("mBoard").constrain(this).identity();
        q.descend("mThreadID").constrain(threadID);
        ObjectSet<BoardThreadLink> results = q.execute();
       
        switch(results.size()) {
          case 1:
        final BoardThreadLink threadRef = results.next();
        threadRef.initializeTransient(mFreetalk);
View Full Code Here


        final Query q = mDB.query();
        q.constrain(BoardMessageLink.class);
        q.descend("mBoard").constrain(this).identity();
        q.descend("mWasRead").constrain(false);
       
        return q.execute().size();
    }

    /**
     * Gets a reference to the message with the given index number.
     *
 
View Full Code Here

    public synchronized BoardMessageLink getMessageByIndex(int index) throws NoSuchMessageException {
      final Query q = mDB.query();
        q.constrain(BoardMessageLink.class);
        q.descend("mBoard").constrain(this).identity();
        q.descend("mIndex").constrain(index);
        final ObjectSet<BoardMessageLink> result = q.execute();
       
        switch(result.size()) {
          case 1:
            final BoardMessageLink ref = result.next();
            ref.initializeTransient(mFreetalk);
View Full Code Here

     */
    public synchronized int messageCount() {
      final Query q = mDB.query();
        q.constrain(BoardMessageLink.class);
        q.descend("mBoard").constrain(this).identity();
        return q.execute().size();
    }

    /**
     * Get the number of replies to the given thread.
     */
 
View Full Code Here

    public synchronized int threadReplyCount(String threadID) {
      final Query q = mDB.query();
        q.constrain(BoardReplyLink.class);
        q.descend("mBoard").constrain(this).identity();
        q.descend("mThreadID").constrain(threadID);
        return q.execute().size();
    }
   
    /**
     * Get the number of unread replies to the given thread.
     * TODO: This should rather be cached in the BoardThreadLink
View Full Code Here

        q.constrain(BoardReplyLink.class);
        q.descend("mBoard").constrain(this).identity();
        q.descend("mThreadID").constrain(threadID);
        q.descend("mWasRead").constrain(false);
       
        return q.execute().size();
    }

    /**
     * Get all replies to the given thread, sorted ascending by date if requested
     */
 
View Full Code Here

 
  public synchronized int countMessages() {
    final Query q = db.query();
    q.constrain(Message.class);
    // This should use indexes and be O(1) therefore, which I'm not sure about with using "q.constrain(OwnMessage.class).not();"
    return q.execute().size() - countOwnMessages();
  }
 
  public synchronized int countOwnMessages() {
    final Query q = db.query();
    q.constrain(OwnMessage.class);
View Full Code Here

  }
 
  public synchronized int countOwnMessages() {
    final Query q = db.query();
    q.constrain(OwnMessage.class);
    return q.execute().size();
  }
 
  public void deleteUnsentMessage(String messageID) throws NoSuchMessageException {
    synchronized(mFreetalk.getMessageInserter()) {
    synchronized(this) {
View Full Code Here

  protected MessageListFetchFailedMarker getMessageListFetchFailedMarker(final String messageListID) throws NoSuchFetchFailedMarkerException {
    final Query q = db.query();
    q.constrain(MessageListFetchFailedMarker.class);
    q.descend("mMessageListID").constrain(messageListID);
    @SuppressWarnings("unchecked")
    final ObjectSet<MessageListFetchFailedMarker> markers = q.execute();
   
    switch(markers.size()) {
      case 1:
        final MessageListFetchFailedMarker result = markers.next();
        result.initializeTransient(mFreetalk);
View Full Code Here

  public synchronized Message get(final String id) throws NoSuchMessageException {
    final Query query = db.query();
    query.constrain(Message.class);
    query.constrain(OwnMessage.class).not();
    query.descend("mID").constrain(id);
    final ObjectSet<Message> result = query.execute();

    switch(result.size()) {
      case 1:
        final Message m = result.next();
        m.initializeTransient(mFreetalk);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.