com.knowgate.hipergate
Class ProductLoader

java.lang.Object
  extended by com.knowgate.hipergate.ProductLoader
All Implemented Interfaces:
ImportLoader

public class ProductLoader
extends java.lang.Object
implements ImportLoader

Load Product data from a single source


Field Summary
static int adult_rated
           
static int alturl
           
static int author
           
static int availability
           
static int bo_active
           
static int brand
           
static int client
           
static int color
           
static int contact_person
           
static int coord_x
           
static int coord_y
           
static int country
           
static int country_code
           
static int cover
           
static int days_to_deliver
           
static int de_prod_locat
           
static int de_product
           
static int department
           
static int direct_phone
           
static int disk_space
           
static int display
           
static int doc_no
           
static int dt_acknowledge
           
static int dt_created
           
static int dt_end
           
static int dt_expire
           
static int dt_modified
           
static int dt_out
           
static int dt_start
           
static int dt_uploaded
           
static int email
           
static int fax
           
static int fax_phone
           
static int forward_to
           
static int gu_address
           
static int gu_blockedby
           
static int gu_category
           
static int gu_location
           
static int gu_owner
           
static int gu_product
           
static int gu_user
           
static int home_phone
           
static int icq_id
           
static int id_cont_type
           
static int id_country
           
static int id_currency
           
static int id_fare
           
static int id_language
           
static int id_prod_type
           
static int id_ref
           
static int id_state
           
static int id_status
           
static int ip_addr
           
static int is_compound
           
static int is_tax_included
           
static int isbn
           
static int ix_address
           
static int len_file
           
static int memory
           
static int mn_city
           
static int mobilephone
           
static int MODE_APPEND
           
static int MODE_APPENDUPDATE
           
static int MODE_UPDATE
           
static int mov_phone
           
static int nm_category
           
static int nm_company
           
static int nm_country
           
static int nm_product
           
static int nm_state
           
static int nm_street
           
static int NO_DUPLICATED_NAMES
           
static int NO_DUPLICATED_REFERENCES
           
static int nu_current_stock
           
static int nu_lines
           
static int nu_min_stock
           
static int nu_reserved_stock
           
static int nu_street
           
static int od_position
           
static int office
           
static int ordinal
           
static int organization
           
static int other_phone
           
static int pages
           
static int paragraphs
           
static int pct_tax_rate
           
static int pg_prod_locat
           
static int phone1
           
static int phone2
           
static int po_box
           
static int power
           
static int pr_discount
           
static int pr_list
           
static int pr_purchase
           
static int pr_sale
           
static int product_group
           
static int project
           
static int rank
           
static int reference_id
           
static int revised_by
           
static int rooms
           
static int scope
           
static int signature
           
static int size_x
           
static int size_y
           
static int size_z
           
static int speed
           
static int state
           
static int state_code
           
static int status
           
static int subject
           
static int tag_prod_locat
           
static int tag_product
           
static int target
           
static int template
           
static int tp_fare
           
static int tp_location
           
static int tp_street
           
static int tx_addr1
           
static int tx_addr2
           
static int tx_email
           
static int tx_email_alt
           
static int tx_keywords
           
static int tx_remarks
           
static int tx_salutation
           
static int typeof
           
static int upload_by
           
static int url_addr
           
static int vs_stamp
           
static int weight
           
static int words
           
static int work_phone
           
static int WRITE_ADDRESSES
           
static int WRITE_LOOKUPS
           
static int xanchor
           
static int xfile
           
static int xhost
           
static int xoriginalfile
           
static int xpath
           
static int xport
           
static int xprotocol
           
static int zip_code
           
 
Fields inherited from interface com.knowgate.hipergate.datamodel.ImportLoader
LOOUKP_TR_COLUMNS, LOOUKP_TR_COUNT
 
Constructor Summary
ProductLoader()
           
ProductLoader(java.sql.Connection oConn)
          Create ProductLoader and call prepare() on Connection
 
Method Summary
 void close()
          Close prepared statements This method must always be called before object is destroyed or else cursors may be left open at the database
 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 properties curently held in RAM into the database
 
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

WRITE_LOOKUPS

public static final int WRITE_LOOKUPS
See Also:
Constant Field Values

WRITE_ADDRESSES

public static final int WRITE_ADDRESSES
See Also:
Constant Field Values

NO_DUPLICATED_NAMES

public static final int NO_DUPLICATED_NAMES
See Also:
Constant Field Values

NO_DUPLICATED_REFERENCES

public static final int NO_DUPLICATED_REFERENCES
See Also:
Constant Field Values

adult_rated

public static int adult_rated

alturl

public static int alturl

author

public static int author

availability

public static int availability

bo_active

public static int bo_active

brand

public static int brand

client

public static int client

color

public static int color

contact_person

public static int contact_person

coord_x

public static int coord_x

coord_y

