Package lotus.domino

Examples of lotus.domino.Document


  public void getCreated() {
    try {
      Database currDb = ExtLibUtil.getCurrentDatabase();
      View contacts = currDb.getView("AllContacts");
      Document doc = contacts.getFirstDocument();
      SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy hh:mm");
      String formatted = format.format(doc.getCreated().toJavaDate());
      ExtLibUtil.getViewScope().put("oldJavaTest", formatted);
    } catch (NotesException e) {
      //doSomething
    }
  }
View Full Code Here


  public void getCreatedOld() {
    try {
      Database currDb = ExtLibUtil.getCurrentDatabase();
      View contacts = currDb.getView("AllContacts");
      Document doc = contacts.getFirstDocument();
      SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy hh:mm");
      String formatted = format.format(doc.getCreated().toJavaDate());
      ExtLibUtil.getViewScope().put("oldJavaTest", formatted);
    } catch (NotesException e) {
      //doSomething
    }
  }
View Full Code Here

  public void getOtherDates() {
    try {
      Database currDb = ExtLibUtil.getCurrentDatabase();
      View contacts = currDb.getView("AllContacts");
      Document doc = contacts.getFirstDocument();
      StringBuilder sb = new StringBuilder();
      SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy hh:mm");
      sb.append("Created: " + format.format(doc.getCreated().toJavaDate()));
      sb.append("....");
      String mod = new String();
      try {
        mod = "First modified: " + format.format(doc.getInitiallyModified().toJavaDate());
      } catch (Exception e) {
        mod = "First modified: not modified??";
      }
      sb.append(mod);
      sb.append("....");
      try {
        mod = "Last modified: " + format.format(doc.getLastModified().toJavaDate());
      } catch (Exception e) {
        mod = "Last modified: not modified??";
      }
      sb.append(mod);
      sb.append("....");
      String accessed = new String();
      try {
        accessed = "Last accessed: " + format.format(doc.getLastAccessed().toJavaDate());
      } catch (Exception e) {
        accessed = "Last accessed: not modified??";
      }
      sb.append(accessed);
      ExtLibUtil.getViewScope().put("oldJavaTest", sb.toString());
View Full Code Here

      Database db = ExtLibUtil.getCurrentDatabase();
      newsByLink = db.getView("NewsAllbyLink");
      newsByLink.setAutoUpdate(false);
      docs = newsByLink.getAllDocumentsByKey(sNLink, true);

      Document doc = docs.getFirstDocument();
      while(doc != null) {
        if(!doc.getItemValueString("NID").equals(sNID)){
          //the document is not the current document
          bCheck = true;
          DuplicateEntry dup = new DuplicateEntry();
          dup.setNid(doc.getItemValueString("NID"));
          dup.setNLink(doc.getItemValueString("NLink"));
          dup.setNTitle(doc.getItemValueString("NTitle"));

          duplicatesList.add(dup);
        }

        Document tempDoc = doc;
        doc = docs.getNextDocument(doc);
        tempDoc.recycle();
      }

    } catch(Exception e) {
      MiscUtils.logException(e);
    } finally {
View Full Code Here

    boolean bCheck = false;
    DocumentCollection docs = null;
    try {
      Database db = ExtLibUtil.getCurrentDatabase();
      docs = db.FTSearch(sNTitle, 30, Database.FT_SCORES, Database.FT_FUZZY);
      Document doc = docs.getFirstDocument();
      while(doc != null) {
        if(!doc.getItemValueString("NID").equals(sNID)){
          // the document is not the current document
          bCheck = true;
          DuplicateEntry dup = new DuplicateEntry();
          dup.setNid(doc.getItemValueString("NID"));
          dup.setNLink(doc.getItemValueString("NLink"));
          dup.setNTitle(doc.getItemValueString("NTitle"));

          duplicatesList.add(dup);
        }

        Document tempDoc = doc;
        doc = docs.getNextDocument(doc);
        tempDoc.recycle();
      }

    } catch(Exception e) {
      MiscUtils.logException(e);
    } finally {
View Full Code Here

        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");
      viewConfigAll.setAutoUpdate(false);
      viewNavigatorConfig = viewConfigAll.createViewNav();
      entry = viewNavigatorConfig.getFirst();
      if (entry != null) {
        Document doc = entry.getDocument();
        if (doc != null) {
          setCaptchaPublicKey(doc.getItemValueString("COCaptchaPublicKey"));
          setCaptchaPrivateKey(doc.getItemValueString("COCaptchaPrivateKey"));
          _analyticsJS = doc.getItemValueString("COAnalytics");
          doc.recycle();
        }
        entry.recycle();
     
    }
    catch (Exception e) {
View Full Code Here

  /**
   * @param db: The database object where feed definitions exists
   * @return true if we can't get the feed definition document. Probably deleted. 
   */
  public boolean isDeleted(Database db) {
    Document feedDoc=null;
    try {
      feedDoc = db.getDocumentByID(noteId);
      return (feedDoc==null);
    } catch (NotesException e) {
      throw new RuntimeException("Unable to check if Feed definition is deleted!");
View Full Code Here

    boolean result;
   
    Session session=db.getParent();
    DateTime someDate;
   
    Document feedDoc = db.getDocumentByID(noteId);
   
    if(getLastTry()!=null) {
      someDate=session.createDateTime(getLastTry());
      feedDoc.replaceItemValue("BLastTry", someDate);
      someDate.recycle();
    } else {
      feedDoc.replaceItemValue("BLastTry", "");
    }
   
    if(getLastSuccess()!=null) {
      someDate=session.createDateTime(getLastSuccess());
      feedDoc.replaceItemValue("BLastSuccess", someDate);
      someDate.recycle();
    } else {
      feedDoc.replaceItemValue("BLastSuccess", "");
    }
   
    if(getLastError()!=null) {
      someDate=session.createDateTime(getLastError());
      feedDoc.replaceItemValue("BLastError", someDate);
      someDate.recycle();
    } else {
      feedDoc.replaceItemValue("BLastError", "");
    }
   
    feedDoc.replaceItemValue("BLastErrorMessage", getLastErrorMessage());
   
    result=feedDoc.save();
    feedDoc.recycle();
    return result;
  }
View Full Code Here

     
      setCreationDate(Calendar.getInstance());
     
      Session session=db.getParent();
     
      Document storyDoc = db.createDocument();
      storyDoc.replaceItemValue("Form", "News");
      storyDoc.replaceItemValue("NID", Utilities.generateUniqueId());       
     
      if(isRedirectEnabled()) {
        try {
          setLink(Utilities.followRedirect(getLink()));
        } catch (IOException e) {
          throw new StoryReaderException(Constants.EXCEPTION_COMM_ERROR + ": "+getLink());
        }
      }

      storyDoc.replaceItemValue("NLink", getLink());

      someDate=session.createDateTime(getCreationDate());
      storyDoc.replaceItemValue("NCreationDate", someDate);
      someDate.recycle();

      someDate=session.createDateTime(getDate());
      storyDoc.replaceItemValue("NPublicationDate", someDate);
      someDate.recycle();
     
      storyDoc.replaceItemValue("NTitle", getTitle());
      storyDoc.replaceItemValue("NAbstract", getAbstractContent());
      storyDoc.replaceItemValue("NContent", getFullContent());

      // Not checked, but in case additional field has Date or Calendar value, this is going to throw NotesException...
      for (Map.Entry<String, Object> entry : additionalFields.entrySet()) {
            storyDoc.replaceItemValue(entry.getKey(), entry.getValue());
          }
     
      storyDoc.save();
      storyDoc.recycle();

      return true;
    } catch (NotesException e) {
      throw new StoryReaderException(Constants.EXCEPTION_SAVE_STORY + ": "+ e.getMessage());
    }
View Full Code Here

           
            // Getting a collection of all documents from the database.
            DocumentCollection documentCollection = database.getAllDocuments();
     
            // Getting the first document from the database
            Document document = documentCollection.getFirstDocument();
     
            // Start to write to cells at this row.
            int intRowToStart = 0;
     
            // The current row.
            int intRow = intRowToStart;
     
            // The current column.
            int intColumn = 0;
     
            // Process all documents
            while ( document != null ) {
                // Getting the name of the stock.
                String stringName = document.getItemValueString("Name");
               
                // Inserting the name to a specified cell.
                insertIntoCell(intColumn, intRow, stringName, xSpreadsheet, "");
               
                // Getting the number of stocks.
                double intNumber = document.getItemValueInteger( "Number" );
       
                // Inserting the number of stocks to a specified cell.
                insertIntoCell( intColumn + 1, intRow, String.valueOf(intNumber),
                                xSpreadsheet, "V" );
       
                // Getting current share price.
                double doubleSharePrice = document.getItemValueDouble("SharePrice");
       
                // Inserting the current share price to a specified cell.
                insertIntoCell(intColumn + 2, intRow,
                               String.valueOf(doubleSharePrice),
                               xSpreadsheet, "V");
View Full Code Here

TOP

Related Classes of lotus.domino.Document

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.