コード例 #1
0
  protected void saveAsset(ImportSource source, VFSFile root, AssetNode node) throws Exception {
    JSSnippet snippet = (JSSnippet) node.load(root);
    Document doc = getDatabase().createDocument();
    try {
      setItemValue(doc, "Form", "CodeSnippet");
      setItemValue(
          doc,
          "Author",
          doc.getParentDatabase()
              .getParent()
              .getUserName()); // Should we make this private (reader field)?
      setItemValue(doc, "Id", node.getUnid());
      setItemValue(doc, "Category", node.getCategory());
      setItemValue(doc, "Name", node.getName());
      setItemValue(doc, "Description", snippet.getProperty("description"));
      setItemValue(doc, "Tags", snippet.getProperty("tags"));
      setItemValue(doc, "ImportSource", source.getName());
      setItemValueRichText(doc, "Html", snippet.getHtml());
      setItemValueRichText(doc, "Css", snippet.getCss());
      setItemValueRichText(doc, "JavaScript", snippet.getJs());
      setItemValueRichText(doc, "Properties", snippet.getPropertiesAsString());
      setItemValueRichText(doc, "Documentation", snippet.getDocHtml());

      doc.save();
    } finally {
      doc.recycle();
    }
  }
コード例 #2
0
 /**
  * RWFException constructor
  *
  * @param - msg, String the error message to be used.
  * @param Document doc the context document.
  */
 public RWFException(String msg, Document doc) {
   Database db = null;
   try {
     db = doc.getParentDatabase();
   } catch (NotesException e) {
     e.printStackTrace();
   }
   new RWFException(msg, db, doc);
 }
コード例 #3
0
 /**
  * Wrap.
  *
  * @param doc the doc
  * @return the document
  */
 public static Document wrap(final lotus.domino.Document doc) {
   try {
     lotus.domino.Database db = doc.getParentDatabase();
     Session session = Factory.fromLotus(db.getParent(), Session.class, null);
     Database wrappedDB = Factory.fromLotus(db, Database.class, session);
     return Factory.fromLotus(doc, Document.class, wrappedDB);
   } catch (lotus.domino.NotesException ne) {
     return null;
   }
 }
コード例 #4
0
 /**
  * This will display an error page to the user. The error page must be in a view in the current
  * Database with the name matching the value of EXCEPTION_VIEW. The key of the document in the
  * view is the same as the class of the exception that is calling this method.
  *
  * @param - contextDoc Document , the context document.
  */
 public void showExceptionWebPage(Document contextDoc) {
   try {
     Database db = contextDoc.getParentDatabase();
     View view = db.getView(EXCEPTION_VIEW);
     if (view != null) {
       Document errorPage = view.getDocumentByKey(EXCEPTION_KEY);
       if (errorPage != null) {
         contextDoc.replaceItemValue(
             "$$Return",
             "[/"
                 + db.getFilePath()
                 + "/"
                 + EXCEPTION_VIEW
                 + "/"
                 + EXCEPTION_KEY
                 + "?OpenDocument]");
       }
     }
   } catch (
       NotesException
           e) {; /// Do nothing if the database doesn't have an exception page  for this exception
   }
 }