Package com.db4o.query

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


    assertEquals(1, markers.size());
    assertEquals(marker, markers.next());
   
    q = db.query();
    q.constrain(MessageList.class);
    messageLists = q.execute();
    assertEquals(0, messageLists.size());
   
    mMessageManager.onMessageListFetchFailed(author, WoTMessageList.assembleURI(author.getRequestURI(), 1), FetchFailedMarker.Reason.DataNotFound);
   
    q = db.query();
View Full Code Here


   
    mMessageManager.onMessageListFetchFailed(author, WoTMessageList.assembleURI(author.getRequestURI(), 1), FetchFailedMarker.Reason.DataNotFound);
   
    q = db.query();
    q.constrain(FetchFailedMarker.class);
    markers = q.execute();
    assertEquals(1, markers.size());
    assertEquals(marker, markers.next());
    assertTrue((CurrentTimeUTC.getInMillis() - marker.getDate().getTime()) < 10 * 1000);
    assertEquals(marker.getDate().getTime() + Math.min(MessageManager.MINIMAL_MESSAGELIST_FETCH_RETRY_DELAY*2, MessageManager.MAXIMAL_MESSAGELIST_FETCH_RETRY_DELAY),
          marker.getDateOfNextRetry().getTime());
View Full Code Here

    assertEquals(1, marker.getNumberOfRetries());
    assertEquals(false, marker.isRetryAllowedNow());
   
    q = db.query();
    q.constrain(MessageList.class);
    messageLists = q.execute();
    assertEquals(1, messageLists.size());
    assertEquals(messageLists.next().getID(), marker.getMessageListID());
   
    // Simulate failure with existing marker and existing ghost message list, i.e. the message list fetcher tried to fetch even though it shouldn't.
   
View Full Code Here

   
    mMessageManager.onMessageListFetchFailed(author, WoTMessageList.assembleURI(author.getRequestURI(), 1), FetchFailedMarker.Reason.DataNotFound);
   
    q = db.query();
    q.constrain(FetchFailedMarker.class);
    markers = q.execute();
    assertEquals(1, markers.size());
    assertEquals(marker, markers.next());
   
    q = db.query();
    q.constrain(MessageList.class);
View Full Code Here

    assertEquals(1, markers.size());
    assertEquals(marker, markers.next());
   
    q = db.query();
    q.constrain(MessageList.class);
    messageLists = q.execute();
    assertEquals(1, messageLists.size());
    assertEquals(messageLists.next().getID(), marker.getMessageListID());
  }
}
View Full Code Here

  @SuppressWarnings("unchecked")
  public synchronized WoTIdentity getIdentity(String id) throws NoSuchIdentityException {
    Query q = db.query();
    q.constrain(WoTIdentity.class);
    q.descend("mID").constrain(id);
    ObjectSet<WoTIdentity> result = q.execute();
   
    switch(result.size()) {
      case 1:
        WoTIdentity identity = result.next();
        identity.initializeTransient(mFreetalk);
View Full Code Here

  @SuppressWarnings("unchecked")
  public synchronized WoTOwnIdentity getOwnIdentity(String id) throws NoSuchIdentityException {
    Query q = db.query();
    q.constrain(WoTOwnIdentity.class);
    q.descend("mID").constrain(id);
    ObjectSet<WoTOwnIdentity> result = q.execute();
   
    switch(result.size()) {
      case 1:
        WoTOwnIdentity identity = result.next();
        identity.initializeTransient(mFreetalk);
View Full Code Here

     
      synchronized(this) { /* We lock here and not during the whole function to allow other threads to execute */
        Query q = db.query(); // TODO: Encapsulate the query in a function...
        q.constrain(WoTIdentity.class);
        q.descend("mID").constrain(identityID);
        ObjectSet<WoTIdentity> result = q.execute();
        WoTIdentity id = null;
       
        if(result.size() == 0) {
          try {
            importIdentity(bOwnIdentities, identityID, requestURI, insertURI, nickname, fetchID);
View Full Code Here

        q.constrain(WoTIdentity.class);
        q.constrain(WoTOwnIdentity.class).not();
      }
     
      q.descend("mLastReceivedFromWoT").constrain(acceptID).not();
      ObjectSet<WoTIdentity> result = q.execute();

      for(WoTIdentity identity : result) {
        identity.initializeTransient(mFreetalk);
        if(logDEBUG) Logger.debug(this, "Garbage collecting identity " + identity);
        deleteIdentity(identity, messageManager, taskManager);
View Full Code Here

  @SuppressWarnings("deprecation")
  protected static int peekDatabaseFormatVersion(Freetalk myFreetalk, ExtObjectContainer myDatabase) {
    final Query query = myDatabase.query();
    query.constrain(Configuration.class);
    @SuppressWarnings("unchecked")
    ObjectSet<Configuration> result = (ObjectSet<Configuration>)query.execute();
   
    switch(result.size()) {
      case 1: {
        final Configuration config = (Configuration)result.next();
        config.initializeTransient(myFreetalk, myDatabase);
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.