org.opensubsystems.inventory.persist.db
Class ItemDatabaseFactory

java.lang.Object
  extended by org.opensubsystems.core.persist.db.DatabaseFactoryImpl
      extended by org.opensubsystems.patterns.listdata.persist.db.impl.ListDatabaseFactoryImpl
          extended by org.opensubsystems.inventory.persist.db.ItemDatabaseFactory
All Implemented Interfaces:
org.opensubsystems.core.persist.BasicDataFactory, org.opensubsystems.core.persist.DataFactory, org.opensubsystems.core.persist.db.BasicDatabaseFactory, org.opensubsystems.core.persist.db.DatabaseFactory, org.opensubsystems.core.persist.db.ModifiableDatabaseFactory, org.opensubsystems.core.persist.ModifiableDataFactory, ItemFactory, org.opensubsystems.patterns.listdata.persist.db.ListDatabaseFactory, org.opensubsystems.patterns.listdata.persist.ListFactory

public class ItemDatabaseFactory
extends org.opensubsystems.patterns.listdata.persist.db.impl.ListDatabaseFactoryImpl
implements ItemFactory, org.opensubsystems.core.persist.db.ModifiableDatabaseFactory

Data factory to retrieve and manipulate item types in persistence store.

Version:
$Id: ItemDatabaseFactory.java,v 1.21 2007/01/28 06:54:43 bastafidli Exp $
Author:
Martin Cerba
Code reviewer:
Miro Halas
Code reviewed:
1.18 2006/08/11 00:29:37 jlegeny

Field Summary
protected  ItemDatabaseSchema m_schema
          Schema to use to execute database dependent operations.
protected  CategoryDatabaseSchema m_schemaCategory
          Schema to use to execute database dependent operations for categories.
 
Fields inherited from class org.opensubsystems.patterns.listdata.persist.db.impl.ListDatabaseFactoryImpl
m_arrOrderColumnCodes, m_arrOrderDirections, m_arrShowColumnCodes, m_listSchema
 
Fields inherited from class org.opensubsystems.core.persist.db.DatabaseFactoryImpl
m_connectionFactory, m_iConcurrencySelectListResultSet, m_iDataType, m_iTypeSelectListResultSet, m_transactionFactory
 
Constructor Summary
ItemDatabaseFactory()
          Default constructor.
 
Method Summary
 boolean addToCategories(int iItemId, int[] arrCategoryIds)
          Add item type to a specified categories.
 boolean addToCategory(int iItem, int iCategory)
          Add item type to a specified category.
 void changeAvailableCount(int iItemId, int iAvailableCountChange, int iDomainId)
          Change the available count for specified items by specified relative values.
 boolean changeAvailableCount(java.util.List lstChanges, int iDomainId)
          Change the available count for specified items by specified relative values.
protected  int changeAvailableCount(java.sql.PreparedStatement updateStatement, int iItemId, int iAvailableCountChange)
          Change the available count for specified inventory items by specified relative values.
 void changeCounts(int iItemTypeId, int iAvailableCountChange, int iOnHoldCountChange, int iDomainId)
          Update the on hold cont and available count for specified item.
 void changeCounts(java.util.List lstChanges, int iDomainId)
          Update the on hold cont and available count for specified item.
protected  void changeCounts(java.sql.PreparedStatement updateStatement, int iItemId, int iAvailableCountChange, int iOnHoldCountChange, int iDomaindId)
          Update the on hold cont and available count for specified item.
 void changeOnHoldCount(int iItemTypeId, int iOnHoldCountChange, boolean bOnlyIfAvailable, int iDomainId)
          Update the on hold count for specified item by specified relative values.
 void changeOnHoldCount(java.util.List lstChanges, boolean bOnlyIfAvailable, int iDomainId)
          Update the on hold count for specified item, which means that the item is still in the inventory but it was reserved.
protected  int changeOnHoldCount(java.sql.PreparedStatement updateStatement, int iItemId, int iOnHoldCountChange, boolean bOnlyIfAvailable)
          Update the on hold count for specified item, which means that the item is still in the inventory but it was reserved.
 boolean changeShippedAndAvailableCount(int iItemId, int iAvailableCountChange, int iDomainId)
          Update the shipped and available count for specified item.
 boolean changeShippedAndAvailableCount(java.util.List lstChanges)
          Update the shipped and available count for specified item.
