Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.knowgate.hipergate
Class Category

    java.lang.Object
      com.knowgate.dataobjs.DBPersist
          com.knowgate.hipergate.Category

All Implemented Interfaces:
  java.io.Serializable, java.util.Map

Direct Known Subclasses:
  NewsGroup

    public class Category

extends DBPersist

Categories from k_categories database table

See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from interface java.util.Map
`java.util.Map.Entry<K,V>`

Field Summary
`static int` | `BROWSE_BOTTOMUP`
`static int` | `BROWSE_DOWN`
`static int` | `BROWSE_TOPDOWN`
`static int` | `BROWSE_UP`
`static short` | `ClassId`

Fields inherited from class com.knowgate.dataobjs.DBPersist
`AllVals, sAuditCls, sAuditUsr, sTransactId`

Constructor Summary
`` | `Category()` Create empty Category
`` | `Category(JDCConnection oConn, java.lang.String sIdCategory)` Load Category from database
`` | `Category(java.lang.String sIdCategory)` Create Category and set gu_category.
`protected` | `Category(java.lang.String sTableName, java.lang.String sClassName)`

Method Summary
`int` | `addObject(java.sql.Connection oConn, java.lang.String sIdObject, int iIdClass, int iAttribs, int iOdPosition)` Add object to Category.
`java.util.LinkedList<Category>` | `browse(JDCConnection oConn, int iDirection, int iOrder)` Get a list of all parents or childs of a Category.
`void` | `checkIn(JDCConnection oConn, java.lang.String sUserId)` Check-in all documents from this Category and all its subcategories
`void` | `checkOut(JDCConnection oConn, java.lang.String sUserId)` Check-out all documents from this Category and all its subcategories
`static java.lang.String` | `create(JDCConnection oConn, java.lang.Object[] Values)` Create new Category with translated labels.
`boolean` | `delete(JDCConnection oConn)` Delete Category and all its childs.
`static boolean` | `delete(JDCConnection oConn, java.lang.String sCategoryGUID)` Delete Category and all its childs.
`void` | `expand(java.sql.Connection oConn)` Expand all Category childs.
`DBSubset` | `getACLGroups(JDCConnection oConn)` Get Groups with permissions over this Category.
`DBSubset` | `getACLUsers(JDCConnection oConn)` Get Users with direct permissions over this Category.
`DBSubset` | `getChilds(JDCConnection oConn)` Get first level childs as a DBSubset.
`int` | `getDomainId(JDCConnection oConn)` Get integer indentifier of the domain to which this category belongs
`int` | `getGroupPermissions(java.sql.Connection oConn, java.lang.String sIdGroup)` Get permissions mas of a group over this category If there is no explicit permissions mask set at k_x_cat_group_acl for given group and this category, then the category hierarchy is scanned upwards and the permissions of the closest parent are assumed to be the ones of this category.
`static java.lang.String` | `getIdFromName(JDCConnection oConn, java.lang.String sCategoryNm)` Get Category GUID given its internal name.
`boolean` | `getIsRoot(java.sql.Connection oConn)`
`java.lang.String` | `getLabel(java.sql.Connection oConn, java.lang.String sLanguage)` Get translated label for a category.
`DBSubset` | `getNames(JDCConnection oConn)` Get Category translated labels as a DBSubset.
`DBSubset` | `getObjects(JDCConnection oConn)` Get objects contained at Category.
`DBSubset` | `getObjectsOfClass(JDCConnection oConn, short iClassId)` Get objects contained at Category.
`DBSubset` | `getParents(JDCConnection oConn)` Get inmediate parents as a DBSubset.
`java.lang.String` | `getPath(java.sql.Connection oConn)` Compose a path to Category by concatenating all parents names.
`Product[]` | `getProducts(JDCConnection oConn, java.lang.String sOrderBy)` Get Products contained at this Category
`int` | `getUserPermissions(java.sql.Connection oConn, java.lang.String sIdUser)` Get User permissions for Category Calls k_sp_cat_usr_perm stored procedure.
`void` | `inheritPermissions(JDCConnection oConn, java.lang.String sFromCategory, short iRecurse, short iObjects)` Inherits permissions from another Category.
`boolean` | `isChildOf(java.sql.Connection oConn, java.lang.String sParentCategory)` Get whether or not this category descends at any level from another one.
`boolean` | `isParentOf(java.sql.Connection oConn, java.lang.String sChildCategory)` Get whether or not this category is parent at any level of another one.
`int` | `level(JDCConnection oConn)` Get category depth level.
`static java.lang.String` | `makeName(JDCConnection oConn, java.lang.String sCategoryNm)` Make an internal category name from an arbitrary string.
`void` | `removeGroupPermissions(java.sql.Connection oConn, java.lang.String sIdGroups, short iRecurse, short iObjects)` Set group permissions.
`int` | `removeObject(java.sql.Connection oConn, java.lang.String sIdObject)` Remove object from Category Removing an object from a Category does not delete it.
`int` | `removeObject(java.sql.Connection oConn, java.lang.String sIdObject, int iClassId)` Remove object from Category Removing an object from a Category does not delete it.
`void` | `removeUserPermissions(java.sql.Connection oConn, java.lang.String sIdUsers, short iRecurse, short iObjects)` Remove permissions for user at a Category.
`void` | `resetParent(java.sql.Connection oConn, java.lang.String sIdParent)` Remove Category from parent.
`void` | `setGroupPermissions(java.sql.Connection oConn, java.lang.String sIdGroups, int iACLMask, short iRecurse, short iObjects)` Set group permissions for Category Calls k_sp_cat_set_grp stored procedure.
`void` | `setIsRoot(java.sql.Connection oConn, boolean bIsRoot)` Make or unmake a root category.
`void` | `setLabel(java.sql.Connection oConn, java.lang.String sTr)` Set category label for all supported languages
`void` | `setParent(java.sql.Connection oConn, java.lang.String sIdParent)` Set New Parent for this category.
`void` | `setUserPermissions(java.sql.Connection oConn, java.lang.String sIdUsers, int iACLMask, short iRecurse, short iObjects)` Set user permissions for a Category.
`boolean` | `store(JDCConnection oConn)` Store Category.
`static java.lang.String` | `store(JDCConnection oConn, java.lang.String sCategoryId, java.lang.String sParentId, java.lang.String sCategoryName, short iIsActive, int iDocStatus, java.lang.String sOwner, java.lang.String sIcon1, java.lang.String sIcon2)` Create or Store Category.
`void` | `storeLabels(JDCConnection oConn, java.lang.String sNamesTable, java.lang.String sRowDelim, java.lang.String sColDelim)` Store a set of labels for this category This method takes a string of the form "en;Root|es;Raíz|fr;Racine|it;Radice|ru;Корень" and store one label for each {language,literal} pair
`java.lang.String` | `toXMLWithLabels(JDCConnection oConn)` Get an XML dump for the Category values plus nodes for translated labels
`java.lang.String` | `toXMLWithLabels(JDCConnection oConn, java.lang.String sIdent)` Get an XML dump for the Category values plus nodes for translated labels
`java.lang.String` | `toXMLWithLabels(JDCConnection oConn, java.lang.String sIdent, java.lang.String sDelim)` Get an XML dump for the Category values plus nodes for translated labels
`void` | `uploadDirectory(JDCConnection oConn, java.lang.String sSourcePath, java.lang.String sProtocol, java.lang.String sServer, java.lang.String sTargetPath, java.lang.String sLanguage)` Copy a directory and index all its files as products inside this Category

