KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > pim > business > base > Owner


1 package org.enhydra.pim.business.base;
2
3 import java.math.BigDecimal JavaDoc;
4 import java.util.Vector JavaDoc;
5 import org.enhydra.pim.business.PersonManager;
6 import org.enhydra.pim.business.PimBase;
7 import org.enhydra.pim.business.UserManager;
8 import org.enhydra.pim.business.api.*;
9 import org.enhydra.pim.exception.EnhydraPimException;
10 import org.enhydra.pim.exception.EnhydraPimLogicException;
11
12 /**
13  * @author P.Djojic Apr 20, 2005 3:50:41 AM
14  *
15  * TODO User
16  */

17 public class Owner extends BasePimImpl implements OwnerI, java.io.Serializable JavaDoc {
18
19     private String JavaDoc username = null;
20
21     private String JavaDoc password = null;
22
23     /**
24      * @param username
25      * @param password
26      */

27     public Owner(String JavaDoc username, String JavaDoc password) {
28         super(null);
29         this.username = username;
30         this.password = password;
31     }
32
33     /**
34      * @param handle
35      * @param username
36      * @param password
37      */

38     public Owner(BigDecimal JavaDoc handle, String JavaDoc username, String JavaDoc password) {
39         super(handle);
40         this.username = username;
41         this.password = password;
42     }
43
44     public void clean() {
45         super.clean();
46         this.username = null;
47         this.password = null;
48     }
49
50     /**
51      * Sets Username.
52      *
53      * @param _username
54      * new value.
55      */

56     public void setUsername(String JavaDoc _username) {
57         username = _username;
58     }
59
60     /**
61      * Return value of Username.
62      *
63      * @return value of Username.
64      */

65     public String JavaDoc getUsername() {
66         return username;
67     }
68
69     /**
70      * Sets Password.
71      *
72      * @param _password
73      * new value.
74      */

75     public void setPassword(String JavaDoc _password) {
76         password = _password;
77     }
78
79     /**
80      * Return value of Password.
81      *
82      * @return value of Password.
83      */

84     public String JavaDoc getPassword() {
85         return password;
86     }
87
88     /**
89      * Is user registred.
90      *
91      * @return true if user is registred.
92      */

93     public boolean isValid() {
94         OwnerI user = null;
95         UserManager uMan = new UserManager();
96         try {
97             user = uMan.checkOwner(this.username, this.password);
98         } catch (EnhydraPimLogicException ex1) {
99             PimBase.logDebug("[id=2010]" + ex1.getMessage());
100         } catch (Exception JavaDoc ex2) {
101             ex2.printStackTrace();
102         }
103         return (user != null && this.handle != null && user.getHandle().equals(this.handle));
104     }
105
106     /**
107      * Returns User Notes.
108      *
109      * @return User Notes.
110      */

111     public Vector JavaDoc getNotes() {
112         //TODO:FuterExtensions
113
return null;
114     }
115
116     /**
117      * Add User Note.
118      *
119      * @param _note
120      * User Note.
121      */

122     public void addNote(NoteI _note) {
123         //TODO:FuterExtensions
124
}
125
126     /**
127      * Remove User Note.
128      *
129      * @param Remove
130      * _note Note.
131      */

132     public void removeNote(NoteI _note) {
133         //TODO:FuterExtensions
134
}
135
136     /**
137      * Returns User Person Contacts.
138      *
139      * @return Returns User Person Contacts.
140      * @throws EnhydraPimException
141      */

142     public Vector JavaDoc getPersons() throws EnhydraPimException {
143         PersonManager pMan = new PersonManager();
144         return pMan.getOwnerPersons(this);
145     }
146
147     /**
148      * Add User Person Contacts.
149      *
150      * @param _person
151      * User Person Contacts.
152      * @throws EnhydraPimException
153      */

154     public void addPerson(PersonI _person) throws EnhydraPimException {
155         PersonManager pMan = new PersonManager();
156         pMan.addPerson(_person,this);
157     }
158
159     /**
160      * Remove User Person Contacts.
161      *
162      * @param _person
163      * User Person Contacts.
164      * @throws EnhydraPimException
165      */

166     public void removePerson(PersonI _person) throws EnhydraPimException {
167         PersonManager pMan = new PersonManager();
168         pMan.removePerson(_person);
169     }
170
171     /**
172      * Returns User Tasks.
173      *
174      * @return Returns User Tasks.
175      */

176     public Vector JavaDoc getTasks() {
177         //TODO:FuterExtensions
178
return null;
179     }
180
181     /**
182      * Add User Task.
183      *
184      * @param _task
185      * User Task.
186      */

187     public void addTask(TaskI _task) {
188         //TODO:FuterExtensions
189
}
190
191     /**
192      * Remove User Task.
193      *
194      * @param _task
195      * User Task.
196      */

197     public void removeTask(TaskI _task) {
198         //TODO:FuterExtensions
199
}
200 }
Popular Tags