@Override
    public void run() {
      long start = System.nanoTime();

      Session s = Factory.getSession();
      Database db = s.getDatabase("", "events4.nsf");
      Base.lock(s, db);

      int delay = 500;
      DominoChildThread[] threads = new DominoChildThread[THREAD_COUNT];
      Map<String, lotus.domino.Base> context = new HashMap<String, lotus.domino.Base>();
      context.put("session", s);
      context.put("database", db);
      for (int i = 0; i < THREAD_COUNT; i++) {
        threads[i] = new DominoChildThread(new Doer(), "Scratch Test " + i);
        threads[i].setContext(context);
      }

      for (DominoChildThread thread : threads) {
        thread.start();
        try {
          Thread.sleep(delay);
        } catch (InterruptedException e1) {
          DominoUtils.handleException(e1);
        }
      }

      for (DominoChildThread thread : threads) {
        try {
          thread.join();
        } catch (InterruptedException e) {
          DominoUtils.handleException(e);
        }
      }

      for (DominoChildThread thread : threads) {
        thread.close();
      }

      Base.unlock(s, db);

      // boolean keepGoing = true;
      // while (keepGoing) {
      // for (Thread t : threads) {
      // keepGoing = (keepGoing || t.isAlive());
      // }
      // Thread.yield();
      // }

    }
