Package org.openntf.domino.helpers

Examples of org.openntf.domino.helpers.Formula


  }

  @Override
  public void run() {
    Session session = this.getSession();
    Formula formula = new Formula();
    String source = "REM {Begin_Do_Not_Tag};\r\n" + "\r\n" + "SenderName := @If(SendTo = \"\";EnterSendTo;SendTo);\r\n"
        + "Send := @Subset(SenderName; 1);\r\n" + "CN1 := @Trim(@Name([CN]; Send));\r\n"
        + "CN := @If(@Contains(@Right(Send;\"@\");\">\") & CN1 = \"\";@Trim(Send); CN1);\r\n"
        + "G := @If(CN = \"\"; @Name([G]; @Subset(SenderName; 1)); \"\");\r\n"
        + "S := @If(CN = \"\"; @Name([S]; @Subset(SenderName; 1)); \"\");\r\n"
        + "Person := @If(CN != \"\"; CN; G + \" \" + S);\r\n"
        + "@If(@Left(Person;1)=\"\\\"\" & @Right(Person;1)=\"\\\"\"; @LeftBack(@RightBack(Person;1);1); Person);\r\n"
        + "REM {End_Do_Not_Tag};";
    formula.setExpression(source);
    org.openntf.domino.helpers.Formula.Parser parser = formula.getParser();
    if (parser != null) {
      parser.parse();
      Set<String> literals = parser.getLiterals();
      System.out.println("BEGIN LITERALS");
      for (String literal : literals) {
View Full Code Here


  }

  @Override
  public void run() {
    Session session = this.getSession();
    Formula formula = new Formula();
    String source = "REM {the quick \"brown\" fox jumped};\r\n" + "REM {over the \"lazy\" dog};\r\n"
        + "DEFAULT defVar := @If(isThing2; \"thing2\"; thing);\r\n" + "ENVIRONMENT envVar := @Now;\r\n"
        + "FIELD field1 := \"the cow jumped over the moon\";\r\n" + "FIELD field2 := \"dish... spoon... you know the score.\";\r\n"
        + "FIELD field3 := @Adjust([08/08/2002]; 1; 2; 3; 4; 5; 6);\r\n"
        + "tmpVar := field1 + \" rhyming \\\"time\\\" \" + field2[2];\r\n" + "tmpVar2 := 54938 + docField2;\r\n"
        + "tmpVar + tmpVar2 + docField3 + @Name([CN]; @UserName) + 8;\r\n" + "@Command([AddBookmark]; \"foo\"; docField);\r\n" + "";
    formula.setExpression(source);
    org.openntf.domino.helpers.Formula.Parser parser = formula.getParser();
    if (parser != null) {
      parser.parse();
      Set<String> literals = parser.getLiterals();
      System.out.println("BEGIN LITERALS");
      for (String literal : literals) {
View Full Code Here

    Session s = Factory.getSession();
    Database currDb = s.getCurrentDatabase();
    View contacts = currDb.getView("AllContacts");
    Utils.addAllListeners(currDb);
    Document doc = contacts.getFirstDocument();
    Formula fm = new Formula("@DocumentUniqueID");
    doc.put("javaFormulaField", "Document UNID is " + fm.getValue(doc));
    doc.save(true, false);
    ExtLibUtil.getViewScope().put("javaTest", doc.get("javaFormulaField"));
  }
View Full Code Here

          return parent.getUniversalID();
        }

        // TODO RPr: This should be replaced
        //TODO NTF: Agreed when we can have an extensible switch for which formula engine to use
        Formula formula = new Formula();
        formula.setExpression(key.toString());
        List<?> value = formula.getValue(this);
        if (value.size() == 1) {
          return value.get(0);
        }
        return value;
      }
View Full Code Here

TOP

Related Classes of org.openntf.domino.helpers.Formula

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.