Пример #1
0
  /**
   * Check if a message already exists in the list of overridden or displayed messages
   *
   * @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 eqMessage - the Equation message
   * @return the Equation message if it it not existing<br>
   *     Otherwise, return NULL
   * @throws EQException
   */
  public EQMessage chkMessage(
      int screenSetId,
      int scrnNo,
      String fieldName,
      int sequence,
      FieldData fieldData,
      EQMessage eqMessage) {
    // check the message severity
    int msgSev = Toolbox.parseInt(eqMessage.getSeverity(), FunctionMessages.MSG_ERROR);

    // if this is a warning check if it has already been overridden, if is has, then do not issue
    // this anymore
    if (msgSev == FunctionMessages.MSG_WARN) {
      if (overWarnMessages.chkMessageExists(
          screenSetId, scrnNo, fieldName, sequence, eqMessage.getDsepms())) {
        return null;
      }
    }

    // if this is an informational message check if it has already been displayed to the user, if it
    // has, then do not issue
    // this anymore
    else if (msgSev == FunctionMessages.MSG_INFO) {
      if (dispInfoMessages.chkMessageExists(
          screenSetId, scrnNo, fieldName, sequence, eqMessage.getDsepms())) {
        return null;
      }
    }

    // not found
    return eqMessage;
  }
Пример #2
0
  /**
   * Generate a message only if the message has not been overridden and has the same severity or
   * worse than the existing messages
   *
   * @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 eqMessage - the Equation message
   * @param firstLevelText - text to be appended to the start of messageText
   * @param secondLevelText - text to be appended to the end of messageText
   * @param ignoreMessages - the message severity to ignore. All equal/lower message severity will
   *     be ignored
   * @return the function message added
   */
  public FunctionMessage generateMessage(
      FunctionMessages fms,
      int screenSetId,
      int scrnNo,
      String fieldName,
      int sequence,
      FieldData fieldData,
      EQMessage eqMessage,
      String firstLevelText,
      String secondLevelText,
      int ignoreMessages) {
    // message to be ignored?
    if (Toolbox.parseInt(eqMessage.getSeverity(), FunctionMessages.MSG_ERROR) <= ignoreMessages) {
      return null;
    }

    // is the message already existing?
    eqMessage = chkMessage(screenSetId, scrnNo, fieldName, sequence, fieldData, eqMessage);

    if (eqMessage == null) {
      return null;
    }

    // is the message already exists in the list?
    if (fms.chkMessageExists(screenSetId, scrnNo, fieldName, sequence, eqMessage.getDsepms())) {
      return null;
    }

    // add the message
    FunctionMessage fm =
        fms.insertMessage(
            screenSetId, scrnNo, fieldName, sequence, eqMessage, firstLevelText, secondLevelText);
    if (fm == null) {
      return null;
    }

    // add the error message to the field
    if (fieldData != null) {
      fieldData
          .getFunctionMessages()
          .insertMessage(
              screenSetId, scrnNo, fieldName, sequence, eqMessage, firstLevelText, secondLevelText);
    }

    // message severity
    return fm;
  }