protected  int changeShippedAndAvailableCount(java.sql.PreparedStatement updateStatement, int iItemId, int iAvailableCountChange, boolean isSecure)
          Change the shipped and available count for specified inventory items by specified relative values.
 boolean changeShippedAndAvailableCountSafely(java.util.List lstChanges)
          Update the shipped and available count for specified item.
protected  void checkAvailableChangeError(int iItemId, int iUpdateCount, int iDomainId)
          Check what type of error has occured during update of available count.
protected  void checkOnHoldChangeError(int iItemId, int iOnHoldCountChange, int iUpdateCount, int iDomainId)
          Check what type of error has occured during update of on hold count.
 int create(java.util.Collection colDataObject)
          
 org.opensubsystems.core.data.DataObject create(org.opensubsystems.core.data.DataObject data)
          
 void delete(int iId, int iDomainId)
          
 org.opensubsystems.core.data.DataObject get(int iId, int iDomainId)
          
 Item get(int iInventoryId, java.lang.String strItemName)
          Get item based on it's inventory id and name.
 int[] getAllEmptyCategories(int iInventoryId, int[] arrIds)
          Get IDs for all empty categories belonging to the specified inventory.
 org.opensubsystems.core.util.TwoIntStruct[] getCategories(long time, int iInventoryId)
          Return all mapping between items and categories that's changed since the specified time.
 java.util.List getIdsInCategory(int iRootCategoryId)
          Get ids of all items for category with id TODO: For Miro: Figure out what this method means? Will it return items from all subcategories or just the one specified? Should we call this main or root?
 int getMainCategoryId(int iItemId)
          Get id of item type main category.
 java.util.List getSubcategoryIds(int iItemId)
          Get id of ite type main category TODO: For Miro: Figure out what this method means? Item type should be able to be at multiple level of subcategories.
protected  int insertItemCategories(java.sql.Connection cntConnection, int iItemId, int[] arrCategoryIds)
          Assign new categories to item.
 org.opensubsystems.core.data.DataObject load(java.sql.ResultSet rsQueryResults, int initialIndex)
          
 org.opensubsystems.core.data.DataObject load(java.sql.ResultSet rsQueryResults, int[] selectedColumns, int initialIndex)
          
 void removeFromAllCategories(int iItemId)
          Remove specified item for all categories
 int resetCounts(int iInventoryId)
          Reset all counts of all items in the inventory to 0.
 org.opensubsystems.core.data.ModifiableDataObject save(org.opensubsystems.core.data.ModifiableDataObject data)
          
 int setValuesForInsert(java.sql.PreparedStatement insertStatement, org.opensubsystems.core.data.DataObject data, int iIndex)
          
 int setValuesForUpdate(java.sql.PreparedStatement updateStatement, org.opensubsystems.core.data.DataObject data, int iIndex)
          
 
Methods inherited from class org.opensubsystems.patterns.listdata.persist.db.impl.ListDatabaseFactoryImpl
get, getDefaultListDefinition, getListDatabaseSchema
 
Methods inherited from class org.opensubsystems.core.persist.db.DatabaseFactoryImpl
getConcurrencySelectListResultSet, getDataType, getTypeSelectListResultSet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opensubsystems.core.persist.DataFactory
getDataType
 
Methods inherited from interface org.opensubsystems.patterns.listdata.persist.ListFactory
get, getDefaultListDefinition
 

Field Detail

m_schema

protected ItemDatabaseSchema m_schema
Schema to use to execute database dependent operations.


m_schemaCategory

protected CategoryDatabaseSchema m_schemaCategory
Schema to use to execute database dependent operations for categories.

Constructor Detail

ItemDatabaseFactory

public ItemDatabaseFactory()
                    throws org.opensubsystems.core.error.OSSException
Default constructor.

Throws:
org.opensubsystems.core.error.OSSException - - an error has occured
Method Detail

load

public org.opensubsystems.core.data.DataObject load(java.sql.ResultSet rsQueryResults,
                                                    int[] selectedColumns,
                                                    int initialIndex)
                                             throws org.opensubsystems.core.error.OSSDatabaseAccessException

Specified by:
load in interface org.opensubsystems.patterns.listdata.persist.db.ListDatabaseFactory
Throws:
org.opensubsystems.core.error.OSSDatabaseAccessException

setValuesForInsert

public int setValuesForInsert(java.sql.PreparedStatement insertStatement,
                              org.opensubsystems.core.data.DataObject data,
                              int iIndex)
                       throws org.opensubsystems.core.error.OSSException,
                              java.sql.SQLException