Methods inherited from class com.knowgate.dataobjs.DBPersist
`allcaps, allcaps, changelog, clear, clone, containsKey, containsValue, entrySet, exists, get, get, getAuditClassName, getCreationDate, getDate, getDateFormated, getDateShort, getDateTime, getDateTime24, getDecimal, getDecimalFormated, getDecimalFormated, getDouble, getDoubleFormated, getFloat, getFloatFormated, getInt, getInteger, getIntervalPart, getItemMap, getItems, getMoney, getShort, getSQLDate, getSQLTime, getString, getStringHtml, getStringNull, getTable, getTable, getTableName, getTime, getTimeOfDay, getTimestamp, getUIdFromName, isEmpty, isNull, iterator, keySet, load, load, parseXML, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, putAll, putAll, remove, remove, replace, replace, replace, replace, replace, replace, replace, replace, setAuditTransact, setAuditUser, setCreationDate, size, toLowerCase, toUpperCase, toXML, toXML, toXML, toXML, values`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface java.util.Map
`equals, hashCode`

Field Detail

### BROWSE_UP

    public static final int BROWSE_UP

See Also:
  Constant Field Values

### BROWSE_DOWN

    public static final int BROWSE_DOWN

See Also:
  Constant Field Values

### BROWSE_TOPDOWN

    public static final int BROWSE_TOPDOWN

