Package overit.geocall.basic.bl.user.da
Class DAUsers
java.lang.Object
overit.geocall.da.DABase
overit.geocall.basic.bl.user.da.DAUsers
- All Implemented Interfaces:
Serializable,DataAttributesHolder,EDMConfigurableBean,overit.geocall.marks.FieldExposer,overit.geocall.marks.NameExposer,DBFieldMapper,DBObjectMapper,Identified,Tool
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final intstatic final Stringstatic final Stringstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final StringFields inherited from class overit.geocall.da.DABase
DA_BASE_FILTER_PREFIX, DELETE_FILTER, DELETE_PK, INSATE, INSERT, REPLACE_DBVIEW, SAVE_DBVIEW, SELECT_FILTER, SELECT_NONE, SELECT_PK, UPDATE_FILTER, UPDATE_PK, UPSERT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcommand(int commandId, HashGetter filter, HashGetter values, PooledConnection conn, DBStatementObserver observer) Executes a command.Returns the field of the table in which is stored the "branch id" valueprotected intgiveCommands(int i, PooledConnection conn, DBStatement stmt, HashGetter oKeys, HashGetter oParams) Implements new specific commands that are different from the standard ones.Must returns aDBFieldMapif you want to implement an object mapping mechanism for queries and standard commands.Must returns aDBObjectMapif you want to implement an object mapping mechanism for queries and standard commands.Returns the field of the table in which is stored the "factory id" valueString[]Returns the array that contains the names of the columns on which we made the sorting of the result.Returns the name of the pool from which the specific DA extracts the connections when they are not explicitly passed to methods.String[]Must be implemented and returns the array that contains the primary keys of the specific table on which the DA acts.protected DBViewgiveQueries(int i, PooledConnection conn, DBStatement stmt, HashGetter oParams, int maxrows, int skiprows) Implements new specific queries that are different from the standard ones.Must be implemented and returns a string that represent the name of the field used as sequence for the insert commands on the table.Returns the name of the table on which the specific DA acts.protected voidpreInsert(HashGetter oFields, PooledConnection conn) Called before every insert command.protected voidpreUpdate(HashGetter filter, HashGetter values, PooledConnection conn) Called before every update command.Methods inherited from class overit.geocall.da.DABase
command, command, getAutoIncrementVal, getDataAttributes, getDBFieldMap, getDBFields, getDBObjectMap, getFieldMap, getIdentity, getQueryId, getQueryId, getReadOnlyCols, getSequenceNextVal, getTeacher, giveIsDistinct, giveIsService, giveMinLevel, giveStar, hasNotBeenDecorated, haveDBFieldMap, haveDBObjectMap, markAsDecorated, postDelete, postInsert, postUpdate, preDelete, preQuery, query, query, query, query, query, release, removeReadOnlyCols, replace, replace, save, save, setDataAttributes, setDBFieldMap, setDBObjectMap, setIdentity, setReadOnlyCols, useConnectionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface overit.geocall.edm.model.DataAttributesHolder
getEntitiesMethods inherited from interface overit.geocall.edm.model.EDMConfigurableBean
getEntity, hasEntity
-
Field Details
-
POOL
- See Also:
-
TABLE
- See Also:
-
FACTORY
- See Also:
-
PK
- See Also:
-
SELECT_TIPO
public static final int SELECT_TIPO- See Also:
-
SELECT_TIPO_ORDER_BYCOGNOME
public static final int SELECT_TIPO_ORDER_BYCOGNOME- See Also:
-
SELECT_TIPO_DESCORDER_BYCOGNOME
public static final int SELECT_TIPO_DESCORDER_BYCOGNOME- See Also:
-
SELECT_ALL_FIELDS
public static final int SELECT_ALL_FIELDS- See Also:
-
SELECT_ALL_FIELDS_WITH_CUSTOM_ORDER
public static final int SELECT_ALL_FIELDS_WITH_CUSTOM_ORDER- See Also:
-
SELECT_ALL_FIELDS_ORDER_BYCOGNOME
public static final int SELECT_ALL_FIELDS_ORDER_BYCOGNOME- See Also:
-
SELECT_ALL_FIELDS_DESCORDER_BYCOGNOME
public static final int SELECT_ALL_FIELDS_DESCORDER_BYCOGNOME- See Also:
-
SELECT_COGNOME
public static final int SELECT_COGNOME- See Also:
-
SELECTCOGNOME_ORDER_BYCOGNOME
public static final int SELECTCOGNOME_ORDER_BYCOGNOME- See Also:
-
SELECTCOGNOME_DESCORDER_BYCOGNOME
public static final int SELECTCOGNOME_DESCORDER_BYCOGNOME- See Also:
-
SELECT_TEST_USERNAME
public static final int SELECT_TEST_USERNAME- See Also:
-
MATCH_EMAIL
public static final int MATCH_EMAIL- See Also:
-
-
Constructor Details
-
DAUsers
public DAUsers()
-
-
Method Details
-
giveDBFieldMap
Description copied from class:DABaseMust returns aDBFieldMapif you want to implement an object mapping mechanism for queries and standard commands. If you do not want to define any mapping just make sure that the method returns null.- Specified by:
giveDBFieldMapin classDABase- Returns:
- the DBFieldMapper that defines the object mapping, or null
-
giveDBObjectMap
Description copied from class:DABaseMust returns aDBObjectMapif you want to implement an object mapping mechanism for queries and standard commands. If you do not want to define any mapping just make sure that the method returns null.- Specified by:
giveDBObjectMapin classDABase- Returns:
- the DBObjectMapper that defines the object mapping, or null
-
giveOrderCols
Description copied from class:DABaseReturns the array that contains the names of the columns on which we made the sorting of the result.- Specified by:
giveOrderColsin classDABase- Returns:
- Array that contains the name of the fields of the specific table
-
givePoolName
Description copied from class:DABaseReturns the name of the pool from which the specific DA extracts the connections when they are not explicitly passed to methods. It must be implemented making it return a string that represents the name of the pool.- Specified by:
givePoolNamein classDABase- Returns:
- The name of the pool from which the specific DA extracts the connections. It must return a not-null value
-
givePrimaryKeys
Description copied from class:DABaseMust be implemented and returns the array that contains the primary keys of the specific table on which the DA acts.- Specified by:
givePrimaryKeysin classDABase- Returns:
- Array that contains the name of the fields that are primary keys of the specific table
-
giveSequenceField
Description copied from class:DABaseMust be implemented and returns a string that represent the name of the field used as sequence for the insert commands on the table.- Specified by:
giveSequenceFieldin classDABase- Returns:
- The name of the sequence field or null if there isn't a defined sequence
-
giveTableName
Description copied from class:DABaseReturns the name of the table on which the specific DA acts. It must be implemented making it return a string that represents the name of the table on which you want to access and operate.- Specified by:
giveTableNamein classDABase- Returns:
- The name of the table on which the specific DA acts
-
giveBranchField
Description copied from class:DABaseReturns the field of the table in which is stored the "branch id" value- Specified by:
giveBranchFieldin classDABase- Returns:
- The name of the table field in which we store the "branch id" value; it must retrun null if we don't want to store this information
-
giveFactoryField
Description copied from class:DABaseReturns the field of the table in which is stored the "factory id" value- Specified by:
giveFactoryFieldin classDABase- Returns:
- The field containing the "factory id" value
-
preInsert
protected void preInsert(HashGetter oFields, PooledConnection conn) throws DAValidateException, SQLException Description copied from class:DABaseCalled before every insert command. We can overload it to implements specific operations. The standard method set the LOGIN and DATASTAMP fields and eventually the values for the factory, branch and sequence fields.- Overrides:
preInsertin classDABase- Parameters:
oFields- Map that contains the fields that we want to insertconn- Connection with which we act- Throws:
DAValidateException- If there is a validation error the DAValidateException is thrownSQLException- If there is an error in the SQL SQLException is thrown
-
preUpdate
protected void preUpdate(HashGetter filter, HashGetter values, PooledConnection conn) throws DAValidateException, SQLException Description copied from class:DABaseCalled before every update command. We can overload it to implements specific operations. The standard method set the LOGIN and DATASTAMP fields and eventually the values for the factory, branch and sequence fields.- Overrides:
preUpdatein classDABase- Parameters:
filter- Map that contains the filter used to select the rows to updatevalues- Map with the values that will be used to the updateconn- Connection with which we act- Throws:
DAValidateException- If there is a validation error the DAValidateException is thrownSQLException- If there is an SQL error the SQLException is thrown
-
giveQueries
protected DBView giveQueries(int i, PooledConnection conn, DBStatement stmt, HashGetter oParams, int maxrows, int skiprows) throws SQLException Description copied from class:DABaseImplements new specific queries that are different from the standard ones.
For all the queries implemented with this method we must set, in theDBStatement, the SQL (setSql()), the parameters (available as filters and settable usingset()) and any map (setDBObjectMap(),setDBFieldMap()) to use on the DBStatement.
The execution is done when we call one of thequery()methods, so we can do here only the statement setup.
It is fundamental that the method return null if the query id is not recognized.- Specified by:
giveQueriesin classDABase- Parameters:
i- The id of the queryconn- Connection from which we have extracted the DBStatement; it can be used to extract other DBStatementstmt- DBStatement used to set the SQL code and the parametersoParams- Parameters to set in the DBStatementmaxrows- Maximum rows number extracted with the queryskiprows- Number of initial lines that you do not want to be returned. Even these lines, although skipped, are counted in the maxrows parameter.- Returns:
- If the query id is valid we must return the DBStatement passed as parameter; if the is is not valid, or we don't want to add specific queries to the standard ones we must return null
- Throws:
SQLException- If there is an error in the SQL SQLException is thrown
-
giveCommands
protected int giveCommands(int i, PooledConnection conn, DBStatement stmt, HashGetter oKeys, HashGetter oParams) throws SQLException Description copied from class:DABaseImplements new specific commands that are different from the standard ones.
For all the commands implemented with this method we must set, in theDBStatement, the SQL (setSql()), (setDBObjectMap(),setDBFieldMap()) to use on the DBStatement.
The execution is done when we call one of thecommand()methods, so we can do here only the statement setup.
It is fundamental that the method return null if the command id is not recognized.- Specified by:
giveCommandsin classDABase- Parameters:
i- The id of the commandconn- Connection from which we have extracted the DBStatement; it can be used to extract other DBStatementstmt- DBStatement used to set the SQL code and the parametersoKeys- Values used as filters to set for the update commandsoParams- Values to set as parameters in the DBStatement- Returns:
- If the command id is valid we must return the DBStatement passed as parameter; if the id is not valid, or we don't want to add specific commands to the standard ones we must return null
- Throws:
SQLException- If there is an error in the SQL SQLException is thrown
-
command
public int command(int commandId, HashGetter filter, HashGetter values, PooledConnection conn, DBStatementObserver observer) throws DAValidateException, DAException Description copied from class:DABaseExecutes a command. The command is specified by a unique numeric id; it can be one of the predefined ids (like DELETE_PK, UPDATE_PK and so on) or one specific defined by thegiveCommands()method- Overrides:
commandin classDABase- Parameters:
commandId- Numeric id that identifies the specific commandfilter- Map that contains the parmeters used to find the record on which we want to execute the command. If the command don't ness a filter we can use nullvalues- Map that contains the values that we want to apply to the selected records on which we want to execute the command. If the command don't need values, we can use nullconn- The connection which we use to do the commandobserver- The DBStatementObserver that will receive the creation and release of the DBStatement- Returns:
- An integer that indicates the number of record on which the command have act. Before the returning the method make a commit and release the connection to the pool
- Throws:
DAValidateException- DAValidateException If there are error in the pre-validation phase, a DAValidateException is thrown and the connection is closedDAException- If there is a (blocking) data-access error, a DAException is thrown
-