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.menus.business;
35
36 import java.io.Serializable;
37 import java.util.ArrayList;
38 import java.util.List;
39
40 import javax.validation.constraints.NotEmpty;
41 import javax.validation.constraints.Pattern;
42 import javax.validation.constraints.Size;
43
44
45
46
47 public class CustomMenu implements Serializable
48 {
49 private static final long serialVersionUID = 2L;
50
51
52 private int _nId;
53 @NotEmpty( message = "#i18n{menus.validation.customMenu.name.notEmpty}" )
54 @Size( max = 100, message = "#i18n{menus.validation.customMenu.name.size}" )
55 private String _strName;
56 @Pattern( regexp = "^[a-zA-Z0-9_]*$", message = "#i18n{menus.validation.customMenu.bookmark.pattern}" )
57 @Pattern( regexp = "^(?!customMenu$|customMenuMainPage$|customMenuInternalPage$|customMenuSideBar$|page_tree_menu_main$|page_tree_menu_tree$|page_tree_menu_tree_all_pages$).+$", message = "#i18n{menus.validation.customMenu.bookmark.forbiddenName}" )
58 @Size( max = 100, message = "#i18n{menus.validation.customMenu.bookmark.size}" )
59 @NotEmpty( message = "#i18n{menus.validation.customMenu.bookmark.notEmpty}" )
60 private String _strBookmark;
61 @Pattern( regexp = "main|internal|sidebar|submenu", message = "#i18n{menus.validation.customMenu.type.pattern}" )
62 private String _strType;
63 @Size( max = 255, message = "#i18n{menus.validation.customMenu.description.size}" )
64 private String _strDescription;
65 private List < CustomMenuItem > _listItems;
66
67
68 public static final String TYPE_MAIN = "menus.constant_custom_menu.type.main";
69 public static final String TYPE_SUBMENU = "menus.constant_custom_menu.type.customMenu";
70 public static final String TYPE_INTERNAL = "menus.constant_custom_menu.type.internal";
71 public static final String TYPE_SIDEBAR = "menus.constant_custom_menu.type.sidebar";
72
73
74
75
76 public CustomMenu( )
77 {
78 _listItems = new ArrayList < CustomMenuItem >( );
79 _strBookmark = "";
80 }
81
82
83
84
85
86
87 public int getId( )
88 {
89 return _nId;
90 }
91
92
93
94
95
96
97
98 public void setId( int nId )
99 {
100 _nId = nId;
101 }
102
103
104
105
106
107
108 public String getName( )
109 {
110 return _strName;
111 }
112
113
114
115
116
117
118
119 public void setName( String strName )
120 {
121 _strName = strName;
122 }
123
124
125
126
127
128
129 public String getBookmark( )
130 {
131 return _strBookmark;
132 }
133
134
135
136
137
138
139
140 public void setBookmark( String strBookmark )
141 {
142 _strBookmark = strBookmark;
143 }
144
145
146
147
148
149
150 public String getType( )
151 {
152 return _strType;
153 }
154
155
156
157
158
159
160
161 public void setType( String strType )
162 {
163 _strType = strType;
164 }
165
166
167
168
169
170
171 public String getDescription( )
172 {
173 return _strDescription;
174 }
175
176
177
178
179
180
181
182 public void setDescription( String strDescription )
183 {
184 _strDescription = strDescription;
185 }
186
187
188
189
190
191
192 public List < CustomMenuItem > getListItems( )
193 {
194 return _listItems;
195 }
196
197
198
199
200
201
202
203 public void setListItems( List < CustomMenuItem > listItems )
204 {
205 _listItems = listItems;
206 }
207
208
209
210
211
212
213
214 public void addItem( CustomMenuItem item )
215 {
216 _listItems.add( item );
217 }
218
219
220
221
222
223
224
225 public void removeItem( CustomMenuItem item )
226 {
227 _listItems.remove( item );
228 }
229 }