org.hippoecm.hst.utils
Class BeanUtils

java.lang.Object
  extended by org.hippoecm.hst.utils.BeanUtils

public class BeanUtils
extends Object

Class containing utility methods for Beans


Constructor Summary
BeanUtils()
           
 
Method Summary
static HstQuery createIncomingBeansQuery(HippoDocumentBean bean, HippoBean scope, int depth, BaseHstComponent component, Class<? extends HippoBean> beanMappingClass, boolean includeSubTypes)
          Deprecated. use ContentBeanUtils.createIncomingBeansQuery(HippoDocumentBean, HippoBean, int, ObjectConverter, Class, boolean) instead. The objectConverter can be fetched from BaseHstComponent.getObjectConverter()
static HstQuery createIncomingBeansQuery(HippoDocumentBean bean, HippoBean scope, List<String> linkPaths, BaseHstComponent component, Class<? extends HippoBean> beanMappingClass, boolean includeSubTypes)
          Deprecated. use ContentBeanUtils.createIncomingBeansQuery(HippoDocumentBean, HippoBean, List, ObjectConverter, Class, boolean) instead. The objectConverter can be fetched from BaseHstComponent.getObjectConverter()
static HstQuery createIncomingBeansQuery(HippoDocumentBean bean, HippoBean scope, String linkPath, BaseHstComponent component, Class<? extends HippoBean> beanMappingClass, boolean includeSubTypes)
          Deprecated. use ContentBeanUtils.createIncomingBeansQuery(HippoDocumentBean, HippoBean, String, ObjectConverter, Class, boolean) instead. The objectConverter can be fetched from BaseHstComponent.getObjectConverter()
static javax.jcr.Session getDisposablePoolSession(HstRequestContext requestContext, String disposablePoolIdentifier)
          This method tries to get a Session from a disposable pool which is identified by disposablePoolIdentifier If disposablePoolIdentifier is empty or null an HstComponentException will be thrown.
static javax.jcr.Session getDisposablePoolSession(HstRequest hstRequest, String disposablePoolIdentifier)
           
static
<T extends HippoBean>
T
getFacetedNavigationResultDocument(HstRequest hstRequest, HstQuery query, ObjectConverter objectConverter, Class<T> beanMappingClass)
          Tries to return a bean that is located in a faceted navigation tree below a result set.
static
<T extends HippoBean>
T
getFacetedNavigationResultDocument(HstRequest hstRequest, HstQuery query, String relPath, ObjectConverter objectConverter, Class<T> beanMappingClass)
          Tries to return a bean that is located in a faceted navigation tree below a result set.
static
<T extends HippoBean>
T
getFacetedNavigationResultDocument(HstRequest hstRequest, String query, ObjectConverter objectConverter, Class<T> beanMappingClass)
          Tries to return a bean that is located in a faceted navigation tree below a result set.
static
<T extends HippoBean>
T
getFacetedNavigationResultDocument(HstRequest hstRequest, String query, String relPath, ObjectConverter objectConverter, Class<T> beanMappingClass)
          Tries to return a bean that is located in a faceted navigation tree below a result set.
static HippoFacetNavigationBean getFacetNavigationBean(HstRequest hstRequest, HstQuery query, ObjectConverter objectConverter)
          Same as getFacetNavigationBean(HstRequest, String, ObjectConverter) only now instead of a String query we pass in a HstQuery
static HippoFacetNavigationBean getFacetNavigationBean(HstRequest hstRequest, HstQuery query, String relPath, ObjectConverter objectConverter)
          Same as getFacetNavigationBean(HstRequest, HstQuery, ObjectConverter) only now instead of having the faceted navigation node from the ResolvedSiteMapItem we add a relPath where it should be found
static HippoFacetNavigationBean getFacetNavigationBean(HstRequest hstRequest, String query, ObjectConverter objectConverter)
           Returns the HippoFacetNavigationBean for this HstRequest from the ResolvedSiteMapItem where it is accounted for the free text query.
static HippoFacetNavigationBean getFacetNavigationBean(HstRequest hstRequest, String relPath, String query, ObjectConverter objectConverter)
           Returns the HippoFacetNavigationBean for this HstRequest and relPath where it is accounted for the free text query.