Specified by:
setValuesForInsert in interface org.opensubsystems.core.persist.db.BasicDatabaseFactory
Throws:
org.opensubsystems.core.error.OSSException
java.sql.SQLException

setValuesForUpdate

public int setValuesForUpdate(java.sql.PreparedStatement updateStatement,
                              org.opensubsystems.core.data.DataObject data,
                              int iIndex)
                       throws org.opensubsystems.core.error.OSSException,
                              java.sql.SQLException

Specified by:
setValuesForUpdate in interface org.opensubsystems.core.persist.db.ModifiableDatabaseFactory
Throws:
org.opensubsystems.core.error.OSSException
java.sql.SQLException

get

public org.opensubsystems.core.data.DataObject get(int iId,
                                                   int iDomainId)
                                            throws org.opensubsystems.core.error.OSSException

Specified by:
get in interface org.opensubsystems.core.persist.DataFactory
Throws:
org.opensubsystems.core.error.OSSException

get

public Item get(int iInventoryId,
                java.lang.String strItemName)
         throws org.opensubsystems.core.error.OSSException
Get item based on it's inventory id and name.

Specified by:
get in interface ItemFactory
Parameters:
iInventoryId - - id of the inventory from where to get the Item
strItemName - - name of the Item to get
Returns:
ItemType - specified Item or null if not found
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

load

public org.opensubsystems.core.data.DataObject load(java.sql.ResultSet rsQueryResults,
                                                    int initialIndex)
                                             throws org.opensubsystems.core.error.OSSDatabaseAccessException

Specified by:
load in interface org.opensubsystems.core.persist.db.DatabaseFactory
Throws:
org.opensubsystems.core.error.OSSDatabaseAccessException

create

public org.opensubsystems.core.data.DataObject create(org.opensubsystems.core.data.DataObject data)
                                               throws org.opensubsystems.core.error.OSSException

Specified by:
create in interface org.opensubsystems.core.persist.BasicDataFactory
Throws:
org.opensubsystems.core.error.OSSException

create

public int create(java.util.Collection colDataObject)
           throws org.opensubsystems.core.error.OSSException

Specified by:
create in interface org.opensubsystems.core.persist.BasicDataFactory
Throws:
org.opensubsystems.core.error.OSSException

delete

public void delete(int iId,
                   int iDomainId)
            throws org.opensubsystems.core.error.OSSException

Specified by:
delete in interface org.opensubsystems.core.persist.BasicDataFactory
Throws:
org.opensubsystems.core.error.OSSException

save

public org.opensubsystems.core.data.ModifiableDataObject save(org.opensubsystems.core.data.ModifiableDataObject data)
                                                       throws org.opensubsystems.core.error.OSSException

Specified by:
save in interface org.opensubsystems.core.persist.ModifiableDataFactory
Throws:
org.opensubsystems.core.error.OSSException

getCategories

public org.opensubsystems.core.util.TwoIntStruct[] getCategories(long time,
                                                                 int iInventoryId)
                                                          throws org.opensubsystems.core.error.OSSException
Return all mapping between items and categories that's changed since the specified time. Since for the mapping we don't keep modification time, it will return those, for which either item type or category was modified. If time is zero, then return ALL item inventory category mappings.

Specified by:
getCategories in interface ItemFactory
Parameters:
time - - Number of seconds since January 1, 1970, 00:00:00 GMT. If zero, then return ALL item inventory category mappings.
iInventoryId - - id of inventory to get the categories for
Returns:
TwoIntStruct[] - All item inventory categories that have changed or been added since specified time. - first int is item id - second int is category id - null is returned if no links exist
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

addToCategory

public boolean addToCategory(int iItem,
                             int iCategory)
                      throws org.opensubsystems.core.error.OSSException
Add item type to a specified category.

Specified by:
addToCategory in interface ItemFactory
Parameters:
iItem - - id of item to add to category
iCategory - - id of cateogry to add the item type to
Returns:
boolean - success flag
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

addToCategories

public boolean addToCategories(int iItemId,
                               int[] arrCategoryIds)
                        throws org.opensubsystems.core.error.OSSException
Add item type to a specified categories.

Specified by:
addToCategories in interface ItemFactory
Parameters:
iItemId - - id of item to add to categories
arrCategoryIds - - array of category ids where to add the item
Returns:
boolean - sucess flag
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

resetCounts

public int resetCounts(int iInventoryId)
                throws org.opensubsystems.core.error.OSSException
