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.portal.service.plugin;
35
36 import fr.paris.lutece.portal.business.portlet.PortletType;
37 import fr.paris.lutece.portal.business.portlet.PortletTypeHome;
38 import fr.paris.lutece.portal.business.right.Right;
39 import fr.paris.lutece.portal.business.right.RightHome;
40 import fr.paris.lutece.portal.business.style.Theme;
41 import fr.paris.lutece.portal.service.content.ContentService;
42 import fr.paris.lutece.portal.service.content.ContentServiceEntry;
43 import fr.paris.lutece.portal.service.content.XPageAppService;
44 import fr.paris.lutece.portal.service.daemon.AppDaemonService;
45 import fr.paris.lutece.portal.service.daemon.DaemonEntry;
46 import fr.paris.lutece.portal.service.dashboard.DashboardComponentEntry;
47 import fr.paris.lutece.portal.service.dashboard.DashboardService;
48 import fr.paris.lutece.portal.service.dashboard.admin.AdminDashboardService;
49 import fr.paris.lutece.portal.service.database.PluginConnectionService;
50 import fr.paris.lutece.portal.service.filter.FilterEntry;
51 import fr.paris.lutece.portal.service.filter.FilterService;
52 import fr.paris.lutece.portal.service.includes.PageIncludeEntry;
53 import fr.paris.lutece.portal.service.includes.PageIncludeService;
54 import fr.paris.lutece.portal.service.init.LuteceInitException;
55 import fr.paris.lutece.portal.service.insert.InsertService;
56 import fr.paris.lutece.portal.service.insert.InsertServiceManager;
57 import fr.paris.lutece.portal.service.portal.PortalService;
58 import fr.paris.lutece.portal.service.rbac.RBACResourceTypeEntry;
59 import fr.paris.lutece.portal.service.rbac.ResourceIdService;
60 import fr.paris.lutece.portal.service.search.IndexationService;
61 import fr.paris.lutece.portal.service.search.SearchIndexer;
62 import fr.paris.lutece.portal.service.search.SearchIndexerEntry;
63 import fr.paris.lutece.portal.service.servlet.ServletEntry;
64 import fr.paris.lutece.portal.service.servlet.ServletService;
65 import fr.paris.lutece.portal.service.sessionlistener.HttpSessionListenerEntry;
66 import fr.paris.lutece.portal.service.sessionlistener.HttpSessionListenerService;
67 import fr.paris.lutece.portal.service.util.AppPropertiesService;
68 import fr.paris.lutece.portal.web.xpages.XPageApplicationEntry;
69
70 import java.util.ArrayList;
71 import java.util.Collections;
72 import java.util.Comparator;
73 import java.util.HashMap;
74 import java.util.List;
75 import java.util.Map;
76
77 import javax.servlet.http.HttpServletRequest;
78
79 import org.apache.commons.collections.CollectionUtils;
80
81
82
83
84 public abstract class Plugin implements Comparable<Plugin>
85 {
86
87 public static final int PLUGIN_TYPE_FEATURE = 0x01;
88 public static final int PLUGIN_TYPE_PORTLET = 0x02;
89 public static final int PLUGIN_TYPE_APPLICATION = 0x04;
90 public static final int PLUGIN_TYPE_INSERTSERVICE = 0x08;
91 public static final int PLUGIN_TYPE_CONTENTSERVICE = 0x10;
92 public static final int PLUGIN_TYPE_DAEMON = 0x20;
93 private static final String PROPERTY_DEFAULT_ICON_URL = "plugin.image.defaultIconUrl";
94 private static final String SCOPE_PORTAL = "portal";
95 private static final String SCOPE_XPAGE = "xpage";
96
97
98 private String _strName;
99 private String _strVersion;
100 private String _strDescription;
101 private String _strProvider;
102 private String _strProviderUrl;
103 private String _strCopyright;
104 private String _strPluginClass;
105 private String _strDbPoolName;
106 private String _strIconUrl;
107 private String _strDocumentationUrl;
108 private String _strMinCoreVersion;
109 private String _strMaxCoreVersion;
110 private boolean _bIsInstalled;
111 private boolean _bDbPoolRequired;
112 private ContentService _contentService;
113 private String _strCssStylesheetsScope;
114 private String _strJavascriptFilesScope;
115
116
117 private List<XPageApplicationEntry> _listXPageApplications;
118 private List<FilterEntry> _listFilters;
119 private List<ServletEntry> _listServlets;
120 private List<HttpSessionListenerEntry> _listListeners;
121 private Map<Integer, List<String>> _listCssStyleSheets;
122 private Map<Integer, List<String>> _listJavascriptFiles;
123 private List<String> _listAdminCssStyleSheets;
124 private List<String> _listAdminJavascriptFiles;
125 private List<Right> _listRights;
126 private List<PortletType> _listPortletTypes;
127 private List<ContentServiceEntry> _listContentServices;
128 private List<SearchIndexerEntry> _listSearchIndexers;
129 private List<InsertService> _listInsertServices;
130 private List<PageIncludeEntry> _listPageIncludes;
131 private List<DashboardComponentEntry> _listDashboardComponents;
132 private List<DashboardComponentEntry> _listAdminDashboardComponents;
133 private List<RBACResourceTypeEntry> _listRBACResourceTypes;
134 private List<DaemonEntry> _listDaemons;
135 private List<String> _listFreemarkerMacrosFiles;
136
137
138 private Map<String, String> _mapParams = new HashMap<>( );
139 private PluginConnectionService _connectionService;
140
141
142
143
144
145 public abstract void init( );
146
147
148
149
150
151
152
153
154
155 void load( PluginFile pluginFile ) throws LuteceInitException
156 {
157 try
158 {
159 _strName = pluginFile.getName( );
160 _strVersion = pluginFile.getVersion( );
161 _strDescription = pluginFile.getDescription( );
162 _strProvider = pluginFile.getProvider( );
163 _strProviderUrl = pluginFile.getProviderUrl( );
164
165 String strDefaultIconUrl = AppPropertiesService.getProperty( PROPERTY_DEFAULT_ICON_URL );
166 _strIconUrl = pluginFile.getIconUrl( ).equals( "" ) ? strDefaultIconUrl : pluginFile.getIconUrl( );
167 _strDocumentationUrl = pluginFile.getDocumentationUrl( );
168 _strCopyright = pluginFile.getCopyright( );
169 _strPluginClass = pluginFile.getPluginClass( );
170 _strMinCoreVersion = pluginFile.getMinCoreVersion( );
171 _strMaxCoreVersion = pluginFile.getMaxCoreVersion( );
172 _listXPageApplications = pluginFile.getXPageApplications( );
173 _listFilters = pluginFile.getFilters( );
174 _listServlets = pluginFile.getServlets( );
175 _listListeners = pluginFile.getListeners( );
176 _listRights = pluginFile.getRights( );
177 _listPortletTypes = pluginFile.getPortletTypes( );
178 _listContentServices = pluginFile.getContentServices( );
179 _listInsertServices = pluginFile.getInsertServices( );
180 _listSearchIndexers = pluginFile.getSearchIndexers( );
181 _listPageIncludes = pluginFile.getPageIncludes( );
182 _listDashboardComponents = pluginFile.getDashboardComponents( );
183 _listAdminDashboardComponents = pluginFile.getAdminDashboardComponents( );
184 _listRBACResourceTypes = pluginFile.getRBACResourceTypes( );
185 _listDaemons = pluginFile.getDaemons( );
186 _mapParams = pluginFile.getParams( );
187 _bDbPoolRequired = pluginFile.isDbPoolRequired( );
188
189 _listCssStyleSheets = pluginFile.getCssStyleSheetsForAllModes( );
190 _strCssStylesheetsScope = ( pluginFile.getCssStylesheetsScope( ) != null ) ? pluginFile.getCssStylesheetsScope( ) : SCOPE_XPAGE;
191 _listJavascriptFiles = pluginFile.getJavascriptFilesForAllModes( );
192 _strJavascriptFilesScope = ( pluginFile.getJavascriptFilesScope( ) != null ) ? pluginFile.getJavascriptFilesScope( ) : SCOPE_XPAGE;
193 _listFreemarkerMacrosFiles = pluginFile.getFreemarkerMacrosFiles( );
194 _listAdminCssStyleSheets = pluginFile.getAdminCssStyleSheets( );
195 _listAdminJavascriptFiles = pluginFile.getAdminJavascriptFiles( );
196
197 registerXPageApplications( );
198 registerFilters( );
199 registerServlets( );
200 registerListeners( );
201 registerContentServices( );
202 registerInsertServices( );
203 registerSearchIndexers( );
204 registerPageIncludes( );
205 registerDashboardComponents( );
206 registerAdminDashboardComponents( );
207 registerRBACResourceTypes( );
208 registerDaemons( );
209 }
210 catch( Exception e )
211 {
212 throw new LuteceInitException( "Error loading plugin : " + e.getMessage( ), e );
213 }
214 }
215
216
217
218
219
220 public ContentService getContentService( )
221 {
222 return _contentService;
223 }
224
225
226
227
228
229
230 public boolean hasPortlets( )
231 {
232 return CollectionUtils.isNotEmpty( _listPortletTypes );
233 }
234
235
236
237
238
239
240 public boolean hasDaemons( )
241 {
242 return CollectionUtils.isNotEmpty( _listDaemons );
243 }
244
245
246
247
248
249
250 public List<DaemonEntry> getDaemons( )
251 {
252 return _listDaemons;
253 }
254
255
256
257
258 protected void update( )
259 {
260 PluginService.updatePluginData( this );
261 }
262
263
264
265
266
267
268
269 public void setStatus( boolean bStatus )
270 {
271 _bIsInstalled = bStatus;
272 }
273
274
275
276
277
278
279
280 public void updatePoolName( String strPoolName )
281 {
282 _strDbPoolName = strPoolName;
283 _connectionService.setPool( strPoolName );
284 update( );
285
286 notifyListeners( PluginEvent.PLUGIN_POOL_CHANGED );
287 }
288
289
290
291
292
293
294
295 public void setPoolName( String strPoolName )
296 {
297 _strDbPoolName = strPoolName;
298 }
299
300
301
302
303
304
305 public String getDbPoolName( )
306 {
307 return _strDbPoolName;
308 }
309
310
311
312
313 protected void registerRights( )
314 {
315 for ( Right right : _listRights )
316 {
317 RightHome.remove( right.getId( ) );
318
319 if ( !( right.getId( ).equals( "" ) ) )
320 {
321 RightHome.create( right );
322 }
323 }
324 }
325
326
327
328
329 protected void unregisterRights( )
330 {
331 for ( Right right : _listRights )
332 {
333 if ( ( right != null ) && ( !( right.getId( ).equals( "" ) ) ) )
334 {
335 RightHome.remove( right.getId( ) );
336 }
337 }
338 }
339
340
341
342
343 protected void registerPortlets( )
344 {
345 for ( PortletType portletType : _listPortletTypes )
346 {
347 PortletTypeHome.remove( portletType.getId( ) );
348
349 if ( ( portletType.getHomeClass( ) != null ) && ( !( portletType.getHomeClass( ).equals( "" ) ) ) )
350 {
351 PortletTypeHome.create( portletType );
352 }
353 }
354 }
355
356
357
358
359 protected void unregisterPortlets( )
360 {
361 for ( PortletType portletType : _listPortletTypes )
362 {
363 PortletTypeHome.remove( portletType.getId( ) );
364 }
365 }
366
367
368
369
370
371
372
373 protected void registerXPageApplications( ) throws LuteceInitException
374 {
375 for ( XPageApplicationEntry entry : _listXPageApplications )
376 {
377 entry.setPluginName( getName( ) );
378 XPageAppService.registerXPageApplication( entry );
379 }
380 }
381
382
383
384
385
386
387
388 protected void registerFilters( ) throws LuteceInitException
389 {
390 for ( FilterEntry entry : _listFilters )
391 {
392 FilterService.getInstance( ).registerFilter( entry, this );
393 }
394 }
395
396
397
398
399
400
401
402 protected void registerServlets( ) throws LuteceInitException
403 {
404 for ( ServletEntry entry : _listServlets )
405 {
406 ServletService.getInstance( ).registerServlet( entry, this );
407 }
408 }
409
410
411
412
413
414
415
416 protected void registerListeners( ) throws LuteceInitException
417 {
418 for ( HttpSessionListenerEntry entry : _listListeners )
419 {
420 HttpSessionListenerService.registerListener( entry );
421 }
422 }
423
424
425
426
427
428
429
430 protected void registerContentServices( ) throws LuteceInitException
431 {
432 for ( ContentServiceEntry entry : _listContentServices )
433 {
434 try
435 {
436 ContentService./../../../../fr/paris/lutece/portal/service/content/ContentService.html#ContentService">ContentService cs = (ContentService) Class.forName( entry.getClassName( ) ).newInstance( );
437
438 cs.setPluginName( getName( ) );
439
440 PortalService.registerContentService( cs.getName( ), cs );
441 }
442 catch( InstantiationException | ClassNotFoundException | IllegalAccessException e )
443 {
444 throw new LuteceInitException( e.getMessage( ), e );
445 }
446 }
447 }
448
449
450
451
452
453
454
455 protected void registerInsertServices( ) throws LuteceInitException
456 {
457 for ( InsertService is : _listInsertServices )
458 {
459 is.setPluginName( getName( ) );
460 InsertServiceManager.registerInsertService( is );
461 }
462 }
463
464
465
466
467
468
469
470 protected void registerSearchIndexers( ) throws LuteceInitException
471 {
472 for ( SearchIndexerEntry entry : _listSearchIndexers )
473 {
474 try
475 {
476 SearchIndexer/../../../fr/paris/lutece/portal/service/search/SearchIndexer.html#SearchIndexer">SearchIndexer indexer = (SearchIndexer) Class.forName( entry.getClassName( ) ).newInstance( );
477 IndexationService.registerIndexer( indexer );
478 }
479 catch( IllegalAccessException | ClassNotFoundException | InstantiationException e )
480 {
481 throw new LuteceInitException( e.getMessage( ), e );
482 }
483 }
484 }
485
486
487
488
489
490
491
492 protected void registerPageIncludes( ) throws LuteceInitException
493 {
494 for ( PageIncludeEntry entry : _listPageIncludes )
495 {
496 entry.setPluginName( getName( ) );
497 PageIncludeService.registerPageInclude( entry );
498 }
499 }
500
501
502
503
504
505
506
507 protected void registerDashboardComponents( ) throws LuteceInitException
508 {
509 for ( DashboardComponentEntry entry : _listDashboardComponents )
510 {
511 DashboardService.getInstance( ).registerDashboardComponent( entry, this );
512 }
513 }
514
515
516
517
518
519
520
521 protected void registerAdminDashboardComponents( ) throws LuteceInitException
522 {
523 for ( DashboardComponentEntry entry : _listAdminDashboardComponents )
524 {
525 AdminDashboardService.getInstance( ).registerDashboardComponent( entry, this );
526 }
527 }
528
529
530
531
532
533
534
535 protected void registerRBACResourceTypes( ) throws LuteceInitException
536 {
537 for ( RBACResourceTypeEntry entry : _listRBACResourceTypes )
538 {
539 ResourceIdService ris;
540
541 try
542 {
543 ris = (ResourceIdService) Class.forName( entry.getClassName( ) ).newInstance( );
544
545 ris.register( );
546 }
547 catch( InstantiationException | ClassNotFoundException | IllegalAccessException e )
548 {
549 throw new LuteceInitException( e.getMessage( ), e );
550 }
551 }
552 }
553
554
555
556
557
558
559
560 protected void registerDaemons( ) throws LuteceInitException
561 {
562 for ( DaemonEntry entry : _listDaemons )
563 {
564 entry.setPluginName( getName( ) );
565 AppDaemonService.registerDaemon( entry );
566 }
567 }
568
569
570
571
572 public void install( )
573 {
574
575 registerRights( );
576
577
578 registerPortlets( );
579
580 _bIsInstalled = true;
581 update( );
582
583 notifyListeners( PluginEvent.PLUGIN_INSTALLED );
584 }
585
586
587
588
589 public void uninstall( )
590 {
591
592 unregisterRights( );
593
594
595 unregisterPortlets( );
596 _bIsInstalled = false;
597 update( );
598
599 notifyListeners( PluginEvent.PLUGIN_UNINSTALLED );
600 }
601
602
603
604
605
606
607
608 private void notifyListeners( int nEventType )
609 {
610 PluginEventvice/plugin/PluginEvent.html#PluginEvent">PluginEvent event = new PluginEvent( this, nEventType );
611 PluginService.notifyListeners( event );
612 }
613
614
615
616
617
618
619 public int getType( )
620 {
621
622 int nPluginTypeFlags = 0;
623
624 if ( CollectionUtils.isNotEmpty( _listXPageApplications ) )
625 {
626 nPluginTypeFlags |= PLUGIN_TYPE_APPLICATION;
627 }
628
629 if ( CollectionUtils.isNotEmpty( _listPortletTypes ) )
630 {
631 nPluginTypeFlags |= PLUGIN_TYPE_PORTLET;
632 }
633
634 if ( CollectionUtils.isNotEmpty( _listRights ) )
635 {
636 nPluginTypeFlags |= PLUGIN_TYPE_FEATURE;
637 }
638
639 if ( CollectionUtils.isNotEmpty( _listInsertServices ) )
640 {
641 nPluginTypeFlags |= PLUGIN_TYPE_INSERTSERVICE;
642 }
643
644 if ( CollectionUtils.isNotEmpty( _listContentServices ) )
645 {
646 nPluginTypeFlags |= PLUGIN_TYPE_CONTENTSERVICE;
647 }
648
649 if ( CollectionUtils.isNotEmpty( _listDaemons ) )
650 {
651 nPluginTypeFlags |= PLUGIN_TYPE_DAEMON;
652 }
653
654 return nPluginTypeFlags;
655 }
656
657
658
659
660
661
662 public List<InsertService> getInsertServices( )
663 {
664 return _listInsertServices;
665 }
666
667
668
669
670
671
672 public List<ContentServiceEntry> getContentServices( )
673 {
674 return _listContentServices;
675 }
676
677
678
679
680
681
682 public List<XPageApplicationEntry> getApplications( )
683 {
684 return _listXPageApplications;
685 }
686
687
688
689
690
691
692 public List<PortletType> getPortletTypes( )
693 {
694 return _listPortletTypes;
695 }
696
697
698
699
700
701
702
703 public void setPortletTypes( List<PortletType> listPortletTypes )
704 {
705 _listPortletTypes = listPortletTypes;
706 }
707
708
709
710
711
712
713 public List<Right> getRights( )
714 {
715 return _listRights;
716 }
717
718
719
720
721
722
723
724 public void setRights( List<Right> listRights )
725 {
726 _listRights = listRights;
727 }
728
729
730
731
732
733
734 public String getName( )
735 {
736 return _strName;
737 }
738
739
740
741
742
743
744
745 public void setName( String strName )
746 {
747 _strName = strName;
748 }
749
750
751
752
753
754
755 public String getVersion( )
756 {
757 return _strVersion;
758 }
759
760
761
762
763
764
765
766 public void setVersion( String strVersion )
767 {
768 _strVersion = strVersion;
769 }
770
771
772
773
774
775
776 public String getDescription( )
777 {
778 return _strDescription;
779 }
780
781
782
783
784
785
786
787 public void setDescription( String strDescription )
788 {
789 _strDescription = strDescription;
790 }
791
792
793
794
795
796
797 public String getProvider( )
798 {
799 return _strProvider;
800 }
801
802
803
804
805
806
807
808 public void setProvider( String strProvider )
809 {
810 _strProvider = strProvider;
811 }
812
813
814
815
816
817
818 public String getProviderUrl( )
819 {
820 return _strProviderUrl;
821 }
822
823
824
825
826
827
828
829 public void setProviderUrl( String strProviderUrl )
830 {
831 _strProviderUrl = strProviderUrl;
832 }
833
834
835
836
837
838
839 public String getIconUrl( )
840 {
841 return _strIconUrl;
842 }
843
844
845
846
847
848
849
850 public void setIconUrl( String strIconUrl )
851 {
852 _strIconUrl = strIconUrl;
853 }
854
855
856
857
858
859
860 public String getDocumentationUrl( )
861 {
862 return _strDocumentationUrl;
863 }
864
865
866
867
868
869
870
871 public void setDocumentationUrl( String strDocumentationUrl )
872 {
873 _strDocumentationUrl = strDocumentationUrl;
874 }
875
876
877
878
879
880
881 public String getCopyright( )
882 {
883 return _strCopyright;
884 }
885
886
887
888
889
890
891
892 public void setCopyright( String strCopyright )
893 {
894 _strCopyright = strCopyright;
895 }
896
897
898
899
900
901
902 public String getServiceClass( )
903 {
904 return _strPluginClass;
905 }
906
907
908
909
910
911
912
913 public void setServiceClass( String strPluginClass )
914 {
915 _strPluginClass = strPluginClass;
916 }
917
918
919
920
921
922
923 public boolean isInstalled( )
924 {
925 return _bIsInstalled;
926 }
927
928
929
930
931
932
933
934 public void setIsInstalled( boolean bIsInstalled )
935 {
936 _bIsInstalled = bIsInstalled;
937 }
938
939
940
941
942
943
944 public String getMinCoreVersion( )
945 {
946 return _strMinCoreVersion;
947 }
948
949
950
951
952
953
954
955 public void setMinCoreVersion( String strMinCoreVersion )
956 {
957 _strMinCoreVersion = strMinCoreVersion;
958 }
959
960
961
962
963
964
965 public String getMaxCoreVersion( )
966 {
967 return _strMaxCoreVersion;
968 }
969
970
971
972
973
974
975
976 public void setMaxCoreVersion( String strMaxCoreVersion )
977 {
978 _strMaxCoreVersion = strMaxCoreVersion;
979 }
980
981
982
983
984
985
986 public boolean isDbPoolRequired( )
987 {
988 return _bDbPoolRequired;
989 }
990
991
992
993
994
995
996
997 public void setIsDbPoolRequired( boolean bDbPoolRequired )
998 {
999 _bDbPoolRequired = bDbPoolRequired;
1000 }
1001
1002
1003
1004
1005
1006
1007 public PluginConnectionService getConnectionService( )
1008 {
1009 return _connectionService;
1010 }
1011
1012
1013
1014
1015
1016
1017
1018 public void setConnectionService( PluginConnectionService connectionService )
1019 {
1020 _connectionService = connectionService;
1021 }
1022
1023
1024
1025
1026
1027
1028
1029 public void initConnectionService( String strPoolName )
1030 {
1031 _connectionService = new PluginConnectionService( strPoolName );
1032 }
1033
1034
1035
1036
1037
1038
1039 public Map<String, String> getParams( )
1040 {
1041 return _mapParams;
1042 }
1043
1044
1045
1046
1047
1048
1049
1050
1051 public String getParamValue( String strParamName )
1052 {
1053 if ( !_mapParams.containsKey( strParamName ) )
1054 {
1055 return null;
1056 }
1057
1058 return _mapParams.get( strParamName );
1059 }
1060
1061
1062
1063
1064
1065
1066
1067 public void setParams( Map<String, String> mapParams )
1068 {
1069 _mapParams = mapParams;
1070 }
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080 public void setParamValue( String strParamName, String strParamValue )
1081 {
1082 if ( _mapParams.containsKey( strParamName ) )
1083 {
1084 _mapParams.put( strParamName, strParamValue );
1085 }
1086 }
1087
1088
1089
1090
1091
1092
1093
1094
1095 @Override
1096 public int compareTo( Plugin plugin )
1097 {
1098 Comparator<String> comparator = String.CASE_INSENSITIVE_ORDER;
1099
1100 return comparator.compare( getName( ), plugin.getName( ) );
1101 }
1102
1103
1104
1105
1106 @Override
1107 public boolean equals( Object o )
1108 {
1109 if ( !( o instanceof Plugin ) )
1110 {
1111 return false;
1112 }
1113
1114 return compareTo( (Plugin) o ) == 0;
1115 }
1116
1117
1118
1119
1120
1121
1122 public List<String> getCssStyleSheets( )
1123 {
1124 List<String> res = _listCssStyleSheets.get( null );
1125
1126 if ( res == null )
1127 {
1128 return Collections.emptyList( );
1129 }
1130
1131 return res;
1132 }
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142 public List<String> getCssStyleSheets( int mode )
1143 {
1144 List<String> res = _listCssStyleSheets.get( mode );
1145
1146 if ( res == null )
1147 {
1148 return Collections.emptyList( );
1149 }
1150
1151 return res;
1152 }
1153
1154
1155
1156
1157
1158
1159
1160
1161 public Theme getXPageTheme( HttpServletRequest request )
1162 {
1163 return null;
1164 }
1165
1166
1167
1168
1169
1170
1171
1172 public void addJavascriptFile( String strJavascriptFile )
1173 {
1174 List<String> files = _listJavascriptFiles.computeIfAbsent( null, s -> new ArrayList<>( ) );
1175 files.add( strJavascriptFile );
1176 }
1177
1178
1179
1180
1181
1182
1183 public List<String> getJavascriptFiles( )
1184 {
1185 List<String> res = _listJavascriptFiles.get( null );
1186
1187 if ( res == null )
1188 {
1189 return Collections.emptyList( );
1190 }
1191
1192 return res;
1193 }
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203 public List<String> getJavascriptFiles( int mode )
1204 {
1205 List<String> res = _listJavascriptFiles.get( mode );
1206
1207 if ( res == null )
1208 {
1209 return Collections.emptyList( );
1210 }
1211
1212 return res;
1213 }
1214
1215
1216
1217
1218
1219
1220 public boolean isCssStylesheetsScopePortal( )
1221 {
1222 return ( ( _strCssStylesheetsScope != null ) && _strCssStylesheetsScope.equalsIgnoreCase( SCOPE_PORTAL ) );
1223 }
1224
1225
1226
1227
1228
1229
1230 public boolean isCssStylesheetsScopeXPage( )
1231 {
1232 return ( ( _strCssStylesheetsScope != null ) && _strCssStylesheetsScope.equalsIgnoreCase( SCOPE_XPAGE ) );
1233 }
1234
1235
1236
1237
1238
1239
1240 public boolean isJavascriptFilesScopePortal( )
1241 {
1242 return ( ( _strJavascriptFilesScope != null ) && _strJavascriptFilesScope.equalsIgnoreCase( SCOPE_PORTAL ) );
1243 }
1244
1245
1246
1247
1248
1249
1250 public boolean isJavascriptFilesScopeXPage( )
1251 {
1252 return ( ( _strJavascriptFilesScope != null ) && _strJavascriptFilesScope.equalsIgnoreCase( SCOPE_XPAGE ) );
1253 }
1254
1255
1256
1257
1258
1259
1260
1261 public List<String> getAdminCssStyleSheets( )
1262 {
1263 return _listAdminCssStyleSheets;
1264 }
1265
1266
1267
1268
1269
1270
1271
1272 public List<String> getAdminJavascriptFiles( )
1273 {
1274 return _listAdminJavascriptFiles;
1275 }
1276
1277
1278
1279
1280
1281
1282
1283 public void addFreemarkerMacrosFile( String strMacroFileName )
1284 {
1285 _listFreemarkerMacrosFiles.add( strMacroFileName );
1286 }
1287
1288
1289
1290
1291
1292
1293 public List<String> getFreeMarkerMacrosFiles( )
1294 {
1295 return _listFreemarkerMacrosFiles;
1296 }
1297
1298
1299
1300
1301
1302
1303 @Override
1304 public String toString( )
1305 {
1306 return getName( );
1307 }
1308
1309
1310
1311
1312 @Override
1313 public int hashCode( )
1314 {
1315 if ( getName( ) == null )
1316 {
1317 return 0;
1318 }
1319
1320 return getName( ).toLowerCase( ).hashCode( );
1321 }
1322 }