See Also:
  Constant Field Values

### BROWSE_BOTTOMUP

    public static final int BROWSE_BOTTOMUP

See Also:
  Constant Field Values

### ClassId

    public static final short ClassId

See Also:
  Constant Field Values

Constructor Detail

### Category

    public Category()

  Create empty Category

### Category

    public Category(java.lang.String sIdCategory)
             throws java.sql.SQLException

  Create Category and set gu_category.

  Parameters:
    `sIdCategory` - Category GUID
  Throws:
    `java.sql.SQLException`

### Category

    public Category(JDCConnection oConn,
                    java.lang.String sIdCategory)
             throws java.sql.SQLException

  Load Category from database

  Parameters:
    `oConn` - Database Connection
    `sIdCategory` - Category GUID
  Throws:
    `java.sql.SQLException`

### Category

    protected Category(java.lang.String sTableName,
                       java.lang.String sClassName)

Method Detail

### browse

    public java.util.LinkedList<Category> browse(JDCConnection oConn,
                                                 int iDirection,
                                                 int iOrder)
                                          throws java.sql.SQLException

  Get a list of all parents or childs of a Category.

  All levels up or down are scanned recursively.

  Parameters:
    `oConn` - Database Connection
    `iDirection` - BROWSE_UP for browsing parents or BROWSE_DOWN for browsing childs.
    `iOrder` - BROWSE_TOPDOWN first element on the list will be the top most parent, BROWSE_BOTTOMUP first element on the list will be the deepest child.
  Returns:
    LinkedList of Category objects.
  Throws:
    `java.sql.SQLException`

### getPath

    public java.lang.String getPath(java.sql.Connection oConn)
                             throws java.sql.SQLException

  Compose a path to Category by concatenating all parents names.

  Calls k_sp_get_cat_path.
  Category parents are found and each parent name is extracted.
  Then parent names are contenated in order separated by slash '/' characters.
  This method is usefull when creating a physical directory path for files belonging to Products contained in a Category. This way the directory paths can mimmic the category tree structure.

  Parameters:
    `oConn` - Database Connection
  Returns:
    String with Category parent names concatenated with slash '/' characters. For example "ROOT/DOMAINS/SYSTEM/SYSTEM_APPS/SYSTEM_apps_webbuilder"
  Throws:
    `java.sql.SQLException`

### delete

    public boolean delete(JDCConnection oConn)
                   throws java.sql.SQLException

  Delete Category and all its childs.

  First delete all Products and Companies contained in Category, including physical disk files associted with Products and Company attachments.
  Then call k_sp_del_category_r stored procedure and perform recursive deletion of all childs.

  Overrides:
    `delete` in class `DBPersist`
  Parameters:
    `oConn` - Database Connection
  Returns:
    true if register was successfully erased, false if not.
  Throws:
    `java.sql.SQLException`

### addObject

    public int addObject(java.sql.Connection oConn,
                         java.lang.String sIdObject,
                         int iIdClass,
                         int iAttribs,
                         int iOdPosition)
                  throws java.sql.SQLException

  Add object to Category.

  The object GUID and numeric class identifier is inserted at k_x_cat_objs table.

  Parameters:
    `oConn` - Database Connection
    `sIdObject` - Object GUID
    `iIdClass` - Object Numeric Class Identifier (variable ClassId)
    `iAttribs` - Object attributes mask (user defined)
    `iOdPosition` - Object Position. An arbitrary position for the object inside the category. Position is not unique for an object. Two or more objects may have the same position.
  Throws:
    `java.sql.SQLException` - If object is alredy contanied in Category then a primary key violation exception is raised.

### removeObject

    public int removeObject(java.sql.Connection oConn,
                            java.lang.String sIdObject)
                     throws java.sql.SQLException

  Remove object from Category

  Removing an object from a Category does not delete it.

  Parameters:
    `oConn` - Database Connection
    `sIdObject` - Object GUID
  Returns:
    1 if object was present at category, 0 if object was not present at category.
  Throws:
    `java.sql.SQLException`

### removeObject

    public int removeObject(java.sql.Connection oConn,
                            java.lang.String sIdObject,
                            int iClassId)
                     throws java.sql.SQLException

  Remove object from Category

  Removing an object from a Category does not delete it.

  Parameters:
    `oConn` - Database Connection
    `sIdObject` - Object GUID
    `iClassId` - Object Class Numeric Identifier
  Returns:
    1 if object was present at category, 0 if object was not present at category.
  Throws:
    `java.sql.SQLException`
  Since:
    4.0

