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.service.impl.user;
6   
7   import java.util.Date;
8   
9   import com.hack23.cia.model.application.dto.common.UserSessionDTO;
10  import com.hack23.cia.model.application.impl.common.ActionEvent;
11  import com.hack23.cia.model.application.impl.common.UserSession;
12  import com.hack23.cia.model.application.impl.user.CommitteeReportsActionEvent;
13  import com.hack23.cia.service.api.common.ServiceResponse;
14  import com.hack23.cia.service.api.user.CommitteeReportsRequest;
15  import com.hack23.cia.service.api.user.CommitteeReportsResponse;
16  import com.hack23.cia.service.impl.common.ParliamentService;
17  import com.hack23.cia.service.impl.common.UserSessionService;
18  
19  /***
20   * The Class CommitteeReportsRequestService.
21   */
22  public class CommitteeReportsRequestService extends
23          AbstractParliamentRequestService<CommitteeReportsRequest> {
24  
25      /***
26       * Instantiates a new committee reports request service.
27       *
28       * @param userSessionService the user session service
29       * @param parliamentService the parliament service
30       */
31      public CommitteeReportsRequestService(
32              final UserSessionService userSessionService,
33              final ParliamentService parliamentService) {
34          super(userSessionService, parliamentService);
35      }
36  
37      /*
38       * (non-Javadoc)
39       * 
40       * @see
41       * com.hack23.cia.service.impl.common.AbstractGenericService#createActionEvent
42       * (com.hack23.cia.service.api.common.AbstractServiceRequest,
43       * com.hack23.cia.model.application.UserSession)
44       */
45      @Override
46      public final ActionEvent createActionEvent(
47              final CommitteeReportsRequest request, final UserSession userSession) {
48          return new CommitteeReportsActionEvent(new Date(), userSession);
49      }
50  
51      /*
52       * (non-Javadoc)
53       * 
54       * @see com.hack23.cia.service.common.ServiceHandler#getSupportedService()
55       */
56      @SuppressWarnings("unchecked")
57      @Override
58      public final Class getSupportedService() {
59          return CommitteeReportsRequest.class;
60      }
61  
62      /*
63       * (non-Javadoc)
64       * 
65       * @seecom.hack23.cia.service.common.AbstractGenericServiceHandler#
66       * handleServiceRequest(com.hack23.cia.service.api.AbstractServiceRequest)
67       */
68      @Override
69      public final ServiceResponse handleServiceRequest(
70              final CommitteeReportsRequest request, final UserSessionDTO userSession) {
71          final CommitteeReportsResponse committeeReportsResponse = new CommitteeReportsResponse(
72                  userSession, getParliamentService().getAllCommiteeReports());
73          return committeeReportsResponse;
74      }
75  }