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