java.lang.Object
com.aquima.interactions.portal.model.session.EventErrors
All Implemented Interfaces:
Serializable

public class EventErrors extends Object implements Serializable
This object contains the errors that are generated during the processing of a single event.
Since:
5.0
Author:
O. Kerpershoek
See Also:
  • Constructor Details

    • EventErrors

      public EventErrors(IProject project, IFiredEvent firedEvent, Set<Object> warnings)
      Constructor that creates an event error object for the specified meta-model and event.
      Parameters:
      project - The project model that should be used to retrieve messages from (mandatory).
      firedEvent - The event for which the error list is created (mandatory).
      warnings - The set of warnings that have already been shown.
  • Method Details

    • getEvent

      public IFiredEvent getEvent()
      Returns the event for which this context is working.
      Returns:
      The fired even object which is never null.
    • hasErrors

      public boolean hasErrors()
      Indicator if the request scope contains generic errors or errors on attribute values.
      Returns:
      boolean indicating if errors are present in the request scope.
    • clearErrors

      public boolean clearErrors()
      This method will remove all the errors that might have been added. The method returns a boolean indicating if any errors were actually discarded.
      Warning: Use this method with care, as clearing errors might result in a state that is not consistent with the rules defined in the model.
      Returns:
      a boolean indicating if any errors were actually discarded.
    • removeWarnings

      protected void removeWarnings()
    • addErrorText

      public boolean addErrorText(RuntimeKey elementId, String source, ValueReference attributeReference, IMultilingualText text, Throwable cause)
      This method may be used to add an error to the current context. The error may be linked to a value by specifying a value reference, or the value reference may be left empty (null) to indicate that the error is generic.
      Parameters:
      elementId - Optional ID of the element where the error originated from.
      source - The sender name of the message, in most cases this is the validation rule name which triggered the warning/error.
      attributeReference - Optional parameter that specifies the value the error belongs to.
      text - The error message that should be added to the context.
      cause - The optional cause of the error.
      Returns:
      Boolean indicating if the error was actually added.
    • addErrorText

      public boolean addErrorText(RuntimeKey elementId, ValueReference attributeReference, IMultilingualText text, IFieldValidation cause)
    • addErrorMessage

      public boolean addErrorMessage(RuntimeKey elementId, String source, ValueReference attributeReference, String key, String[] parameters)
      This method may be used to add an error to the current context. The error may be linked to a value by specifying a value reference, or the value reference may be left empty (null) to indicate that the error is generic. The message of the error is retrieved from the meta model for the specified the key.
      Parameters:
      elementId - Optional ID of the element where the error originated from.
      source - The sender name of the message, in most cases this is the validation rule name which triggered the warning/error.
      attributeReference - Optional parameter that specifies the value the error belongs to.
      key - The id of the message from the meta model.
      parameters - Optional parameters for the message.
      Returns:
      Boolean indicating if the error was actually added.
    • addWarningText

      public boolean addWarningText(RuntimeKey elementId, String source, ValueReference attributeReference, IMultilingualText text, Throwable cause)
      This method may be used to add a warning to the current context. The warning may be linked to a value by specifying a value reference, or the value reference may be left empty (null) to indicate that the warning is generic.
      Parameters:
      elementId - Optional ID of the element where the error originated from.
      source - The sender name of the message, in most cases this is the validation rule name which triggered the warning/error.
      attributeReference - Optional parameter that specifies the value the warning belongs to.
      text - The warning message that should be added to the context.
      cause - The optional cause of the warning.
      Returns:
      Boolean indicating if the error was actually added.
    • addWarningText

      public boolean addWarningText(RuntimeKey elementId, ValueReference attributeReference, IMultilingualText text, IFieldValidation cause)
    • addWarningMessage

      public boolean addWarningMessage(RuntimeKey elementId, String source, ValueReference attributeReference, String key, String[] parameters)
      This method may be used to add a warning to the current context. The warning may be linked to a value by specifying a value reference, or the value reference may be left empty (null) to indicate that the warning is generic. The message of the warning is retrieved from the meta model for the specified the key.
      Parameters:
      elementId - Optional ID of the element where the error originated from.
      source - The sender name of the message, in most cases this is the validation rule name which triggered the warning/error.
      attributeReference - Optional parameter that specifies the value the warning belongs to.
      key - The id of the message from the meta model.
      parameters - Optional parameters for the message.
      Returns:
      Boolean indicating if the error was actually added.
    • getErrors

      public EventError[] getErrors(boolean onlyGenericErrors)
      Returns the error messages (never null) that have been set in the request scope. When no errors have been an empty array will be returned.
      Parameters:
      onlyGenericErrors - Boolean indicating if only generic error messages should be returned.
      Returns:
      Array containing the errors that have been set on the request scope.
    • getErrors

      public EventError[] getErrors(ValueReference attributeReference)
      Retrieves the errors for a specific ValueReference (never null) When no error messages have been set for the specified attribute, an empty array will be returned.
      Parameters:
      attributeReference - Reference to the attribute for which the error messages are requested.
      Returns:
      Array containing the error messages for the specified attribute (may be empty).
    • addRejectedValue

      public void addRejectedValue(ValueReference reference, Serializable postedValue)