com.mizar.faces.javax.utils
Class SelectItemUtils

java.lang.Object
  extended by com.mizar.faces.javax.utils.SelectItemUtils

public class SelectItemUtils
extends java.lang.Object


Method Summary
static java.util.List<javax.faces.model.SelectItem> getSelectItemList(javax.persistence.EntityManager em, java.lang.Class beanClass, java.lang.String labelProperty, java.lang.String descriptionProperty, java.lang.String alias, java.lang.String whereClause, java.lang.String orderClause, javax.faces.model.SelectItem firstItem, javax.faces.model.SelectItem lastItem)
           
static java.util.List<javax.faces.model.SelectItem> getSelectItemList(javax.persistence.EntityManager em, java.lang.Class beanClass, java.lang.String labelProperty, java.lang.String descriptionProperty, java.lang.String alias, java.lang.String whereClause, java.lang.String orderClause, javax.faces.model.SelectItem firstItem, javax.faces.model.SelectItem lastItem, java.lang.Object emptyObject)
           
static java.util.List<javax.faces.model.SelectItem> getSelectItemList(javax.persistence.EntityManager em, java.lang.Class beanClass, java.lang.String valueProperty, java.lang.String labelProperty, java.lang.String descriptionProperty, java.lang.String alias, java.lang.String whereClause, java.lang.String orderClause, javax.faces.model.SelectItem firstItem, javax.faces.model.SelectItem lastItem)
           
static javax.faces.model.SelectItem[] getSelectItems(javax.persistence.EntityManager em, java.lang.Class beanClass, java.lang.String labelProperty, java.lang.String descriptionProperty, java.lang.String alias, java.lang.String whereClause, java.lang.String orderClause, javax.faces.model.SelectItem firstItem, javax.faces.model.SelectItem lastItem)
           
static javax.faces.model.SelectItem[] getSelectItems(javax.persistence.EntityManager em, java.lang.Class beanClass, java.lang.String valueProperty, java.lang.String labelProperty, java.lang.String descriptionProperty, java.lang.String alias, java.lang.String whereClause, java.lang.String orderClause, javax.faces.model.SelectItem firstItem, javax.faces.model.SelectItem lastItem)
          SelectItem arrays are used as components of JSF <af:selectOneChoice>, <af:selectOneListbox> and other JSF components.
static javax.faces.model.SelectItem[] getSelectItems(java.util.List list)
           
static javax.faces.model.SelectItem[] getSelectItems(java.util.List items, java.lang.String labelProperty, java.lang.String descriptionProperty)
          Converts a list of beans into an array of select items.
static javax.faces.model.SelectItem[] getSelectItems(java.util.Map map)
           
static java.util.List<javax.faces.model.SelectItem> getSelectItemsList(java.util.List list)
           
static java.util.List<javax.faces.model.SelectItem> getSelectItemsList(java.util.List items, java.lang.String labelProperty, java.lang.String descriptionProperty)
          Converts a list of beans into an array of select items.
static void removeDuplicateEntries(java.util.List<javax.faces.model.SelectItem> list)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

removeDuplicateEntries

public static void removeDuplicateEntries(java.util.List<javax.faces.model.SelectItem> list)

getSelectItemList

public static java.util.List<javax.faces.model.SelectItem> getSelectItemList(javax.persistence.EntityManager em,
                                                                             java.lang.Class beanClass,
                                                                             java.lang.String valueProperty,
                                                                             java.lang.String labelProperty,
                                                                             java.lang.String descriptionProperty,
                                                                             java.lang.String alias,
                                                                             java.lang.String whereClause,
                                                                             java.lang.String orderClause,
                                                                             javax.faces.model.SelectItem firstItem,
                                                                             javax.faces.model.SelectItem lastItem)

getSelectItems

public static javax.faces.model.SelectItem[] getSelectItems(javax.persistence.EntityManager em,
                                                            java.lang.Class beanClass,
                                                            java.lang.String valueProperty,
                                                            java.lang.String labelProperty,
                                                            java.lang.String descriptionProperty,
                                                            java.lang.String alias,
                                                            java.lang.String whereClause,
                                                            java.lang.String orderClause,
                                                            javax.faces.model.SelectItem firstItem,
                                                            javax.faces.model.SelectItem lastItem)
