1 | package fr.mael.jiwigo.om; |
---|
2 | |
---|
3 | import org.jdom.Element; |
---|
4 | |
---|
5 | import fr.mael.jiwigo.transverse.enumeration.TagEnum; |
---|
6 | |
---|
7 | /** |
---|
8 | Copyright (c) 2010, Mael |
---|
9 | All rights reserved. |
---|
10 | |
---|
11 | Redistribution and use in source and binary forms, with or without |
---|
12 | modification, are permitted provided that the following conditions are met: |
---|
13 | * Redistributions of source code must retain the above copyright |
---|
14 | notice, this list of conditions and the following disclaimer. |
---|
15 | * Redistributions in binary form must reproduce the above copyright |
---|
16 | notice, this list of conditions and the following disclaimer in the |
---|
17 | documentation and/or other materials provided with the distribution. |
---|
18 | * Neither the name of jiwigo nor the |
---|
19 | names of its contributors may be used to endorse or promote products |
---|
20 | derived from this software without specific prior written permission. |
---|
21 | |
---|
22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
---|
23 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
---|
24 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
---|
25 | DISCLAIMED. IN NO EVENT SHALL Mael BE LIABLE FOR ANY |
---|
26 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
---|
27 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
---|
28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
---|
29 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
---|
30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
---|
31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
32 | |
---|
33 | * @author mael |
---|
34 | * |
---|
35 | */ |
---|
36 | public class Tag { |
---|
37 | /** |
---|
38 | * Name of the tag |
---|
39 | */ |
---|
40 | private String nom; |
---|
41 | |
---|
42 | /** |
---|
43 | * Id of the tag |
---|
44 | */ |
---|
45 | private Integer identifiant; |
---|
46 | |
---|
47 | /** |
---|
48 | * Empty constructor |
---|
49 | */ |
---|
50 | public Tag() { |
---|
51 | } |
---|
52 | |
---|
53 | /** |
---|
54 | * @param element the element in the RPC response |
---|
55 | */ |
---|
56 | public Tag(Element element) { |
---|
57 | this.identifiant = Integer.valueOf(element.getAttributeValue(TagEnum.ID.getLabel())); |
---|
58 | this.nom = element.getAttributeValue(TagEnum.NAME.getLabel()); |
---|
59 | } |
---|
60 | |
---|
61 | /** |
---|
62 | * @param nom the name of the tag |
---|
63 | */ |
---|
64 | public Tag(String nom) { |
---|
65 | this.nom = nom; |
---|
66 | } |
---|
67 | |
---|
68 | /** |
---|
69 | * @return the nom |
---|
70 | */ |
---|
71 | public String getNom() { |
---|
72 | return nom; |
---|
73 | } |
---|
74 | |
---|
75 | /** |
---|
76 | * @param nom the nom to set |
---|
77 | */ |
---|
78 | public void setNom(String nom) { |
---|
79 | this.nom = nom; |
---|
80 | } |
---|
81 | |
---|
82 | /** |
---|
83 | * @return the id |
---|
84 | */ |
---|
85 | public Integer getId() { |
---|
86 | return identifiant; |
---|
87 | } |
---|
88 | |
---|
89 | /** |
---|
90 | * @param id the id to set |
---|
91 | */ |
---|
92 | public void setId(Integer id) { |
---|
93 | this.identifiant = id; |
---|
94 | } |
---|
95 | |
---|
96 | @Override |
---|
97 | public String toString() { |
---|
98 | // TODO Auto-generated method stub |
---|
99 | return nom; |
---|
100 | } |
---|
101 | } |
---|