com.knowgate.acl
Class UserLoader

java.lang.Object
  extended by com.knowgate.acl.UserLoader
All Implemented Interfaces:
ImportLoader

public final class UserLoader
extends java.lang.Object
implements ImportLoader

Load user data from a single source


Field Summary
static int bo_active
           
static int bo_change_pwd
           
static int bo_searchable
           
static int de_title
           
static int dt_birth
           
static int dt_cancel
           
static int dt_created
           
static int dt_last_update
           
static int dt_last_visit
           
static int dt_pwd_expires
           
static int gu_acl_group
           
static int gu_category
           
static int gu_user
           
static int gu_workarea
           
static int icq_id
           
static int id_account
           
static int id_domain
           
static int id_gender
           
static int len_quota
           
static int marital_status
           
static int max_quota
           
static int MODE_APPEND
           
static int MODE_APPENDUPDATE
           
static int MODE_UPDATE
           
static int nm_acl_group
           
static int nm_company
           
static int nm_user
           
static int nm_workarea
           
static int ny_age
           
static int sn_passport
           
static int tp_account
           
static int tp_passport
           
static int tx_alt_email
           
static int tx_challenge
           
static int tx_comments
           
static int tx_education
           
static int tx_main_email
           
static int tx_nickname
           
static int tx_pwd
           
static int tx_pwd_sign
           
static int tx_reply
           
static int tx_surname1
           
static int tx_surname2
           
 
Fields inherited from interface com.knowgate.hipergate.datamodel.ImportLoader
LOOUKP_TR_COLUMNS, LOOUKP_TR_COUNT, WRITE_LOOKUPS
 
Constructor Summary
UserLoader()
           
UserLoader(java.sql.Connection oConn)
          Create UserLoader and call prepare() on Connection
 
Method Summary
 void close()
          Close ImportLoader Must be always called before ImportLoader is destroyed
 int columnCount()
          Get columns count
 java.lang.String[] columnNames()
          Get array of column names
 java.lang.Object get(int iColumnIndex)
          Get column by index
 java.lang.Object get(java.lang.String sColumnName)
          Get column by name
 int getColumnIndex(java.lang.String sColumnName)
          Get column index at ColumnNames array given its name This method performs binary search assuming that ColumnNames is sorted in ascending order
 void prepare(java.sql.Connection oConn, ColumnList oColList)
          Prepare statements for execution This method needs to be called only once if the default constructor was used.
 void put(int iColumnIndex, java.lang.Object oValue)
          Put value for a given column
 void put(java.lang.String sColumnName, java.lang.Object oValue)
          Put value for a given column If a previous value already exists then it is replaced
 void putAll(java.util.Map oValues)
          Put all values from a map on their corresponding columns matching by name
 void setAllColumnsToNull()
          Set all column values to null
 void store(java.sql.Connection oConn, java.lang.String sWorkArea, int iFlags)
          Store a single row or a set of related rows
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODE_APPEND

public static final int MODE_APPEND
See Also:
Constant Field Values

MODE_UPDATE

public static final int MODE_UPDATE
See Also:
Constant Field Values

MODE_APPENDUPDATE

public static final int MODE_APPENDUPDATE
See Also:
Constant Field Values

bo_active

public static int bo_active

bo_change_pwd

public static int bo_change_pwd

bo_searchable

public static int bo_searchable

de_title

public static int de_title

dt_birth

public static int dt_birth

dt_cancel

public static int dt_cancel

dt_created

public static int dt_created

dt_last_update

public static int dt_last_update

dt_last_visit

public static int dt_last_visit

dt_pwd_expires

public static int dt_pwd_expires

gu_acl_group

public static int gu_acl_group

gu_category

public static int gu_category

gu_user

public static int gu_user

gu_workarea

public static int gu_workarea

icq_id

public static int icq_id

id_account

public static int id_account

id_domain

public static int id_domain

id_gender

public static int id_gender

len_quota

public static int len_quota

marital_status

public static int marital_status

max_quota

public static int max_quota

nm_acl_group

public static int nm_acl_group

nm_company

public static int nm_company

nm_user

public static int nm_user

nm_workarea

public static int nm_workarea

ny_age

public static int ny_age

sn_passport

public static int sn_passport

tp_account

public static int tp_account

tp_passport

public static int tp_passport

tx_alt_email

public static int tx_alt_email

tx_challenge

public static int tx_challenge

tx_comments

public static int tx_comments

tx_education

public static int tx_education

tx_main_email

public static int tx_main_email

tx_nickname

public static int tx_nickname

tx_pwd

