Package lotus.domino

Examples of lotus.domino.Document


           
            // 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


           
            // 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

     
      // 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

    try {

      Database database = (Database) resolveVariable("database");
      View settingsView = database.getView("applicationSettings");
      Document settings = settingsView.getFirstDocument();

      if (null == settings) {

        settingsView.recycle();
        XSPContext context = (XSPContext) resolveVariable("context");

        UIViewRootEx2 view = (UIViewRootEx2) resolveVariable("view");
        if (!view.getPageName().equals("/admin.xsp")) {
          System.out.println("mypic: invalid configuration - " + view.getPageName());
          validConfig = false;
          context.redirectToPage("/admin.xsp");
        }

      } else {

        SaveUrlInNab = settings.getItemValueString("saveMypicURLToNab");
        EnableProfiles = settings.getItemValueString("enableProfiles");
        StoreProfilesInNab = settings.getItemValueString("saveProfileToNab");
        NabServer = settings.getItemValueString("nabServer");
        NabFilePath = settings.getItemValueString("nabFilePath");
        ShowApiInNav = settings.getItemValueString("enableAPIPage");
        DefaultFormat = settings.getItemValueString("defaultFormat");
        DefaultSize = settings.getItemValueString("defaultSize");
       
        if (DefaultSize.trim().compareTo("") == 0) {
          DefaultSize = "50";
        }
       
        if (DefaultFormat.trim().compareTo("") == 0) {
          DefaultFormat = "png";
        }

        if ((SaveUrlInNab.equals("Yes") || StoreProfilesInNab.equals("Yes")) && (NabServer.isEmpty() || NabFilePath.isEmpty())) {
          Messages.clear();
          Messages.add("To save mypic URLs or Profile information to a Names and address book, "
              + "the NAB Server and File Path must be specified.");

          UIViewRootEx2 view = (UIViewRootEx2) resolveVariable("view");
          if (!view.getPageName().equals("/admin.xsp")) {
            XSPContext context = (XSPContext) resolveVariable("context");
            validConfig = false;
            context.redirectToPage("/admin.xsp");
          }

        }

        settings.recycle();
        settingsView.recycle();
      }
      validConfig = true;
    } catch (NotesException e) {
      e.printStackTrace();
View Full Code Here

  public boolean saveSettings() {

    try {
      Database database = (Database) resolveVariable("database");
      Document settings = null;
      View settingsView = database.getView("applicationSettings");
      settings = settingsView.getFirstDocument();
      if (settings == null) {
        settings = database.createDocument();
        settings.replaceItemValue("form", "applicationSettings");
      }

      settings.replaceItemValue("saveMypicURLToNab", SaveUrlInNab);
      settings.replaceItemValue("enableProfiles", EnableProfiles);
      settings.replaceItemValue("saveProfileToNab", StoreProfilesInNab);
      settings.replaceItemValue("nabServer", NabServer);
      settings.replaceItemValue("nabFilePath", NabFilePath);
      settings.replaceItemValue("enableAPIPage", ShowApiInNav);
      settings.replaceItemValue("defaultFormat", DefaultFormat);
      settings.replaceItemValue("defaultSize", DefaultSize);
     
      settings.save();

      if ((SaveUrlInNab.equals("Yes") || StoreProfilesInNab.equals("Yes")) && (NabServer.isEmpty() || NabFilePath.isEmpty())) {
        Messages.clear();
        Messages.add("To save mypic URLs or Profile information to a Names and address book, "
            + "the NAB Server and File Path must be specified.");
        validConfig = false;
      } else {
        Messages.clear();
        validConfig = true;
      }

      settings.recycle();
    } catch (NotesException e) {
      e.printStackTrace();
      return false;
    }
View Full Code Here

  }
 
  public boolean storeInNab(String mypicProfileUNID) {
    try {
      Database database = (Database) resolveVariable("database");
      Document profile = database.getDocumentByUNID(mypicProfileUNID);
     
      if (null != profile) {
        Session session = (Session) resolveVariable("sessionAsSigner");
        Database nab = session.getDatabase(this.NabServer, this.NabFilePath);
       
        if (null != nab) {
          String userAbbrev = session.createName(profile.getItemValueString("User")).getAbbreviated();
          View VIMPeople = nab.getView("($VIMPeople)");
         
          Document nabEntry = VIMPeople.getDocumentByKey(userAbbrev, true);
          if (null != nabEntry) {
            XSPContext context = (XSPContext) resolveVariable("context");

            profile.replaceItemValue("PhotoURL",
                context.getUrl().getScheme() + "://" + context.getUrl().getHost() + '/' + database.getFilePath() +
                "/api.xsp?method=getmypic&id=" +
                UNIDEncoder.encode(session.createName(profile.getItemValueString("User")).getCanonical()) + "&size=" +
                this.DefaultSize + "&format=" + this.DefaultFormat);
           
            if (this.StoreProfilesInNab == "Yes") {
              // If we're synching w/ the NAB, Email Address should not be pushed to nab -- it should only get pulled
              profile.replaceItemValue("InternetAddress", nabEntry.getItemValueString("InternetAddress"));

              nabEntry.replaceItemValue("WebSite", profile.getItemValueString("WebSite"));
              nabEntry.replaceItemValue("PhotoURL", profile.getItemValueString("PhotoURL"));
              nabEntry.replaceItemValue("AboutMe", profile.getItemValueString("AboutMe"));
              nabEntry.replaceItemValue("StreetAddress", profile.getItemValueString("StreetAddress"));
              nabEntry.replaceItemValue("City", profile.getItemValueString("City"));
              nabEntry.replaceItemValue("State", profile.getItemValueString("State"));
              nabEntry.replaceItemValue("Zip", profile.getItemValueString("Zip"));
              nabEntry.replaceItemValue("Country", profile.getItemValueString("Country"));
              nabEntry.replaceItemValue("PhoneNumber", profile.getItemValueString("PhoneNumber"));
              nabEntry.replaceItemValue("HomeFAXPhoneNumber", profile.getItemValueString("HomeFAXPhoneNumber"));
              nabEntry.replaceItemValue("Spouse", profile.getItemValueString("Spouse"));
              nabEntry.replaceItemValue("Children", profile.getItemValueString("Children"));
              nabEntry.replaceItemValue("JobTitle", profile.getItemValueString("JobTitle"));
              nabEntry.replaceItemValue("CompanyName", profile.getItemValueString("CompanyName"));
              nabEntry.replaceItemValue("Dpartment", profile.getItemValueString("Dpartment"));
              nabEntry.replaceItemValue("Employee", profile.getItemValueString("Employee"));
              nabEntry.replaceItemValue("Location", profile.getItemValueString("Location"));
              nabEntry.replaceItemValue("Manager", profile.getItemValueString("Manager"));
              nabEntry.replaceItemValue("OfficePhoneNumber", profile.getItemValueString("OfficePhoneNumber"));
              nabEntry.replaceItemValue("OfficeFAXPhoneNumber", profile.getItemValueString("OfficeFAXPhoneNumber"));
              nabEntry.replaceItemValue("CellPhoneNumber", profile.getItemValueString("CellPhoneNumber"));
              nabEntry.replaceItemValue("PhoneNumber_6", profile.getItemValueString("PhoneNumber_6"));
              nabEntry.replaceItemValue("Assistant", profile.getItemValueString("Assistant"));
              nabEntry.replaceItemValue("OfficeStreetAddress", profile.getItemValueString("OfficeStreetAddress"));
              nabEntry.replaceItemValue("OfficeCity", profile.getItemValueString("OfficeCity"));
              nabEntry.replaceItemValue("OfficeState", profile.getItemValueString("OfficeState"));
              nabEntry.replaceItemValue("OfficeZip", profile.getItemValueString("OfficeZip"));
              nabEntry.replaceItemValue("OfficeCountry", profile.getItemValueString("OfficeCountry"));
              nabEntry.replaceItemValue("OfficeNumber", profile.getItemValueString("OfficeNumber"));
            }
            if (this.SaveUrlInNab == "Yes") {
              nabEntry.replaceItemValue("PhotoURL", profile.getItemValueString("PhotoURL"));
            }
            if (nabEntry.save()) {
              if (profile.save()) {
                return true;
              } else {
                return false;
              }
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

  }

  void createUser(Database db, String id, String firstName, String lastName, String city, String state, String email)
      throws NotesException {
    Document doc = db.createDocument();
    try {
      doc.replaceItemValue("Form", "Contact");
      doc.replaceItemValue("Id", id);
      doc.replaceItemValue("FirstName", firstName);
      doc.replaceItemValue("LastName", lastName);
      doc.replaceItemValue("City", city);
      doc.replaceItemValue("State", state);
      doc.replaceItemValue("email", email);
      doc.save();
    } finally {
      doc.recycle();
    }
  }
View Full Code Here

    }

  }

  void createState(Database db, String key, String name) throws NotesException {
    Document doc = db.createDocument();
    try {
      doc.replaceItemValue("Form", "State");
      doc.replaceItemValue("Key", key);
      doc.replaceItemValue("Name", name);
      doc.save();
    } finally {
      doc.recycle();
    }
  }
View Full Code Here

    DateTime date = db.getParent().createDateTime(new Date());
    String[] loremIpsum = SampleDataUtil.readLoremIpsum();
    for (int j = 0; j < nDoc; j++) {
      pos[pos.length - 1] = j + 1;

      Document doc = db.createDocument();
      try {
        doc.replaceItemValue("Form", "Discussion");
        StringBuilder b = new StringBuilder();
        for (int i = 0; i < pos.length; i++) {
          if (i > 0) {
            b.append("/");
          }
          b.append(pos[i]);
        }
        int idx = (int) (Math.random() * (loremIpsum.length - 1));
        String body = loremIpsum[idx];
        int dot = body.indexOf('.');
        if (dot < 0) {
          dot = body.length() - 1;
        }
        int coma = body.indexOf(',');
        if (coma < 0) {
          coma = body.length() - 1;
        }
        String title = body.substring(0, Math.min(dot, coma));

        // Get a random author
        int x = Math.min((int) (Math.random() * (users.size())), users.size());
        String author = users.get(x);

        doc.replaceItemValue("Title", title);
        doc.replaceItemValue("Body", body);
        doc.replaceItemValue("Author", author);
        doc.replaceItemValue("Date", date);
        if (parent != null) {
          doc.makeResponse(parent);
        }
        doc.computeWithForm(false, false);
        doc.save();

        if (pos.length < disc_maxDepth) {
          double r = Math.random();
          if (r <= (1.0 / pos.length)) {
            int[] newPos = new int[pos.length + 1];
            System.arraycopy(pos, 0, newPos, 0, pos.length);
            int n = (int) (Math.random() * 5);
            createDiscussionDocument(db, doc, users, newPos, n);
          }
        }
        // Move the date to the day before if requested
        boolean mvd = Math.random() <= 0.40;
        if (mvd) {
          // Previous day...
          date.adjustDay(-1);
        }
      } finally {
        doc.recycle();
      }
    }
  }
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.