com.knowgate.forums
Class Subscription

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

public class Subscription
extends DBPersist

NewsGroup Subscription

Handles subscriptions of users from k_users table to newsgroups from k_newsgroups table


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
static short ACTIVE
           
static short ACTIVE_MY_FOR_THREADS_ONLY
           
static short GROUP_DIGEST
           
static short GROUP_NONE
           
static short UNACTIVE
           
 
Fields inherited from class com.knowgate.dataobjs.DBPersist
AllVals, sAuditCls, sAuditUsr, sTransactId
 
Constructor Summary
Subscription()
          Default constructor
Subscription(JDCConnection oConn, java.lang.String sNewsGroupId, java.lang.String sUserId)
           
 
Method Summary
static boolean activate(JDCConnection oConn, java.lang.String sNewsGroupId, java.lang.String sUserId)
          Activate a Subscription Set k_newsgroup_subscriptions.id_status=ACTIVE
static boolean deactivate(JDCConnection oConn, java.lang.String sNewsGroupId, java.lang.String sUserId)
          Deactivate a Subscription Set k_newsgroup_subscriptions.id_status=UNACTIVE
static boolean subscribe(JDCConnection oConn, java.lang.String sNewsGroupId, java.lang.String sUserId)
          Subscribe ACLUser to a NewsGroup Message format is TXT with no grouping by default.
static boolean subscribe(JDCConnection oConn, java.lang.String sNewsGroupId, java.lang.String sUserId, java.lang.String sMessageFormat, short iMessagesGrouping)
          Subscribe ACLUser to a NewsGroup Newly created subscriptions are activated by default.
static boolean unsubscribe(JDCConnection oConn, java.lang.String sNewsGroupId, java.lang.String sUserId)
          Unsubscribe ACLUser to a NewsGroup The ACLUser is removed from table k_newsgroup_subscriptions for given NewsGroup.
 
Methods inherited from class com.knowgate.dataobjs.DBPersist
allcaps, allcaps, changelog, clear, clone, containsKey, containsValue, delete, 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, 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, store, 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

UNACTIVE

public static final short UNACTIVE
See Also:
Constant Field Values

ACTIVE

public static final short ACTIVE
See Also:
Constant Field Values

ACTIVE_MY_FOR_THREADS_ONLY

public static final short ACTIVE_MY_FOR_THREADS_ONLY
See Also:
Constant Field Values

GROUP_NONE

public static final short GROUP_NONE
See Also:
Constant Field Values

GROUP_DIGEST

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

Subscription

public Subscription()
Default constructor


Subscription

public Subscription(JDCConnection oConn,
                    java.lang.String sNewsGroupId,
                    java.lang.String sUserId)
             throws java.sql.SQLException
Throws:
java.sql.SQLException
Method Detail

subscribe

public static boolean subscribe(JDCConnection oConn,
                                java.lang.String sNewsGroupId,
                                java.lang.String sUserId,
                                java.lang.String sMessageFormat,
                                short iMessagesGrouping)
                         throws java.sql.SQLException

Subscribe ACLUser to a NewsGroup

Newly created subscriptions are activated by default.

Parameters:
oConn - JDBC Database Connection
sNewsGroupId - NewsGroup GUID
sUserId - ACLUser GUID
sMessageFormat - Message Format {TXT | HTM}
sUserId - iMessagesGrouping Message Grouping { GROUP_NONE | GROUP_DIGEST }
Returns:
true if ACLUser was successfully subscribed to NewsGroup, false if no ACLUser with such GUID was found at k_users table.
Throws:
java.sql.SQLException

subscribe

public static boolean subscribe(JDCConnection oConn,
                                java.lang.String sNewsGroupId,
                                java.lang.String sUserId)
                         throws java.sql.SQLException

Subscribe ACLUser to a NewsGroup

Message format is TXT with no grouping by default.

Parameters:
oConn - JDBC Database Connection
sNewsGroupId - NewsGroup GUID
sUserId - ACLUser GUID
Returns:
true if ACLUser was successfully subscribed to NewsGroup, false if no ACLUser with such GUID was found at k_users table.
Throws:
java.sql.SQLException

unsubscribe

public static boolean unsubscribe(JDCConnection oConn,
                                  java.lang.String sNewsGroupId,
                                  java.lang.String sUserId)
                           throws java.sql.SQLException

Unsubscribe ACLUser to a NewsGroup

The ACLUser is removed from table k_newsgroup_subscriptions for given NewsGroup.
If you want to remove an e-mail directly first call ACLUser.getIdFromEmail() method.

Parameters:
oConn - JDBC Database Connection
sNewsGroupId - NewsGroup GUID
sUserId - ACLUser GUID
Returns:
true if ACLUser was successfully unsubscribed from NewsGroup, false if no ACLUser with such GUID was found at k_newsgroup_subscriptions.
Throws:
java.sql.SQLException

activate

public static boolean activate(JDCConnection oConn,
                               java.lang.String sNewsGroupId,
                               java.lang.String sUserId)
                        throws java.sql.SQLException

Activate a Subscription

Set k_newsgroup_subscriptions.id_status=ACTIVE

Parameters:
oConn - JDBC Database Connection
sNewsGroupId - Newsgroup GUID
sUserId - ACLUser GUID
Returns:
true if subscription from ACLUser was successfully activated, false if no ACLUser with such GUID was found at k_newsgroup_subscriptions.
Throws:
java.sql.SQLException

deactivate

public static boolean deactivate(JDCConnection oConn,
                                 java.lang.String sNewsGroupId,
                                 java.lang.String sUserId)
                          throws java.sql.SQLException

Deactivate a Subscription

Set k_newsgroup_subscriptions.id_status=UNACTIVE

Parameters:
oConn - JDBC Database Connection
sNewsGroupId - Newsgroup GUID
sUserId - ACLUser GUID
Returns:
true if subscription from ACLUser was successfully deactivated, false if no ACLUser with such GUID was found at k_newsgroup_subscriptions.
Throws:
java.sql.SQLException