pl.chilldev.web.faces.context.PageMetaModelContextUtils Maven / Gradle / Ivy
/**
* This file is part of the ChillDev-Web.
*
* @license http://mit-license.org/ The MIT license
* @copyright 2014 - 2015 © by Rafał Wrzeszcz - Wrzasq.pl.
*/
package pl.chilldev.web.faces.context;
import javax.faces.view.facelets.FaceletContext;
import pl.chilldev.web.core.page.PageMetaModel;
/**
* Page context utilities.
*/
public class PageMetaModelContextUtils
{
/**
* Page context resolver.
*/
private static PageMetaModelResolver resolver;
/**
* Sets page model resolver.
*
* @param resolver New page meta model resolver.
*/
public static void setPageMetaModelResolver(PageMetaModelResolver resolver)
{
PageMetaModelContextUtils.resolver = resolver;
}
/**
* Returns current model resolver.
*
* @return Page meta model resolver.
*/
public static synchronized PageMetaModelResolver getPageMetaModelResolver()
{
if (PageMetaModelContextUtils.resolver == null) {
PageMetaModelContextUtils.resolver = new FacesPageMetaModelResolver();
}
return PageMetaModelContextUtils.resolver;
}
/**
* Retrives page metadata model for given Facelets context.
*
* @param context Current Facelets context.
* @return Page metadata model.
* @throws PageMetaModelContextException When page meta model in given cotnext is corrupted.
*/
public static PageMetaModel getPageMetaModel(FaceletContext context)
throws
PageMetaModelContextException
{
return PageMetaModelContextUtils.getPageMetaModelResolver().getPageMetaModel(context);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy