Package com.db4o.query

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


  @SuppressWarnings("unchecked")
  private ISearchMark getSearchMark(ISearchCondition searchCondition) {
    Query query = fDb.query();
    query.constrain(ISearchMark.class);
    query.descend("fSearchConditions").constrain(searchCondition);
    List<ISearchMark> marks = query.execute();
    if (marks.size() != 1)
      throw new IllegalStateException("searchCondition has less than or more than 1 parent ISearchMark");

    return marks.get(0);
View Full Code Here


  private void deleteFeedIfNecessary(IBookMark mark) {
    //TODO Share logic with IApplicationLayer method that does the same
    Query query = fDb.query();
    query.constrain(Feed.class);
    query.descend("fLinkText").constrain(mark.getFeedLinkReference().getLink().toString()); //$NON-NLS-1$
    @SuppressWarnings("unchecked")
    List<IFeed> feeds = query.execute();
    for (IFeed feed : feeds) {
      if(onlyBookMarkReference(feed)) {
        fDb.delete(feed);
View Full Code Here

  private boolean onlyBookMarkReference(IFeed feed) {
    //TODO Share logic with IApplicationLayer method that does the same
    Query query = fDb.query();
    query.constrain(BookMark.class);
    query.descend("fFeedLink").constrain(feed.getLink().toString()); //$NON-NLS-1$

    @SuppressWarnings("unchecked")
    List<IBookMark> marks = query.execute();

    if (marks.size() == 1) {
View Full Code Here

  public Collection<IFolder> loadRoots() {
    try {
      Query query = fDb.query();
      query.constrain(fEntityClass);
      query.descend("fParent").constrain(null); //$NON-NLS-1$
      List<IFolder> folders = getList(query);
      activateAll(folders);
      return new ArrayList<IFolder>(folders);
    } catch (Db4oException e) {
      throw new PersistenceException(e);
View Full Code Here

  public IConditionalGet load(URI link) {
    Assert.isNotNull(link, "link cannot be null"); //$NON-NLS-1$
    try {
      Query query = fDb.query();
      query.constrain(fEntityClass);
      query.descend("fLink").constrain(link.toString()); //$NON-NLS-1$

      for (IConditionalGet entity : getList(query)) {
        fDb.activate(entity, Integer.MAX_VALUE);
        return entity;
      }
View Full Code Here

    for (INewsBin newsBin : newsBins) {
      oc.activate(newsBin, Integer.MAX_VALUE);
      for (NewsReference newsRef : newsBin.getNewsRefs()) {
        Query query = oc.query();
        query.constrain(News.class);
        query.descend("fId").constrain(newsRef.getId()); //$NON-NLS-1$
        News news = (News) query.execute().iterator().next();
        oc.activate(news, Integer.MAX_VALUE);
        String parentIdFieldName = "fParentId"; //$NON-NLS-1$
        MigrationHelper.setField(news, parentIdFieldName, newsBin.getId().longValue());
        oc.ext().store(news, Integer.MAX_VALUE);
View Full Code Here

  @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;
  }

  public static final Feed loadFeed(ObjectContainer db, URI link, Integer activationDepth) {
View Full Code Here

  @SuppressWarnings("unchecked")
  public static Collection<IBookMark> loadAllBookMarks(ObjectContainer db, FeedLinkReference feedRef) {
    Query query = db.query();
    query.constrain(BookMark.class);
    query.descend("fFeedLink").constrain(feedRef.getLink().toString()); //$NON-NLS-1$
    return query.execute();
  }

  static boolean feedHasNewsWithCopies(ObjectContainer db, FeedLinkReference feedRef) {
    Query query = db.query();
View Full Code Here

  }

  static boolean feedHasNewsWithCopies(ObjectContainer db, FeedLinkReference feedRef) {
    Query query = db.query();
    query.constrain(News.class);
    query.descend("fFeedLink").constrain(feedRef.getLink().toString()); //$NON-NLS-1$
    query.descend("fParentId").constrain(0).not(); //$NON-NLS-1$
    return !query.execute().isEmpty();
  }

  public static void updateNewsCounter(ObjectContainer db) {
View Full Code Here

  static boolean feedHasNewsWithCopies(ObjectContainer db, FeedLinkReference feedRef) {
    Query query = db.query();
    query.constrain(News.class);
    query.descend("fFeedLink").constrain(feedRef.getLink().toString()); //$NON-NLS-1$
    query.descend("fParentId").constrain(0).not(); //$NON-NLS-1$
    return !query.execute().isEmpty();
  }

  public static void updateNewsCounter(ObjectContainer db) {
    List<EventRunnable<?>> eventRunnables = EventsMap.getInstance().getEventRunnables();
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.