Reset all counts of all items in the inventory to 0.

Specified by:
resetCounts in interface ItemFactory
Parameters:
iInventoryId - - inventory id where to reset count of items
Returns:
int - number of updated item types
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

removeFromAllCategories

public void removeFromAllCategories(int iItemId)
                             throws org.opensubsystems.core.error.OSSException
Remove specified item for all categories

Specified by:
removeFromAllCategories in interface ItemFactory
Parameters:
iItemId - - Item id
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

changeCounts

public void changeCounts(int iItemTypeId,
                         int iAvailableCountChange,
                         int iOnHoldCountChange,
                         int iDomainId)
                  throws org.opensubsystems.core.error.OSSException
Update the on hold cont and available count for specified item. Remember that the available count is just cached copy and it should be always equal to sum of units of this item.

Specified by:
changeCounts in interface ItemFactory
Parameters:
iItemTypeId - - id of the Item
iAvailableCountChange - - value to increment or decrement the available count by
iOnHoldCountChange - - value to increment or decrement the on hold count by
iDomainId - - id of domain in which the item is supposed to exist
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

changeCounts

public void changeCounts(java.util.List lstChanges,
                         int iDomainId)
                  throws org.opensubsystems.core.error.OSSException
Update the on hold cont and available count for specified item. Remember that the available count is just cached copy and it should be always equal to sum of inventory items of this item type.

Specified by:
changeCounts in interface ItemFactory
Parameters:
lstChanges - - list of ThreeIntStructs where the first int is the item id, second is the relative available count change and third is relative onhold count change.
iDomainId - - id of domain in which the items are supposed to exist
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

changeOnHoldCount

public void changeOnHoldCount(int iItemTypeId,
                              int iOnHoldCountChange,
                              boolean bOnlyIfAvailable,
                              int iDomainId)
                       throws org.opensubsystems.core.error.OSSException
Update the on hold count for specified item by specified relative values. It means that the item is still in the inventory but it was reserved. Using flag caller can specify if the count should be updated even if there is not enough available items. This can be used in the situation when we allow user to place request without having necessary inventory.

Specified by:
changeOnHoldCount in interface ItemFactory
Parameters:
iItemTypeId - - id of the Item
iOnHoldCountChange - - increment (positive) or decrement (negative) value
bOnlyIfAvailable - - if true then the on hold count will be updated only if available that is (item count - already on hold item count >= the new on hold item count) (that means there are some items which are available which were not reserved yet)
iDomainId - - id of domain in which the item is supposed to exist
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

changeOnHoldCount

public void changeOnHoldCount(java.util.List lstChanges,
                              boolean bOnlyIfAvailable,
                              int iDomainId)
                       throws org.opensubsystems.core.error.OSSException
Update the on hold count for specified item, which means that the item is still in the inventory but it was reserved. Using flag caller can specify if the count should be updated even if there is not enough available items. This can be used in the situation wen we alow user to place request without having necessary inventory.

Specified by:
changeOnHoldCount in interface ItemFactory
Parameters:
lstChanges - - list of TwoIntStructs where the first int is the item id and the second int is the integer value (positive or negative) to change the count by
bOnlyIfAvailable - - if true then the on hold count will be updated only if available that is (item count - already on hold item count >= the new on hold item count) (that means there are some items which are available which were not reserved yet)
iDomainId - - id of domain in which the items are supposed to exist
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

changeAvailableCount

public void changeAvailableCount(int iItemId,
                                 int iAvailableCountChange,
                                 int iDomainId)
                          throws org.opensubsystems.core.error.OSSException
Change the available count for specified items by specified relative values. If the value is positive the available item count will be increased otherwise it will be decreased. This means that the item was either taken out of the inventory or returned to the inventory. Remember that the available count is just cached copy and it should be always equal to sum of units of this item.

Specified by:
changeAvailableCount in interface ItemFactory
Parameters:
iItemId - - id of the Item
iAvailableCountChange - - value to increment or decrement available count by
iDomainId - - id of domain in which the item is supposed to exist
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

changeAvailableCount

public boolean changeAvailableCount(java.util.List lstChanges,
                                    int iDomainId)
                             throws org.opensubsystems.core.error.OSSException
Change the available count for specified items by specified relative values. If the value is positive the available item count will be increased otherwise it will be decreased. This means that the item was either taken out of the inventory or returned to the inventory. Remember that the available count is just cached copy and it should be always equal to sum of units of this item.

