Package lotus.domino

Examples of lotus.domino.DateTime


  public void dateTimeEqualsIgnoreTimeTest() {
    StringBuilder sb = new StringBuilder();
    View threads = null;
    Document firstDoc = null;
    Document secondDoc = null;
    DateTime firstDate = null;
    DateTime secondDate = null;
    try {
      Session s = ExtLibUtil.getCurrentSession();
      Database currDb = s.getCurrentDatabase();
      threads = currDb.getView("AllThreads");
      Random randomGenerator = new Random();
      int randomInt = randomGenerator.nextInt(100);
      firstDoc = threads.getNthDocument(randomInt);
      randomInt = randomGenerator.nextInt(100);
      secondDoc = threads.getNthDocument(randomInt);
      String firstDt = firstDoc.getFirstItem("Date").getText();
      String secondDt = secondDoc.getFirstItem("Date").getText();
      firstDate = s.createDateTime(firstDt);
      secondDate = s.createDateTime(secondDt);
      Calendar c1 = GregorianCalendar.getInstance();
      Calendar c2 = GregorianCalendar.getInstance();
      c1.setTime(firstDate.toJavaDate());
      c1.set(Calendar.HOUR_OF_DAY, 0);
      c1.set(Calendar.MINUTE, 0);
      c1.set(Calendar.SECOND, 0);
      c1.set(Calendar.MILLISECOND, 0);
      c2.setTime(secondDate.toJavaDate());
      c2.set(Calendar.HOUR_OF_DAY, 0);
      c2.set(Calendar.MINUTE, 0);
      c2.set(Calendar.SECOND, 0);
      c2.set(Calendar.MILLISECOND, 0);
      sb.append("Comparing " + firstDt + " (" + firstDoc.getUniversalID() + ") with " + secondDt + " ("
          + secondDoc.getUniversalID() + ")...");
      if (c1.equals(c2)) {
        sb.append("first is the same date as second");
      } else {
        sb.append("first is NOT the same date as second");
      }
    } catch (NotesException e) {
      // doSomething
    } finally {
      try {
        threads.recycle();
        firstDoc.recycle();
        secondDoc.recycle();
        firstDate.recycle();
        secondDate.recycle();
      } catch (NotesException e) {
        // doSomething
      }
    }
    ExtLibUtil.getViewScope().put("oldJavaTest", sb.toString());
View Full Code Here


    try {
      Session s = ExtLibUtil.getCurrentSession();
      Database currDb = s.getCurrentDatabase();
      threads = currDb.getView("AllContacts");
      Document doc = threads.getFirstDocument();
      DateTime dt = s.createDateTime(new Date());
      doc.replaceItemValue("testDate", dt);
      doc.save(true, false);
      if (doc.hasItem("testDate")) {
        java.util.Vector<?> vector = doc.getItemValue("testDate");
        if (vector != null && !vector.isEmpty()) {
View Full Code Here

    int i = 0;
    try {
      for (i = 0; i <= 100000; i++) {
        name = session.createName(UUID.randomUUID().toString());
        getLotusId(name);
        DateTime dt = session.createDateTime(new Date());
        getLotusId(dt);
        DateTime end = session.createDateTime(new Date());
        getLotusId(end);
        DateRange dr = session.createDateRange(dt, end);
        getLotusId(dr);
        Document doc = db.createDocument();
        getLotusId(doc);
        Item i1 = doc.replaceItemValue("Foo", dr);
        getLotusId(i1);
        Item i2 = doc.replaceItemValue("Bar", dr.getText());
        getLotusId(i2);
        Item i3 = doc.replaceItemValue("Blah", dr.getStartDateTime().getLocalTime());
        getLotusId(i3);
        lotus.domino.ColorObject color = session.createColorObject();
        getLotusId(color);
        color.setRGB(128, 128, 128);
        Item i4 = doc.replaceItemValue("color", color.getNotesColor());
        getLotusId(i4);
        i1.recycle();
        i2.recycle();
        i3.recycle();
        i4.recycle();
        DateTime create = doc.getCreated();
        getLotusId(create);
        @SuppressWarnings("unused")
        String lc = create.getLocalTime();
        //          if (i % 10000 == 0) {
        //            System.out.println(Thread.currentThread().getName() + " Name " + i + " is " + name.getCommon() + " "
        //                + "Local time is " + lc + "  " + dr.getText());
        //          }
        dr.recycle();
        doc.recycle();
        dt.recycle();
        end.recycle();
        create.recycle();
        color.recycle();
        name.recycle();
      }
    } catch (Throwable t) {
      t.printStackTrace();
View Full Code Here

 
  public boolean saveState(Database db) throws NotesException {
    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());
View Full Code Here

   
  }

  public static Calendar getDateField(Document doc, String fieldName) throws NotesException {
    Item someItem=doc.getFirstItem(fieldName);
    DateTime someDate=null;
    Calendar result=null;
   
    if(null != someItem && someItem.getType()==Item.DATETIMES) {
      someDate=someItem.getDateTimeValue();
      result=Calendar.getInstance();
      result.setTime(someDate.toJavaDate());
    }

    if(someItem!=null) someItem.recycle();
    if(someDate!=null) someDate.recycle();
   
    return result;
  }
View Full Code Here

    return getTitle() + " (" + getLink() + " - " + sdf.format(getDate().getTime()) + ")";
  }
 
  public boolean saveToDatabase(Database db) throws StoryReaderException {
    try {
      DateTime someDate=null;
     
      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());
View Full Code Here

TOP

Related Classes of lotus.domino.DateTime

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.