com.knowgate.marketing
Class Activity

java.lang.Object
  extended by com.knowgate.dataobjs.DBPersist
      extended by com.knowgate.marketing.Activity
All Implemented Interfaces:
java.io.Serializable, java.util.Map

public class Activity
extends DBPersist

Marketing Activity

Copyright: Copyright (c) KnowGate 2009

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 short ClassId
           
 
Fields inherited from class com.knowgate.dataobjs.DBPersist
AllVals, sAuditCls, sAuditUsr, sTransactId
 
Constructor Summary
Activity()
           
Activity(JDCConnection oConn, java.lang.String sGuActivity)
          Create Activity and load fields from database.
 
Method Summary
 ActivityAttachment addAttachment(JDCConnection oConn, java.lang.String sGuWriter, java.lang.String sDirPath, java.lang.String sFileName, boolean bDeleteOriginalFile)
          Add an Attachment to an Activity
 ActivityAttachment addAttachment(JDCConnection oConn, java.lang.String sGuWriter, java.lang.String sDirPath, java.lang.String sFileName, java.lang.String sDescription, boolean bDeleteOriginalFile)
          Add an Attachment to an Activity
 boolean delete(JDCConnection oConn)
          Delete Activity.
 Address getAddress()
          Get address of Activity.
 ActivityAudience[] getAudience(JDCConnection oConn)
           
 int getConfirmedAudienceCount(JDCConnection oConn)
           
 int getNotConfirmedAudienceCount(JDCConnection oConn)
           
 int getRefusedAudienceCount(JDCConnection oConn)
           
 int getTotalAudienceCount(JDCConnection oConn)
           
 boolean load(JDCConnection oConn, java.lang.Object[] PKVals)
          Load the internal value set from a register at a database table
 boolean load(JDCConnection oConn, java.lang.String sGuActivity)
          Load the internal value set from a register at a database table
 boolean removeAttachment(JDCConnection oConn, int iPgAttachment)
          Remove attachment
 boolean store(JDCConnection oConn)
          Store a register at database representing this instance of DBPersist Insertions and updates : The store method automatically manages register insertions and updates.
 
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, 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

ClassId

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

Activity

public Activity()

Activity

public Activity(JDCConnection oConn,
                java.lang.String sGuActivity)
         throws java.sql.SQLException
Create Activity and load fields from database.

Parameters:
oConn - Database Connection
sGuActivity - Activity GUID
Throws:
java.sql.SQLException
Method Detail

getAddress

public Address getAddress()

Get address of Activity.

Activity must has been previously loaded before trying to get its Address

Returns:
Address

getConfirmedAudienceCount

public int getConfirmedAudienceCount(JDCConnection oConn)
                              throws java.sql.SQLException
Returns:
Count of people from k_x_activity_audience which bo_confirmed status is CONFIRMED
Throws:
java.sql.SQLException

getNotConfirmedAudienceCount

public int getNotConfirmedAudienceCount(JDCConnection oConn)
                                 throws java.sql.SQLException
Returns:
Count of people from k_x_activity_audience which bo_confirmed status is NOTCONFIRMED
Throws:
java.sql.SQLException

getRefusedAudienceCount

public int getRefusedAudienceCount(JDCConnection oConn)
                            throws java.sql.SQLException
Returns:
Count of people from k_x_activity_audience which bo_confirmed status is REFUSED
Throws:
java.sql.SQLException

getTotalAudienceCount

public int getTotalAudienceCount(JDCConnection oConn)
                          throws java.sql.SQLException
Returns:
Total count of people from k_x_activity_audience for this Activity with any status
Throws:
java.sql.SQLException

getAudience

public ActivityAudience[] getAudience(JDCConnection oConn)
                               throws java.sql.SQLException
Throws:
java.sql.SQLException

load

public boolean load(JDCConnection oConn,
                    java.lang.Object[] PKVals)
             throws java.sql.SQLException
Description copied from class: DBPersist

Load the internal value set from a register at a database table

Overrides:
load in class DBPersist
Parameters:
oConn - Database Connection
PKVals - Primary key values in order of appearance
Returns:
true if a register was found, false if no register was found with such primary key.
Throws:
java.sql.SQLException

load

public boolean load(JDCConnection oConn,
                    java.lang.String sGuActivity)
             throws java.sql.SQLException
Description copied from class: DBPersist

Load the internal value set from a register at a database table

Overrides:
load in class DBPersist
Parameters:
oConn - JDCConnection
sGuActivity - String Primary key value
Returns:
true if a register was found, false if no register was found with such primary key.
Throws:
java.sql.SQLException

store

public boolean store(JDCConnection oConn)
              throws java.sql.SQLException
Description copied from class: DBPersist

Store a register at database representing this instance of DBPersist

Insertions and updates : The store method automatically manages register insertions and updates. If the stored object already exists at database then it is updated, if it does not exists then it is inserted. A primary key violation error is never thrown so ther is no need to call delete() method before re-writing an existing object.

NULL fields : All values not set calling put() methods for DBPersist will be assumed to be NULL. If a not nullable field is not set then an SQLException will be raised.
On storing an already existing object all values will we overwrited, so is a DBPersist is not fully loaded before storing it, values not set by calling put() methods that already were present at database will be lost.

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

delete

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

Delete Activity.

The delete step by step is as follows:
All Activity Attachments are deleted.
Stored Procedure k_sp_del_activity is called

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

addAttachment

public ActivityAttachment addAttachment(JDCConnection oConn,
                                        java.lang.String sGuWriter,
                                        java.lang.String sDirPath,
                                        java.lang.String sFileName,
                                        java.lang.String sDescription,
                                        boolean bDeleteOriginalFile)
                                 throws java.sql.SQLException,
                                        java.lang.NullPointerException,
                                        java.io.FileNotFoundException,
                                        java.lang.Exception
Add an Attachment to an Activity

Parameters:
oConn - JDCConnection
sGuWriter - String GUID of user (from k_users table) who is uploading the attachment
sDirPath - String Physical path (directory) where file to be attached ir located
sFileName - String Name of file to be attached
sDescription - String File Description (up to 254 characters)
bDeleteOriginalFile - boolean true if original file must be deleted after being attached
Returns:
ActivityAttachment
Throws:
java.sql.SQLException
java.lang.NullPointerException
java.io.FileNotFoundException
java.lang.Exception
Since:
5.5

addAttachment

public ActivityAttachment addAttachment(JDCConnection oConn,
                                        java.lang.String sGuWriter,
                                        java.lang.String sDirPath,
                                        java.lang.String sFileName,
                                        boolean bDeleteOriginalFile)
                                 throws java.sql.SQLException,
                                        java.lang.NullPointerException,
                                        java.io.FileNotFoundException,
                                        java.lang.Exception
Add an Attachment to an Activity

Parameters:
oConn - JDCConnection
sGuWriter - String GUID of user (from k_users table) who is uploading the attachment
sDirPath - String Physical path (directory) where file to be attached ir located
sFileName - String Name of file to be attached
bDeleteOriginalFile - boolean true if original file must be deleted after being attached
Returns:
Attachment
Throws:
java.sql.SQLException
java.lang.NullPointerException
java.io.FileNotFoundException
java.lang.Exception
Since:
5.5

removeAttachment

public boolean removeAttachment(JDCConnection oConn,
                                int iPgAttachment)
                         throws java.sql.SQLException
Remove attachment

Parameters:
oConn - JDCConnection
iPgAttachment - int
Returns:
boolean
Throws:
java.sql.SQLException
java.lang.NullPointerException
Since:
5.5