3 * Copyright (c) 2006 - 2007, Newspiritcompany.com
7 package org
.spirit
.contract
;
9 import javax
.servlet
.http
.HttpServletRequest
;
10 import javax
.servlet
.http
.HttpSession
;
12 import org
.spirit
.bean
.impl
.BotListCoreUsers
;
13 import org
.spirit
.bean
.impl
.BotListProfileSettings
;
14 import org
.spirit
.dao
.BotListProfileSettingsDAO
;
15 import org
.spirit
.util
.BotListSessionManager
;
18 * This is class is used by botverse.
19 * @author Berlin Brown
22 public class BotListContractManager
{
24 public static BotListCoreUsersContract
getUserInfo(HttpServletRequest request
) {
25 HttpSession cur_session
= request
.getSession(false);
26 if (cur_session
== null) {
27 cur_session
= request
.getSession(true);
29 BotListCoreUsersContract userInfo
= (BotListCoreUsersContract
) cur_session
.getAttribute(BotListSessionManager
.USER_INFO_OBJECT
);
30 if (userInfo
== null) {
31 // If a user info object is not found, the user
39 * Create the user contract object based on information from the core user and
40 * profile settings objects.
42 * Note: A similar utility exists in the ruby modules, 'core_users.rb'
45 public static BotListCoreUsersContract
createUserContract(BotListProfileSettingsDAO dao_profile
, BotListCoreUsers user_bean
) {
46 // Create the user contract and store in session
47 BotListCoreUsersContract user
= new BotListCoreUsersContract();
48 user
.setUserName(user_bean
.getUserName());
49 user
.setUserEmail(user_bean
.getUserEmail());
50 user
.setDateOfBirth(user_bean
.getDateOfBirth());
51 user
.setCreatedOn(user_bean
.getCreatedOn());
52 user
.setAccountNumber(user_bean
.getAccountNumber());
53 user
.setId(user_bean
.getId());
55 // Also, load the user profile
56 BotListProfileSettings profile
= dao_profile
.readProfile(user
.getId().intValue());
57 user
.setLinkColor(profile
.getLinkColor());
58 user
.setProfileId(profile
.getId());