View Javadoc

1   /*
2   Copyright 2010 James Pether Sörling Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 
3   	$Id
4   */
5   package com.hack23.cia.web.viewfactory.api.common;
6   
7   import com.hack23.cia.model.application.dto.common.UserSessionDTO;
8   import com.hack23.cia.web.action.common.ControllerAction;
9   
10  /***
11   * The Class ErrorMessageModelAndView.
12   */
13  public class ErrorMessageModelAndView extends AbstractModelAndView {
14  
15      /***
16       * The Enum ErrorViewSpecification.
17       */
18      public enum ErrorViewSpecification {
19  
20          /*** The Error message view. */
21          ErrorMessageView
22      }
23  
24      /*** The Constant serialVersionUID. */
25      private static final long serialVersionUID = 1L;
26  
27      /*** The error message. */
28      private final String errorMessage;
29  
30      /*** The error view specification. */
31      private final ErrorViewSpecification errorViewSpecification;
32  
33      /***
34       * Instantiates a new error message model and view.
35       *
36       * @param userSessionDTO the user session dto
37       * @param controllerAction the controller action
38       * @param errorViewSpecification the error view specification
39       * @param errorMessage the error message
40       */
41      public ErrorMessageModelAndView(final UserSessionDTO userSessionDTO,
42              final ControllerAction controllerAction,
43              final ErrorViewSpecification errorViewSpecification,
44              final String errorMessage) {
45          super(userSessionDTO, controllerAction);
46          this.errorViewSpecification = errorViewSpecification;
47          this.errorMessage = errorMessage;
48      }
49  
50      /***
51       * Gets the error message.
52       *
53       * @return the error message
54       */
55      public final String getErrorMessage() {
56          return errorMessage;
57      }
58  
59      /***
60       * Gets the error view specification.
61       *
62       * @return the error view specification
63       */
64      public final ErrorViewSpecification getErrorViewSpecification() {
65          return errorViewSpecification;
66      }
67  
68      /*
69       * (non-Javadoc)
70       * 
71       * @seecom.hack23.cia.web.viewfactory.api.common.AbstractModelAndView#
72       * getViewSpecificationDescription()
73       */
74      @Override
75      public final String getViewSpecificationDescription() {
76          return errorViewSpecification.toString();
77      }
78  }