static
<T extends HippoBean>
List<T>
getIncomingBeans(HstQuery query, Class<? extends HippoBean> beanMappingClass)
          Deprecated. use ContentBeanUtils.getIncomingBeans(HstQuery, Class) instead
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanUtils

public BeanUtils()
Method Detail

createIncomingBeansQuery

@Deprecated
public static HstQuery createIncomingBeansQuery(HippoDocumentBean bean,
                                                           HippoBean scope,
                                                           String linkPath,
                                                           BaseHstComponent component,
                                                           Class<? extends HippoBean> beanMappingClass,
                                                           boolean includeSubTypes)
                                         throws QueryException
Deprecated. use ContentBeanUtils.createIncomingBeansQuery(HippoDocumentBean, HippoBean, String, ObjectConverter, Class, boolean) instead. The objectConverter can be fetched from BaseHstComponent.getObjectConverter()

Returns a HstQuery for incoming beans (incoming beans within scope scope). You can add filters and ordering to the query before executing it You need to add a linkPath: this is that path, that the incoming beans use to link to the HippoDocumentBean bean. For example, with '/myproject:link/@hippo:docbase' or even 'wildcard/@hippo:docbase' or 'wildcard/wildcard/@hippo:docbase' where wildcard = *

Throws:
QueryException

createIncomingBeansQuery

@Deprecated
public static HstQuery createIncomingBeansQuery(HippoDocumentBean bean,
                                                           HippoBean scope,
                                                           int depth,
                                                           BaseHstComponent component,
                                                           Class<? extends HippoBean> beanMappingClass,
                                                           boolean includeSubTypes)
                                         throws QueryException
Deprecated. use ContentBeanUtils.createIncomingBeansQuery(HippoDocumentBean, HippoBean, int, ObjectConverter, Class, boolean) instead. The objectConverter can be fetched from BaseHstComponent.getObjectConverter()

Returns a HstQuery for incoming beans (incoming beans within scope scope). You can add filters and ordering to the query before executing it The depth indicates how many child nodes deep is searched for a link to the HippoDocumentBean bean. The depth is allowed to range from 0 (direct hippo:docbase) to 4 (at most 4 levels deep searching is done)

Throws:
QueryException

createIncomingBeansQuery

@Deprecated
public static HstQuery createIncomingBeansQuery(HippoDocumentBean bean,
                                                           HippoBean scope,
                                                           List<String> linkPaths,
                                                           BaseHstComponent component,
                                                           Class<? extends HippoBean> beanMappingClass,
                                                           boolean includeSubTypes)
                                         throws QueryException
Deprecated. use ContentBeanUtils.createIncomingBeansQuery(HippoDocumentBean, HippoBean, List, ObjectConverter, Class, boolean) instead. The objectConverter can be fetched from BaseHstComponent.getObjectConverter()

Returns a HstQuery for incoming beans. You can add filters and ordering to the query before executing it List linkPaths is the list of paths that are searched that might have a link to the HippoDocumentBean bean. For example {/myproject:link/@hippo:docbase, /myproject:body/hippostd:content/@hippo:docbase}

Throws:
QueryException

getIncomingBeans

@Deprecated
public static <T extends HippoBean> List<T> getIncomingBeans(HstQuery query,
                                                                        Class<? extends HippoBean> beanMappingClass)
                                                  throws QueryException
Deprecated. use ContentBeanUtils.getIncomingBeans(HstQuery, Class) instead

Returns a list of beans of type T (the same type as beanMappingClass) that have a (facet)link to the HippoDocumentBean bean. If no incoming beans are found, an empty list will be returned. List linkPaths is the list of paths that are searched that might have a link to the HippoDocumentBean bean. For example {/myproject:link/@hippo:docbase, /myproject:body/hippostd:content/@hippo:docbase}

Throws:
QueryException

getFacetNavigationBean

public static HippoFacetNavigationBean getFacetNavigationBean(HstRequest hstRequest,
                                                              String relPath,
                                                              String query,
                                                              ObjectConverter objectConverter)
                                                       throws HstComponentException

Returns the HippoFacetNavigationBean for this HstRequest and relPath where it is accounted for the free text query. When query is null or empty, we return the HippoFacetNavigationBean without free text search. Else, we try to return the HippoFacetNavigationBean with free text search. If the HippoFacetNavigationBean does not exist in the faceted navigation tree in combination with the free text search, we return null.

