1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package fr.paris.lutece.plugins.crm.business.demand.category;
35
36 import java.util.List;
37 import java.util.Locale;
38
39 import javax.servlet.http.HttpServletRequest;
40
41 import fr.paris.lutece.plugins.crm.business.demand.DemandType;
42 import fr.paris.lutece.plugins.crm.util.CrmUtils;
43 import fr.paris.lutece.plugins.crm.util.constants.CRMConstants;
44 import fr.paris.lutece.util.xml.XmlUtil;
45
46
47
48
49
50
51 public class Category
52 {
53
54 private int _nIdCategory;
55 private String _strName;
56 private String _strDescription;
57 private String _strCode;
58
59
60
61
62
63
64 public int getIdCategory( )
65 {
66 return _nIdCategory;
67 }
68
69
70
71
72
73
74
75 public void setIdCategory( int nIdCategory )
76 {
77 _nIdCategory = nIdCategory;
78 }
79
80
81
82
83
84
85 public String getName( )
86 {
87 return _strName;
88 }
89
90
91
92
93
94
95
96 public void setName( String strName )
97 {
98 _strName = strName;
99 }
100
101
102
103
104
105
106 public String getDescription( )
107 {
108 return _strDescription;
109 }
110
111
112
113
114
115
116
117 public void setDescription( String strDescription )
118 {
119 _strDescription = strDescription;
120 }
121
122
123
124
125
126 public String getCode( )
127 {
128 return _strCode;
129 }
130
131
132
133
134
135 public void setCode( String strCode )
136 {
137 _strCode = strCode;
138 }
139
140
141
142
143
144
145
146
147
148
149
150
151 public String getXml( HttpServletRequest request, Locale locale, List<DemandType> listDemandType )
152 {
153 StringBuffer strXml = new StringBuffer( );
154 XmlUtil.beginElement( strXml, CRMConstants.TAG_CATEGORY );
155 XmlUtil.addElement( strXml, CRMConstants.TAG_CATEGORY_ID, _nIdCategory );
156 CrmUtils.addElementHtml( strXml, CRMConstants.TAG_CATEGORY_NAME, _strName );
157 CrmUtils.addElementHtml( strXml, CRMConstants.TAG_CATEGORY_DESCRIPTION, _strDescription );
158 if ( listDemandType != null )
159 {
160 XmlUtil.beginElement( strXml, CRMConstants.TAG_DEMAND_TYPE_LIST );
161 for ( DemandType demandType : listDemandType )
162 {
163 strXml.append( demandType.getXml( request, locale ) );
164
165 }
166 XmlUtil.endElement( strXml, CRMConstants.TAG_DEMAND_TYPE_LIST );
167 }
168
169 XmlUtil.endElement( strXml, CRMConstants.TAG_CATEGORY );
170 return strXml.toString( );
171 }
172
173
174
175
176
177
178
179
180
181
182 public String getXml( HttpServletRequest request, Locale locale )
183 {
184 return getXml( request, locale, null );
185 }
186 }