Package com.db4o.query

Examples of com.db4o.query.Query


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

  @Override
  protected void doDelete(ILabel entity) {
    Query query = fDb.query();
    query.constrain(News.class);
    query.descend("fLabels").constrain(entity); //$NON-NLS-1$
    @SuppressWarnings("unchecked")
    List<INews> news = query.execute();
    for (INews newsItem : news) {
      newsItem.removeLabel(entity);
    }
    DynamicDAO.saveAll(news);
    super.doDelete(entity);
View Full Code Here


    Assert.isNotNull(states, "states"); //$NON-NLS-1$
    if (states.isEmpty())
      return new ArrayList<INews>(0);

    try {
      Query query = fDb.query();
      query.constrain(News.class);
      query.descend("fFeedLink").constrain(feedRef.getLink().toString()); //$NON-NLS-1$
      query.descend("fParentId").constrain(0); //$NON-NLS-1$
      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()); //$NON-NLS-1$
          else
            constraint = query.descend("fStateOrdinal").constrain(state.ordinal()).or(constraint); //$NON-NLS-1$
        }
      }

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

    Assert.isNotNull(state, "state"); //$NON-NLS-1$
    if (originalStates.isEmpty())
      return;

    try {
      Query query = fDb.query();
      query.constrain(News.class);
      if (!originalStates.containsAll(EnumSet.allOf(INews.State.class))) {
        Constraint constraint = null;
        for (INews.State originalState : originalStates) {
          if (constraint == null)
            constraint = query.descend("fStateOrdinal").constrain(originalState.ordinal()); //$NON-NLS-1$
          else
            constraint = query.descend("fStateOrdinal").constrain(originalState.ordinal()).or(constraint); //$NON-NLS-1$
        }
      }

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

  }

  @SuppressWarnings("unchecked")
  public final List<IBookMark> loadBookMarks(IFeed feed) {
    try {
      Query query = fDb.query();
      query.constrain(IBookMark.class);
      query.descend("fFeedId").constrain(feed.getId()); //$NON-NLS-1$
      ObjectSet<IBookMark> marks = query.execute();
      activateAll(marks);
      return new ArrayList<IBookMark>(marks);
    } catch (Db4oException e) {
      throw new PersistenceException(e);
    }
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  public final List<IFolder> loadRootFolders() {
    try {
      Query query = fDb.query();
      query.constrain(IFolder.class);
      query.descend("fParent").constrain(null); //$NON-NLS-1$
      ObjectSet<IFolder> folders = query.execute();
      activateAll(folders);
      return new ArrayList<IFolder>(folders);
    } catch (Db4oException e) {
      throw new PersistenceException(e);
    }
View Full Code Here

        + dbNews.toLongString());
  }

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

    return changedNews;
  }

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

    return getFeedSet(db, link).hasNext();
  }
 
  @SuppressWarnings("unchecked")
  private static ObjectSet<IFeed> getFeedSet(ObjectContainer db, URL link){
    Query query = db.query();
    query.constrain(Feed.class);
    query.descend("fLinkText").constrain(link.toString()); //$NON-NLS-1$
    ObjectSet<IFeed> set = query.execute();
    return set;
  }
View Full Code Here

  protected PreferenceEvent createSaveEventTemplate(IPreference entity) {
    return null;
  }

  public IPreference load(String key) throws PersistenceException {
    Query query = fDb.query();
    query.constrain(fEntityClass);
    query.descend("fKey").constrain(key);
    List<IPreference> prefs = getList(query);
    activateAll(prefs);
    if (!prefs.isEmpty()) {
      return prefs.iterator().next();
    }
View Full Code Here

    return !getFeeds(db, link).isEmpty();
  }

  @SuppressWarnings("unchecked")
  private static List<Feed> getFeeds(ObjectContainer db, URI link){
    Query query = db.query();
    query.constrain(Feed.class);
    query.descend("fLinkText").constrain(link.toString()); //$NON-NLS-1$
    List<Feed> set = query.execute();
    return set;
  }
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.