Subversion Repositories bacoAlunos

Rev

Rev 1315 | Rev 1510 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
113 fvelez 1
package pt.estgp.estgweb.domain.views;
2
 
1054 jmachado 3
import jomm.utils.BytesUtils;
4
import jomm.utils.DesUtils;
146 jmachado 5
import org.apache.log4j.Logger;
206 jmachado 6
import pt.estgp.estgweb.domain.*;
1054 jmachado 7
import pt.estgp.estgweb.domain.dao.DaoFactory;
215 jmachado 8
import pt.estgp.estgweb.domain.enums.RecordEnum;
113 fvelez 9
import pt.estgp.estgweb.utils.RoleManager;
10
 
146 jmachado 11
import java.io.Serializable;
215 jmachado 12
import java.util.*;
113 fvelez 13
 
14
/**
15
 * @author Jorge Machado
16
 * @date 2/Mar/2008
17
 * @time 19:34:49
18
 * @see pt.estgp.estgweb.domain.views
19
 */
146 jmachado 20
public class UserView extends DomainObjectView implements IOwned
113 fvelez 21
{
146 jmachado 22
 
219 jmachado 23
    private static final 1.5.0/docs/api/java/util/logging/Logger.html">Logger logger = 1.5.0/docs/api/java/util/logging/Logger.html">Logger.getLogger(UserView.class);
146 jmachado 24
 
25
 
113 fvelez 26
    private long id;
206 jmachado 27
    private int code;
113 fvelez 28
    private 1.5.0/docs/api/java/lang/String.html">String name;
132 fvelez 29
    private List<String> userRoles;
381 jmachado 30
    private 1.5.0/docs/api/java/lang/String.html">String mainArea;
113 fvelez 31
    private 1.5.0/docs/api/java/lang/String.html">String address;
32
    private 1.5.0/docs/api/java/lang/String.html">String zip;
33
    private 1.5.0/docs/api/java/lang/String.html">String country;
381 jmachado 34
    private 1.5.0/docs/api/java/lang/String.html">String office;
35
    private 1.5.0/docs/api/java/lang/String.html">String ext;
113 fvelez 36
    private 1.5.0/docs/api/java/lang/String.html">String email;
132 fvelez 37
    private 1.5.0/docs/api/java/lang/String.html">String outEmail;
113 fvelez 38
    private 1.5.0/docs/api/java/lang/String.html">String phonenumber;
132 fvelez 39
    private 1.5.0/docs/api/java/lang/String.html">String bi;
40
    private 5+0%2Fdocs%2Fapi+Date">Date birthDate;
41
    private 1.5.0/docs/api/java/lang/String.html">String username;
146 jmachado 42
    private User user;
156 jmachado 43
    private 1.5.0/docs/api/java/lang/String.html">String pop3server;
215 jmachado 44
    private 1.5.0/docs/api/java/lang/String.html">String pop3username;
45
    private 1.5.0/docs/api/java/lang/String.html">String pop3password;
156 jmachado 46
    private 1.5.0/docs/api/java/lang/String.html">String pop3passwordAgain;
215 jmachado 47
    private 1.5.0/docs/api/java/lang/String.html">String skype;
48
    private 1.5.0/docs/api/java/lang/String.html">String gmail;
49
    private 1.5.0/docs/api/java/lang/String.html">String msn;
175 jmachado 50
    private 1.5.0/docs/api/java/lang/String.html">String password;
51
    private 1.5.0/docs/api/java/lang/String.html">String passwordAgain;
52
    private boolean passwordLocal = false;
113 fvelez 53
 
215 jmachado 54
    private 1.5.0/docs/api/java/lang/String.html">String scholarDegree;
55
    private 1.5.0/docs/api/java/lang/String.html">String academicDegree;
56
 
428 jmachado 57
    //This field should be set true when a user View is representing a deleted user
58
    private boolean deleted = false;
59
 
806 jmachado 60
 
61
    private boolean autoBlockMode;
62
    private boolean autoBlock;
63
    private boolean manualBlock;
64
 
215 jmachado 65
    private List<RecordView> creatorRecords;
66
    private List<RecordView> contributorRecords;
67
 
68
    private List<CourseView> courses;
69
    private List<CourseUnitView> courseUnits;
219 jmachado 70
    private List<CourseUnitGradeView> grades;
215 jmachado 71
 
821 jmachado 72
    private List<CourseUnitView> responsableCourseUnits;
73
 
1054 jmachado 74
    private boolean propinasEmDia = false;
75
 
1315 jmachado 76
    private CourseUnitTurmaView studentCourseUnitTurmaView = null;
77
 
78
    public void setStudentCourseUnitTurmaView(CourseUnitTurmaView studentCourseUnitTurmaView) {
79
        this.studentCourseUnitTurmaView = studentCourseUnitTurmaView;
80
    }
81
 
82
    public 1.5.0/docs/api/java/lang/String.html">String getStudentTurma()
83
    {
84
        if(studentCourseUnitTurmaView == null)
85
            return "";
86
        else
87
            return studentCourseUnitTurmaView.getTurma();
88
    }
89
 
113 fvelez 90
    public UserView()
91
    {}
92
 
93
    public UserView(User user)
94
    {
95
        super(user);
428 jmachado 96
        if(user == null)
97
        {
98
            this.deleted = true;
99
            return;
100
        }
146 jmachado 101
        this.user = user;
113 fvelez 102
        this.id = user.getId();
103
        this.name=user.getName();
104
        this.address=user.getAddress();
105
        this.zip = user.getZip();
106
        this.country=user.getCountry();
107
        this.email=user.getEmail();
108
        this.phonenumber=user.getPhonenumber();
132 fvelez 109
        this.userRoles = RoleManager.getRolesFromSerial(user.getRoles());
110
        this.outEmail=user.getOutEmail();
111
        this.bi=user.getBi();
112
        this.birthDate=user.getBirthDate();
113
        this.username=user.getUsername();
175 jmachado 114
        if(user.getPassword() != null && user.getPassword().length() > 0)
115
            passwordLocal = true;
156 jmachado 116
        this.pop3server = user.getPop3server();
117
        this.pop3username = user.getPop3username();
118
        this.skype=user.getSkype();
119
        this.gmail=user.getGmail();
120
        this.msn=user.getMsn();
215 jmachado 121
        this.scholarDegree = user.getScholarDegree();
381 jmachado 122
        this.office = user.getOffice();
123
        this.ext = user.getExt();
124
 
806 jmachado 125
        this.autoBlockMode = user.isAutoBlockMode();
126
        this.autoBlock = user.isAutoBlock();
127
        this.manualBlock = user.isManualBlock();
128
 
206 jmachado 129
        if(user instanceof Teacher)
130
        {
381 jmachado 131
            mainArea = ((Teacher)user).getMainArea();
206 jmachado 132
            code = ((Teacher)user).getSigesCode();
215 jmachado 133
            this.academicDegree = ((Teacher)user).getAcademicDegree();
206 jmachado 134
        }
135
        else if(user instanceof Student)
136
        {
381 jmachado 137
            mainArea = ((Student)user).getMainArea();
206 jmachado 138
            code = ((Student)user).getSigesCode();
1054 jmachado 139
            propinasEmDia = ((Student)user).isPropinasEmDia();
206 jmachado 140
        }
113 fvelez 141
    }
142
 
821 jmachado 143
    public List<CourseUnitView> getResponsableCourseUnits() {
144
        return responsableCourseUnits;
145
    }
146
 
147
    public void setResponsableCourseUnits(List<CourseUnitView> responsableCourseUnits) {
148
        this.responsableCourseUnits = responsableCourseUnits;
149
    }
150
 
806 jmachado 151
    public boolean isAutoBlockMode() {
152
        return autoBlockMode;
153
    }
215 jmachado 154
 
806 jmachado 155
    public void setAutoBlockMode(boolean autoBlockMode) {
156
        this.autoBlockMode = autoBlockMode;
157
    }
158
 
159
    public boolean isAutoBlock() {
160
        return autoBlock;
161
    }
162
 
163
    public void setAutoBlock(boolean autoBlock) {
164
        this.autoBlock = autoBlock;
165
    }
166
 
167
    public boolean isManualBlock() {
168
        return manualBlock;
169
    }
170
 
171
    public void setManualBlock(boolean manualBlock) {
172
        this.manualBlock = manualBlock;
173
    }
174
 
132 fvelez 175
    public void persistViewInObjectAdmin(User user)
113 fvelez 176
    {
177
        user.setName(name);
178
        user.setAddress(address);
179
        user.setZip(zip);
180
        user.setCountry(country);
181
        user.setEmail(email);
182
        user.setPhonenumber(phonenumber);
132 fvelez 183
        user.setRoles(RoleManager.getSerialRoles(userRoles));
184
        user.setOutEmail(outEmail);
185
        user.setBi(bi);
186
        user.setBirthDate(birthDate);
187
        user.setUsername(username);
156 jmachado 188
        user.setPop3server(pop3server);
189
        user.setPop3username(pop3username);
190
        if(pop3password != null && pop3password.length()> 0)
191
            user.setPop3password(DesUtils.getInstance().encrypt(pop3password));
192
        user.setSkype(skype);
193
        user.setGmail(gmail);
194
        user.setMsn(msn);
215 jmachado 195
        user.setScholarDegree(scholarDegree);
381 jmachado 196
        user.setOffice(office);
197
        user.setExt(ext);
806 jmachado 198
        user.setAutoBlockMode(autoBlockMode);
199
        user.setAutoBlock(autoBlock);
200
        user.setManualBlock(manualBlock);
381 jmachado 201
 
175 jmachado 202
        if(password != null && password.length() > 0)
203
        {
204
            user.setPassword(BytesUtils.getDigestMD5Hex(password));
205
        }
206 jmachado 206
        if(user instanceof Teacher)
207
        {
381 jmachado 208
            ((Teacher)user).setMainArea(mainArea);
206 jmachado 209
            ((Teacher)user).setSigesCode(code);
215 jmachado 210
            ((Teacher)user).setAcademicDegree(academicDegree);
206 jmachado 211
        }
212
        else if(user instanceof Student)
213
        {
381 jmachado 214
            ((Student)user).setMainArea(mainArea);
206 jmachado 215
            ((Student)user).setSigesCode(code);
216
        }
113 fvelez 217
    }
218
 
381 jmachado 219
    public 1.5.0/docs/api/java/lang/String.html">String getMainArea()
220
    {
221
        return mainArea;
222
    }
223
 
224
    public void setMainArea(1.5.0/docs/api/java/lang/String.html">String mainArea)
225
    {
226
        this.mainArea = mainArea;
227
    }
228
 
215 jmachado 229
    public 1.5.0/docs/api/java/lang/String.html">String getScholarDegree()
230
    {
231
        return scholarDegree;
232
    }
233
 
234
    public void setScholarDegree(1.5.0/docs/api/java/lang/String.html">String scholarDegree)
235
    {
236
        this.scholarDegree = scholarDegree;
237
    }
238
 
239
    public 1.5.0/docs/api/java/lang/String.html">String getAcademicDegree()
240
    {
241
        return academicDegree;
242
    }
243
 
219 jmachado 244
    public List<CourseUnitGradeView> getGrades()
245
    {
246
        return grades;
247
    }
248
 
249
    public void setGrades(List<CourseUnitGradeView> grades)
250
    {
251
        this.grades = grades;
252
    }
253
 
215 jmachado 254
    public void setAcademicDegree(1.5.0/docs/api/java/lang/String.html">String academicDegree)
255
    {
256
        this.academicDegree = academicDegree;
257
    }
258
 
259
    public List<RecordView> getCreatorRecords()
260
    {
261
        return creatorRecords;
262
    }
263
 
264
    HashMap<RecordEnum,List<RecordView>> recordCreatorMap = new HashMap<RecordEnum,List<RecordView>>();
265
 
266
    public List<RecordView> getCreatorRecords(RecordEnum type)
267
    {
268
        if(creatorRecords != null && creatorRecords.size() > 0)
269
        {
270
            List<RecordView> views = recordCreatorMap.get(type);
271
            if(views == null)
272
            {
273
                views = new ArrayList<RecordView>();
274
                for(RecordView recordView: creatorRecords)
275
                {
276
                    if(recordView.getTypeEnum() == type)
277
                        views.add(recordView);
278
                }
279
                recordCreatorMap.put(type,views);
280
            }
281
            return views;
282
        }
283
        return null;
284
    }
285
 
286
    HashMap<RecordEnum,List<RecordView>> recordContributorMap = new HashMap<RecordEnum,List<RecordView>>();
287
 
288
    public List<RecordView> getContributorRecords(RecordEnum type)
289
    {
290
        if(contributorRecords != null && contributorRecords.size() > 0)
291
        {
292
            List<RecordView> views = recordContributorMap.get(type);
293
            if(views == null)
294
            {
295
                views = new ArrayList<RecordView>();
296
                for(RecordView recordView: contributorRecords)
297
                {
298
                    if(recordView.getTypeEnum() == type)
299
                        views.add(recordView);
300
                }
301
                recordContributorMap.put(type,views);
302
            }
303
            return views;
304
        }
305
        return null;
306
    }
307
 
308
    public void setCreatorRecords(List<RecordView> creatorRecords)
309
    {
310
        this.creatorRecords = creatorRecords;
311
    }
312
 
313
    public List<RecordView> getContributorRecords()
314
    {
315
        return contributorRecords;
316
    }
317
 
318
    public void setContributorRecords(List<RecordView> contributorRecords)
319
    {
320
        this.contributorRecords = contributorRecords;
321
    }
322
 
132 fvelez 323
    public void persistViewInObjectUser(User user)
324
    {
198 jmachado 325
        user.setName(name);
485 jmachado 326
        user.setAddress(address);
327
        user.setZip(zip);
328
        user.setCountry(country);
368 jmachado 329
        user.setEmail(email);
485 jmachado 330
        user.setPhonenumber(phonenumber);
132 fvelez 331
        user.setOutEmail(outEmail);
485 jmachado 332
 
156 jmachado 333
        user.setPop3server(pop3server);
334
        user.setPop3username(pop3username);
335
        if(pop3password != null && pop3password.length()> 0)
336
            user.setPop3password(DesUtils.getInstance().encrypt(pop3password));
337
        user.setSkype(skype);
338
        user.setGmail(gmail);
339
        user.setMsn(msn);
485 jmachado 340
        user.setOffice(office);
341
        user.setExt(ext);
342
 
343
 
344
 
345
        user.setScholarDegree(scholarDegree);
175 jmachado 346
        if(user.getPassword() != null && user.getPassword().length() > 0 && password != null && password.length() > 0)
347
        {
348
            user.setPassword(BytesUtils.getDigestMD5Hex(password));
349
        }
220 jmachado 350
        if(user instanceof Teacher)
351
        {
352
            ((Teacher)user).setAcademicDegree(academicDegree);
353
        }
132 fvelez 354
    }
355
 
113 fvelez 356
    public 1.5.0/docs/api/java/lang/Class.html">Class getReferenceClass()
357
    {
203 jmachado 358
        return UserImpl.class;
113 fvelez 359
    }
360
 
361
    public 1.5.0/docs/api/java/io/Serializable.html">Serializable getSerializable()
362
    {
363
        return id;
364
    }
365
 
175 jmachado 366
 
206 jmachado 367
    public int getCode()
368
    {
369
        return code;
370
    }
371
 
372
    public void setCode(int code)
373
    {
374
        this.code = code;
375
    }
376
 
175 jmachado 377
    public boolean isPasswordLocal()
378
    {
379
        return passwordLocal;
380
    }
381
 
382
    public void setPasswordLocal(boolean passwordLocal)
383
    {
384
        this.passwordLocal = passwordLocal;
385
    }
386
 
387
 
388
    public 1.5.0/docs/api/java/lang/String.html">String getPasswordAgain()
389
    {
390
        return passwordAgain;
391
    }
392
 
393
    public void setPasswordAgain(1.5.0/docs/api/java/lang/String.html">String passwordAgain)
394
    {
395
        this.passwordAgain = passwordAgain;
396
    }
397
 
398
    public 1.5.0/docs/api/java/lang/String.html">String getPassword()
399
    {
400
        return password;
401
    }
402
 
403
    public void setPassword(1.5.0/docs/api/java/lang/String.html">String password)
404
    {
405
        this.password = password;
406
    }
407
 
113 fvelez 408
    public long getId() {
409
        return id;
410
    }
411
 
412
    public void setId(long id) {
413
        this.id = id;
414
    }
415
 
416
    public 1.5.0/docs/api/java/lang/String.html">String getName() {
428 jmachado 417
        if(deleted)
418
        {
419
            return "(Apagado do Sistema) "  + name;
420
        }
421
        else
422
            return name;
113 fvelez 423
    }
424
 
425
    public void setName(1.5.0/docs/api/java/lang/String.html">String name) {
426
        this.name = name;
427
    }
428
 
132 fvelez 429
    public List<String> getUserRoles() {
113 fvelez 430
        return userRoles;
431
    }
432
 
132 fvelez 433
    public void setUserRoles(List<String> userRoles) {
113 fvelez 434
        this.userRoles = userRoles;
435
    }
436
 
437
    public 1.5.0/docs/api/java/lang/String.html">String getAddress() {
438
        return address;
439
    }
440
 
441
    public void setAddress(1.5.0/docs/api/java/lang/String.html">String address) {
442
        this.address = address;
443
    }
444
 
445
    public 1.5.0/docs/api/java/lang/String.html">String getZip() {
446
        return zip;
447
    }
448
 
449
    public void setZip(1.5.0/docs/api/java/lang/String.html">String zip) {
450
        this.zip = zip;
451
    }
452
 
453
    public 1.5.0/docs/api/java/lang/String.html">String getCountry() {
454
        return country;
455
    }
456
 
457
    public void setCountry(1.5.0/docs/api/java/lang/String.html">String country) {
458
        this.country = country;
459
    }
460
 
461
    public 1.5.0/docs/api/java/lang/String.html">String getEmail() {
462
        return email;
463
    }
464
 
298 jmachado 465
    public 1.5.0/docs/api/java/lang/String.html">String getSafeEmail()
466
    {
565 jmachado 467
 
1316 jmachado 468
        1.5.0/docs/api/java/lang/String.html">String email = getEmail();
469
        /*if(pop3username != null && pop3username.trim().length() > 0)
565 jmachado 470
            email = pop3username + "@" + Globals.EMAIL_LOCAL_SUFFIX;
471
        else
1316 jmachado 472
            email = username + "@" + Globals.EMAIL_LOCAL_SUFFIX*/;
565 jmachado 473
 
1316 jmachado 474
        if(email != null && email.indexOf("@") > 0)
298 jmachado 475
        {
311 jmachado 476
            1.5.0/docs/api/java/lang/String.html">String safe = email.replace("@", " [ AT ] ").replace("."," [ DOT ] ");
298 jmachado 477
            1.5.0/docs/api/java/lang/StringBuilder.html">StringBuilder result = new 1.5.0/docs/api/java/lang/StringBuilder.html">StringBuilder();
478
            result.append("<script type=\"text/javascript\" language=\"JavaScript\">\n");
479
            for(int i = 0;i< safe.length();i++)
480
            {
481
                char c = safe.charAt(i);
482
                if(c != '\'')
483
                    result.append("document.write('").append(c).append("');\n");
484
            }
485
            result.append("</script>");
486
            return result.toString();
487
        }
488
        return email;
489
    }
490
 
113 fvelez 491
    public void setEmail(1.5.0/docs/api/java/lang/String.html">String email) {
492
        this.email = email;
493
    }
494
 
495
    public 1.5.0/docs/api/java/lang/String.html">String getPhonenumber() {
496
        return phonenumber;
497
    }
