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.pluginwizard.business.model;
35
36 import org.hibernate.validator.constraints.URL;
37
38 import java.util.ArrayList;
39 import java.util.List;
40 import java.util.Locale;
41
42 import javax.validation.constraints.NotEmpty;
43 import javax.validation.constraints.Pattern;
44 import javax.validation.constraints.Size;
45
46 import com.fasterxml.jackson.annotation.JsonIgnore;
47
48
49
50
51 public class PluginModel
52 {
53
54 private int _nIdPlugin;
55 private String _strPluginName;
56 private String _strPluginClass;
57 @NotEmpty( message = "pluginwizard.error.plugin.description.notEmpty" )
58 @Size( min = 5, max = 255, message = "pluginwizard.error.plugin.description.size" )
59 private String _strPluginDescription;
60 private String _strPluginDocumentation;
61 private String _strType;
62 private String _strPluginInstallation;
63 private String _strPluginChanges;
64 private String _strPluginUserGuide;
65 @NotEmpty( message = "pluginwizard.error.plugin.version.notEmpty" )
66 @Pattern( regexp = "[0-9].[0-9].[0-9]", message = "pluginwizard.error.plugin.version.pattern" )
67 private String _strPluginVersion;
68 @NotEmpty( message = "pluginwizard.error.plugin.copyright.notEmpty" )
69 private String _strPluginCopyright;
70 private String _strPluginIconUrl;
71 @NotEmpty( message = "pluginwizard.error.plugin.provider.notEmpty" )
72 @Size( min = 5, max = 255, message = "pluginwizard.error.plugin.description.size" )
73 private String _strPluginProvider;
74 @NotEmpty( message = "pluginwizard.error.plugin.urlProvider.notEmpty" )
75 @URL( message = "pluginwizard.error.plugin.urlProvider.url" )
76 private String _strPluginProviderUrl;
77 private String _strPluginDbPoolRequired;
78 private Locale _locale;
79 private List<Application> _listPluginApplications;
80 private List<Feature> _listPluginFeatures;
81 private List<Portlet> _listPluginPortlets;
82 private List<BusinessClass> _listBusinessClasses;
83 private Rest _rest;
84 private boolean _bIsModule;
85
86
87
88
89 public PluginModel( )
90 {
91 _listPluginApplications = new ArrayList<>( );
92 _listPluginFeatures = new ArrayList<>( );
93 _listPluginPortlets = new ArrayList<>( );
94 _listBusinessClasses = new ArrayList<>( );
95 _rest = new Rest( );
96 }
97
98
99
100
101
102
103 public int getIdPlugin( )
104 {
105 return _nIdPlugin;
106 }
107
108
109
110
111
112
113
114 public void setIdPlugin( int nIdPlugin )
115 {
116 _nIdPlugin = nIdPlugin;
117 }
118
119
120
121
122
123
124 public String getPluginName( )
125 {
126 return _strPluginName;
127 }
128
129
130
131
132
133
134 @JsonIgnore
135 public String getPluginNameAsRadicalPackage( )
136 {
137 if ( isModule( ) )
138 {
139 return _strPluginName.split( "-" ) [0] + ".modules." + _strPluginName.split( "-" ) [1];
140 }
141 else
142 {
143 return _strPluginName;
144 }
145
146 }
147
148
149
150
151
152
153 @JsonIgnore
154 public String getPluginNameAsRadicalPath( )
155 {
156 if ( isModule( ) )
157 {
158 return _strPluginName.split( "-" ) [0] + "/modules/" + _strPluginName.split( "-" ) [1];
159 }
160 else
161 {
162 return _strPluginName;
163 }
164 }
165
166
167
168
169
170
171 @JsonIgnore
172 public String getPluginNameAsPackage( )
173 {
174 if ( isModule( ) )
175 {
176 return "module." + _strPluginName.replace( "-", "." );
177 }
178 else
179 {
180 return _strPluginName;
181 }
182
183 }
184
185
186
187
188
189
190 @JsonIgnore
191 public String getPluginNameForRessource( )
192 {
193 if ( isModule( ) )
194 {
195 return getModuleName( ).toLowerCase( );
196 }
197 else
198 {
199 return _strPluginName.toLowerCase( );
200 }
201
202 }
203
204
205
206
207
208
209 @JsonIgnore
210 public String getModuleName( )
211 {
212 if ( isModule( ) )
213 {
214 return getPluginName( ).split( "-" ) [1];
215 }
216 else
217 {
218 return "";
219 }
220 }
221
222
223
224
225
226
227
228 public void setPluginName( String strPluginName )
229 {
230 _strPluginName = strPluginName;
231 }
232
233
234
235
236
237
238 public String getPluginClass( )
239 {
240 return _strPluginClass;
241 }
242
243
244
245
246
247
248
249 public void setPluginClass( String strPluginClass )
250 {
251 _strPluginClass = strPluginClass;
252 }
253
254
255
256
257
258
259 public String getPluginDescription( )
260 {
261 return _strPluginDescription;
262 }
263
264
265
266
267
268
269
270 public void setPluginDescription( String strPluginDescription )
271 {
272 _strPluginDescription = strPluginDescription;
273 }
274
275
276
277
278
279
280 public String getPluginDocumentation( )
281 {
282 return _strPluginDocumentation;
283 }
284
285
286
287
288
289
290
291 public void setPluginDocumentation( String strPluginDocumentation )
292 {
293 _strPluginDocumentation = strPluginDocumentation;
294 }
295
296
297
298
299
300
301 public String getPluginInstallation( )
302 {
303 return _strPluginInstallation;
304 }
305
306
307
308
309
310
311
312 public void setPluginInstallation( String strPluginInstallation )
313 {
314 _strPluginInstallation = strPluginInstallation;
315 }
316
317
318
319
320
321
322 public String getPluginChanges( )
323 {
324 return _strPluginChanges;
325 }
326
327
328
329
330
331
332
333 public void setPluginChanges( String strPluginChanges )
334 {
335 _strPluginChanges = strPluginChanges;
336 }
337
338
339
340
341
342
343 public String getPluginUserGuide( )
344 {
345 return _strPluginUserGuide;
346 }
347
348
349
350
351
352
353
354 public void setPluginUserGuide( String strPluginUserGuide )
355 {
356 _strPluginUserGuide = strPluginUserGuide;
357 }
358
359
360
361
362
363
364 public String getPluginVersion( )
365 {
366 return _strPluginVersion;
367 }
368
369
370
371
372
373
374
375 public void setPluginVersion( String strPluginVersion )
376 {
377 _strPluginVersion = strPluginVersion;
378 }
379
380
381
382
383
384
385 public String getPluginCopyright( )
386 {
387 return _strPluginCopyright;
388 }
389
390
391
392
393
394
395
396 public void setPluginCopyright( String strPluginCopyright )
397 {
398 _strPluginCopyright = strPluginCopyright;
399 }
400
401
402
403
404
405
406 public String getPluginIconUrl( )
407 {
408 return _strPluginIconUrl;
409 }
410
411
412
413
414
415
416
417 public void setPluginIconUrl( String strPluginIconUrl )
418 {
419 _strPluginIconUrl = strPluginIconUrl;
420 }
421
422
423
424
425
426
427 public String getPluginProvider( )
428 {
429 return _strPluginProvider;
430 }
431
432
433
434
435
436
437
438 public void setPluginProvider( String strPluginProvider )
439 {
440 _strPluginProvider = strPluginProvider;
441 }
442
443
444
445
446
447
448 public String getPluginProviderUrl( )
449 {
450 return _strPluginProviderUrl;
451 }
452
453
454
455
456
457
458
459 public void setPluginProviderUrl( String strPluginProviderUrl )
460 {
461 _strPluginProviderUrl = strPluginProviderUrl;
462 }
463
464
465
466
467
468
469 public String getPluginDbPoolRequired( )
470 {
471 return _strPluginDbPoolRequired;
472 }
473
474
475
476
477
478
479
480 public void setPluginDbPoolRequired( String strPluginDbPoolRequired )
481 {
482 _strPluginDbPoolRequired = strPluginDbPoolRequired;
483 }
484
485
486
487
488
489
490 public Locale getLocale( )
491 {
492 return _locale;
493 }
494
495
496
497
498
499
500
501 public void setLocale( Locale locale )
502 {
503 _locale = locale;
504 }
505
506
507
508
509
510
511
512 public void setApplications( List<Application> listPluginApplications )
513 {
514 if ( listPluginApplications != null )
515 {
516 _listPluginApplications = new ArrayList<>( listPluginApplications );
517 }
518 else
519 {
520 _listPluginApplications = null;
521 }
522 }
523
524
525
526
527
528
529 public List<Application> getApplications( )
530 {
531 return new ArrayList<>( _listPluginApplications );
532 }
533
534
535
536
537
538
539
540 public void setRest( Rest rest )
541 {
542 _rest = rest;
543 }
544
545
546
547
548
549
550 public Rest getRest( )
551 {
552 return _rest;
553 }
554
555
556
557
558
559
560
561 public void setFeatures( List<Feature> listPluginFeatures )
562 {
563 if ( listPluginFeatures != null )
564 {
565 _listPluginFeatures = new ArrayList<>( listPluginFeatures );
566 }
567 else
568 {
569 _listPluginFeatures = null;
570 }
571 }
572
573
574
575
576
577
578 public List<Feature> getFeatures( )
579 {
580 return new ArrayList<>( _listPluginFeatures );
581 }
582
583
584
585
586
587
588
589 public void setPortlets( List<Portlet> listPluginPortlets )
590 {
591 if ( listPluginPortlets != null )
592 {
593 _listPluginPortlets = new ArrayList<>( listPluginPortlets );
594 }
595 else
596 {
597 _listPluginPortlets = null;
598 }
599 }
600
601
602
603
604
605
606 public List<Portlet> getPortlets( )
607 {
608 return new ArrayList<>( _listPluginPortlets );
609 }
610
611
612
613
614
615
616 public List<BusinessClass> getBusinessClasses( )
617 {
618 return new ArrayList<>( _listBusinessClasses );
619 }
620
621 public void setBusinessClasses( List<BusinessClass> listBusinessClasses )
622 {
623 _listBusinessClasses = new ArrayList<>( listBusinessClasses );
624 }
625
626 public List<Feature> BusinessClass( )
627 {
628 throw new UnsupportedOperationException( "Not supported yet." );
629 }
630
631
632
633
634
635
636 public String getType( )
637 {
638 return _strType;
639 }
640
641
642
643
644
645
646
647 public void setType( String strType )
648 {
649 _strType = strType;
650 }
651
652
653
654
655
656
657 public boolean isModule( )
658 {
659 return ( _bIsModule || "MODULE".equals( _strType ) );
660 }
661
662
663
664
665
666
667 @JsonIgnore
668 public boolean getModule( )
669 {
670 return _bIsModule;
671 }
672
673
674
675
676
677
678
679 public void setModule( boolean bIsModule )
680 {
681 this._bIsModule = bIsModule;
682 }
683
684 }