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