1 /*
2 * Copyright (c) 2002-2014, Mairie de 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 /**
41 * PageInclude Entry used by XML plugin file
42 */
43 public class PageIncludeEntry
44 {
45 // Variables declarations
46 private String _strId;
47 private String _strClassName;
48 private String _strPluginName;
49 private boolean _bEnabled = true; // defaults to enabled
50 private PageInclude _pageInclude;
51
52 /**
53 * Returns the Id
54 *
55 * @return The Id
56 */
57 public String getId( )
58 {
59 return _strId;
60 }
61
62 /**
63 * Sets the Id
64 *
65 * @param strId 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 The ClassName
86 */
87 public void setClassName( String strClassName )
88 {
89 _strClassName = strClassName;
90 }
91
92 /**
93 * Return the name of the plugin
94 *
95 * @return The name of the plugin
96 */
97 public String getPluginName( )
98 {
99 return _strPluginName;
100 }
101
102 /**
103 * Set the plugin name
104 *
105 * @param strPluginName the plugin name
106 */
107 public void setPluginName( String strPluginName )
108 {
109 _strPluginName = strPluginName;
110 }
111
112 /**
113 * Sets the enabled state of this PageInclude
114 * @param enabled <code>true</code> if this PageInclude is enabled, <code>false</code> otherwise
115 * @since 5.1
116 */
117 public void setEnabled( boolean enabled )
118 {
119 _bEnabled = enabled;
120 }
121
122 /**
123 * Tells if the PageInclude is enabled, independently of the plugin's status
124 * @return <code>true</code> if this PageInclude is enabled, <code>false</code> otherwise
125 * @since 5.1
126 */
127 public boolean isEnabled( )
128 {
129 return _bEnabled;
130 }
131
132 /**
133 * Tells if the PageInclude is enabled (plugin enabled and this
134 * particular PageInclude is enabled)
135 *
136 * @return True if the PageInclude is enabled, otherwise false
137 */
138 public boolean isEnable( )
139 {
140 return PluginService.isPluginEnable( _strPluginName ) && _bEnabled;
141 }
142
143 /**
144 * Gets the plugin instance associated to the application
145 *
146 * @return the plugin
147 */
148 public Plugin getPlugin( )
149 {
150 return PluginService.getPlugin( _strPluginName );
151 }
152
153 /**
154 * Sets the PageInclude object
155 * @param pageInclude the PageInclude object
156 */
157 public void setPageInclude( PageInclude pageInclude )
158 {
159 _pageInclude = pageInclude;
160 }
161
162 /**
163 * Gets the PageInclude object
164 * @return The PageInclude object
165 */
166 public PageInclude getPageInclude( )
167 {
168 return _pageInclude;
169 }
170 }