### removeGroupPermissions

    public void removeGroupPermissions(java.sql.Connection oConn,
                                       java.lang.String sIdGroups,
                                       short iRecurse,
                                       short iObjects)
                                throws java.sql.SQLException

  Set group permissions.

  Calls k_sp_cat_del_grp stored procedure.

  Parameters:
    `oConn` - Database Connection
    `sIdGroups` - String of comma separated GUIDs of ACLGroups with permissions to remove.
    `iRecurse` - Remove permissions also from childs Categories all levels down.
    `iObjects` - Not Used, must be zero.
  Throws:
    `java.sql.SQLException`

### setGroupPermissions

    public void setGroupPermissions(java.sql.Connection oConn,
                                    java.lang.String sIdGroups,
                                    int iACLMask,
                                    short iRecurse,
                                    short iObjects)
                             throws java.sql.SQLException

  Set group permissions for Category

  Calls k_sp_cat_set_grp stored procedure.

  Parameters:
    `oConn` - Database Connection
    `sIdGroups` - String of comma separated GUIDs of ACLGroups with permissions to set.
    `iACLMask` - Permissions mask, any combination of { ACL.PERMISSION_LIST, ACL.PERMISSION_READ,ACL.PERMISSION_ADD,ACL.PERMISSION_DELETE,ACL.PERMISSION_MODIFY, ACL.PERMISSION_MODERATE,ACL.PERMISSION_SEND,ACL.PERMISSION_GRANT, ACL.PERMISSION_FULL_CONTROL }
    `iRecurse` - Remove permissions also from childs Categories all levels down.
    `iObjects` - Not Used, must be zero.
  Throws:
    `java.sql.SQLException`
  See Also:
    `ACL`

### getUserPermissions

    public int getUserPermissions(java.sql.Connection oConn,
                                  java.lang.String sIdUser)
                           throws java.sql.SQLException

  Get User permissions for Category

  Calls k_sp_cat_usr_perm stored procedure.
  User permissions are those granted directy to user plus those grants indirectly by assigning permisssion to a group witch the user belongs to.
  Permissions are accumulative; a user gains new permissions by belonging to new groups. All permissions are of grant type, there are no deny permissions.

  Parameters:
    `oConn` - Database Connection
    `sIdUser` - User GUID
  Returns:
    User permissions mask. Any combination of: { ACL.PERMISSION_LIST, ACL.PERMISSION_READ,ACL.PERMISSION_ADD, ACL.PERMISSION_DELETE,ACL.PERMISSION_MODIFY, ACL.PERMISSION_MODERATE, ACL.PERMISSION_SEND,ACL.PERMISSION_GRANT,ACL.PERMISSION_FULL_CONTROL }
  Throws:
    `java.sql.SQLException`

### getGroupPermissions

    public int getGroupPermissions(java.sql.Connection oConn,
                                   java.lang.String sIdGroup)
                            throws java.sql.SQLException

  Get permissions mas of a group over this category

  If there is no explicit permissions mask set at k_x_cat_group_acl for given group and this category, then the category hierarchy is scanned upwards and the permissions of the closest parent are assumed to be the ones of this category. If no parent has explicit permissions set for given group then return value is zero.

  Parameters:
    `oConn` - Database Connection
    `sIdGroup` - ACLGroup GUID
  Returns:
    Group permissions mask. Any combination of: { ACL.PERMISSION_LIST, ACL.PERMISSION_READ,ACL.PERMISSION_ADD, ACL.PERMISSION_DELETE,ACL.PERMISSION_MODIFY, ACL.PERMISSION_MODERATE, ACL.PERMISSION_SEND,ACL.PERMISSION_GRANT,ACL.PERMISSION_FULL_CONTROL }
  Throws:
    `java.sql.SQLException`
  Since:
    3.0

### removeUserPermissions

    public void removeUserPermissions(java.sql.Connection oConn,
                                      java.lang.String sIdUsers,
                                      short iRecurse,
                                      short iObjects)
                               throws java.sql.SQLException

  Remove permissions for user at a Category.

  Calls k_sp_cat_del_usr.
  Only permissions directly granted to user are removed.
  Permissions obtained by belonging to a Group remain active.

  Parameters:
    `oConn` - Database Connection
    `sIdUsers` - String of user GUIDs separated by commas.
    `iRecurse` - Remove permissions from child categories.
    `iObjects` - Not used, must be zero.
  Throws:
    `java.sql.SQLException`