public static int tx_pwd

tx_pwd_sign

public static int tx_pwd_sign

tx_reply

public static int tx_reply

tx_surname1

public static int tx_surname1

tx_surname2

public static int tx_surname2
Constructor Detail

UserLoader

public UserLoader()

UserLoader

public UserLoader(java.sql.Connection oConn)
           throws java.sql.SQLException
Create UserLoader and call prepare() on Connection

Parameters:
oConn - Connection
Throws:
java.sql.SQLException
Method Detail

setAllColumnsToNull

public void setAllColumnsToNull()
Set all column values to null

Specified by:
setAllColumnsToNull in interface ImportLoader

getColumnIndex

public int getColumnIndex(java.lang.String sColumnName)

Get column index at ColumnNames array given its name

This method performs binary search assuming that ColumnNames is sorted in ascending order

Specified by:
getColumnIndex in interface ImportLoader
Parameters:
sColumnName - String Column name (case insensitive)
Returns:
int Column index or -1 if not found

columnCount

public int columnCount()
Description copied from interface: ImportLoader
Get columns count

Specified by:
columnCount in interface ImportLoader
Returns:
int

columnNames

public java.lang.String[] columnNames()
                               throws java.lang.IllegalStateException
Description copied from interface: ImportLoader
Get array of column names

Specified by:
columnNames in interface ImportLoader
Returns:
String[]
Throws:
java.lang.IllegalStateException

put

public void put(int iColumnIndex,
                java.lang.Object oValue)
         throws java.lang.ArrayIndexOutOfBoundsException
Put value for a given column

Specified by:
put in interface ImportLoader
Parameters:
iColumnIndex - Column index [0..getColumnCount()-1]
oValue - Value for column
Throws:
java.lang.ArrayIndexOutOfBoundsException

put

public void put(java.lang.String sColumnName,
                java.lang.Object oValue)
         throws java.lang.ArrayIndexOutOfBoundsException

Put value for a given column

If a previous value already exists then it is replaced

Specified by:
put in interface ImportLoader
Parameters:
sColumnName - Column name (case sensitive)
oValue - Value for column
Throws:
java.lang.ArrayIndexOutOfBoundsException

putAll

public void putAll(java.util.Map oValues)
Put all values from a map on their corresponding columns matching by name

Parameters:
oValues - Map

get

public java.lang.Object get(int iColumnIndex)
                     throws java.lang.ArrayIndexOutOfBoundsException
Get column by index

Specified by:
get in interface ImportLoader
Parameters:
iColumnIndex - int Colunm index [0..getColumnCount()-1]
Returns:
Object Column value
Throws:
java.lang.ArrayIndexOutOfBoundsException

get

public java.lang.Object get(java.lang.String sColumnName)
                     throws java.lang.ArrayIndexOutOfBoundsException
Get column by name

Specified by:
get in interface ImportLoader
Parameters:
sColumnName - String Column name (case sensitive)
Returns:
Object Column value
Throws:
java.lang.ArrayIndexOutOfBoundsException - If no column with sucjh name was found

prepare

public void prepare(java.sql.Connection oConn,
                    ColumnList oColList)
             throws java.sql.SQLException

Prepare statements for execution

This method needs to be called only once if the default constructor was used.
If ContactLoader(Connection) constructor was used, there is no need to call prepare() and a SQLException will be raised if the attempt is made.
It is neccesary to call close() always for prepared instances as a failure to do so will leave open cursors on the database causing it eventually to stop.

Specified by:
prepare in interface ImportLoader
Parameters:
oConn - Connection Open JDBC database connection
oColList - ColumnList This parameter is ignored
Throws:
java.sql.SQLException

close

public void close()
           throws java.sql.SQLException
Description copied from interface: ImportLoader

Close ImportLoader

Must be always called before ImportLoader is destroyed

Specified by:
close in interface ImportLoader
Throws:
java.sql.SQLException

store

public void store(java.sql.Connection oConn,
                  java.lang.String sWorkArea,
                  int iFlags)
           throws java.sql.SQLException,
                  java.lang.IllegalArgumentException,
                  java.lang.NullPointerException,
                  java.lang.ClassCastException,
                  java.lang.NumberFormatException
Description copied from interface: ImportLoader
Store a single row or a set of related rows

Specified by:
store in interface ImportLoader
Parameters:
oConn - Connection
sWorkArea - String
iFlags - int
Throws:
java.sql.SQLException
java.lang.IllegalArgumentException
java.lang.NullPointerException
java.lang.ClassCastException
java.lang.NumberFormatException