Пример #2
0
  public String getPostId() {
    String id = null;
    // First check the URL
    Map<String, String> param = FrameworkUtils.getParam();
    if (StringUtil.isNotEmpty(param.get("id"))) { // $NON-NLS-1$
      id = param.get("id"); // $NON-NLS-1$
    }

    if (StringUtil.isEmpty(id)) {
      // Then check the path info
      String pathInfo = FacesContext.getCurrentInstance().getExternalContext().getRequestPathInfo();
      if (StringUtil.isNotEmpty(pathInfo)) {
        id = pathInfo.substring(1);
      }
    }

    if (StringUtil.isNotEmpty(id)) {
      if (!DominoUtils.isUnid(id)) {
        // Then it must be the URL slug - look it up in the view
        AbstractModelList<Post> posts =
            Post.Manager.get().getNamedCollection("All", null); // $NON-NLS-1$
        posts.setResortOrder("$Key", TabularDataModel.SORT_ASCENDING); // $NON-NLS-1$
        return posts.getByKey(id).getId();
      } else {
        return id;
      }
    }

    return "new"; //$NON-NLS-1$
  }
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.Directory#setLimitMatches(boolean)
  */
 @Override
 public void setLimitMatches(boolean flag) {
   try {
     getDelegate().setLimitMatches(flag);
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
Пример #4
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.MIMEEntity#getContentAsBytes(lotus.domino.Stream)
  */
 @Override
 public void getContentAsBytes(final lotus.domino.Stream stream) {
   try {
     getDelegate().getContentAsBytes(toLotus(stream));
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
Пример #5
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.DxlImporter#setReplaceDbProperties(boolean)
  */
 @Override
 public void setReplaceDbProperties(final boolean flag) {
   try {
     getDelegate().setReplaceDbProperties(flag);
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
Пример #6
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.DxlImporter#setReplicaRequiredForReplaceOrUpdate(boolean)
  */
 @Override
 public void setReplicaRequiredForReplaceOrUpdate(final boolean flag) {
   try {
     getDelegate().setReplicaRequiredForReplaceOrUpdate(flag);
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.Directory#setTrustedOnly(boolean)
  */
 @Override
 public void setTrustedOnly(boolean flag) {
   try {
     getDelegate().setTrustedOnly(flag);
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
Пример #8
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.Replication#setPriority(int)
  */
 @Override
 public void setPriority(final int priority) {
   try {
     getDelegate().setPriority(priority);
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
Пример #9
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.DxlImporter#setDocumentImportOption(int)
  */
 @Override
 public void setDocumentImportOption(final int option) {
   try {
     getDelegate().setDocumentImportOption(option);
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
Пример #10
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.MIMEEntity#transformXML(java.lang.Object, lotus.domino.XSLTResultTarget)
  */
 @Override
 public void transformXML(final Object style, final lotus.domino.XSLTResultTarget result) {
   try {
     getDelegate().transformXML(style, result);
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
Пример #11
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.DxlImporter#setCompileLotusScript(boolean)
  */
 @Override
 public void setCompileLotusScript(final boolean flag) {
   try {
     getDelegate().setCompileLotusScript(flag);
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
Пример #12
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.DxlImporter#setCreateFTIndex(boolean)
  */
 @Override
 public void setCreateFTIndex(final boolean flag) {
   try {
     getDelegate().setCreateFTIndex(flag);
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
Пример #13
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.DxlImporter#importDxl(java.lang.String, lotus.domino.Database)
  */
 @Override
 public void importDxl(final String dxl, final lotus.domino.Database db) {
   try {
     getDelegate().importDxl(dxl, (lotus.domino.Database) toLotus(db));
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
Пример #14
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.Directory#freeLookupBuffer()
  */
 @Override
 public void freeLookupBuffer() {
   try {
     getDelegate().freeLookupBuffer();
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
Пример #15
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.Directory#setUseContextServer(boolean)
  */
 @Override
 public void setUseContextServer(boolean flag) {
   try {
     getDelegate().setUseContextServer(flag);
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
Пример #16
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.MIMEEntity#getContentAsText(lotus.domino.Stream, boolean)
  */
 @Override
 public void getContentAsText(final lotus.domino.Stream stream, final boolean decoded) {
   try {
     getDelegate().getContentAsText(toLotus(stream), decoded);
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
Пример #17
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.NotesProperty#clear()
  */
 @Override
 public void clear() {
   try {
     getDelegate().clear();
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
Пример #18
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.MIMEEntity#getEntityAsText(lotus.domino.Stream)
  */
 @Override
 public void getEntityAsText(final lotus.domino.Stream stream) {
   try {
     getDelegate().getEntityAsText(toLotus(stream));
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
Пример #19
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.Replication#setDontSendLocalSecurityUpdates(boolean)
  */
 @Override
 public void setDontSendLocalSecurityUpdates(final boolean flag) {
   try {
     getDelegate().setDontSendLocalSecurityUpdates(flag);
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
Пример #20
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.DxlImporter#setExitOnFirstFatalError(boolean)
  */
 @Override
 public void setExitOnFirstFatalError(final boolean flag) {
   try {
     getDelegate().setExitOnFirstFatalError(flag);
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
Пример #21
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.Directory#setSearchAllDirectories(boolean)
  */
 @Override
 public void setSearchAllDirectories(boolean flag) {
   try {
     getDelegate().setSearchAllDirectories(flag);
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
Пример #22
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.Replication#setCutoffInterval(long)
  */
 @Override
 public void setCutoffInterval(final long interval) {
   try {
     getDelegate().setCutoffInterval(interval);
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
Пример #23
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.DxlImporter#setInputValidationOption(int)
  */
 @Override
 public void setInputValidationOption(final int option) {
   try {
     getDelegate().setInputValidationOption(option);
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
Пример #24
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.Replication#setIgnoreDestDeletes(boolean)
  */
 @Override
 public void setIgnoreDestDeletes(final boolean flag) {
   try {
     getDelegate().setIgnoreDestDeletes(flag);
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
Пример #25
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.DxlImporter#setLogComment(java.lang.String)
  */
 @Override
 public void setLogComment(final String comment) {
   try {
     getDelegate().setLogComment(comment);
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
Пример #26
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.DxlImporter#setUnknownTokenLogOption(int)
  */
 @Override
 public void setUnknownTokenLogOption(final int option) {
   try {
     getDelegate().setUnknownTokenLogOption(option);
   } catch (NotesException e) {
     DominoUtils.handleException(e);
   }
 }
Пример #27
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.Replication#getDontSendLocalSecurityUpdates()
  */
 @Override
 public boolean getDontSendLocalSecurityUpdates() {
   try {
     return getDelegate().getDontSendLocalSecurityUpdates();
   } catch (NotesException e) {
     DominoUtils.handleException(e);
     return false;
   }
 }
Пример #28
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.Replication#getCutoffDate()
  */
 @Override
 public DateTime getCutoffDate() {
   try {
     return Factory.fromLotus(getDelegate().getCutoffDate(), DateTime.class, this);
   } catch (NotesException e) {
     DominoUtils.handleException(e);
     return null;
   }
 }
Пример #29
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.Replication#getCutoffInterval()
  */
 @Override
 public long getCutoffInterval() {
   try {
     return getDelegate().getCutoffInterval();
   } catch (NotesException e) {
     DominoUtils.handleException(e);
     return 0;
   }
 }
Пример #30
0
 /*
  * (non-Javadoc)
  *
  * @see org.openntf.domino.Replication#clearHistory()
  */
 @Override
 public int clearHistory() {
   try {
     return getDelegate().clearHistory();
   } catch (NotesException e) {
     DominoUtils.handleException(e);
     return 0;
   }
 }