498
 
499
    public void setPhonenumber(1.5.0/docs/api/java/lang/String.html">String phonenumber) {
500
        this.phonenumber = phonenumber;
501
    }
132 fvelez 502
 
503
    public 1.5.0/docs/api/java/lang/String.html">String getOutEmail() {
504
        return outEmail;
505
    }
506
 
507
    public void setOutEmail(1.5.0/docs/api/java/lang/String.html">String outEmail) {
508
        this.outEmail = outEmail;
509
    }
510
 
511
    public 1.5.0/docs/api/java/lang/String.html">String getBi() {
512
        return bi;
513
    }
514
 
515
    public void setBi(1.5.0/docs/api/java/lang/String.html">String bi) {
516
        this.bi = bi;
517
    }
518
 
519
    public 5+0%2Fdocs%2Fapi+Date">Date getBirthDate() {
520
        return birthDate;
521
    }
522
 
523
    public void setBirthDate(5+0%2Fdocs%2Fapi+Date">Date birthDate) {
524
        this.birthDate = birthDate;
146 jmachado 525
    }
132 fvelez 526
 
527
    public 1.5.0/docs/api/java/lang/String.html">String getUsername() {
528
        return username;
529
    }
530
 
531
    public void setUsername(1.5.0/docs/api/java/lang/String.html">String username) {
532
        this.username = username;
533
    }