Note we can only return the HippoFacetNavigationBean if the current ResolvedSiteMapItem has a ResolvedSiteMapItem.getRelativeContentPath() that points to points to a HippoFacetNavigationBean or to some lower descendant HippoBean, for example to a HippoResultSetBean. In this latter case, we traverse up until we find a HippoFacetNavigationBean, and return that one.

The relPath is relative to the site content base path and must not start with a /

If some exception happens, like we cannot get a disposable pooled session, we throw a HstComponentException

Parameters:
hstRequest - the hstRequest
relPath - the relative path to the faceted navigation node, which must not start with a / and is relative to the site content base path
query - the free text query that should be accounted for for this facNavBean
objectConverter - the objectConverter to be used
Returns:
the HippoFacetNavigationBean accounted for this query and null if we could not find the HippoFacetNavigationBean when the query is applied
Throws:
HstComponentException

getFacetNavigationBean

public static HippoFacetNavigationBean getFacetNavigationBean(HstRequest hstRequest,
                                                              String query,
                                                              ObjectConverter objectConverter)
                                                       throws HstComponentException

Returns the HippoFacetNavigationBean for this HstRequest from the ResolvedSiteMapItem where it is accounted for the free text query. When query is null or empty, we return the HippoFacetNavigationBean without free text search. Else, we try to return the HippoFacetNavigationBean with free text search. If the HippoFacetNavigationBean does not exist in the faceted navigation tree in combination with the free text search, we return null.

Note we can only return the HippoFacetNavigationBean if the current ResolvedSiteMapItem has a ResolvedSiteMapItem.getRelativeContentPath() that points to points to a HippoFacetNavigationBean or to some lower descendant HippoBean, for example to a HippoResultSetBean. In this latter case, we traverse up until we find a HippoFacetNavigationBean, and return that one.

If you need a HippoFacetNavigationBean that is not on for the ResolvedSiteMapItem, but at some fixed location, you can use getFacetNavigationBean(HstRequest, String, String, ObjectConverter)

If some exception happens, like we cannot get a disposable pooled session, we throw a HstComponentException

Parameters:
hstRequest - the hstRequest
query - the free text query that should be accounted for for this facNavBean
objectConverter - the objectConverter to be used
Returns:
the HippoFacetNavigationBean accounted for this query and null if we could not find the HippoFacetNavigationBean when the query is applied
Throws:
HstComponentException

getFacetNavigationBean

public static HippoFacetNavigationBean getFacetNavigationBean(HstRequest hstRequest,
                                                              HstQuery query,
                                                              ObjectConverter objectConverter)
                                                       throws HstComponentException
Same as getFacetNavigationBean(HstRequest, String, ObjectConverter) only now instead of a String query we pass in a HstQuery

Parameters:
hstRequest - the hstRequest
query - a HstQuery object. If null the call returns as if there is no query
objectConverter - the objectConverter to be used
Returns:
the HippoFacetNavigationBean accounted for this query and null if we could not find the HippoFacetNavigationBean when the query is applied
Throws:
HstComponentException
See Also:
#getFacetNavigationBean(HstRequest, String, ObjectConverter)}

getFacetNavigationBean

public static HippoFacetNavigationBean getFacetNavigationBean(HstRequest hstRequest,
                                                              HstQuery query,
                                                              String relPath,
                                                              ObjectConverter objectConverter)
                                                       throws HstComponentException
Same as getFacetNavigationBean(HstRequest, HstQuery, ObjectConverter) only now instead of having the faceted navigation node from the ResolvedSiteMapItem we add a relPath where it should be found

Parameters:
hstRequest - the hstRequest
query - a HstQuery object
relPath - the relative path from site base content to the faceted navigation node, which must not start with a / and is relative to the site content base path
objectConverter - the objectConverter to be used
Returns:
the HippoFacetNavigationBean accounted for this query and relPath and null if we could not find the HippoFacetNavigationBean when the query is applied
Throws:
HstComponentException
See Also:
#getFacetNavigationBean(HstRequest, String, ObjectConverter)}

getFacetedNavigationResultDocument

public static <T extends HippoBean> T getFacetedNavigationResultDocument(HstRequest hstRequest,
                                                                         String query,
                                                                         ObjectConverter objectConverter,
                                                                         Class<T> beanMappingClass)
