org.opensubsystems.inventory.persist
Interface CategoryFactory

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:
CategoryDatabaseFactory

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

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

Version:
$Id: CategoryFactory.java,v 1.10 2007/01/07 06:14:31 bastafidli Exp $
Author:
Martin Cerba
Code reviewer:
Miro Halas
Code reviewed:
1.6 2005/12/17 00:40:32 jlegeny

Method Summary
 int deleteRoot(int iId, org.opensubsystems.patterns.listdata.data.SimpleRule listSecurityData)
          Delete root category with all subcategories contained in this category.
 int deleteRoots(int[] arrIds, org.opensubsystems.patterns.listdata.data.SimpleRule listSecurityData)
          Delete all specified root categories with all its subcategories contained in.
 Category get(int iParentId, java.lang.String strName)
          Get category based on unique combination of name and parent id.
 int getActualCount(int[] arrIds)
          Get actual number of categories that still exists within the DB.
 boolean verifyUniqueCategory(Category category)
          Get result for category existence.
 
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

Category get(int iParentId,
             java.lang.String strName)
             throws org.opensubsystems.core.error.OSSException
Get category based on unique combination of name and parent id.

Parameters:
iParentId - - parent id of the category
strName - - name of the subcategory under given parent
Returns:
Category - category with specified parent id and name or null if not found
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

deleteRoot

int deleteRoot(int iId,
               org.opensubsystems.patterns.listdata.data.SimpleRule listSecurityData)
               throws org.opensubsystems.core.error.OSSException
Delete root category with all subcategories contained in this category. The regular delete method deletes the category only if it is empty while this method will delete even non empty category by deleting all subcategories.

Parameters:
iId - - id of category that has to be deleted
listSecurityData - - security data describing what data can be deleted
Returns:
int - number of deleted categories and subcategories
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

deleteRoots

int deleteRoots(int[] arrIds,
                org.opensubsystems.patterns.listdata.data.SimpleRule listSecurityData)
                throws org.opensubsystems.core.error.OSSException
Delete all specified root categories with all its subcategories contained in. The regular delete method deletes the category only if it is empty.

Parameters:
arrIds - - array of category ids that has to be deleted
listSecurityData - - security data describing what data can be deleted
Returns:
int - number of deleted categories and subcategories
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

getActualCount

int getActualCount(int[] arrIds)
                   throws org.opensubsystems.core.error.OSSException
Get actual number of categories that still exists within the DB. This doesn't uses security because this method is used within the controller for checking of security of list of data to process.

Parameters:
arrIds - - array of category IDs that has to be counted
Returns:
int - number of existing categories
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured

verifyUniqueCategory

boolean verifyUniqueCategory(Category category)
                             throws org.opensubsystems.core.error.OSSException
Get result for category existence. This is used for manual unique constraint checking for attributes: DOMAIN_ID, INVENTORY_ID, PARENT_ID, NAME

Parameters:
category - - Category object
Returns:
boolean - flag signaling if particular category already exists (manual check of unique constrain on 4 attributes)
Throws:
org.opensubsystems.core.error.OSSException - - an error has occured


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