Package com.db4o.query

Examples of com.db4o.query.Query


    return new BookMarkEvent(entity, null, true);
  }

  public final Collection<IBookMark> loadAll(FeedLinkReference feedRef) {
    try {
      Query query = fDb.query();
      query.constrain(fEntityClass);
      query.descend("fFeedLink").constrain(feedRef.getLink().toString()); //$NON-NLS-1$
      List<IBookMark> marks = getList(query);
      activateAll(marks);
      return new ArrayList<IBookMark>(marks);
    } catch (Db4oException e) {
      throw new PersistenceException(e);
View Full Code Here


   
    return entities.contains(entity);
  }

  private void deleteFeedIfNecessary(IBookMark mark) {
    Query query = fDb.query();
    query.constrain(Feed.class);
    query.descend("fId").constrain(mark.getFeedReference().getId()); //$NON-NLS-1$
    @SuppressWarnings("unchecked")
    ObjectSet<IFeed> feeds = query.execute();
    for (IFeed feed : feeds) {
      if(onlyBookMarkReference(feed)) {
        fDb.delete(feed);
      }
    }
View Full Code Here

      }
    }
  }

  private boolean onlyBookMarkReference(IFeed feed) {
    Query query = fDb.query();
    query.constrain(BookMark.class);
    query.descend("fFeedId").constrain(feed.getId().longValue()); //$NON-NLS-1$
   
    @SuppressWarnings("unchecked")
    ObjectSet<IBookMark> marks = query.execute();

    if (marks.size() == 1) {
      return true;
    }
    return false;
View Full Code Here

      throw new PersistenceException(e);
    }
  }

  private List<T> loadList(long id) throws Db4oException   {
    Query query = fDb.query();
    query.constrain(fEntityClass);
    query.descend("fId").constrain(Long.valueOf(id)); //$NON-NLS-1$
    return getList(query);
  }
View Full Code Here

    oc.commit();
    /* 80 */
    progressMonitor.worked(40);

    for (Map.Entry<Long, Map<String, ?>> entry : idPropertiesMap.entrySet()) {
      Query query = oc.query();
      query.constrain(org.rssowl.core.internal.persist.AbstractEntity.class);
      query.descend("fId").constrain(entry.getKey()); //$NON-NLS-1$
      List<?> list = query.execute();
      org.rssowl.core.internal.persist.AbstractEntity entity = (org.rssowl.core.internal.persist.AbstractEntity) list.get(0);
      oc.activate(entity, Integer.MAX_VALUE);
      for (Map.Entry<String, ?> valueEntry : entry.getValue().entrySet()) {
        entity.setProperty(valueEntry.getKey(), valueEntry.getValue());
      }
View Full Code Here

    savePreference(pref, valueBoolean);
  }
 
  @SuppressWarnings("unchecked")
  private Preference findPreference(String key)   {
    Query query = fDb.ext().query();
    query.constrain(Preference.class);
    query.descend("fKey").constrain(key); //$NON-NLS-1$
    ObjectSet<Preference> prefs = query.execute();
    if (prefs.hasNext()) {
      Preference pref = prefs.next();
      fDb.activate(pref, Integer.MAX_VALUE);
      return pref;
    }
View Full Code Here

    return new IllegalStateException(message + ". This news in the db looks like: " //$NON-NLS-1$
        + dbNews.toLongString());
  }

  private List<INews> getNewsFromGuid(INews newsItem) {
    Query query = fDb.query();
    query.constrain(fEntityClass);
    query.descend("fGuidValue").constrain(newsItem.getGuid().getValue()); //$NON-NLS-1$
    return activateAll(getList(query));
  }
View Full Code Here

    query.descend("fGuidValue").constrain(newsItem.getGuid().getValue()); //$NON-NLS-1$
    return activateAll(getList(query));
  }

  private List<INews> getNewsFromLink(INews newsItem) {
    Query query = fDb.query();
    query.constrain(fEntityClass);
    query.descend("fLinkText").constrain(newsItem.getLink().toString()); //$NON-NLS-1$
    return activateAll(getList(query));
  }
View Full Code Here

    Assert.isNotNull(states, "states");
    if (states.isEmpty())
      return new ArrayList<INews>(0);

    try {
      Query query = fDb.query();
      query.constrain(News.class);
      query.descend("fFeedLink").constrain(feedRef.getLink().toString());
      if (!states.containsAll(EnumSet.allOf(INews.State.class))) {
        Constraint constraint = null;
        for (INews.State state : states) {
          if (constraint == null)
            constraint = query.descend("fStateOrdinal").constrain(state.ordinal());
          else
            constraint = query.descend("fStateOrdinal").constrain(state.ordinal()).or(constraint);
        }
      }

      Collection<INews> news = getList(query);
      activateAll(news);
View Full Code Here

  }
 
  public final IConditionalGet loadConditionalGet(URL link) throws PersistenceException  {
    Assert.isNotNull(link, "link cannot be null"); //$NON-NLS-1$
    try {
      Query query = fDb.query();
      query.constrain(ConditionalGet.class);
      query.descend("fLink").constrain(link.toString()); //$NON-NLS-1$

      @SuppressWarnings("unchecked")
      ObjectSet<IConditionalGet> set = query.execute();
      for (IConditionalGet entity : set) {
        fDb.activate(entity, Integer.MAX_VALUE);
        return entity;
      }
    } catch (Db4oException e) {
View Full Code Here

TOP

Related Classes of com.db4o.query.Query

Copyright © 2018 www.massapicom. 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.