|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.bsf.commons.ejb.GenericAdapterBean
org.bsf.commons.ejb.EntityAdapterBean
org.bsf.listOfValues.LovBean
The LovBean is a BMP EJB that enables the retrieval of a List of Values (LOV). It uses two tables to retrieve the informations needed to build the LOV.
Description of the two tables used by this BMP: 1) BSF_LOV : The definition of the LOV itself (what to retrieve) => OID : The oid of the LOV (ex: 1) => LOV_NAME : The name of the LOV, only for information (ex: LOV_COUNTRIES) => LOV_REQUEST : The request to execute to retrieve the list of values. : The first returned column will define the PK of the : LovValue(cf. S_LOV_DEFINITON below). : (ex: select oid, short_name, long_name from countries) => TABLE_NAME : The name of the Table used in this LOV (could be usefull : when we need to notify that the LOV has to be retrieved : again since the underlying table has changed). If a LOV : is based on more than one table set the "most important" : one (or the one that changes the most... it is up to you). 2) BSF_LOV_DEFINITION : The definition of the fields contained in the LovValues : returned from the execution of the SQL statement cor- : responding to the selected LOV (cf. BSF_LOV). : Enables to use the expected data type and to label the : fields. => LOV_OID : The OID of the LOV (cf. BSF_LOV) for which we define : a field. => FIELD_NAME : The String used to place and access the column matching : the given field_position of the the LOV_REQUEST in the : returned LovValue. Keep the name simple... => FIELD_TYPE : The type of the field (ie. java.lang.Long, java.lang.String, : java.lang.Double, ...). => FIELD_POSITION : The position of this field in the SQL statement defined : in the LOV_REQUEST column of the BSF_LOV table. The first : column defined will be used as the PK for the LovValues.
LovServiceBean
,
LovBusinessInterface
,
LovValue
,
Serialized FormField Summary | |
private java.util.HashMap |
_lov
Stores the lovValues in their "mapped" (OID, LovValue) form (a HashMap) to prevent remapping each time the map is requested. |
private java.util.List |
_metaData
Stores the metadata (field name, position...) for this list of values. |
private java.util.Vector |
_sortedLov
Used as a cache to store the results of the executed SQL to prevent the reexecution of the SQL statement each time the same LOV is requested). |
private java.lang.String |
JNDI_DATABASE_NAME
The JNDI name used to retrieve a connection to the database. |
static java.lang.String |
LOV_OID_FOR_TABLE_NAME_STATEMENT
|
private static java.lang.String |
METADATA_FOR_OID_STATEMENT
|
private static java.lang.String |
NAME_AND_REQUEST_FOR_OID_STATEMENT
|
Fields inherited from class org.bsf.commons.ejb.EntityAdapterBean |
ejbContext |
Fields inherited from class org.bsf.commons.ejb.GenericAdapterBean |
|
Constructor Summary | |
LovBean()
|
Method Summary | |
java.util.Collection |
ejbFindByPhysicalTable(java.lang.String p_tableName)
Finds the LOVs that are working on a given physical table. |
java.lang.Long |
ejbFindByPrimaryKey(java.lang.Long p_OID)
Checks if the the Lov exist in the S_LOV_REQUESTS table. |
void |
ejbLoad()
Loads all the values from the DB using the request defined in the LOV_REQUESTS table. |
java.util.List |
getListOfValues()
Gets the LovValues in the order of their retrieval (for example if we retrieve them by using a EJB BMP and the LOV_REQUESTS table we will get them in the order of the result of the executed SQL). |
LovValue |
getLovValue(java.lang.Long p_lovValueOID)
Returns the LovValue corresponding to the given OID in the List Of Values held in the implementing Object. |
java.util.HashMap |
getLovValuesPerOID()
Gets the LOV mapped by OID. |
java.util.List |
getMetaData()
|
Methods inherited from class org.bsf.commons.ejb.EntityAdapterBean |
ejbActivate, ejbPassivate, ejbRemove, ejbStore, getEJBContext, getUserName, setEntityContext, unsetEntityContext |
Methods inherited from class org.bsf.commons.ejb.GenericAdapterBean |
getConnection, getEJBClassName, getEJBToolBox, getHome, handleCreateSessionException, handleExceptionAsSystemException, handleFinderException, handleRemoteException, handleSQLException, logDebug, logError, logError, logFatal, logFatal, logGraphBegin, logGraphEnd, logInfo, logWarn |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.String NAME_AND_REQUEST_FOR_OID_STATEMENT
private static final java.lang.String METADATA_FOR_OID_STATEMENT
public static final java.lang.String LOV_OID_FOR_TABLE_NAME_STATEMENT
private final java.lang.String JNDI_DATABASE_NAME
private java.util.Vector _sortedLov
private java.util.HashMap _lov
private java.util.List _metaData
Constructor Detail |
public LovBean()
Method Detail |
public void ejbLoad()
ejbLoad
in interface javax.ejb.EntityBean
public java.lang.Long ejbFindByPrimaryKey(java.lang.Long p_OID) throws javax.ejb.ObjectNotFoundException
javax.ejb.ObjectNotFoundException
- if the corresponding LOV doesn't exist.
java.lang.IllegalArgumentException
- if the given OID is null.public java.util.Collection ejbFindByPhysicalTable(java.lang.String p_tableName) throws javax.ejb.FinderException
Is useful, for example, if the data in the DB are modified (a country is added or removed) and we want to update the LOVs working on those data (on the COUNTRIES table) for them to reflect the changes. First we need to know what LOVs are working on those data and that's what this finder retrieve for us.
You can check the Class description to have more informations about the DB structure.
p_tableName
- The name of the DB table that we want to match.
java.lang.IllegalArgumentException
- if the given table name is null.
javax.ejb.ObjectNotFoundException
- if none is found matching the given
table name.
javax.ejb.FinderException
public LovValue getLovValue(java.lang.Long p_lovValueOID) throws NoSuchLovValueException
getLovValue
in interface LovBusinessInterface
p_lovValueOID
- The OID, in the List Of Values held in the implementing
Object, of the LovValue desired.
NoSuchLovValueException
- if the requested LovValue isn't found in
the LOV.public java.util.HashMap getLovValuesPerOID()
getLovValuesPerOID
in interface LovBusinessInterface
public java.util.List getListOfValues()
getListOfValues
in interface LovBusinessInterface
public java.util.List getMetaData()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |