com.knowgate.forums
Class NewsGroup

java.lang.Object
  extended by com.knowgate.dataobjs.DBPersist
      extended by com.knowgate.hipergate.Category
          extended by com.knowgate.forums.NewsGroup
All Implemented Interfaces:
java.util.Map

public class NewsGroup
extends Category

NewsGroup


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
static short ClassId
           
static short FREE
           
static short MODERATED
           
 
Fields inherited from class com.knowgate.hipergate.Category
BROWSE_BOTTOMUP, BROWSE_DOWN, BROWSE_TOPDOWN, BROWSE_UP
 
Fields inherited from class com.knowgate.dataobjs.DBPersist
AllVals, sAuditCls, sAuditUsr, sTransactId
 
Constructor Summary
NewsGroup()
          Create empty newsgroup
NewsGroup(JDCConnection oConn, java.lang.String sIdNewsGroup)
          Create newsGroup and load properties from Database Both field sets from k_categories and k_newsgroups are loaded into internal properties collection upon load.
NewsGroup(java.lang.String sIdNewsGroup)
          Create NewsGroup and set its Category GUID
 
Method Summary
 int countMessages(JDCConnection oConn)
          Count messages for this NewsGroup
 int countMessages(JDCConnection oConn, short iMsgStatus)
          Count messages for this NewsGroup in a given status
 boolean delete(JDCConnection oConn)
          Delete this NewsGroup and all its messages
static boolean delete(JDCConnection oConn, java.lang.String sNewsGroupGUID)
          Delete NewsGroup and all its messages.
 DBSubset getTopLevelMessages(JDCConnection oConn, int nMaxMsgs, java.lang.String sOrderBy)
          Get messages
 boolean isSubscriber(JDCConnection oConn, java.lang.String sUserId)
          Get whether or not a user is subcribed this news group
 boolean load(JDCConnection oConn, java.lang.Object[] PKVals)
          Load NewsGroup from database Both field sets from k_categories and k_newsgroups are loaded into internal properties collection upon load.
static java.lang.String store(JDCConnection oConn, int iDomain, java.lang.String sWorkArea, 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)
          Store Newsgroup
 DBSubset subscribers(JDCConnection oConn)
          Get ACLUsers subscribed to this NewsGroup
 
Methods inherited from class com.knowgate.hipergate.Category
addObject, browse, checkIn, checkOut, create, expand, getACLGroups, getACLUsers, getChilds, getDomainId, getGroupPermissions, getIdFromName, getIsRoot, getLabel, getNames, getObjects, getObjectsOfClass, getParents, getPath, getProducts, getUserPermissions, inheritPermissions, isChildOf, isParentOf, level, makeName, removeGroupPermissions, removeObject, removeObject, removeUserPermissions, resetParent, setGroupPermissions, setIsRoot, setParent, setUserPermissions, store, store, storeLabels, toXMLWithLabels, toXMLWithLabels, toXMLWithLabels, uploadDirectory
 
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, getStringNull, getTable, getTable, getTableName, getTime, getTimeOfDay, getTimestamp, getUIdFromName, isEmpty, isNull, iterator, keySet, 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, setAuditTransact, setAuditUser, 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

ClassId

public static final short ClassId
See Also:
Constant Field Values

FREE

public static final short FREE
See Also:
Constant Field Values

MODERATED

public static final short MODERATED
See Also:
Constant Field Values
Constructor Detail

NewsGroup

public NewsGroup()
Create empty newsgroup


NewsGroup

public NewsGroup(java.lang.String sIdNewsGroup)
          throws java.sql.SQLException
Create NewsGroup and set its Category GUID

Parameters:
sIdNewsGroup - GUID of NewsGroup/Category
Throws:
java.sql.SQLException

NewsGroup

public NewsGroup(JDCConnection oConn,
                 java.lang.String sIdNewsGroup)
          throws java.sql.SQLException

Create newsGroup and load properties from Database

Both field sets from k_categories and k_newsgroups are loaded into internal properties collection upon load.

Parameters:
oConn - Database Conenction
sIdNewsGroup - GUID of newsGroup to be loaded
Throws:
java.sql.SQLException
Method Detail

countMessages

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

Count messages for this NewsGroup

Parameters:
oConn - Database connection
Returns:
Message Count
Throws:
java.sql.SQLException - If NewsGroup does not exist

countMessages

public int countMessages(JDCConnection oConn,
                         short iMsgStatus)
                  throws java.sql.SQLException

Count messages for this NewsGroup in a given status

