Line | |
---|
1 | /** |
---|
2 | * |
---|
3 | */ |
---|
4 | package de.mpiwg.itgroup.annotations; |
---|
5 | |
---|
6 | import de.mpiwg.itgroup.annotations.restlet.BaseRestlet; |
---|
7 | |
---|
8 | /** |
---|
9 | * @author casties |
---|
10 | * |
---|
11 | */ |
---|
12 | public class Person extends Actor { |
---|
13 | |
---|
14 | public Person() { |
---|
15 | } |
---|
16 | |
---|
17 | public Person(String id) { |
---|
18 | super(); |
---|
19 | this.id = id; |
---|
20 | } |
---|
21 | |
---|
22 | public Person(String uri, String name) { |
---|
23 | super(); |
---|
24 | this.uri = uri; |
---|
25 | this.name = name; |
---|
26 | } |
---|
27 | |
---|
28 | public Person(String id, String uri, String name) { |
---|
29 | super(); |
---|
30 | this.id = id; |
---|
31 | this.uri = uri; |
---|
32 | this.name = name; |
---|
33 | } |
---|
34 | |
---|
35 | @Override |
---|
36 | public boolean isGroup() { |
---|
37 | return false; |
---|
38 | } |
---|
39 | |
---|
40 | public String getIdString() { |
---|
41 | if (id == null) { |
---|
42 | id = getIdFromUri(uri, false); |
---|
43 | } |
---|
44 | return id; |
---|
45 | } |
---|
46 | |
---|
47 | /** |
---|
48 | * Returns a Person with this id or null. |
---|
49 | * |
---|
50 | * @param id |
---|
51 | * @return |
---|
52 | */ |
---|
53 | public static Person createPersonWithId(String id) { |
---|
54 | if (id != null) { |
---|
55 | return new Person(id); |
---|
56 | } |
---|
57 | return null; |
---|
58 | } |
---|
59 | |
---|
60 | /** |
---|
61 | * Sets the name from the id using getFullNameFromLdap of the Application. |
---|
62 | * |
---|
63 | * @param application |
---|
64 | * @return |
---|
65 | */ |
---|
66 | public String updateName(BaseRestlet application) { |
---|
67 | if (id != null) { |
---|
68 | name = application.getFullNameFromLdap(id); |
---|
69 | } |
---|
70 | return name; |
---|
71 | } |
---|
72 | |
---|
73 | /* (non-Javadoc) |
---|
74 | * @see java.lang.Object#toString() |
---|
75 | */ |
---|
76 | @Override |
---|
77 | public String toString() { |
---|
78 | String s = "PERSON["+id+"]"; |
---|
79 | if (name != null) { |
---|
80 | s += ": "+name; |
---|
81 | } |
---|
82 | return s; |
---|
83 | } |
---|
84 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.