SelectItem arrays are used as components of JSF <af:selectOneChoice>, <af:selectOneListbox> and other JSF components. This method provides a convenient tool to build SelectItem arrays based on database domain tables.

Parameters:
em - an open EntityManager
beanClass - the class of the bean to use to build the SelectItem array
valueProperty - the name of the beanClass property to use for the SelectItem value
labelProperty - the name of the beanClass property to use for the SelectItem label
descriptionProperty - may be null the name of the beanClass property to use for the SelectItem description
alias - may be null but must match reference in whereClause or orderClause
whereClause - may be null
orderClause - may be null
firstItem - may be null
lastItem - may be null
Returns:

getSelectItems

public static javax.faces.model.SelectItem[] getSelectItems(javax.persistence.EntityManager em,
                                                            java.lang.Class beanClass,
                                                            java.lang.String labelProperty,
                                                            java.lang.String descriptionProperty,
                                                            java.lang.String alias,
                                                            java.lang.String whereClause,
                                                            java.lang.String orderClause,
                                                            javax.faces.model.SelectItem firstItem,
                                                            javax.faces.model.SelectItem lastItem)
Parameters:
em -
beanClass -
labelProperty -
descriptionProperty -
alias -
whereClause -
orderClause -
firstItem -
lastItem -
Returns:

getSelectItemList

public static java.util.List<javax.faces.model.SelectItem> getSelectItemList(javax.persistence.EntityManager em,
                                                                             java.lang.Class beanClass,
                                                                             java.lang.String labelProperty,
                                                                             java.lang.String descriptionProperty,
                                                                             java.lang.String alias,
                                                                             java.lang.String whereClause,
                                                                             java.lang.String orderClause,
                                                                             javax.faces.model.SelectItem firstItem,
                                                                             javax.faces.model.SelectItem lastItem)

getSelectItemList

public static java.util.List<javax.faces.model.SelectItem> getSelectItemList(javax.persistence.EntityManager em,
                                                                             java.lang.Class beanClass,
                                                                             java.lang.String labelProperty,
                                                                             java.lang.String descriptionProperty,
                                                                             java.lang.String alias,
                                                                             java.lang.String whereClause,
                                                                             java.lang.String orderClause,
                                                                             javax.faces.model.SelectItem firstItem,
                                                                             javax.faces.model.SelectItem lastItem,
                                                                             java.lang.Object emptyObject)

getSelectItems

public static javax.faces.model.SelectItem[] getSelectItems(java.util.Map map)
Parameters:
map - a set of value label pairs where the Map key is the value, and the Map value is the label
Returns:
an Array of SelectItem that can be used with <f:selectItems> sorted by Map value

getSelectItemsList

public static java.util.List<javax.faces.model.SelectItem> getSelectItemsList(java.util.List items,
                                                                              java.lang.String labelProperty,
                                                                              java.lang.String descriptionProperty)
Converts a list of beans into an array of select items. Supports JPA style notation when referencing objects

Parameters:
items - Beans to be converted into selectItems
descriptionProperty -
labelProperty -
Returns:

getSelectItems

public static javax.faces.model.SelectItem[] getSelectItems(java.util.List items,
                                                            java.lang.String labelProperty,
                                                            java.lang.String descriptionProperty)
Converts a list of beans into an array of select items. Supports JPA style notation when referencing objects

Parameters:
items -
labelProperty -
descriptionProperty -
Returns:
See Also:
getSelectItemsList(List items, String labelProperty, String descriptionProperty)

getSelectItems

public static javax.faces.model.SelectItem[] getSelectItems(java.util.List list)
Parameters:
list -
Returns:
an Array of SelectItem that can be used with <f:selectItems>

getSelectItemsList

public static java.util.List<javax.faces.model.SelectItem> getSelectItemsList(java.util.List list)