Package org.ametys.plugins.linkdirectory
Class LinkDirectoryInputData
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.plugins.linkdirectory.LinkDirectoryInputData
-
- All Implemented Interfaces:
InputData,Initializable,Contextualizable,LogEnabled,Serviceable
public class LinkDirectoryInputData extends AbstractLogEnabled implements Contextualizable, InputData, Initializable, Serviceable
Input data for the link directory user preferences in thumbnails mode
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classLinkDirectoryInputData.ThemeInputData
-
Field Summary
Fields Modifier and Type Field Description private static String__CONF_FILE_PATHThe path to the configuration fileprivate static String__WILDCARDThe wildcardprivate Map<String,String>_configurationErrorprivate Context_contextThe Avalon contextprotected CurrentUserProvider_currentUserProviderThe current user providerprivate DirectoryHelper_directoryHelperprivate Map<String,Long>_lastConfUpdateThe last time the file was loadedprivate SourceResolver_sourceResolverExcalibur source resolverprivate Map<String,List<LinkDirectoryInputData.ThemeInputData>>_themesCacheCache for themes: <skinId, List<theme info>>
-
Constructor Summary
Constructors Constructor Description LinkDirectoryInputData()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void_cacheConfigurationValues(Source source, String skinId)Read the configuration values and store themprivate boolean_filterByTemplate(LinkDirectoryInputData.ThemeInputData theme, String template)private List<String>_getConfiguredThemes(LinkDirectoryInputData.ThemeInputData themeInputData, String lang)Retrieve the configured themes names defined in the skin file link-themes.xml for the current input data and the current languageprivate String_getSkin(Request request)Get the current skinprivate String_getTemplate(Request request)Get the current templateprivate List<LinkDirectoryInputData.ThemeInputData>_getThemesForSkinAndTemplate(String skinId, String template)private void_saxLinks(ContentHandler contentHandler, UserIdentity user, Request request, List<String> themeIds, boolean displayUserLinks, String specificContext)private void_saxThemes(ContentHandler contentHandler, List<String> themeIds, List<String> unknownThemesNames)private void_updateConfigurationValues(String skinId)Update the configuration values : read them if the map is empty, update them if the file was changed or simply return themvoidcontextualize(Context context)voidinitialize()booleanisCacheable(Site site, Page currentPage)Returns true if thisInputDatais cacheable for the current site and if possible page.voidservice(ServiceManager manager)voidtoSAX(ContentHandler contentHandler)Generates SAX events for providing data.-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.web.inputdata.InputData
shouldBeCached
-
-
-
-
Field Detail
-
__CONF_FILE_PATH
private static final String __CONF_FILE_PATH
The path to the configuration file- See Also:
- Constant Field Values
-
__WILDCARD
private static final String __WILDCARD
The wildcard- See Also:
- Constant Field Values
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider
-
_sourceResolver
private SourceResolver _sourceResolver
Excalibur source resolver
-
_directoryHelper
private DirectoryHelper _directoryHelper
-
_themesCache
private Map<String,List<LinkDirectoryInputData.ThemeInputData>> _themesCache
Cache for themes: <skinId, List<theme info>>
-
_configurationError
private Map<String,String> _configurationError
-
_lastConfUpdate
private Map<String,Long> _lastConfUpdate
The last time the file was loaded
-
-
Constructor Detail
-
LinkDirectoryInputData
public LinkDirectoryInputData()
-
-
Method Detail
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
initialize
public void initialize() throws Exception
- Specified by:
initializein interfaceInitializable- Throws:
Exception
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
isCacheable
public boolean isCacheable(Site site, Page currentPage)
Description copied from interface:InputDataReturns true if thisInputDatais cacheable for the current site and if possible page.- Specified by:
isCacheablein interfaceInputData- Parameters:
site- the currentSite.currentPage- the currentPage. Can be null.- Returns:
- true if this
InputDatais cacheable for the current site or page.
-
toSAX
public void toSAX(ContentHandler contentHandler) throws ProcessingException
Description copied from interface:InputDataGenerates SAX events for providing data.- Specified by:
toSAXin interfaceInputData- Parameters:
contentHandler- the content handler to SAX into.- Throws:
ProcessingException- if an error occurs during processing.
-
_saxThemes
private void _saxThemes(ContentHandler contentHandler, List<String> themeIds, List<String> unknownThemesNames) throws SAXException
- Throws:
SAXException
-
_saxLinks
private void _saxLinks(ContentHandler contentHandler, UserIdentity user, Request request, List<String> themeIds, boolean displayUserLinks, String specificContext) throws ProcessingException
- Throws:
ProcessingException
-
_getConfiguredThemes
private List<String> _getConfiguredThemes(LinkDirectoryInputData.ThemeInputData themeInputData, String lang)
Retrieve the configured themes names defined in the skin file link-themes.xml for the current input data and the current language- Parameters:
themeInputData- Can be an emptyStringlang- the current language- Returns:
- the list of configured themes ids, can be empty, cannot be null
-
_getThemesForSkinAndTemplate
private List<LinkDirectoryInputData.ThemeInputData> _getThemesForSkinAndTemplate(String skinId, String template)
-
_filterByTemplate
private boolean _filterByTemplate(LinkDirectoryInputData.ThemeInputData theme, String template)
-
_updateConfigurationValues
private void _updateConfigurationValues(String skinId) throws Exception
Update the configuration values : read them if the map is empty, update them if the file was changed or simply return them- Parameters:
skinId- The skin- Throws:
Exception- if an exception occurs
-
_cacheConfigurationValues
private void _cacheConfigurationValues(Source source, String skinId)
Read the configuration values and store them- Parameters:
source- the file's sourceskinId- The skin
-
_getTemplate
private String _getTemplate(Request request)
Get the current template- Parameters:
request- the request- Returns:
- the current template
-
-