Specified by:
changeAvailableCount in interface ItemFactory
Parameters:
lstChanges - - list of TwoIntStructs where the first int is the item id and the second int is the integer value (positive or negative) to change the count by
iDomainId - - id of domain in which the items are supposed to exist
Returns:
boolean - sucess flag
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

changeShippedAndAvailableCount

public boolean changeShippedAndAvailableCount(int iItemId,
                                              int iAvailableCountChange,
                                              int iDomainId)
                                       throws org.opensubsystems.core.error.OSSException
Update the shipped and available count for specified item. If the value is positive the shipped and available item count will be increased otherwise it will be decreased. This means that the item was either removed out of the inventory or shipped to the inventory. Remember that the shipped and available counts are just cached copy and they should be always equal to sum of units of this item.

Specified by:
changeShippedAndAvailableCount in interface ItemFactory
Parameters:
iItemId - - id of the Item
iAvailableCountChange - - value to increment or decrement the shipped and available count by
iDomainId - - id of domain in which the item is supposed to exist
Returns:
boolean - sucess flag
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

changeShippedAndAvailableCount

public boolean changeShippedAndAvailableCount(java.util.List lstChanges)
                                       throws org.opensubsystems.core.error.OSSException
Update the shipped and available count for specified item. If the value is positive the shipped and available item count will be increased otherwise it will be decreased. This means that the item was either removed out of the inventory or shipped to the inventory. Remember that the shipped and available counts are just cached copy and they should be always equal to sum of nits of this item.

Specified by:
changeShippedAndAvailableCount in interface ItemFactory
Parameters:
lstChanges - - list of TwoIntStructs where the first int is the item id and the second int is the integer shipped and available count value (positiveor negative) to change the count by
Returns:
boolean - sucess flag
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

changeShippedAndAvailableCountSafely

public boolean changeShippedAndAvailableCountSafely(java.util.List lstChanges)
                                             throws org.opensubsystems.core.error.OSSException
Update the shipped and available count for specified item. If the value is positive the shipped available item count will be increased otherwise it will be decreased. This means that the item was either removed out of the inventory or shipped to the inventory. Remember that the shipped and available counts are just cached copy and they should be always equal to sum of units of this item. This is "safe" variant of function. This variant check if after change the available or the shipped will be >= 0 and it changes it only if this condition is satified.

Specified by:
changeShippedAndAvailableCountSafely in interface ItemFactory
Parameters:
lstChanges - - list of TwoIntStructs where the first int is the item id and the second int is the integer shipped and available count value (positive or negative) to change the count by
Returns:
boolean - sucess flag
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

getMainCategoryId

public int getMainCategoryId(int iItemId)
                      throws org.opensubsystems.core.error.OSSException
Get id of item type main category. TODO: For Miro: Figure out what this method means? I didn't know there is one main category for an item type. Should we call this root category?

Specified by:
getMainCategoryId in interface ItemFactory
Parameters:
iItemId - - Item id
Returns:
int - id of main category for item
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

getSubcategoryIds

public java.util.List getSubcategoryIds(int iItemId)
                                 throws org.opensubsystems.core.error.OSSException
Get id of ite type main category TODO: For Miro: Figure out what this method means? Item type should be able to be at multiple level of subcategories.

Specified by:
getSubcategoryIds in interface ItemFactory
Parameters:
iItemId - - item id
Returns:
List - ids for all item type subcategories
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

getIdsInCategory

public java.util.List getIdsInCategory(int iRootCategoryId)
                                throws org.opensubsystems.core.error.OSSException
Get ids of all items for category with id TODO: For Miro: Figure out what this method means? Will it return items from all subcategories or just the one specified? Should we call this main or root?

Specified by:
getIdsInCategory in interface ItemFactory
Parameters:
iRootCategoryId - - id of root category
Returns:
List - ids of items in given root category
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

getAllEmptyCategories

public int[] getAllEmptyCategories(int iInventoryId,
                                   int[] arrIds)
                            throws org.opensubsystems.core.error.OSSException
Get IDs for all empty categories belonging to the specified inventory. Category is empty when it doesn't contain any items.

Specified by:
getAllEmptyCategories in interface ItemFactory
Parameters:
iInventoryId - - inventory to find empty categories in
arrIds - - array of category IDs to delete, can be null to get all empty categories
Returns:
int[] - array of ids for empty categories
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

changeCounts