### setUserPermissions

    public void setUserPermissions(java.sql.Connection oConn,
                                   java.lang.String sIdUsers,
                                   int iACLMask,
                                   short iRecurse,
                                   short iObjects)
                            throws java.sql.SQLException

  Set user permissions for a Category.

  Calls k_sp_cat_set_usr stored procedure.

  Parameters:
    `oConn` - Database Connection
    `sIdUsers` - String of user GUIDs separated by commas.
    `iACLMask` - Permissions mask. Any combination of: { ACL.PERMISSION_LIST, ACL.PERMISSION_READ,ACL.PERMISSION_ADD, ACL.PERMISSION_DELETE,ACL.PERMISSION_MODIFY, ACL.PERMISSION_MODERATE, ACL.PERMISSION_SEND,ACL.PERMISSION_GRANT,ACL.PERMISSION_FULL_CONTROL }
    `iRecurse` - Remove permissions from child categories.
    `iObjects` - Not used, must be zero.
  Throws:
    `java.sql.SQLException`

### inheritPermissions

    public void inheritPermissions(JDCConnection oConn,
                                   java.lang.String sFromCategory,
                                   short iRecurse,
                                   short iObjects)
                            throws java.sql.SQLException

  Inherits permissions from another Category.

  All previous permissions on this Category are removed before copying permission from the other Category.

  Parameters:
    `oConn` - Database Connection
    `sFromCategory` - GUID of category with permissions to be inherited.
    `iRecurse` - Propagate permissions to child categories.
    `iObjects` - Not used, must be zero.
  Throws:
    `java.sql.SQLException`

### isChildOf

    public boolean isChildOf(java.sql.Connection oConn,
                             java.lang.String sParentCategory)
                      throws java.sql.SQLException

  Get whether or not this category descends at any level from another one.

  Parameters:
    `oConn` - Database Connection
    `sParentCategory` - Parent category
  Returns:
    true if this category descends at any level of depth from sParentCategory.
  Throws:
    `java.sql.SQLException`

### isParentOf

    public boolean isParentOf(java.sql.Connection oConn,
                              java.lang.String sChildCategory)
                       throws java.sql.SQLException

  Get whether or not this category is parent at any level of another one.

  Parameters:
    `oConn` - Database Connection
    `sChildCategory` - Child Category GUID
  Returns:
    true if this category is parent at any level.
  Throws:
    `java.sql.SQLException`

### level

    public int level(JDCConnection oConn)
              throws java.sql.SQLException

  Get category depth level.

  Calls k_sp_cat_level stored procedure.
  Root Categories have level 1.

  Parameters:
    `oConn` - Database Connection
  Returns:
    Category depth evel starting at 1.
  Throws:
    `java.sql.SQLException`

### getIsRoot

    public boolean getIsRoot(java.sql.Connection oConn)
                      throws java.sql.SQLException

  Parameters:
    `oConn` - Database Connection
  Returns:
    true if Category is present at k_cat_root table.
  Throws:
    `java.sql.SQLException`

### setIsRoot

    public void setIsRoot(java.sql.Connection oConn,
                          boolean bIsRoot)
                   throws java.sql.SQLException

  Make or unmake a root category.

  Parameters:
    `oConn` - Database Connection
    `bIsRoot` - true if category is to be made root.
  Throws:
    `java.sql.SQLException` - If This Category is present as a child of another category at k_cat_tree table.

### getLabel

    public java.lang.String getLabel(java.sql.Connection oConn,
                                     java.lang.String sLanguage)
                              throws java.sql.SQLException

  Get translated label for a category.

  Parameters:
    `oConn` - Database Connection
    `sLanguage` - Language code from k_lu_languages table.
  Returns:
    Translated label or null if no translated label for such language was found at k_cat_labels table.
  Throws:
    `java.sql.SQLException`

### setLabel

    public void setLabel(java.sql.Connection oConn,
                         java.lang.String sTr)
                  throws java.sql.SQLException

  Set category label for all supported languages

  Parameters:
    `oConn` - Database connection
    `sTr` - Label
  Throws:
    `java.sql.SQLException`
    `java.lang.NullPointerException` - if label is null or empty string
  Since:
    5.0