Parameters:
oConn - Database connection
iMsgStatus - One of { NewsMessage.STATUS_VALIDATED, NewsMessage.STATUS_PENDING, NewsMessage.STATUS_DISCARDED, NewsMessage.STATUS_EXPIRED }
Returns:
Message Count
Throws:
java.sql.SQLException - If NewsGroup does not exist

load

public boolean load(JDCConnection oConn,
                    java.lang.Object[] PKVals)
             throws java.sql.SQLException

Load NewsGroup from database

Both field sets from k_categories and k_newsgroups are loaded into internal properties collection upon load.

Overrides:
load in class DBPersist
Parameters:
oConn - Database Conenction
PKVals - A single element array containing the GUID of NewsGroup to be loaded. For example: oNewsGrpObj.load(oConnection, new object[]{"123456789012345678901234567890AB"});
Returns:
true if NewsGroup was successfully loaded, false if Newsgroup GUID was not found at k_newsgropus o k_categories tables.
Throws:
java.sql.SQLException

subscribers

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

Get ACLUsers subscribed to this NewsGroup

Parameters:
oConn - JDBC Database Connection
Returns:
A DBSubset with the following columns:
gu_usertx_emailid_msg_typetp_subscrip
ACLUser GUIDACLUser main e-mailMessage Format {TXT | HTM}Message Grouping {GROUP_NONE | GROUP_DIGEST}
Throws:
java.sql.SQLException

isSubscriber

public boolean isSubscriber(JDCConnection oConn,
                            java.lang.String sUserId)
                     throws java.sql.SQLException

Get whether or not a user is subcribed this news group

Parameters:
oConn - JDBC Database Connection
sUserId - User GUID
Returns:
true if user is subscribed to this news group and he is active (k_newsgroup_subscriptions.id_status=1), false if user is not subscribed or if he is subscribed but unactive (k_newsgroup_subscriptions.id_status=0)
Throws:
java.sql.SQLException

delete

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

Delete this NewsGroup and all its messages

Overrides:
delete in class Category
Parameters:
oConn - JDBC Database Connection
Returns:
Throws:
java.sql.SQLException

getTopLevelMessages

public DBSubset getTopLevelMessages(JDCConnection oConn,
                                    int nMaxMsgs,
                                    java.lang.String sOrderBy)
                             throws java.sql.SQLException,
                                    java.lang.IllegalArgumentException,
                                    java.lang.IllegalStateException

Get messages

Parameters:
oConn - Database Connection
nMaxMsgs - Maximum number of messages to get
sOrderBy - Attribute to sort messages. By default it is dt_published which corresponds to publishing date. Can be also nu_votes to sort messages by number of votes or nm_author to sort by author.
Returns:
DBSubset containing the following columns: gu_msg,nm_author,gu_writer,dt_published,dt_start,id_language,id_status,id_msg_type,nu_thread_msgs,gu_thread_msg,nu_votes,tx_email,tx_subject,dt_expire,dt_validated,gu_validator,gu_product,tx_msg
Throws:
java.sql.SQLException
java.lang.IllegalArgumentException - If nMaxMsgs<=0
java.lang.IllegalStateException - If this Newsgroup message has not been previously loaded
Since:
4.0

store

public static java.lang.String store(JDCConnection oConn,
                                     int iDomain,
                                     java.lang.String sWorkArea,
                                     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

Store Newsgroup

Parameters:
oConn - Database Connection
iDomain - Identifier of Domain to with the NewsGroup will belong.
sWorkArea - GUID of WorkArea to with the NewsGroup will belong.
sCategoryId - Category GUID (newsgroups are subregisters of categories)
sParentId - GUID of Parent Group (groups, as categories, are hierarchical)
sCategoryName - Category name (k_categories.nm_category)
iIsActive - 1 if group is activem, 0 if it is inactive.
iDocStatus - Initial Document Status. One of { Newsgroup.FREE, Newsgroup.MODERATED }
sOwner - GUID of User owner of this NewsGroup
sIcon1 - Closed Folder Icon
sIcon2 - Opened Folder Icon
Returns:
GUID of newly created NewsGroup
Throws:
java.sql.SQLException

delete

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

Delete NewsGroup and all its messages.

Delete all files attached to messages contained in group and then call k_sp_del_newsgroup stored procedure.

Parameters:
oConn - Database Connection
sNewsGroupGUID - GUID of NewsGroup to be deleted.
Throws:
java.sql.SQLException
See Also:
Product.delete(JDCConnection)