public static int coord_y

country

public static int country

country_code

public static int country_code

cover

public static int cover

days_to_deliver

public static int days_to_deliver

de_prod_locat

public static int de_prod_locat

de_product

public static int de_product

department

public static int department

direct_phone

public static int direct_phone

disk_space

public static int disk_space

display

public static int display

doc_no

public static int doc_no

dt_acknowledge

public static int dt_acknowledge

dt_created

public static int dt_created

dt_end

public static int dt_end

dt_expire

public static int dt_expire

dt_modified

public static int dt_modified

dt_out

public static int dt_out

dt_start

public static int dt_start

dt_uploaded

public static int dt_uploaded

email

public static int email

fax

public static int fax

fax_phone

public static int fax_phone

forward_to

public static int forward_to

gu_address

public static int gu_address

gu_blockedby

public static int gu_blockedby

gu_category

public static int gu_category

gu_location

public static int gu_location

gu_owner

public static int gu_owner

gu_product

public static int gu_product

gu_user

public static int gu_user

home_phone

public static int home_phone

icq_id

public static int icq_id

id_cont_type

public static int id_cont_type

id_country

public static int id_country

id_currency

public static int id_currency

id_fare

public static int id_fare

id_language

public static int id_language

id_prod_type

public static int id_prod_type

id_ref

public static int id_ref

id_state

public static int id_state

id_status

public static int id_status

ip_addr

public static int ip_addr

is_compound

public static int is_compound

is_tax_included

public static int is_tax_included

isbn

public static int isbn

ix_address

public static int ix_address

len_file

public static int len_file

memory

public static int memory

mn_city

public static int mn_city

mobilephone

public static int mobilephone

mov_phone

public static int mov_phone

nm_category

public static int nm_category

nm_company

public static int nm_company

nm_country

public static int nm_country

nm_product

public static int nm_product

nm_state

public static int nm_state

nm_street

public static int nm_street

nu_current_stock

public static int nu_current_stock

nu_lines

public static int nu_lines

nu_min_stock

public static int nu_min_stock

nu_reserved_stock

public static int nu_reserved_stock

nu_street

public static int nu_street

od_position

public static int od_position

office

public static int office

ordinal

public static int ordinal

organization

public static int organization

other_phone

public static int other_phone

pages

public static int pages

paragraphs

public static int paragraphs

pct_tax_rate

public static int pct_tax_rate

pg_prod_locat

public static int pg_prod_locat

phone1

public static int phone1

phone2

public static int phone2

po_box

public static int po_box

power

public static int power

pr_discount

public static int pr_discount

pr_list

public static int pr_list

pr_purchase

public static int pr_purchase

pr_sale

public static int pr_sale

product_group

public static int product_group

project

public static int project

rank

public static int rank

reference_id

public static int reference_id

revised_by

public static int revised_by

rooms

public static int rooms

scope

public static int scope

signature

public static int signature

size_x

public static int size_x

size_y

public static int size_y

size_z

public static int size_z

speed

public static int speed

state

public static int state

state_code

public static int state_code

status

public static int status

subject

public static int subject

tag_prod_locat

public static int tag_prod_locat

tag_product

public static int tag_product

target

public static int target

template

public static int template

tp_fare

public static int tp_fare

tp_location

public static int tp_location

tp_street

public static int tp_street

tx_addr1

public static int tx_addr1

tx_addr2

public static int tx_addr2

tx_email

public static int tx_email

tx_email_alt

public static int tx_email_alt

tx_keywords

public static int tx_keywords

tx_remarks

public static int tx_remarks

tx_salutation

public static int tx_salutation

typeof

public static int typeof

upload_by

public static int upload_by

url_addr

public static int url_addr

vs_stamp

public static int vs_stamp

weight

public static int weight

words

public static int words

work_phone

public static int work_phone

xanchor

public static int xanchor

xfile

public static int xfile

xhost

public static int xhost

xoriginalfile

public static int xoriginalfile

xpath

public static int xpath

xport

public static int xport

xprotocol

public static int xprotocol

zip_code

public static int zip_code
Constructor Detail

ProductLoader

public ProductLoader()

ProductLoader

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

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

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 ProductLoader(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

Close prepared statements

This method must always be called before object is destroyed or else cursors may be left open at the database

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

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

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
Store properties curently held in RAM into the database

Specified by:
store in interface ImportLoader
Parameters:
oConn - Opened JDBC connection
sWorkArea - String GUID of WorkArea to which inserted data will belong
iFlags - int A boolean combination of {MODE_APPEND|MODE_UPDATE|WRITE_ADDRESSES|WRITE_LOOKUPS|NO_DUPLICATED_NAMES|NO_DUPLICATED_REFERENCES}
Throws:
java.sql.SQLException
java.lang.IllegalArgumentException
java.lang.NullPointerException
java.lang.ClassCastException