### getNames

    public DBSubset getNames(JDCConnection oConn)
                      throws java.sql.SQLException

  Get Category translated labels as a DBSubset.

  Parameters:
    `oConn` - Database Connection
  Returns:
    DBSubset with columns:

    id_language | tr_category | url_category
    2 chras. Lang. Id. | Translated Category Name | URL for Category

  Throws:
    `java.sql.SQLException`

### getChilds

    public DBSubset getChilds(JDCConnection oConn)
                       throws java.sql.SQLException

  Get first level childs as a DBSubset.

  Parameters:
    `oConn` - Database Connection
  Returns:
    Single column DBSubset with child GUIDs
  Throws:
    `java.sql.SQLException`

### getParents

    public DBSubset getParents(JDCConnection oConn)
                        throws java.sql.SQLException

  Get inmediate parents as a DBSubset.

  Parameters:
    `oConn` - Database Connection
  Returns:
    Single column DBSubset with parent GUIDs
  Throws:
    `java.sql.SQLException`

### getObjects

    public DBSubset getObjects(JDCConnection oConn)
                        throws java.sql.SQLException

  Get objects contained at Category.

  Parameters:
    `oConn` - Database Connection
  Returns:
    DBSubset with columns:

    gu_object | id_class | bi_attribs

  Throws:
    `java.sql.SQLException`

### getObjectsOfClass

    public DBSubset getObjectsOfClass(JDCConnection oConn,
                                      short iClassId)
                               throws java.sql.SQLException

  Get objects contained at Category.

  Parameters:
    `oConn` - Database Connection
    `Numeric` - identifier of class to get (ClassId member variable value)
  Returns:
    DBSubset with columns:

    gu_object | id_class | bi_attribs

  Throws:
    `java.sql.SQLException`
  Since:
    4.0

### getProducts

    public Product[] getProducts(JDCConnection oConn,
                                 java.lang.String sOrderBy)
                          throws java.sql.SQLException

  Get Products contained at this Category

  Parameters:
    `oConn` - Database Connection
    `sOrderBy` - Column to sort the products { od_position, nm_product, pr_list, pr_sale, ... } If null no sorting is performed
  Returns:
    Array of Product instances or null if this Category contains no products
  Throws:
    `java.sql.SQLException`
  Since:
    4.0

### getACLGroups

    public DBSubset getACLGroups(JDCConnection oConn)
                          throws java.sql.SQLException

  Get Groups with permissions over this Category.

  Parameters:
    `oConn` - Database Connection
  Returns:
    A DBSubset with 2 columns: gu_acl_group, acl_mask
  Throws:
    `java.sql.SQLException`

### getACLUsers

    public DBSubset getACLUsers(JDCConnection oConn)
                         throws java.sql.SQLException

  Get Users with direct permissions over this Category.

  Parameters:
    `oConn` - Database Connection
  Returns:
    A DBSubset with 2 columns: gu_user, acl_mask
  Throws:
    `java.sql.SQLException`

### getDomainId

    public int getDomainId(JDCConnection oConn)
                    throws java.sql.SQLException,
                           java.lang.IllegalStateException

  Get integer indentifier of the domain to which this category belongs

  Parameters:
    `JDCConnection` -
  Returns:
    id_domain
  Throws:
    `java.sql.SQLException`
    `java.lang.IllegalStateException`
  Since:
    4.0

### setParent

    public void setParent(java.sql.Connection oConn,
                          java.lang.String sIdParent)
                   throws java.sql.SQLException

  Set New Parent for this category.

  The old parent (if any) is not changed nor removed.
  If Category is already a child of selected parent method proceeds silently and no error is raised.

  Parameters:
    `oConn` - Database Connection
    `sIdParent` - GUID of parent Category
  Throws:
    `java.sql.SQLException`

### resetParent

    public void resetParent(java.sql.Connection oConn,
                            java.lang.String sIdParent)
                     throws java.sql.SQLException

  Remove Category from parent.

  Removing a Category from a parent does not delete it.

  Parameters:
    `oConn` - Database Connection
    `sIdParent` - Parent Category GUID
  Throws:
    `java.sql.SQLException`

### store

    public boolean store(JDCConnection oConn)
                  throws java.sql.SQLException

  Store Category.

  If gu_category is null a new GUID is automatically assigned.
  dt_modified field is set to current date.

  Overrides:
    `store` in class `DBPersist`
  Parameters:
    `oConn` - Database Connection
  Returns:
    boolean true if register was stored for the first time, false if register already existed.
  Throws:
    `java.sql.SQLException`

