Mercurial > hg > AnnotationManagerN4J
annotate src/main/java/de/mpiwg/itgroup/annotations/Person.java @ 86:e3f0613b2f2d
renamed getFullname to make it configurable.
fixed Restlet at 2.2.3.
author | casties |
---|---|
date | Mon, 02 Feb 2015 11:32:53 +0100 |
parents | 2b1e6df5e21a |
children | 2beafb8e19e4 |
rev | line source |
---|---|
10 | 1 /** |
2 * | |
3 */ | |
4 package de.mpiwg.itgroup.annotations; | |
5 | |
70 | 6 /* |
7 * #%L | |
8 * AnnotationManager | |
9 * %% | |
10 * Copyright (C) 2012 - 2014 MPIWG Berlin | |
11 * %% | |
12 * This program is free software: you can redistribute it and/or modify | |
13 * it under the terms of the GNU Lesser General Public License as | |
14 * published by the Free Software Foundation, either version 3 of the | |
15 * License, or (at your option) any later version. | |
16 * | |
17 * This program is distributed in the hope that it will be useful, | |
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 * GNU General Lesser Public License for more details. | |
21 * | |
22 * You should have received a copy of the GNU General Lesser Public | |
23 * License along with this program. If not, see | |
24 * <http://www.gnu.org/licenses/lgpl-3.0.html>. | |
25 * #L% | |
26 */ | |
27 | |
32
0731c4549065
UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
15
diff
changeset
|
28 import de.mpiwg.itgroup.annotations.restlet.BaseRestlet; |
0731c4549065
UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
15
diff
changeset
|
29 |
10 | 30 /** |
31 * @author casties | |
32 * | |
33 */ | |
34 public class Person extends Actor { | |
35 | |
12 | 36 public Person() { |
37 } | |
38 | |
39 public Person(String id) { | |
40 super(); | |
41 this.id = id; | |
42 } | |
43 | |
10 | 44 public Person(String uri, String name) { |
45 super(); | |
46 this.uri = uri; | |
47 this.name = name; | |
48 } | |
49 | |
15 | 50 public Person(String id, String uri, String name) { |
51 super(); | |
52 this.id = id; | |
53 this.uri = uri; | |
54 this.name = name; | |
55 } | |
56 | |
10 | 57 @Override |
58 public boolean isGroup() { | |
59 return false; | |
60 } | |
61 | |
62 public String getIdString() { | |
63 if (id == null) { | |
64 id = getIdFromUri(uri, false); | |
65 } | |
66 return id; | |
67 } | |
68 | |
15 | 69 /** |
70 * Returns a Person with this id or null. | |
71 * | |
72 * @param id | |
73 * @return | |
74 */ | |
75 public static Person createPersonWithId(String id) { | |
76 if (id != null) { | |
77 return new Person(id); | |
78 } | |
79 return null; | |
80 } | |
32
0731c4549065
UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
15
diff
changeset
|
81 |
0731c4549065
UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
15
diff
changeset
|
82 /** |
0731c4549065
UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
15
diff
changeset
|
83 * Sets the name from the id using getFullNameFromLdap of the Application. |
0731c4549065
UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
15
diff
changeset
|
84 * |
0731c4549065
UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
15
diff
changeset
|
85 * @param application |
0731c4549065
UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
15
diff
changeset
|
86 * @return |
0731c4549065
UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
15
diff
changeset
|
87 */ |
0731c4549065
UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
15
diff
changeset
|
88 public String updateName(BaseRestlet application) { |
0731c4549065
UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
15
diff
changeset
|
89 if (id != null) { |
86 | 90 name = application.getFullNameForId(id); |
32
0731c4549065
UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
15
diff
changeset
|
91 } |
0731c4549065
UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
15
diff
changeset
|
92 return name; |
0731c4549065
UI for editing groups and persons works now. (still no authorisation!)
casties
parents:
15
diff
changeset
|
93 } |
69 | 94 |
95 /* (non-Javadoc) | |
96 * @see java.lang.Object#toString() | |
97 */ | |
98 @Override | |
99 public String toString() { | |
100 String s = "PERSON["+id+"]"; | |
101 if (name != null) { | |
102 s += ": "+name; | |
103 } | |
104 return s; | |
105 } | |
10 | 106 } |