146 jmachado 534
 
156 jmachado 535
    public User getUser()
536
    {
537
        return user;
538
    }
539
 
540
    public void setUser(User user)
541
    {
542
        this.user = user;
543
    }
544
 
545
    public 1.5.0/docs/api/java/lang/String.html">String getPop3server()
546
    {
547
        return pop3server;
548
    }
549
 
550
    public void setPop3server(1.5.0/docs/api/java/lang/String.html">String pop3server)
551
    {
552
        this.pop3server = pop3server;
553
    }
554
 
555
    public 1.5.0/docs/api/java/lang/String.html">String getPop3username()
556
    {
557
        return pop3username;
558
    }
559
 
560
    public void setPop3username(1.5.0/docs/api/java/lang/String.html">String pop3username)
561
    {
562
        this.pop3username = pop3username;
563
    }
564
 
565
    public 1.5.0/docs/api/java/lang/String.html">String getPop3passwordAgain()
566
    {
567
        return pop3passwordAgain;
568
    }
569
 
570
    public void setPop3passwordAgain(1.5.0/docs/api/java/lang/String.html">String pop3passwordAgain)
571
    {
572
        this.pop3passwordAgain = pop3passwordAgain;
573
    }
574
 
575
    public 1.5.0/docs/api/java/lang/String.html">String getPop3password()
576
    {
577
        return pop3password;
578
    }
579
 
580
    public void setPop3password(1.5.0/docs/api/java/lang/String.html">String pop3password)
581
    {
582
        this.pop3password = pop3password;
583
    }
584
 
585
    public 1.5.0/docs/api/java/lang/String.html">String getSkype()
586
    {
587
        return skype;
588
    }
589
 
590
    public void setSkype(1.5.0/docs/api/java/lang/String.html">String skype)
591
    {
592
        this.skype = skype;
593
    }
594
 
595
    public 1.5.0/docs/api/java/lang/String.html">String getGmail()
596
    {
597
        return gmail;
598
    }
599
 
600
    public void setGmail(1.5.0/docs/api/java/lang/String.html">String gmail)
601
    {
602
        this.gmail = gmail;
603
    }
604
 
605
    public 1.5.0/docs/api/java/lang/String.html">String getMsn()
606
    {
607
        return msn;
608
    }
609
 
610
    public void setMsn(1.5.0/docs/api/java/lang/String.html">String msn)
611
    {
612
        this.msn = msn;
613
    }
614
 
146 jmachado 615
    public boolean isOwnedBy(GenericUser u)
616
    {
208 jmachado 617
        return isOwnedBy(u,false);
618
    }
619
 
620
    public boolean isOwnedBy(GenericUser u, boolean transaction)
621
    {
146 jmachado 622
        return u.getId() == id;
623
    }
624
 
625
    public GenericUser getOwner()
626
    {
627
        return user;
628
    }
629
 
630
    public List<String> getOwnerRoles()
631
    {
632
        return getUserRoles();
633
    }
634
 
635
    /**
636
     * Not implemented here
637
     * @return null
638
     */
639
    public 1.5.0/docs/api/java/lang/String.html">String getChoosedOwnerRole()
640
    {
641
        logger.warn("Invoke not implemented method in class:" + getClass().getName());
642
        return null;
643
    }
215 jmachado 644
 
645
 
646
    public static List<UserView> getViews(List<User> users)
647
    {
648
        if(users == null)
649
            return null;
650
        List<UserView> views = new ArrayList<UserView>();
651
        for(User u: users)
652
        {
653
            views.add(new UserView(u));
654
        }
655
        return views;
656
    }
749 jmachado 657
     public static List<UserView> getTeacherViews(List<Teacher> users)
658
    {
659
        if(users == null)
660
            return null;
661
        List<UserView> views = new ArrayList<UserView>();
662
        for(User u: users)
663
        {
664
            views.add(new UserView(u));
665
        }
666
        return views;
667
    }
215 jmachado 668
 
749 jmachado 669
 
670
 
215 jmachado 671
    public static Set<User> loadUsers(List<UserView> views)
672
    {
673
        if(views != null)
674
        {
675
            Set<User> users = new HashSet<User>();
676
            for(UserView view: views)
677
            {
678
                User u = DaoFactory.getUserDaoImpl().load(view.getId());
679
                users.add(u);
680
            }
681
            return users;
682
        }
683
        return null;
684
    }
685
 
686
    public List<CourseView> getCourses()
687
    {
688
        return courses;
689
    }
690
 
691
    public List<CourseUnitView> getCourseUnits()
692
    {
693
        return courseUnits;
694
    }
695
 
696
    public void setCourses(List<CourseView> courses)
697
    {
698
        this.courses = courses;
699
    }
700
 
701
    public void setCourseUnits(List<CourseUnitView> courseUnits)
702
    {
703
        this.courseUnits = courseUnits;
704
    }
705
 
381 jmachado 706
    public 1.5.0/docs/api/java/lang/String.html">String getOffice()
707
    {
708
        return office;
709
    }
710
 
711
    public void setOffice(1.5.0/docs/api/java/lang/String.html">String office)
712
    {
713
        this.office = office;
714
    }
715
 
716
    public 1.5.0/docs/api/java/lang/String.html">String getExt()
717
    {
718
        return ext;
719
    }
720
 
721
    public void setExt(1.5.0/docs/api/java/lang/String.html">String ext)
722
    {
723
        this.ext = ext;
724
    }
725
 
428 jmachado 726
    public boolean isDeleted()
727
    {
728
        return deleted;
729
    }
730
 
731
    public void setDeleted(boolean deleted)
732
    {
733
        this.deleted = deleted;
734
    }
735
 
1054 jmachado 736
    public boolean isPropinasEmDia() {
737
        return propinasEmDia;
738
    }
739
 
740
    public void setPropinasEmDia(boolean propinasEmDia) {
741
        this.propinasEmDia = propinasEmDia;
742
    }
743
 
744
    //    public List<Course> getCourses()
215 jmachado 745
//    {
746
//        if(courses == null)
747
//        {
748
//            if(user instanceof Teacher)
749
//            {
750
//                courses = ((TeacherImpl)user).getTeachedCoursesView();
751
//            }
752
//            else if(user instanceof Student)
753
//            {
754
//                courses = ((StudentImpl)user).getSubscribedCoursesView();
755
//            }
756
//        }
757
//        return courses;
758
//    }
759
//
760
//    public List<CourseUnit> getCourseUnits()
761
//    {
762
//        if(courseUnits == null)
763
//        {
764
//            if(user instanceof Teacher)
765
//            {
766
//                courseUnits = ((TeacherImpl)user).getTeachedUnitsView();
767
//
768
//            }
769
//            else if(user instanceof Student)
770
//            {
771
//                courseUnits = ((StudentImpl)user).getSubscribedUnitsView();
772
//            }
773
//        }
774
//        return courseUnits;
775
//    }
113 fvelez 776
}