01: package org.romaframework.module.users.view.domain;
02:
03: import org.romaframework.aspect.core.annotation.CoreClass;
04: import org.romaframework.aspect.session.SessionAspect;
05: import org.romaframework.aspect.view.page.CallerHandler;
06: import org.romaframework.core.flow.ObjectContext;
07: import org.romaframework.module.users.domain.BaseAccount;
08: import org.romaframework.module.users.domain.portal.PortalPreferences;
09: import org.romaframework.module.users.domain.portal.PortalPreferencesHelper;
10: import org.romaframework.module.users.view.domain.portal.PortletPreferencesConfiguration;
11:
12: @CoreClass(orderFields="userName account",orderActions="changePassword changePreferences configurePortlets logout")
13: public class UserInfo {
14: protected String userName;
15:
16: protected BaseAccount account;
17:
18: protected CallerHandler preferencesForm;
19:
20: protected ChangePassword changePasswordForm;
21:
22: protected PortletPreferencesConfiguration portletConfiguration;
23:
24: public UserInfo(CallerHandler iPreferencesForm) {
25: preferencesForm = iPreferencesForm;
26: account = (BaseAccount) ObjectContext.getInstance()
27: .getComponent(SessionAspect.class)
28: .getActiveSessionInfo().getAccount();
29: if (account != null) {
30: userName = account.toString();
31: changePasswordForm = new ChangePassword(account, null);
32: PortalPreferences preferences = PortalPreferencesHelper
33: .getUserPreferences(account);
34: if (preferences != null)
35: portletConfiguration = new PortletPreferencesConfiguration(
36: preferences);
37: else
38: portletConfiguration = new PortletPreferencesConfiguration(
39: new PortalPreferences(account));
40: }
41: }
42:
43: public void changePassword() {
44: if (changePasswordForm != null) {
45: changePasswordForm.setBackObject(this );
46: ObjectContext.getInstance().show(changePasswordForm);
47: }
48: }
49:
50: public void changePreferences() {
51: if (preferencesForm != null) {
52: preferencesForm.setBackObject(this );
53: ObjectContext.getInstance().show(preferencesForm);
54: }
55: }
56:
57: public void configurePortlets() {
58: if (portletConfiguration != null) {
59: portletConfiguration.setBackObject(this );
60: ObjectContext.getInstance().show(portletConfiguration);
61: }
62: }
63:
64: public void logout() {
65: ObjectContext.getInstance().logout();
66: }
67:
68: }
|