org.opensubsystems.inventory.persist
Interface ItemFactory

All Superinterfaces:
org.opensubsystems.core.persist.BasicDataFactory, org.opensubsystems.core.persist.DataFactory, org.opensubsystems.patterns.listdata.persist.ListFactory, org.opensubsystems.core.persist.ModifiableDataFactory
All Known Implementing Classes:
ItemDatabaseFactory

public interface ItemFactory
extends org.opensubsystems.core.persist.ModifiableDataFactory, org.opensubsystems.patterns.listdata.persist.ListFactory

Methods to create, retrieve and manipulate items in the persistence store.

Version:
$Id: ItemFactory.java,v 1.9 2007/01/28 06:54:54 bastafidli Exp $
Author:
Martin Cerba
Code reviewer:
Miro Halas
Code reviewed:
1.5 2006/01/16 21:35:25 jlegeny

Method Summary
 boolean addToCategories(int iItemId, int[] arrCategoryIds)
          Add item type to a specified categories.
 boolean addToCategory(int iItemId, int iCategoryId)
          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.
 void changeCounts(int iItemId, 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.
 void changeOnHoldCount(int iItemId, 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.
 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.
 boolean changeShippedAndAvailableCountSafely(java.util.List lstChanges)
          Update the shipped and available count for specified item.
 Item get(int iInventoryId, java.lang.String strName)
          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 lTime, 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.
 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.
 
Methods inherited from interface org.opensubsystems.core.persist.ModifiableDataFactory
save
 
Methods inherited from interface org.opensubsystems.core.persist.BasicDataFactory
create, create, delete
 
Methods inherited from interface org.opensubsystems.core.persist.DataFactory
get, getDataType
 
Methods inherited from interface org.opensubsystems.patterns.listdata.persist.ListFactory
get, getDefaultListDefinition
 

Method Detail

get

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

Parameters:
iInventoryId - - id of the inventory from where to get the Item
strName - - 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

changeOnHoldCount

void changeOnHoldCount(int iItemId,
                       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.

Parameters:
iItemId - - 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

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.

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

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.

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

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.

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

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.

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

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.

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

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.

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

changeCounts

void changeCounts(int iItemId,
                  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.

Parameters:
iItemId - - 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

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.

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

addToCategory

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

Parameters:
iItemId - - id of item to add to category
iCategoryId - - id of cateogry to add the item type to
Returns:
boolean - success flag
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

addToCategories

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

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

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

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

getCategories

org.opensubsystems.core.util.TwoIntStruct[] getCategories(long lTime,
                                                          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.

Parameters:
lTime - - 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

removeFromAllCategories

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

Parameters:
iItemId - - Item id
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

getMainCategoryId

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?

Parameters:
iItemId - - Item id
Returns:
int - id of main category for item
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

getSubcategoryIds

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.

Parameters:
iItemId - - item id
Returns:
List - ids for all item type subcategories
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

getIdsInCategory

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?

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

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.

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


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