Package com.db4o

Examples of com.db4o.ObjectContainer.activate()


    /* Assert NewsCounter / NewsCounterItem */
    NewsCounter newsCounter = db.query(NewsCounter.class).get(0);
    db.activate(newsCounter, Integer.MAX_VALUE);
    NewsCounter otherNewsCounter = defragmentedDb.query(NewsCounter.class).get(0);
    defragmentedDb.activate(otherNewsCounter, Integer.MAX_VALUE);
    assertNotNull(newsCounter);
    assertNotNull(otherNewsCounter);

    NewsCounterItem item = otherNewsCounter.get("http://www.rssowl.org");
    assertEquals(1, item.getNewCounter());
View Full Code Here


    oc = Db4o.openFile(configFactory.createConfiguration(), dbFileName);

    /* Preference */
    for (Preference pref : oc.query(Preference.class)) {
      oc.activate(pref, Integer.MAX_VALUE);
      oc.ext().set(convertPref(pref), Integer.MAX_VALUE);
      oc.delete(pref);
    }
    oc.commit();
    /* 20 */
 
View Full Code Here

    oc.commit();
    /* 20 */
    progressMonitor.worked(10);

    for (org.rssowl.core.persist.ISearchField searchField : oc.query(org.rssowl.core.internal.persist.SearchField.class))   {
      oc.activate(searchField, Integer.MAX_VALUE);
      String entityName = searchField.getEntityName();
      entityName = entityName.replace("core.model.types", "core.persist");
      MigrationHelper.setField(searchField, "fEntityName", entityName);
      oc.ext().set(searchField, Integer.MAX_VALUE);
    }
View Full Code Here

    oc.commit();
    /* 30 */
    progressMonitor.worked(10);

    for (org.rssowl.core.persist.ISearchCondition searchCond : oc.query(org.rssowl.core.internal.persist.SearchCondition.class))   {
      oc.activate(searchCond, Integer.MAX_VALUE);
      int searchSpecOrdinal = searchCond.getSpecifier().ordinal();
      org.rssowl.core.persist.SearchSpecifier searchSpec = org.rssowl.core.persist.SearchSpecifier.values()[searchSpecOrdinal];
      MigrationHelper.setField(searchCond, "fSpecifier", searchSpec);
      oc.ext().set(searchCond, Integer.MAX_VALUE);
    }
View Full Code Here

    /* 40 */
    progressMonitor.worked(10);

    List<org.rssowl.core.persist.IFolder> folders = new ArrayList<org.rssowl.core.persist.IFolder>();
    for (org.rssowl.core.persist.IFolder folder : oc.query(org.rssowl.core.internal.persist.Folder.class))   {
      oc.activate(folder, Integer.MAX_VALUE);
      List<IFolderChild> children = new ArrayList<IFolderChild>(getFolderChildren(folder, "fFolders"));
      MigrationHelper.setField(folder, "fFolders", null);
      children.addAll(getFolderChildren(folder, "fMarks"));
      MigrationHelper.setField(folder, "fMarks", null);
      MigrationHelper.setField(folder, "fChildren", children);
View Full Code Here

      oc.ext().set(folder, Integer.MAX_VALUE);
    }

    List<org.rssowl.core.persist.IMark> marks = new ArrayList<org.rssowl.core.persist.IMark>();
    for (org.rssowl.core.persist.IMark mark : oc.query(org.rssowl.core.internal.persist.Mark.class))   {
      oc.activate(mark, Integer.MAX_VALUE);
      org.rssowl.core.persist.IFolder parent = (org.rssowl.core.persist.IFolder) MigrationHelper.getFieldValue(mark, "fFolder");
      MigrationHelper.setField(mark, "fFolder", null);
      MigrationHelper.setField(mark, "fParent", parent);

      /*
 
View Full Code Here

      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());
      }
      oc.ext().set(entity, Integer.MAX_VALUE);
    }
View Full Code Here

      int chunk = available / allBins.size();
      for (NewsBin newsBin : allBins) {
        if (isCanceled(monitor, sourceDb, destinationDb))
          return;

        destinationDb.activate(newsBin, Integer.MAX_VALUE);
        List<NewsReference> staleNewsRefs = new ArrayList<NewsReference>(0);
        for (NewsReference newsRef : newsBin.getNewsRefs()) {
          if (isCanceled(monitor, sourceDb, destinationDb))
            return;
View Full Code Here

    ObjectContainer oc = Db4o.openFile(configFactory.createConfiguration(), dbFileName);

    List<NewsBin> newsBins = oc.query(NewsBin.class);

    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();
View Full Code Here

      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

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.