Package com.db4o.query

Examples of com.db4o.query.Query


        return clearDynamicElements(retval.getEntry());
    }

    @SuppressWarnings("unchecked")
    private DB4oEntry getInternalEntry(String id) throws StorageException {
        Query query = this.container.query();
        query.constrain(DB4oEntry.class);
        query.descend("entry").descend("id").constrain(id).equal();
        ObjectSet<DB4oEntry> resultSet = query.execute();
        if (resultSet.size() > 1)
            throw new StorageException(
                    "Entry query returned not a unique result");
        if (resultSet.hasNext())
            return resultSet.next();
View Full Code Here


            throw new StorageException("Can not store feed -- id is null");
        if(feed.getServiceType() == null)
            throw new StorageException("Can not store feed -- service type is null");
        if(accountname == null)
            throw new StorageException("Account name is null");
        Query query = this.container.query();
        query.constrain(ServerBaseFeed.class);
        query.descend("feed").descend("id").constrain(feed.getId()).equal();
        ObjectSet set = query.execute();
        if (set.hasNext())
            throw new StorageException("feed with feedID " + feed.getId()
                    + " is already stored");
        GDataAccount account = getAccount(accountname);
        refreshPersistentObject(account);
View Full Code Here

     * @see org.apache.lucene.gdata.storage.Storage#deleteFeed(java.lang.String)
     */
    public void deleteFeed(String feedId) throws StorageException {
        if (feedId == null)
            throw new StorageException("can not delete feed -- feed id is null");
        Query query = this.container.query();
        query.constrain(ServerBaseFeed.class);
        query.descend("feed").descend("id").constrain(feedId).equal();
        ObjectSet set = query.execute();
        if (set.size() > 1)
            throw new StorageException(
                    "Feed query returned not a unique result");
        if (set.size() == 0)
            throw new StorageException("no feed with feedID: " + feedId
View Full Code Here

        if(feed.getServiceType() == null)
            throw new StorageException("Can not update feed -- service type is null");
        if(accountname == null)
            throw new StorageException("Account name is null");
        GDataAccount account = getAccount(accountname);
        Query query = this.container.query();
        query.constrain(ServerBaseFeed.class);
        query.descend("feed").descend("id").constrain(feed.getId());
        ObjectSet<ServerBaseFeed> set=  query.execute();
        if (set.size() > 1)
            throw new StorageException("Query for feed id " + feed.getId()
                    + " returns more than one result");
        if (set.size() < 1)
            throw new StorageException("can not find feed for given feed id -- "
View Full Code Here

    public String getServiceForFeed(final String feedId) throws StorageException {
        if(feedId == null)
            throw new StorageException("can not get Service for feed -- feed id is null");
        if(LOG.isInfoEnabled())
            LOG.info("Retrieving Service for feed -- feed id: "+feedId);
        Query query = this.container.query();
        query.constrain(ServerBaseFeed.class);
        query.descend("feed").descend("id").constrain(feedId);
        ObjectSet<ServerBaseFeed> feed =  query.execute();
        if (feed.size() > 1)
            throw new StorageException("Query for feed id " + feedId
                    + " returns more than one result");
        if (feed.size() < 1)
            throw new StorageException("can not find feed for given feed id -- "
View Full Code Here

        if (accountName == null)
            throw new StorageException(
                    "Can not get account -- account name is null");
        if (LOG.isInfoEnabled())
            LOG.info("Retrieving account for account name: " + accountName);
        Query query = this.container.query();
        query.constrain(GDataAccount.class);
        query.descend("name").constrain(accountName).equal();
        ObjectSet set = query.execute();
        if (set.size() > 1)
            throw new StorageException(
                    "Account query returned not a unique result -- account name: "
                            + accountName);
        if (!set.hasNext())
View Full Code Here

        return new Long(getInternalEntry(entryId).getUpdateTime());
    }
   
    @SuppressWarnings("unchecked")
    private ServerBaseFeed getServerBaseFeed(String feedId)throws StorageException{
        Query query = this.container.query();
        query.constrain(ServerBaseFeed.class);
        query.descend("feed").descend("id").constrain(feedId);
        ObjectSet<ServerBaseFeed> feed =  query.execute();
        if (feed.size() > 1)
            throw new StorageException("Query for feed id " + feedId
                    + " returns more than one result");
        if (feed.size() < 1)
            throw new StorageException("can not find feed for given feed id -- "
View Full Code Here

    }

    }
   
  protected final DownloadedMessageLink getDownloadedMessageLink(Message message) throws NoSuchMessageException {
      Query q = mDB.query();
      q.constrain(DownloadedMessageLink.class);
      q.descend("mMessage").constrain(message).identity();
      q.descend("mBoard").constrain(this).identity();
      ObjectSet<DownloadedMessageLink> messageLinks = new Persistent.InitializingObjectSet<Board.DownloadedMessageLink>(mFreetalk, q);
     
      switch(messageLinks.size()) {
        case 0: throw new NoSuchMessageException(message.getID());
        case 1: return messageLinks.next();
View Full Code Here

    storeWithoutCommit();
    return result;
    }
   
    protected final ObjectSet<DownloadedMessageLink> getDownloadedMessagesAfterIndex(int index) {
        Query q = mDB.query();
        q.constrain(DownloadedMessageLink.class);
        q.descend("mBoard").constrain(this).identity();
        q.descend("mIndex").constrain(index).greater();
        return new Persistent.InitializingObjectSet<DownloadedMessageLink>(mFreetalk, q.execute());
    }
View Full Code Here

        q.descend("mIndex").constrain(index).greater();
        return new Persistent.InitializingObjectSet<DownloadedMessageLink>(mFreetalk, q.execute());
    }
   
    private final DownloadedMessageLink getDownloadedMessageByIndex(int index) throws NoSuchMessageException {
        final Query q = mDB.query();
        q.constrain(DownloadedMessageLink.class);
        q.descend("mBoard").constrain(this).identity();
        q.descend("mIndex").constrain(index);
      final ObjectSet<DownloadedMessageLink> messageLinks = new Persistent.InitializingObjectSet<Board.DownloadedMessageLink>(mFreetalk, q);
     
      switch(messageLinks.size()) {
        case 0: throw new NoSuchMessageException("index: " + index);
        case 1: return messageLinks.next();
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.