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