protected void changeCounts(java.sql.PreparedStatement updateStatement,
                            int iItemId,
                            int iAvailableCountChange,
                            int iOnHoldCountChange,
                            int iDomaindId)
                     throws org.opensubsystems.core.error.OSSException
Update the on hold cont and available count for specified item. Values will be changed only if changed available count >= 0 and changed onhold count >= 0

Parameters:
updateStatement - - PreparedStatement with sql
iItemId - - ID of the Item
iAvailableCountChange - - increment or decrement value
iOnHoldCountChange - - increment or decrement value
iDomaindId - - id of domain in which the item is supposed to exist
Throws:
org.opensubsystems.core.error.OSSException - - error message

changeOnHoldCount

protected int changeOnHoldCount(java.sql.PreparedStatement updateStatement,
                                int iItemId,
                                int iOnHoldCountChange,
                                boolean bOnlyIfAvailable)
                         throws org.opensubsystems.core.error.OSSException
Update the on hold count for specified item, which means that the item is still in the inventory but it was reserved. Using flag caller can specify if the count should be updated even if there is not enough available items. This can be used in the situation wen we alow user to place request without having necessary inventory.

Parameters:
updateStatement - - JDBC statement to use
iItemId - - item id
iOnHoldCountChange - - value to add or subtract
bOnlyIfAvailable - - if true then the on hold count will be updated only if available item count - already on hold item count >= then new on hold item count (that means there are some items which are available which were not reserved yet)
Returns:
updateCout - how many items were updated
Throws:
org.opensubsystems.core.error.OSSException - - database error

checkOnHoldChangeError

protected void checkOnHoldChangeError(int iItemId,
                                      int iOnHoldCountChange,
                                      int iUpdateCount,
                                      int iDomainId)
                               throws org.opensubsystems.core.error.OSSException
Check what type of error has occured during update of on hold count.

Parameters:
iItemId - - item during update of which an error has occured
iOnHoldCountChange - - what should have been the new on hold count
iUpdateCount - - how many database lines were updated
iDomaindId - - id of domain in which the item is supposed to exist
Throws:
org.opensubsystems.core.error.OSSException - - correct error describing what has happened

changeAvailableCount

protected int changeAvailableCount(java.sql.PreparedStatement updateStatement,
                                   int iItemId,
                                   int iAvailableCountChange)
                            throws org.opensubsystems.core.error.OSSException
Change the available count for specified inventory items by specified relative values. If the value is positive the available item count will be increased otherwise it will be decreased.

Parameters:
updateStatement - - JDBC statement to use
iItemId - - item id
iAvailableCountChange - - value to add or subtract
Returns:
updateCout - how many items were updated
Throws:
org.opensubsystems.core.error.OSSException - - database error

checkAvailableChangeError

protected void checkAvailableChangeError(int iItemId,
                                         int iUpdateCount,
                                         int iDomainId)
                                  throws org.opensubsystems.core.error.OSSException
Check what type of error has occured during update of available count.

Parameters:
iItemId - - item during update of which an error has occured
iUpdateCount - - how many database lines were updated
iDomaindId - - id of domain in which the item is supposed to exist
Throws:
org.opensubsystems.core.error.OSSException - - correct error describing what has happened

changeShippedAndAvailableCount

protected int changeShippedAndAvailableCount(java.sql.PreparedStatement updateStatement,
                                             int iItemId,
                                             int iAvailableCountChange,
                                             boolean isSecure)
                                      throws org.opensubsystems.core.error.OSSException
Change the shipped and available count for specified inventory items by specified relative values. If the value is positive the available item count will be increased otherwise it will be decreased.

Parameters:
updateStatement - - JDBC statement to use
iItemId - - item id
iAvailableCountChange - - value to add or subtract
isSecure - - use "secure" variant of sql statement
Returns:
updateCout - how many items were updated
Throws:
org.opensubsystems.core.error.OSSException - - database error

insertItemCategories

protected int insertItemCategories(java.sql.Connection cntConnection,
                                   int iItemId,
                                   int[] arrCategoryIds)
                            throws org.opensubsystems.core.error.OSSException
Assign new categories to item. This method is shared so that the calling method can control the transaction per connection.

Parameters:
cntConnection - - connection to use
iItemId - - ID of the item
arrCategoryIds - - array of category IDs
Returns:
int - number of assigned items
Throws:
org.opensubsystems.core.error.OSSException - - error during insert


Copyright © 2003 - 2006 OpenSubsystems s.r.o.