Example #1
0
 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;
 }
 public String getFirstContactID() throws NotesException {
   if (!firstContactIDRead) {
     Database db = ExtLibUtil.getCurrentDatabase();
     View view = db.getView("AllContacts");
     Document doc = view.getFirstDocument();
     if (doc != null) {
       firstContactID = doc.getNoteID();
     }
   }
   return firstContactID;
 }
Example #3
0
  public void setCallTreeRoleBased() {
    this.callTreeType = CALLTREE_TYPE_ROLE;

    try {
      Document docSettings = ExtLibUtil.getCurrentDatabase().getDocumentByUNID(settingsUnid);
      docSettings.replaceItemValue("callTreeType", callTreeType);
      docSettings.save();
      docSettings.recycle();
    } catch (NotesException e) {
      Logger.error(e);
    }
  }
 /** Read the snippet categories */
 public String[] getAllCategories() throws NotesException {
   Database db = ExtLibUtil.getCurrentDatabase();
   View v = db.getView("AllSnippets");
   ViewNavigator nav = v.createViewNav();
   try {
     nav.setMaxLevel(0);
     // 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(0));
     }
     return categories.toArray(new String[categories.size()]);
   } finally {
     nav.recycle();
   }
 }
 private RootNode readSnippetsNodes() throws NotesException {
   Database db = ExtLibUtil.getCurrentDatabase();
   View v = db.getView("AllSnippetsFlat");
   try {
     RootNode root = new RootNode();
     String snippetSearch = (String) ExtLibUtil.getViewScope().get("snippetSearch");
     if (StringUtil.isNotEmpty(snippetSearch)) {
       v.FTSearch(snippetSearch);
       ViewEntryCollection col = v.getAllEntries();
       for (ViewEntry e = col.getFirstEntry(); e != null; e = col.getNextEntry()) {
         Vector<?> values = e.getColumnValues();
         String unid = e.getUniversalID();
         String cat = (String) values.get(0);
         String name = (String) values.get(1);
         String jspUrl = (String) values.get(2);
         CategoryNode c = findCategory(root, cat);
         SnippetNode snippet = new SnippetNode(c, name, cat, unid, jspUrl);
         c.getChildren().add(snippet);
       }
     } else {
       v.setAutoUpdate(false);
       ViewNavigator nav = v.createViewNav();
       nav.setBufferMaxEntries(500);
       for (ViewEntry e = nav.getFirst(); e != null; e = nav.getNext()) {
         Vector<?> values = e.getColumnValues();
         String unid = e.getUniversalID();
         String cat = (String) values.get(0);
         String name = (String) values.get(1);
         String jspUrl = (String) values.get(2);
         CategoryNode c = findCategory(root, cat);
         SnippetNode snippet = new SnippetNode(c, name, cat, unid, findUniqueUrl(c, unid, jspUrl));
         c.getChildren().add(snippet);
       }
     }
     return root;
   } finally {
     v.recycle();
   }
 }