Class ActionErrors


  • public class ActionErrors
    extends Object
    A storage for various errors that can occur during web controllers execution.
    • Constructor Detail

      • ActionErrors

        public ActionErrors()
        Constructs new errors storage
    • Method Detail

      • addError

        public void addError​(@NotNull
                             String id,
                             @Nullable
                             String message)
        Adds an error with specified id and error message to this storage.
        Parameters:
        id - id of the error
        message - error message
      • addException

        public void addException​(@NotNull
                                 String id,
                                 @NotNull
                                 Exception e)
        Adds an error with specified id and the exception's message to the storage. If exception's message is null, exception's class is used as message
        Parameters:
        id - id of the error
        e - exception to take message from
        Since:
        10.0
      • addError

        public void addError​(@NotNull
                             InvalidProperty ip)
        Adds an error with specified id and error message to this storage.
        Since:
        8.0
      • addAll

        public void addAll​(@NotNull
                           ActionErrors errors)
        Adds all of the errors from the specified errors storage to this storage
        Parameters:
        errors - errors storage
      • getErrors

        @NotNull
        public List<ActionErrors.Error> getErrors()
        Returns list of errors containing in this errors storage.
        Returns:
        list of errors
      • findErrorById

        @Nullable
        public ActionErrors.Error findErrorById​(@NotNull
                                                String id)
        Searches for an error by specified id
        Parameters:
        id - id of the error
        Returns:
        an error or null
      • hasErrors

        public boolean hasErrors()
        Returns true if this storage contains at least one error.
        Returns:
        true if this storage contains at least one error.
      • hasNoErrors

        public boolean hasNoErrors()
        Returns true if this storage does not contain errors
        Returns:
        true if this storage does not contain errors
      • serialize

        public void serialize​(@NotNull
                              org.jdom.Element rootElement)
        Serializes errors containing in this storage into the specified XML document. Errors document structure:
         <errors>
            <error id="{error id}">{error message}</error>
         </errors>
         
        Parameters:
        rootElement - element where the errors should be attached See javascript: BS.Util.xmlErrors
      • fillErrors

        public void fillErrors​(@Nullable
                               PropertiesProcessor processor,
                               @NotNull
                               Map<String,​String> properties)
        Fills this errors storage from the invalid properties returned by PropertiesProcessor TODO: move this method out of web openapi
        Parameters:
        processor - properties processor
        properties - properties to check