Tries to return a bean that is located in a faceted navigation tree below a result set. When it cannot be found, or the bean is not of type beanMappingClass, null will be returned.

Type Parameters:
T -
Parameters:
hstRequest - the hstRequest
query - the free text search as String that is used for this faceted navigation
objectConverter -
beanMappingClass - the class T must be of
Returns:
The faceted navigation result document of type T and null if it cannot be found or is not of type T

getFacetedNavigationResultDocument

public static <T extends HippoBean> T getFacetedNavigationResultDocument(HstRequest hstRequest,
                                                                         String query,
                                                                         String relPath,
                                                                         ObjectConverter objectConverter,
                                                                         Class<T> beanMappingClass)
Tries to return a bean that is located in a faceted navigation tree below a result set. When it cannot be found, or the bean is not of type beanMappingClass, null will be returned.

Type Parameters:
T -
Parameters:
hstRequest - the hstRequest
query - the free text search as String that is used for this faceted navigation. The query should already have been processed by SearchInputParsingUtils.parse(String, boolean) if necessary.
relPath - the relative path from site base content to the faceted navigation node, which must not start with a / and is relative to the site content base path
objectConverter -
beanMappingClass - the class T must be of
Returns:
The faceted navigation result document of type T and null if it cannot be found or is not of type T

getFacetedNavigationResultDocument

public static <T extends HippoBean> T getFacetedNavigationResultDocument(HstRequest hstRequest,
                                                                         HstQuery query,
                                                                         ObjectConverter objectConverter,
                                                                         Class<T> beanMappingClass)
Tries to return a bean that is located in a faceted navigation tree below a result set. When it cannot be found, or the bean is not of type beanMappingClass, null will be returned.

Type Parameters:
T -
Parameters:
hstRequest - the hstRequest
query - the free text search as HstQuery that is used for this faceted navigation
objectConverter -
beanMappingClass - the class T must be of
Returns:
The faceted navigation result document of type T and null if it cannot be found or is not of type T

getFacetedNavigationResultDocument

public static <T extends HippoBean> T getFacetedNavigationResultDocument(HstRequest hstRequest,
                                                                         HstQuery query,
                                                                         String relPath,
                                                                         ObjectConverter objectConverter,
                                                                         Class<T> beanMappingClass)
Tries to return a bean that is located in a faceted navigation tree below a result set. When it cannot be found, or the bean is not of type beanMappingClass, null will be returned.

Type Parameters:
T -
Parameters:
hstRequest - the hstRequest
query - the free text search as HstQuery that is used for this faceted navigation
relPath - the relative path from site base content to the faceted navigation node, which must not start with a / and is relative to the site content base path
objectConverter -
beanMappingClass - the class T must be of
Returns:
The faceted navigation result document of type T and null if it cannot be found or is not of type T

getDisposablePoolSession

public static javax.jcr.Session getDisposablePoolSession(HstRequestContext requestContext,
                                                         String disposablePoolIdentifier)
                                                  throws HstComponentException
This method tries to get a Session from a disposable pool which is identified by disposablePoolIdentifier If disposablePoolIdentifier is empty or null an HstComponentException will be thrown. If it is not possible to return a Session for the disposablePoolIdentifier, for example because there is configured a MultipleRepositoryImpl instead of LazyMultipleRepositoryImpl, also a HstComponentException will be thrown.

Parameters:
requestContext - the hstRequest for this HstComponent
disposablePoolIdentifier - the identifier for this disposable pool. It is not allowed to be empty or null
Returns:
a jcr Session from a disposable pool
Throws:
HstComponentException

getDisposablePoolSession

public static javax.jcr.Session getDisposablePoolSession(HstRequest hstRequest,
                                                         String disposablePoolIdentifier)
                                                  throws HstComponentException
Parameters:
hstRequest - the current HstRequest
disposablePoolIdentifier - the identifier for this disposable pool. It is not allowed to be empty or null
Returns:
a jcr Session from a disposable pool
Throws:
HstComponentException
See Also:
#getDisposablePoolSession(org.hippoecm.hst.core.request.HstRequestContext, String)}


Copyright © 2008-2012 Hippo. All Rights Reserved.