KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > cowsultants > itracker > ejb > beans > entity > UserBean


1 /*
2  * This software was designed and created by Jason Carroll.
3  * Copyright (c) 2002, 2003, 2004 Jason Carroll.
4  * The author can be reached at jcarroll@cowsultants.com
5  * ITracker website: http://www.cowsultants.com
6  * ITracker forums: http://www.cowsultants.com/phpBB/index.php
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it only under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  */

18
19 package cowsultants.itracker.ejb.beans.entity;
20
21 import java.util.*;
22 import java.sql.Timestamp JavaDoc;
23
24 import cowsultants.itracker.ejb.client.models.UserModel;
25
26 public abstract class UserBean extends GenericBean {
27
28     public abstract String JavaDoc getLogin();
29     public abstract void setLogin(String JavaDoc value);
30
31     public abstract String JavaDoc getPassword();
32     public abstract void setPassword(String JavaDoc value);
33
34     public abstract String JavaDoc getFirstName();
35     public abstract void setFirstName(String JavaDoc value);
36
37     public abstract String JavaDoc getLastName();
38     public abstract void setLastName(String JavaDoc value);
39
40     public abstract String JavaDoc getEmail();
41     public abstract void setEmail(String JavaDoc value);
42
43     public abstract int getStatus();
44     public abstract void setStatus(int value);
45
46     public abstract int getSuperUser();
47     public abstract void setSuperUser(int value);
48
49     public abstract int getRegistrationType();
50     public abstract void setRegistrationType(int value);
51
52     public abstract UserPreferencesLocal getPreferences();
53     public abstract void setPreferences(UserPreferencesLocal preferences);
54
55     public abstract Collection getPermissions();
56     public abstract void setPermissions(Collection permissions);
57
58     public abstract Collection getNotifications();
59     public abstract void setNotifications(Collection notifications);
60
61     public abstract Collection getActivities();
62     public abstract void setActivities(Collection activities);
63
64     public abstract Collection getHistory();
65     public abstract void setHistory(Collection history);
66
67     public abstract Collection getProjects();
68     public abstract void setProjects(Collection projects);
69
70     public abstract Collection getAttachments();
71     public abstract void setAttachments(Collection attachments);
72
73     public UserModel getModel() {
74         UserModel model = new UserModel();
75         model.setId(this.getId());
76         model.setLogin(this.getLogin());
77         model.setFirstName(this.getFirstName());
78         model.setLastName(this.getLastName());
79         model.setEmail(this.getEmail());
80         model.setStatus(this.getStatus());
81         model.setSuperUser((this.getSuperUser() == 1 ? true : false));
82         model.setRegistrationType(this.getRegistrationType());
83         model.setLastModifiedDate(this.getLastModifiedDate());
84         model.setCreateDate(this.getCreateDate());
85
86         // Set password in the model to empty so it isn't available to others
87
model.setPassword("");
88
89         return model;
90     }
91
92     public void setModel(UserModel model) {
93         this.setLogin(model.getLogin());
94         this.setFirstName(model.getFirstName());
95         this.setLastName(model.getLastName());
96         this.setEmail(model.getEmail());
97         this.setSuperUser((model.isSuperUser() ? 1 : 0));
98         this.setLastModifiedDate(new Timestamp JavaDoc(new Date().getTime()));
99
100         // Only set the password if it is a new value...
101
if(model.getPassword() != null && ! model.getPassword().equals("") && ! model.getPassword().equals(this.getPassword())) {
102             this.setPassword(model.getPassword());
103         }
104     }
105
106 }
107
Popular Tags