Package lotus.domino

Examples of lotus.domino.ViewNavigator


  }
  private boolean swap(String noteID, boolean previous) throws Exception {
    // Is there a faster way?
    View view = ExtLibUtil.getCurrentDatabase().getView("AllDocumentation");
    //view.setAutoUpdate(false);
    ViewNavigator vn = view.createViewNav();   
    try {
      for(ViewEntry ve=vn.getFirst(); ve!=null; ve=vn.getNext(ve)) {
        if(ve.getNoteID().equals(noteID)) {
          int docIndent = ve.getIndentLevel();
          Document doc = ve.getDocument();
          ve = previous ? vn.getPrev(ve) : vn.getNext(ve);
          if(ve!=null) {
            Document other = ve.getDocument();
            if(ve.getIndentLevel()==docIndent) {
              Object ts = other.getItemValue("OrderTS");
              other.replaceItemValue("OrderTS",doc.getItemValue("OrderTS"));
              doc.replaceItemValue("OrderTS",ts);
              doc.save();
              other.save();
              view.refresh();
              return true;
            }
          }
          return false;
        }
      }
    } finally {
      vn.recycle();
    }
    return false;
  }
View Full Code Here


              c.getChildren().add(node);
            }
          }
        } else {
          v.setAutoUpdate(false);
          ViewNavigator nav = v.createViewNavFromCategory(getAssetForm());
          nav.setBufferMaxEntries(500);
          for(ViewEntry e=nav.getFirst(); e!=null; e=nav.getNext()) {
            Vector<?> values = e.getColumnValues();
            String notesUnid = e.getUniversalID();
            // 2 type
            String cat = (String)values.get(1);
            String name = (String)values.get(2);
View Full Code Here

   * Read the asset categories
   */
  public String[] getAllCategories() throws NotesException {
    Database db = ExtLibUtil.getCurrentDatabase();
    View v = db.getView("AllSnippets");
    ViewNavigator nav = v.createViewNavFromCategory(getAssetForm());
    try {
      nav.setMaxLevel(1);
      //nav.setCacheSize(128);
      List<String> categories = new ArrayList<String>();
      for(ViewEntry ve=nav.getFirst(); ve!=null; ve=nav.getNext(ve)) {
        categories.add((String)ve.getColumnValues().get(1));
      }
      return categories.toArray(new String[categories.size()]);
    } finally {
      nav.recycle();
    }
  }
View Full Code Here

    View view = ExtLibUtil.getCurrentDatabase().getView(viewName);
    return generateAsStringHier(tree, view, compact);
  }

  public String generateAsStringHier(TreeModel tree, View view, boolean compact) throws NotesException, IOException {
    ViewNavigator nav = view.createViewNav();
    try {
      return generateAsStringHier(tree, nav, compact);
    } finally {
      nav.recycle();
    }
  }
View Full Code Here

  private synchronized void init() {
    _persons = new HashMap<String, Person>();

    Database db = ExtLibUtil.getCurrentDatabase();
    View viewPersonsAll = null;
    ViewNavigator viewNavigator = null;

    try {
      viewPersonsAll = db.getView("PersonsAll");
      viewPersonsAll.setAutoUpdate(false);
      viewNavigator = viewPersonsAll.createViewNav();
      ViewEntry tmpEntry;
      ViewEntry entry = viewNavigator.getFirst();
      while (entry != null) {
        entry.setPreferJavaDates(true);
        List<Object> columnValues = entry.getColumnValues();

        Person person = new Person(
            (String)columnValues.get(5),
            (String)columnValues.get(0),
            (String)columnValues.get(1),
            (String)columnValues.get(2),
            (String)columnValues.get(3),
            (String)columnValues.get(4),
            entry.getUniversalID());
        _persons.put((String)columnValues.get(5), person);

        tmpEntry = viewNavigator.getNext();
        entry.recycle();
        entry = tmpEntry;
      }
    } catch (Exception e) {
      e.printStackTrace();
    } catch (Throwable t) {
      t.printStackTrace();   
    } finally {
      try {
        if (viewNavigator != null) {
          viewNavigator.recycle();
        }
        if (viewPersonsAll != null) {
          viewPersonsAll.recycle();
        }
      } catch (NotesException e) {
View Full Code Here

    try {
      Session s = ExtLibUtil.getCurrentSession();
      Database currDb = s.getCurrentDatabase();
      threadsByDate = currDb.getView("AllThreadsByDate");
      threadsByDate.setAutoUpdate(false);
      ViewNavigator vNav = threadsByDate.createViewNav();
      vNav.setEntryOptions(lotus.domino.ViewNavigator.VN_ENTRYOPT_NOCOLUMNVALUES);
      Random randomGenerator = new Random();
      int randomInt = randomGenerator.nextInt(20);
      ViewEntry firstEnt = vNav.getNth(randomInt);
      while (!firstEnt.isDocument()) {
        ViewEntry tmpEnt = vNav.getNext();
        firstEnt.recycle();
        firstEnt = tmpEnt;
      }
      randomInt = randomGenerator.nextInt(20);
      ViewEntry secondEnt = vNav.getNth(randomInt);
      while (!secondEnt.isDocument()) {
        ViewEntry tmpEnt = vNav.getNext();
        secondEnt.recycle();
        secondEnt = tmpEnt;
      }
      firstDoc = firstEnt.getDocument();
      secondDoc = secondEnt.getDocument();
View Full Code Here

    try {
      Session s = ExtLibUtil.getCurrentSession();
      Database currDb = s.getCurrentDatabase();
      threadsByDate = currDb.getView("AllThreadsByDate");
      threadsByDate.setAutoUpdate(false);
      ViewNavigator vNav = threadsByDate.createViewNav();
      vNav.setEntryOptions(lotus.domino.ViewNavigator.VN_ENTRYOPT_NOCOLUMNVALUES);
      Random randomGenerator = new Random();
      int randomInt = randomGenerator.nextInt(20);
      ViewEntry firstEnt = vNav.getNth(randomInt);
      while (!firstEnt.isDocument()) {
        ViewEntry tmpEnt = vNav.getNext();
        firstEnt.recycle();
        firstEnt = tmpEnt;
      }
      randomInt = randomGenerator.nextInt(20);
      ViewEntry secondEnt = vNav.getNth(randomInt);
      while (!secondEnt.isDocument()) {
        ViewEntry tmpEnt = vNav.getNext();
        secondEnt.recycle();
        secondEnt = tmpEnt;
      }
      firstDoc = firstEnt.getDocument();
      secondDoc = secondEnt.getDocument();
View Full Code Here

    _typedNewsEntries = new HashMap<String, List<NewsEntry>>();
    _categorizedTopNewsEntries = new HashMap<String, List<NewsEntry>>();

    Database db = ExtLibUtil.getCurrentDatabase();
    View view = null;
    ViewNavigator navigator = null;
    FacesContext context = FacesContext.getCurrentInstance();
    ConfigCache config = (ConfigCache) context.getApplication()
    .getVariableResolver().resolveVariable(context, "configCache");

    try {
      view = db.getView("NewsModeratedCached");
      view.setAutoUpdate(false);
      navigator = view.createViewNav();
      ViewEntry tmpEntry;
      ViewEntry entry = navigator.getFirst();
      while (entry != null) {
        try {
          entry.setPreferJavaDates(true);
          List<Object> columnValues = entry.getColumnValues();

          Date d1 = MiscUtils.getColumnValueAsDate(columnValues.get(4));
          Date d2 = MiscUtils.getColumnValueAsDate(columnValues.get(0));
          Date d3 = MiscUtils.getColumnValueAsDate(columnValues.get(15));
          Date d4 = MiscUtils.getColumnValueAsDate(columnValues.get(22));

          Double clicksTotalDouble = MiscUtils.getColumnValueAsDouble(columnValues.get(13));
          Double clicksLastWeekDouble = MiscUtils.getColumnValueAsDouble(columnValues.get(14));

          String spotlightImageURL = (String)columnValues.get(18);
          if (spotlightImageURL != null) {
            if (!spotlightImageURL.equals("")) {
              spotlightImageURL = entry.getUniversalID()
              + "/$file/" + spotlightImageURL;
            } else {
              spotlightImageURL = null;
            }
          }
          NewsEntry newsEntry = new NewsEntry(
              (String)columnValues.get(8),
              (String)columnValues.get(1),
              (String)columnValues.get(2),
              (String)columnValues.get(3),
              (String)columnValues.get(5),
              (String)columnValues.get(6),
              (String)columnValues.get(7),
              d1,
              d2,
              (String)columnValues.get(9),
              (String)columnValues.get(10),
              (String)columnValues.get(11),
              (String)columnValues.get(12),
              clicksTotalDouble,
              clicksLastWeekDouble,
              d3,
              (String)columnValues.get(16),
              (String)columnValues.get(17),
              spotlightImageURL,
              (String)columnValues.get(19),
              (String)columnValues.get(20),
              (String)columnValues.get(21),
              d4
          );
          _newsEntries.add(newsEntry);
          if (newsEntry.isSpotlight())
            _spotlightNewsEntries.add(newsEntry);
          getTypedEntriesList(newsEntry.getTID()).add(newsEntry);
          if (newsEntry.isTopStory()) {
            if(newsEntry.getTopStoryCategory().equalsIgnoreCase("top")) {
              _topTopStories.add(newsEntry);
            } else {
              getCategorizedTopEntriesList(
                  newsEntry.getTopStoryCategory()).add(
                      newsEntry);
            }
          }
        } catch (Exception e) {
        }

        tmpEntry = navigator.getNext();
        entry.recycle();
        entry = tmpEntry;
      }
      _spotlightNewsEntries = sortSpotlightStories(_spotlightNewsEntries);
      _topTopStories = sortTopStories(_topTopStories);
      if (_categorizedTopNewsEntries != null) {
        List<Category> categories = config.getCategories();
        if (categories != null) {
          Iterator it = categories.iterator();
          for (; it.hasNext();) {
            Category category = (Category) it.next();
            List<NewsEntry> catTopNews = _categorizedTopNewsEntries.get(category.getID());
            catTopNews = sortTopStories(catTopNews);
            _categorizedTopNewsEntries.put(category.getID(),
                catTopNews);
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
      return;
    } catch (Throwable t) {
      t.printStackTrace();
      return;
    } finally {
      try {
        if (navigator != null) {
          navigator.recycle();
        }
        if (view != null) {
          view.recycle();
        }
      } catch (NotesException e) {
View Full Code Here

    Database db = ExtLibUtil.getCurrentDatabase();
    View viewTypesAll = null;
    View viewCategoriesAll = null;
    View viewConfigAll = null;
    ViewNavigator viewNavigatorTypes = null;
    ViewNavigator viewNavigatorConfig = null;
    ViewNavigator viewNavigatorCategories = null;

    try {
      viewTypesAll = db.getView("TypesAll");
      viewTypesAll.setAutoUpdate(false);
      viewNavigatorTypes = viewTypesAll.createViewNav();
      ViewEntry tmpEntry;
      ViewEntry entry = viewNavigatorTypes.getFirst();
      while (entry != null) {
        if (entry.isCategory() == false) {
          entry.setPreferJavaDates(true);
          List<Object> columnValues = entry.getColumnValues();

          List<String> moderators = new Vector<String>();
          Document doc = entry.getDocument();
          Item moderatorsItem = doc.getFirstItem("TModerators");
          if (moderatorsItem != null) moderators = (Vector<String>)moderatorsItem.getValues();
          Type type = new Type((String)columnValues.get(2),
              (String)columnValues.get(3),
              moderators,
              (String)columnValues.get(4),
              (String)columnValues.get(0),
              (String)columnValues.get(5));
          _types.add(type);
        }

        tmpEntry = viewNavigatorTypes.getNext();
        entry.recycle();
        entry = tmpEntry;
      }

      viewCategoriesAll = db.getView("CategoriesAll");
      viewCategoriesAll.setAutoUpdate(false);
      viewNavigatorCategories = viewCategoriesAll.createViewNav();
      entry = viewNavigatorCategories.getFirst();
      while (entry != null) {
        if (entry.isCategory() == false) {
          entry.setPreferJavaDates(true);
          List<Object> columnValues = entry.getColumnValues();

          Category category = new Category((String)columnValues.get(1),
              (String)columnValues.get(2),
              (String)columnValues.get(3));
          _categories.add(category);
        }

        tmpEntry = viewNavigatorCategories.getNext();
        entry.recycle();
        entry = tmpEntry;
      }

      viewConfigAll = db.getView("ConfigAll");
View Full Code Here

            ve = vc.getNextEntry(ve);
          }
          int nEntries = vc.getCount();
          return new Result(entries, nEntries);
        } else {
          ViewNavigator nav = view.createViewNav();
          try {
            ViewEntry ve = null;
            if (key != null) {
              int searchOptions = DominoUtils.FIND_GREATER_THAN | DominoUtils.FIND_EQUAL | DominoUtils.FIND_PARTIAL
                  | DominoUtils.FIND_CASE_INSENSITIVE;
              // This is the one line that's different
              ve = DominoUtils.getViewEntryByKeyWithOptions(Factory.toLotus(view), key, searchOptions);
            } else {
              ve = nav.getCurrent();
            }
            if (start > 0) {
              if (nav.skip(start) != start) {
                // ok not all of them are skipped, stop the
                // process
                count = 0;
              }
            }
            for (int i = 0; i < count && ve != null; i++) {
              entries.add(meta.createEntry(ve));
              ve = nav.getNext(ve);
            }

            int nEntries = -1;
            return new Result(entries, nEntries);
          } finally {
            nav.recycle();
          }
        }
      } finally {
        // Recycle the view?
      }
View Full Code Here

TOP

Related Classes of lotus.domino.ViewNavigator

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.