### expand

    public void expand(java.sql.Connection oConn)
                throws java.sql.SQLException

  Expand all Category childs.

  Calls k_sp_cat_expand stored procedure.
  Expansion tree is stored at k_cat_expand table.

  Parameters:
    `oConn` - Database Connection
  Throws:
    `java.sql.SQLException`

### storeLabels

    public void storeLabels(JDCConnection oConn,
                            java.lang.String sNamesTable,
                            java.lang.String sRowDelim,
                            java.lang.String sColDelim)
                     throws java.sql.SQLException,
                            java.util.NoSuchElementException

  Store a set of labels for this category

  This method takes a string of the form "en;Root|es;Raíz|fr;Racine|it;Radice|ru;Корень" and store one label for each {language,literal} pair

  Parameters:
    `oConn` - JDCConnection
    `sNamesTable` - String Language names and translated names
    `sRowDelim` - String Delimiter for {language,literal} pairs, in the example above it would be "|"
    `sColDelim` - String Delimiter between language and literal, in the example above it would be ";"
  Throws:
    `java.sql.SQLException`
    `java.util.NoSuchElementException`

### uploadDirectory

    public void uploadDirectory(JDCConnection oConn,
                                java.lang.String sSourcePath,
                                java.lang.String sProtocol,
                                java.lang.String sServer,
                                java.lang.String sTargetPath,
                                java.lang.String sLanguage)
                         throws java.lang.Exception,
                                java.io.IOException,
                                java.sql.SQLException

  Copy a directory and index all its files as products inside this Category

  Parameters:
    `oConn` - JDCConnection Any pending transaction on given connection will be commited. This methods calls Connection.commit() on oConn object, so AutoCommit status for connection must be set to true before calling uploadDirectory()
    `sSourcePath` - String "file:///tmp/upload/myfiles"
    `sProtocol` - String "file://"
    `sServer` - String Server name (for FTP transfers)
    `sTargetPath` - String "file:///opt/hipergate/storege/domains/2050/..."
    `sLanguage` - String
  Throws:
    `java.lang.Exception`
    `java.io.IOException`
    `java.sql.SQLException`

### toXMLWithLabels

    public java.lang.String toXMLWithLabels(JDCConnection oConn,
                                            java.lang.String sIdent,
                                            java.lang.String sDelim)
                                     throws java.sql.SQLException,
                                            java.lang.IllegalStateException

  Get an XML dump for the Category values plus nodes for translated labels

  Parameters:
    `sIdent` - Number of blank spaces for left padding at every line.
    `sDelim` - Line delimiter (usually "\n" or "\r\n")
  Returns:
    XML String
  Throws:
    `java.sql.SQLException`
    `java.lang.IllegalStateException`
  Since:
    4.0

### toXMLWithLabels

    public java.lang.String toXMLWithLabels(JDCConnection oConn,
                                            java.lang.String sIdent)
                                     throws java.sql.SQLException,
                                            java.lang.IllegalStateException

  Get an XML dump for the Category values plus nodes for translated labels

  Parameters:
    `sIdent` - Number of blank spaces for left padding at every line.
  Returns:
    XML String
  Throws:
    `java.sql.SQLException`
    `java.lang.IllegalStateException`
  Since:
    4.0

### toXMLWithLabels

    public java.lang.String toXMLWithLabels(JDCConnection oConn)
                                     throws java.sql.SQLException,
                                            java.lang.IllegalStateException

  Get an XML dump for the Category values plus nodes for translated labels

  Parameters:
    `sIdent` - Number of blank spaces for left padding at every line.
  Returns:
    XML String
  Throws:
    `java.sql.SQLException`
    `java.lang.IllegalStateException`
  Since:
    4.0

### checkOut

    public void checkOut(JDCConnection oConn,
                         java.lang.String sUserId)
                  throws java.lang.SecurityException,
                         java.sql.SQLException,
                         java.lang.IllegalStateException,
                         java.lang.NullPointerException

  Check-out all documents from this Category and all its subcategories

  Parameters:
    `JDCConnection` -
    `sUserId` - GUID of user requesting check-out
  Throws:
    `java.lang.SecurityException` - if user does not have modify permission over any category containing this product
    `java.lang.IllegalStateException` - if product is already checked out by another user
    `java.lang.NullPointerException` - is sUserId is null
    `java.sql.SQLException`
  Since:
    4.0

