source: AnnotationManagerN4J/src/main/java/de/mpiwg/itgroup/annotations/Person.java @ 70:2b1e6df5e21a

Last change on this file since 70:2b1e6df5e21a was 70:2b1e6df5e21a, checked in by casties, 10 years ago

added lgpl_v3 license information.

File size: 2.3 KB
Line 
1/**
2 *
3 */
4package de.mpiwg.itgroup.annotations;
5
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
28import de.mpiwg.itgroup.annotations.restlet.BaseRestlet;
29
30/**
31 * @author casties
32 *
33 */
34public class Person extends Actor {
35
36    public Person() {
37    }
38
39    public Person(String id) {
40        super();
41        this.id = id;
42    }
43
44    public Person(String uri, String name) {
45        super();
46        this.uri = uri;
47        this.name = name;
48    }
49
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
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
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    }
81
82    /**
83     * Sets the name from the id using getFullNameFromLdap of the Application.
84     * 
85     * @param application
86     * @return
87     */
88    public String updateName(BaseRestlet application) {
89        if (id != null) {
90            name = application.getFullNameFromLdap(id);
91        }
92        return name;
93    }
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    }
106}
Note: See TracBrowser for help on using the repository browser.