1 /*
2 * Copyright (c) 2002-2025, City of Paris
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright notice
10 * and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright notice
13 * and the following disclaimer in the documentation and/or other materials
14 * provided with the distribution.
15 *
16 * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 *
32 * License 1.0
33 */
34 package fr.paris.lutece.portal.service.includes;
35
36 import fr.paris.lutece.portal.service.plugin.Plugin;
37 import fr.paris.lutece.portal.service.plugin.PluginService;
38
39 /**
40 * PageInclude Entry used by XML plugin file
41 */
42 public class PageIncludeEntry
43 {
44 // Variables declarations
45 private String _strId;
46 private String _strClassName;
47 private String _strPluginName;
48 private boolean _bEnabled = true; // defaults to enabled
49 private PageInclude _pageInclude;
50
51 /**
52 * Returns the Id
53 *
54 * @return The Id
55 */
56 public String getId( )
57 {
58 return _strId;
59 }
60
61 /**
62 * Sets the Id
63 *
64 * @param strId
65 * The Id
66 */
67 public void setId( String strId )
68 {
69 _strId = strId;
70 }
71
72 /**
73 * Returns the ClassName
74 *
75 * @return The ClassName
76 */
77 public String getClassName( )
78 {
79 return _strClassName;
80 }
81
82 /**
83 * Sets the ClassName
84 *
85 * @param strClassName
86 * The ClassName
87 */
88 public void setClassName( String strClassName )
89 {
90 _strClassName = strClassName;
91 }
92
93 /**
94 * Return the name of the plugin
95 *
96 * @return The name of the plugin
97 */
98 public String getPluginName( )
99 {
100 return _strPluginName;
101 }
102
103 /**
104 * Set the plugin name
105 *
106 * @param strPluginName
107 * the plugin name
108 */
109 public void setPluginName( String strPluginName )
110 {
111 _strPluginName = strPluginName;
112 }
113
114 /**
115 * Sets the enabled state of this PageInclude
116 *
117 * @param enabled
118 * <code>true</code> if this PageInclude is enabled, <code>false</code> otherwise
119 * @since 5.1
120 */
121 public void setEnabled( boolean enabled )
122 {
123 _bEnabled = enabled;
124 }
125
126 /**
127 * Tells if the PageInclude is enabled, independently of the plugin's status
128 *
129 * @return <code>true</code> if this PageInclude is enabled, <code>false</code> otherwise
130 * @since 5.1
131 */
132 public boolean isEnabled( )
133 {
134 return _bEnabled;
135 }
136
137 /**
138 * Tells if the PageInclude is enabled (plugin enabled and this particular PageInclude is enabled)
139 *
140 * @return True if the PageInclude is enabled, otherwise false
141 */
142 public boolean isEnable( )
143 {
144 return PluginService.isPluginEnable( _strPluginName ) && _bEnabled;
145 }
146
147 /**
148 * Gets the plugin instance associated to the application
149 *
150 * @return the plugin
151 */
152 public Plugin getPlugin( )
153 {
154 return PluginService.getPlugin( _strPluginName );
155 }
156
157 /**
158 * Sets the PageInclude object
159 *
160 * @param pageInclude
161 * the PageInclude object
162 */
163 public void setPageInclude( PageInclude pageInclude )
164 {
165 _pageInclude = pageInclude;
166 }
167
168 /**
169 * Gets the PageInclude object
170 *
171 * @return The PageInclude object
172 */
173 public PageInclude getPageInclude( )
174 {
175 return _pageInclude;
176 }
177 }