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   
6   package com.hack23.cia.service.impl.admin;
7   
8   import com.hack23.cia.model.application.impl.common.UserSession;
9   import com.hack23.cia.service.api.admin.AbstractAdminRequest;
10  import com.hack23.cia.service.api.common.AbstractServiceRequest;
11  import com.hack23.cia.service.impl.common.AbstractGenericService;
12  import com.hack23.cia.service.impl.common.UserSessionService;
13  
14  /***
15   * The Class AbstractAdminRequestService.
16   *
17   * @param <REQUEST> the generic type
18   */
19  public abstract class AbstractAdminRequestService<REQUEST extends AbstractAdminRequest>
20          extends AbstractGenericService<REQUEST> {
21  
22      /*** The admin service. */
23      private final AdminService adminService;
24  
25      /***
26       * Instantiates a new abstract admin request service.
27       *
28       * @param userSessionService the user session service
29       * @param adminService the admin service
30       */
31      public AbstractAdminRequestService(
32              final UserSessionService userSessionService,
33              final AdminService adminService) {
34          super(userSessionService);
35          this.adminService = adminService;
36      }
37  
38      /***
39       * Gets the admin service.
40       *
41       * @return the admin service
42       */
43      public final AdminService getAdminService() {
44          return adminService;
45      }
46  
47      /*
48       * (non-Javadoc)
49       * 
50       * @see
51       * com.hack23.cia.service.common.AbstractGenericService#lookupUserSession
52       * (com.hack23.cia.service.api.AbstractServiceRequest)
53       */
54      @Override
55      public final UserSession lookupUserSession(
56              final AbstractServiceRequest request) {
57          final UserSession userSession = this.getUserSessionService()
58                  .loadUserSessionById(request.getUserSessionId());
59          return userSession;
60      }
61  
62  }