Package lotus.domino

Examples of lotus.domino.View


    ExtLibUtil.getViewScope().put("oldJavaTest", sb.toString());
  }

  public void dateTimeEqualsIgnoreDateTest() {
    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.DAY_OF_MONTH, 1);
      c1.set(Calendar.MONTH, 0);
      c1.set(Calendar.YEAR, 2000);
      c2.setTime(secondDate.toJavaDate());
      c2.set(Calendar.DAY_OF_MONTH, 1);
      c2.set(Calendar.MONTH, 0);
      c2.set(Calendar.YEAR, 2000);
      sb.append("Comparing " + firstDt + " (" + firstDoc.getUniversalID() + ") with " + secondDt + " ("
          + secondDoc.getUniversalID() + ")...");
      if (c1.equals(c2)) {
        sb.append("first is the same time as second");
      } else {
        sb.append("first is NOT the same time as second");
      }
    } catch (NotesException e) {
      // doSomething
    } finally {
      try {
        threads.recycle();
        firstDoc.recycle();
        secondDoc.recycle();
        firstDate.recycle();
        secondDate.recycle();
      } catch (NotesException e) {
View Full Code Here


    ExtLibUtil.getViewScope().put("oldJavaTest", sb.toString());
  }

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

    }
    ExtLibUtil.getViewScope().put("oldJavaTest", sb.toString());
  }

  public void getProcessedDate() {
    View threads = null;
    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");
View Full Code Here

  }

  public void processView() {
    Database db = null;
    View view = null;
    ViewEntryCollection collection = null;
    ViewEntry currentEntry = null;
    ViewEntry nextEntry = null;
    StringBuilder sb = new StringBuilder();
    try {
      db = ExtLibUtil.getCurrentDatabase();
      view = db.getView("allStates");
      view.setAutoUpdate(false);
      collection = view.getAllEntries();
      currentEntry = collection.getFirstEntry();
      while (currentEntry != null) {
        nextEntry = collection.getNextEntry(currentEntry);
        try {
          sb.append(currentEntry.getNoteID() + "..."); // Do whatever it is you actually want to get done
View Full Code Here

    ExtLibUtil.getViewScope().put("oldJavaTest", sb.toString());
  }

  public void getAllEntriesByKey() {
    Database db = null;
    View view = null;
    ViewEntryCollection ec = null;
    ViewEntry entry = null;
    ViewEntry nextEntry = null;
    StringBuilder sb = new StringBuilder();
    try {
      db = ExtLibUtil.getCurrentDatabase();
      view = db.getView("allContactsByState");
      view.setAutoUpdate(false);
      Vector<String> key = new Vector<String>();
      key.add("CA");
      ec = view.getAllEntriesByKey(key, true);
      entry = ec.getFirstEntry();
      while (entry != null) {
        nextEntry = ec.getNextEntry();
        try {
          sb.append(entry.getColumnValues().get(7) + "...");
View Full Code Here

    ExtLibUtil.getViewScope().put("oldJavaTest", sb.toString());
  }

  public void getAllDocumentsByKey() {
    Database db = null;
    View view = null;
    DocumentCollection dc = null;
    Document doc = null;
    Document nextDoc = null;
    StringBuilder sb = new StringBuilder();
    try {
      db = ExtLibUtil.getCurrentDatabase();
      view = db.getView("allContactsByState");
      view.setAutoUpdate(false);
      Vector<String> key = new Vector<String>();
      key.add("CA");
      dc = view.getAllDocumentsByKey(key, true);
      doc = dc.getFirstDocument();
      while (doc != null) {
        nextDoc = dc.getNextDocument();
        try {
          sb.append(doc.getItemValueString("FirstName") + " " + doc.getItemValueString("LastName") + "...");
View Full Code Here

    ExtLibUtil.getViewScope().put("oldJavaTest", sb.toString());
  }

  public void getAllDocumentsByKeyNoMatch() {
    Database db = null;
    View view = null;
    DocumentCollection dc = null;
    Document doc = null;
    Document nextDoc = null;
    StringBuilder sb = new StringBuilder();
    try {
      db = ExtLibUtil.getCurrentDatabase();
      view = db.getView("allContactsByState");
      view.setAutoUpdate(false);
      Vector<String> key = new Vector<String>();
      key.add("CX");
      dc = view.getAllDocumentsByKey(key, true);
      sb.append("Getting values...");
      doc = dc.getFirstDocument();
      while (doc != null) {
        nextDoc = dc.getNextDocument();
        try {
View Full Code Here

    ExtLibUtil.getViewScope().put("oldJavaTest", sb.toString());
  }

  public void getAllEntriesByKeyNoMatch() {
    Database db = null;
    View view = null;
    ViewEntryCollection ec = null;
    ViewEntry entry = null;
    ViewEntry nextEntry = null;
    StringBuilder sb = new StringBuilder();
    try {
      db = ExtLibUtil.getCurrentDatabase();
      view = db.getView("allContactsByState");
      view.setAutoUpdate(false);
      Vector<String> key = new Vector<String>();
      key.add("CX");
      ec = view.getAllEntriesByKey(key, true);
      sb.append("Getting values...");
      entry = ec.getFirstEntry();
      while (entry != null) {
        nextEntry = ec.getNextEntry();
        try {
View Full Code Here

    _topTopStories = new ArrayList<NewsEntry>();
    _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) {
        e.printStackTrace();
        return;
      }
View Full Code Here

  }

  private boolean linkAlreadyExists(String sNID, String sNTitle, String sNLink1) {
    boolean bCheck = false;
    String sNLink;
    View newsByLink = null;
    DocumentCollection docs = null;
    try{
      int hashIndex = sNLink1.indexOf("#");
      if(hashIndex > 0) {
        sNLink = sNLink1.substring(0, hashIndex);
      } else {
        sNLink = sNLink1;
      }

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

TOP

Related Classes of lotus.domino.View

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.