示例#1
0
  public boolean test() {
    // Have a bash...
    FunctionHandler functionHandler2 = null;
    try {
      // Maintain
      System.out.println("--------------------------- MA1");
      functionHandler2 = FunctionToolboxStub.getFunctionHandler(user, "SESSIONID", "");
      functionHandler2.doNewTransaction("MA1", "");

      FunctionData functionData2 =
          functionHandler2.getFhd().getScreenSetHandler().rtvScrnSetCurrent().getFunctionData();

      functionData2.chgFieldInputValue("MAB_AB", "0000");
      functionData2.chgFieldInputValue("MAB_AN", "0000001");
      functionData2.chgFieldInputValue("MAB_AS", "001");
      functionHandler2.applyRetrieveTransaction();

      functionHandler2.applyTransaction();

      Toolbox.printList(functionHandler2.print());
      FunctionToolboxStub.printMessages(functionHandler2.rtvFunctionMessages().getMessages());

      JournalHeader journalHeader = functionHandler2.getFhd().getJournalHeader();
      if (journalHeader != null) {
        System.out.println("Journal 2=" + journalHeader);
      } else {
        System.out.println("Journal 2=" + "ERROR");
      }

      return (journalHeader != null);
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    } finally {
      cleanUp();
    }
  }
示例#2
0
  /**
   * Generate a list of messages only if the message has not been overridden and has the same
   * severity or worse than the existing messages
   *
   * @param session - the Equation Standard session
   * @param fms - function messages to add the the new message
   * @param screenSetId - screen set Id
   * @param scrnNo - the screen where the message occurred
   * @param fieldName - the field that generated the message
   * @param sequence - sequence number
   * @param fieldData - the field data
   * @param messageTexts - the list of messages
   * @param firstLevelText - text to be appended to the start of messageText
   * @param secondLevelText - text to be appended to the end of messageText
   * @param functionData - the function data
   * @param ignoreMessages - the message severity to ignore. All equal/lower message severity will
   *     be ignored
   * @return the message severity of generated
   * @throws EQException
   */
  public int generateMessages(
      EquationStandardSession session,
      FunctionMessages fms,
      int screenSetId,
      int scrnNo,
      String fieldName,
      int sequence,
      FieldData fieldData,
      List<UserExitMessage> messageTexts,
      String firstLevelText,
      String secondLevelText,
      FunctionData functionData,
      int ignoreMessages)
      throws EQException {
    for (UserExitMessage rm : messageTexts) {
      // default to the field data in the parameter
      FieldData fd = fieldData;
      String fieldname = fieldName;

      // ignore message if text or field name is blank or null string
      if (rm.getMsgText().trim().length() <= 0) {
        continue;
      }

      // is field name specified in the list
      if (rm.getFieldName().trim().length() > 0) {
        RelatedFields relatedFields = new RelatedFields(rm.getFieldName());
        fd = functionData.rtvFieldData(relatedFields.getFirstField());

        // update message field name with those that are only valid
        rm.setFieldName(relatedFields.getValidRelatedFieldNames(functionData));
        if (fd == null) {
          fd = fieldData;
        } else {
          fieldname = rm.getFieldName();
        }
      }

      if (rm.getSequence() > 0 && fd instanceof RepeatingFieldData) {
        // set row on this repeating data manager
        String list = ((RepeatingFieldData) fd).rtvRepeatingDataManager().getId();
        functionData.getRepeatingDataManager(list).setRow(rm.getSequence() - 1);
      }

      if (rm.getSequence() == 0 && fd instanceof RepeatingFieldData && fieldData != null) {
        // the system does not know which row to highlight
        fd = fieldData;
      }

      String secondLevelTextNew =
          (rm.getSecondLevelText() == null ? "" : rm.getSecondLevelText())
              .concat(secondLevelText == null ? "" : secondLevelText);
      generateMessage(
          session,
          fms,
          screenSetId,
          scrnNo,
          fieldname,
          rm.getSequence(),
          fd,
          rm.getMsgText(),
          firstLevelText,
          secondLevelTextNew,
          ignoreMessages);
    }

    // message severity
    return fms.getMsgSev();
  }
  public boolean test() {
    // Have a bash...
    FunctionHandler functionHandler = null;
    try {
      System.out.println("------------------------------- 1");
      functionHandler = FunctionToolboxStub.getFunctionHandler(user, "SESSIONID", "");
      functionHandler.doNewTransaction("RLX", "");
      FunctionData functionData =
          functionHandler.getFhd().getScreenSetHandler().rtvScrnSetCurrent().getFunctionData();

      String LNR =
          Toolbox.formatDate(Calendar.getInstance(), Toolbox.TIMESTAMP_FORMAT)
              .replaceAll(" ", "")
              .replaceAll(":", "");
      String LNR2 = LNR.substring(LNR.length() - 13);

      if (externalInputTest) {
        LNR2 = "7.08150344998";
      }

      functionData.chgFieldInputValue("LNP", "CR2");
      functionData.chgFieldInputValue("LNR", LNR2);
      // functionData.chgFieldInputValue("BRNM", "");
      functionData.chgFieldInputValue("CUS", "312162");
      functionData.chgFieldInputValue("CLC", "789");
      functionData.chgFieldInputValue("CCY", "GBP");
      functionData.chgFieldInputValue("DLA", "10T");
      functionData.chgFieldInputValue("SDT", "011299");
      functionData.chgFieldInputValue("CTRD", "011299");

      functionData.chgFieldInputValue("RAT", "10");
      functionData.chgFieldInputValue("IDB", "10");
      functionData.chgFieldInputValue("CPI", "N");
      functionData.chgFieldInputValue("RPYM", "1");
      functionData.chgFieldInputValue("SCHC", "2");

      functionData.chgFieldInputValue("NPY", "10");
      functionData.chgFieldInputValue("RPQ", "V01");
      functionData.chgFieldInputValue("RPA", "");
      functionData.chgFieldInputValue("FTA", "");
      functionData.chgFieldInputValue("FDT", "010100");
      functionData.chgFieldInputValue("DIF", "N");
      functionData.chgFieldInputValue("MDT", "");
      functionData.chgFieldInputValue("AB", "9132");
      functionData.chgFieldInputValue("AN", "234567");
      functionData.chgFieldInputValue("AS", "001");
      functionData.chgFieldInputValue("SAP", "N");

      functionData.chgFieldInputValue("PYT", "KBC");

      functionData.chgFieldInputValue("RCCY", "GBP");
      functionData.chgFieldInputValue("RAMT", "10T");
      functionData.chgFieldInputValue("PCCY", "USD");

      functionData.chgFieldInputValue("XREF", LNR2);
      functionData.chgFieldInputValue("RMTR", "Remitter Id");

      functionData.chgFieldInputValue("NST1", "GBP R");
      functionData.chgFieldInputValue("SAD1", "Sender line 1");
      functionData.chgFieldInputValue("SAD2", "Sender line 2");
      functionData.chgFieldInputValue("SAD3", "Sender line 3");
      functionData.chgFieldInputValue("SAD4", "Sender line 4");

      functionData.chgFieldInputValue("NST2", "BARUSD");
      functionData.chgFieldInputValue("OAN1", "Beneficiary account number");
      functionData.chgFieldInputValue("BAD1", "Beneficiary line 1");
      functionData.chgFieldInputValue("BAD2", "Beneficiary line 2");
      functionData.chgFieldInputValue("BAD3", "Beneficiary line 3");
      functionData.chgFieldInputValue("BAD4", "Beneficiary line 4");

      functionData.chgFieldInputValue("OAN2", "A/c with inst account number");
      functionData.chgFieldInputValue("AAD1", "A/c with inst line 1");
      functionData.chgFieldInputValue("AAD2", "A/c with inst line 2");
      functionData.chgFieldInputValue("AAD3", "A/c with inst line 3");
      functionData.chgFieldInputValue("AAD4", "A/c with inst line 4");
      functionData.chgFieldInputValue("US1", "A/c ref 1");
      functionData.chgFieldInputValue("US2", "A/c ref 2");

      functionHandler.applyTransaction();
      FunctionToolboxStub.printMessages(functionHandler.rtvFunctionMessages().getMessages());

      // retrieve journal header
      System.out.println(LNR2);
      JournalHeader journalHeader = functionHandler.getFhd().getJournalHeader();
      if (journalHeader != null) {
        System.out.println("Journal 1=" + journalHeader);
      } else {
        System.out.println("Journal 1=" + "ERROR");
      }

      return (journalHeader != null);
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    } finally {
      if (functionHandler != null) {
        if (functionHandler.getFhd().getFunctionSession() != null) {
          SupervisorToolbox.removeSession(
              functionHandler.getFhd().getFunctionSession(),
              functionHandler.getFhd().getEquationUser().getEquationUnit());
        }
      }
      cleanUp();
    }
  }