author | Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
Sun, 08 Nov 2009 09:54:32 +0100 | |
changeset 146 | 0b889d9e4ee1 |
child 264 | d60370059c3c |
permissions | -rw-r--r-- |
jaroslav@146 | 1 |
/* |
jaroslav@146 | 2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
jaroslav@146 | 3 |
* |
jaroslav@146 | 4 |
* The contents of this file are subject to the terms of either the GNU |
jaroslav@146 | 5 |
* General Public License Version 2 only ("GPL") or the Common |
jaroslav@146 | 6 |
* Development and Distribution License("CDDL") (collectively, the |
jaroslav@146 | 7 |
* "License"). You may not use this file except in compliance with the |
jaroslav@146 | 8 |
* License. You can obtain a copy of the License at |
jaroslav@146 | 9 |
* http://www.netbeans.org/cddl-gplv2.html |
jaroslav@146 | 10 |
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the |
jaroslav@146 | 11 |
* specific language governing permissions and limitations under the |
jaroslav@146 | 12 |
* License. When distributing the software, include this License Header |
jaroslav@146 | 13 |
* Notice in each file and include the License file at |
jaroslav@146 | 14 |
* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this |
jaroslav@146 | 15 |
* particular file as subject to the "Classpath" exception as provided |
jaroslav@146 | 16 |
* by Sun in the GPL Version 2 section of the License file that |
jaroslav@146 | 17 |
* accompanied this code. If applicable, add the following below the |
jaroslav@146 | 18 |
* License Header, with the fields enclosed by brackets [] replaced by |
jaroslav@146 | 19 |
* your own identifying information: |
jaroslav@146 | 20 |
* "Portions Copyrighted [year] [name of copyright owner]" |
jaroslav@146 | 21 |
* |
jaroslav@146 | 22 |
* Contributor(s): |
jaroslav@146 | 23 |
* |
jaroslav@146 | 24 |
* Portions Copyrighted 2009 Jaroslav Tulach |
jaroslav@146 | 25 |
*/ |
jaroslav@146 | 26 |
|
jaroslav@146 | 27 |
package cz.xelfi.quoridor.freemarkerdor; |
jaroslav@146 | 28 |
|
jaroslav@146 | 29 |
import java.util.List; |
jaroslav@146 | 30 |
import javax.xml.bind.annotation.XmlAccessType; |
jaroslav@146 | 31 |
import javax.xml.bind.annotation.XmlAccessorType; |
jaroslav@146 | 32 |
import javax.xml.bind.annotation.XmlAttribute; |
jaroslav@146 | 33 |
import javax.xml.bind.annotation.XmlElement; |
jaroslav@146 | 34 |
import javax.xml.bind.annotation.XmlRootElement; |
jaroslav@146 | 35 |
import javax.xml.bind.annotation.XmlValue; |
jaroslav@146 | 36 |
|
jaroslav@146 | 37 |
/** |
jaroslav@146 | 38 |
* |
jaroslav@146 | 39 |
* @author Jaroslav Tulach <jtulach@netbeans.org> |
jaroslav@146 | 40 |
*/ |
jaroslav@146 | 41 |
@XmlRootElement(name="user") |
jaroslav@146 | 42 |
@XmlAccessorType(XmlAccessType.NONE) |
jaroslav@146 | 43 |
public final class UserInfo extends Object { |
jaroslav@146 | 44 |
@XmlAttribute |
jaroslav@146 | 45 |
private String id; |
jaroslav@146 | 46 |
@XmlElement(name="property") |
jaroslav@146 | 47 |
private List<Property> properties; |
jaroslav@146 | 48 |
|
jaroslav@146 | 49 |
UserInfo() { |
jaroslav@146 | 50 |
} |
jaroslav@146 | 51 |
|
jaroslav@146 | 52 |
public UserInfo(String id) { |
jaroslav@146 | 53 |
this.id = id; |
jaroslav@146 | 54 |
} |
jaroslav@146 | 55 |
|
jaroslav@146 | 56 |
public String getProperty(String name) { |
jaroslav@146 | 57 |
if (properties == null) { |
jaroslav@146 | 58 |
return null; |
jaroslav@146 | 59 |
} |
jaroslav@146 | 60 |
for (Property p : properties) { |
jaroslav@146 | 61 |
if (p.name.equals(name)) { |
jaroslav@146 | 62 |
return p.value; |
jaroslav@146 | 63 |
} |
jaroslav@146 | 64 |
} |
jaroslav@146 | 65 |
return null; |
jaroslav@146 | 66 |
} |
jaroslav@146 | 67 |
|
jaroslav@146 | 68 |
public String getId() { |
jaroslav@146 | 69 |
return id; |
jaroslav@146 | 70 |
} |
jaroslav@146 | 71 |
|
jaroslav@146 | 72 |
public static final class Property { |
jaroslav@146 | 73 |
@XmlAttribute |
jaroslav@146 | 74 |
private String name; |
jaroslav@146 | 75 |
@XmlValue |
jaroslav@146 | 76 |
private String value; |
jaroslav@146 | 77 |
|
jaroslav@146 | 78 |
private Property() { |
jaroslav@146 | 79 |
} |
jaroslav@146 | 80 |
|
jaroslav@146 | 81 |
Property(String name, String value) { |
jaroslav@146 | 82 |
this.name = name; |
jaroslav@146 | 83 |
this.value = value; |
jaroslav@146 | 84 |
} |
jaroslav@146 | 85 |
} |
jaroslav@146 | 86 |
} |