### checkIn

    public void checkIn(JDCConnection oConn,
                        java.lang.String sUserId)
                 throws java.sql.SQLException,
                        java.lang.IllegalStateException,
                        java.lang.NullPointerException

  Check-in all documents from this Category and all its subcategories

  Parameters:
    `JDCConnection` -
    `sUserId` - GUID of user requesting check-out
  Throws:
    `java.lang.IllegalStateException` - if product is already checked out by another user
    `java.lang.NullPointerException` - is sUserId is null
    `java.sql.SQLException`
  Since:
    4.0

### store

    public static java.lang.String store(JDCConnection oConn,
                                         java.lang.String sCategoryId,
                                         java.lang.String sParentId,
                                         java.lang.String sCategoryName,
                                         short iIsActive,
                                         int iDocStatus,
                                         java.lang.String sOwner,
                                         java.lang.String sIcon1,
                                         java.lang.String sIcon2)
                                  throws java.sql.SQLException

  Create or Store Category.

  Parameters:
    `oConn` - Database Connection
    `sCategoryId` - GUID of Category to store or null if it is a new Category.
    `sParentId` - GUID of Parent Category or null if it is a root category.
    `sCategoryName` - Internal Category Name. It is recommended that makeName() method is applied always on sCategoryName. Because category names are often used for composing physical disk paths, assigning characters such as '*', '/', '?' etc. to category names may lead to errors when creating directories for contained Products. As a general rule use ONLY upper case letters and numbers for category names.
    `iIsActive` - 1 if category is to be marked active, 0 if it is to be marked as unactive.
    `iDocStatus` - Initial Document Status, { 0=Pending, 1=Active, 2=Locked } See k_lu_status table.
    `sOwner` - GUID of User owner of this Category.
    `sIcon1` - Icon for closed folder.
    `sIcon2` - Icon for opened folder.
  Returns:
    GUID of new Category or sCategoryId if Category already existed.
  Throws:
    `java.sql.SQLException`

### delete

    public static boolean delete(JDCConnection oConn,
                                 java.lang.String sCategoryGUID)
                          throws java.sql.SQLException,
                                 java.io.IOException

  Delete Category and all its childs.

  First delete all Products and Companies contained in Category, including physical disk files associted with Products and Company attachments.
  Then call k_sp_del_category_r stored procedure and perform recursive deletion of all childs.

  Parameters:
    `oConn` - Database Connection
    `sCategoryGUID` - GUID of Category to delete.
  Throws:
    `java.sql.SQLException`
    `java.io.IOException`

### create

    public static java.lang.String create(JDCConnection oConn,
                                          java.lang.Object[] Values)
                                   throws java.sql.SQLException

  Create new Category with translated labels.

  Parameters:
    `oConn` - Database Connection
    `Values` - An array with the following elements:
    { (String) gu_parent, (String) gu_owner, (String) nm_category, (Short) bo_active, (Short) id_doc_status, (String) nm_icon, (String) nm_icon2 }
  Returns:
    GUID of new Category
  Throws:
    `java.sql.SQLException`

### getIdFromName

    public static java.lang.String getIdFromName(JDCConnection oConn,
                                                 java.lang.String sCategoryNm)
                                          throws java.sql.SQLException

  Get Category GUID given its internal name.

  Category name is column nm_category at table k_categories.
  This Java method calls k_sp_get_cat_id database stored procedure.

  Parameters:
    `oConn` - Database Connection
    `sCategoryNm` - Category Internal Name
  Returns:
    Category GUID or null if no Category with such name is found.
  Throws:
    `java.sql.SQLException`

### makeName

    public static java.lang.String makeName(JDCConnection oConn,
                                            java.lang.String sCategoryNm)
                                     throws java.sql.SQLException

  Make an internal category name from an arbitrary string.

  Because nm_category is a primary key for table k_categories and because category names are used for composing physical disk paths, some special rules must be followed when assigning category names.
  - First a Category Name MUST NOT containing any character not allowed in a directory name.
  - Second a Category Name MUST be unique for all categories at all WorkAreas.

  Parameters:
    `oConn` - Database Connection
    `sCategoryNm` - String to be used as a guide for making category name.
  Returns:
    The input string truncated to 18 characters and transformed to upper case. Method Gadgets.ASCIIEncode() is applies and spaces, commas, asterisks, slashes, backslashes and other characters are removed or substituted. Finally an 8 decimals integer tag is appended to name for making it unique. For example "Barnes & Noble" is transormed to "BARNES_A_NOBLE~00000001"
  Throws:
    `java.sql.SQLException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD