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.controller.admin;
6   
7   import com.hack23.cia.model.application.impl.admin.AgencyActionEvent.Operation;
8   import com.hack23.cia.service.api.admin.AgencyRequest;
9   import com.hack23.cia.service.api.admin.AgencyResponse;
10  import com.hack23.cia.service.api.application.ApplicationManager;
11  import com.hack23.cia.web.action.admin.ConfigureAgencyAction;
12  import com.hack23.cia.web.viewfactory.api.admin.AgencyModelAndView;
13  import com.hack23.cia.web.viewfactory.api.admin.AgencyModelAndView.AgencyViewSpecification;
14  import com.hack23.cia.web.viewfactory.api.common.ModelAndView;
15  import com.hack23.cia.web.viewfactory.api.common.ViewFactoryService;
16  
17  /***
18   * The Class ConfigureAgencyActionHandler.
19   */
20  public class ConfigureAgencyActionHandler
21          extends
22          AbstractAdminActionHandler<ConfigureAgencyAction, AgencyRequest, AgencyResponse> {
23  
24      /***
25       * Instantiates a new configure agency action handler.
26       *
27       * @param viewFactoryService the view factory service
28       * @param applicationManager the application manager
29       */
30      public ConfigureAgencyActionHandler(
31              final ViewFactoryService viewFactoryService,
32              final ApplicationManager applicationManager) {
33          super(viewFactoryService, applicationManager);
34      }
35  
36      /*
37       * (non-Javadoc)
38       * 
39       * @seecom.hack23.cia.web.controller.common.AbstractGenericHandler#
40       * createServiceRequest(com.hack23.cia.web.action.common.AbstractAction)
41       */
42      @Override
43      public final AgencyRequest createServiceRequest(
44              final ConfigureAgencyAction action) {
45          return new AgencyRequest(getUserStateService().getUserSessionId(),
46                  Operation.ConfigureAgency, null);
47      }
48  
49      /*
50       * (non-Javadoc)
51       * 
52       * @see com.hack23.cia.web.controller.ActionHandler#getSupportedAction()
53       */
54      @SuppressWarnings("unchecked")
55      @Override
56      public final Class getSupportedAction() {
57          return ConfigureAgencyAction.class;
58      }
59  
60      /*
61       * (non-Javadoc)
62       * 
63       * @seecom.hack23.cia.web.controller.common.AbstractGenericHandler#
64       * handleSuccessResponse(com.hack23.cia.web.action.common.AbstractAction,
65       * com.hack23.cia.service.api.common.AbstractServiceResponse)
66       */
67      @Override
68      public final ModelAndView handleSuccessResponse(
69              final ConfigureAgencyAction action, final AgencyResponse response) {
70          return new AgencyModelAndView(response.getUserSessionDTO(), action,
71                  AgencyViewSpecification.ConfigureAgencyView, response
72                          .getAgency());
73      }
74  
75  }