com.arsdigita.notification
Class Digest

java.lang.Object
  extended bycom.arsdigita.domain.DomainObject
      extended bycom.arsdigita.domain.ObservableDomainObject
          extended bycom.arsdigita.kernel.ACSObject
              extended bycom.arsdigita.notification.Digest
All Implemented Interfaces:
com.arsdigita.notification.NotificationConstants

public class Digest
extends ACSObject
implements com.arsdigita.notification.NotificationConstants

Models the envelope information associated with a digest. When a digest is processed, all notifications associated with it are grouped for delivery as a single unit to each receiver. The outbound email generated for the receivers has a common subject, header, separator between the individual messages, and signature.

Version:
$Id: //core-platform/dev/src/com/arsdigita/notification/Digest.java#12 $
Author:
Ron Henderson, David Dao

Field Summary
static String BASE_DATA_OBJECT_TYPE
           
static String CANCELLED
           
static int DAILY
           
static String DIGEST_ID
           
static String EXPAND_GROUP
           
static String EXPUNGE_MSG_P
           
static String EXPUNGE_P
           
static String FAILED
           
static String FAILED_PARTIAL
           
static String FREQUENCY
           
static String FULFILL_DATE
           
static String GET_DIGEST_QUEUED_NOTIFICATIONS
           
static String GET_SIMPLE_QUEUED_NOTIFICATIONS
           
static String HEADER
           
static int HOURLY
           
static String MAX_RETRIES
           
static String MESSAGE_ID
           
static String NEXT_RUN
           
static String PARTY_FROM
           
static String PARTY_TO
           
static String PARTY_TO_ADDR
           
static String PENDING
           
static String QUEUED
           
static String REQUEST_DATE
           
static String REQUEST_ID
           
static String RETRY_COUNT
           
static String SENT
           
static String SEPARATOR
           
static String SIGNATURE
           
static String STATUS
           
static String SUBJECT
           
static String SUCCESS
           
static int WEEKLY
           
 
Fields inherited from class com.arsdigita.kernel.ACSObject
CONTAINER, DEFAULT_DOMAIN_CLASS, DISPLAY_NAME, ID, OBJECT_TYPE, versionId
 
Constructor Summary
Digest()
          Default constructor.
Digest(BigDecimal id)
          Retrieve a digest with the given id;
Digest(DataObject dataObj)
          Creates a Digest from a DataObject
Digest(OID oid)
          Retrieves an existing digest from the database.
Digest(Party from, String subject, String header, String signature)
          Creates a digest with the default processing frequency and separator.
 
Method Summary
protected  void beforeSave()
          Saves the Digest to the database so it can be used for sending notifications.
 Integer getFrequency()
          Gets the current processing frequency (in minutes) for this digest.
 Party getFrom()
          Gets the sender of the digest.
 String getFromEmail()
          Gets the email address of the digest sender as a string.
 String getHeader()
          Gets the common header for the digest.
 Date getNextRun()
          Get the date when this digest will next be processed.
 String getSeparator()
          Gets the current separator for elements of the digest.
 String getSignature()
          Gets the signature used for this digest.
 String getSubject()
          Gets the common subject for the digest.
 void setFrequency(int frequency)
          Sets the processing frequency (in minutes) for this digest.
 void setFrom(Party from)
          Sets the common sender for the digest.
 void setHeader(String header)
          Set the common header for the digest.
 void setSeparator(char s, int n)
          Sets the separator by specifing a single character and a repeat count.
 void setSeparator(String separator)
          Sets the separator by specifying its value as a String.
 void setSignature(String signature)
          Sets the signature used for this digest.
 void setSubject(String subject)
          Sets the common subject for the digest.
 
Methods inherited from class com.arsdigita.kernel.ACSObject
assertPrivilege, checkPrivilege, doCreateCheck, doWriteCheck, getBaseDataObjectType, getContainer, getDefaultDomainClass, getDisplayName, getID, getSpecificObjectType, getSpecificOID, gimmeContainer, initialize, isContainerModified, setID, setID
 
Methods inherited from class com.arsdigita.domain.ObservableDomainObject
addObserver, getObservers
 
Methods inherited from class com.arsdigita.domain.DomainObject
add, add, addToAssociation, afterDelete, afterSave, beforeDelete, clear, delete, disconnect, equals, get, getObjectType, getOID, getSession, hashCode, isDeleted, isDisconnected, isModified, isNew, isPropertyModified, isValid, remove, remove, remove, removeFromAssociation, save, set, setAssociation, setAssociation, specializeDataObject, specializeDataObject, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

BASE_DATA_OBJECT_TYPE

public static final String BASE_DATA_OBJECT_TYPE
See Also:
Constant Field Values

HOURLY

public static final int HOURLY
See Also:
Constant Field Values

DAILY

public static final int DAILY
See Also:
Constant Field Values

WEEKLY

public static final int WEEKLY
See Also:
Constant Field Values

DIGEST_ID

public static final String DIGEST_ID
See Also:
Constant Field Values

REQUEST_ID

public static final String REQUEST_ID
See Also:
Constant Field Values

MESSAGE_ID

public static final String MESSAGE_ID
See Also:
Constant Field Values

PARTY_TO

public static final String PARTY_TO
See Also:
Constant Field Values

PARTY_TO_ADDR

public static final String PARTY_TO_ADDR
See Also:
Constant Field Values

PARTY_FROM

public static final String PARTY_FROM
See Also:
Constant Field Values

RETRY_COUNT

public static final String RETRY_COUNT
See Also:
Constant Field Values

SUCCESS

public static final String SUCCESS
See Also:
Constant Field Values

EXPAND_GROUP

public static final String EXPAND_GROUP
See Also:
Constant Field Values

REQUEST_DATE

public static final String REQUEST_DATE
See Also:
Constant Field Values

FULFILL_DATE

public static final String FULFILL_DATE
See Also:
Constant Field Values

STATUS

public static final String STATUS
See Also:
Constant Field Values

MAX_RETRIES

public static final String MAX_RETRIES
See Also:
Constant Field Values

EXPUNGE_P

public static final String EXPUNGE_P
See Also:
Constant Field Values

EXPUNGE_MSG_P

public static final String EXPUNGE_MSG_P
See Also:
Constant Field Values

HEADER

public static final String HEADER
See Also:
Constant Field Values

SIGNATURE

public static final String SIGNATURE
See Also:
Constant Field Values

SUBJECT

public static final String SUBJECT
See Also:
Constant Field Values

SEPARATOR

public static final String SEPARATOR
See Also:
Constant Field Values

FREQUENCY

public static final String FREQUENCY
See Also:
Constant Field Values

NEXT_RUN

public static final String NEXT_RUN
See Also:
Constant Field Values

PENDING

public static final String PENDING
See Also:
Constant Field Values

QUEUED

public static final String QUEUED
See Also:
Constant Field Values

SENT

public static final String SENT
See Also:
Constant Field Values

FAILED

public static final String FAILED
See Also:
Constant Field Values

FAILED_PARTIAL

public static final String FAILED_PARTIAL
See Also:
Constant Field Values

CANCELLED

public static final String CANCELLED
See Also:
Constant Field Values

GET_SIMPLE_QUEUED_NOTIFICATIONS

public static final String GET_SIMPLE_QUEUED_NOTIFICATIONS
See Also:
Constant Field Values

GET_DIGEST_QUEUED_NOTIFICATIONS

public static final String GET_DIGEST_QUEUED_NOTIFICATIONS
See Also:
Constant Field Values
Constructor Detail

Digest

public Digest()
Default constructor. Generates a digest scheduled to run immediately and every hour thereafter. Default separator is a line consisting of 78 dashes (-).


Digest

public Digest(Party from,
              String subject,
              String header,
              String signature)
Creates a digest with the default processing frequency and separator.

Parameters:
from - the party responsible for sending the digest
subject - the common subject for digest notifications
header - the common header
signature - the common signature

Digest

public Digest(OID oid)
       throws DataObjectNotFoundException
Retrieves an existing digest from the database.

Parameters:
oid - the OID of the digest

Digest

public Digest(DataObject dataObj)
Creates a Digest from a DataObject

Parameters:
dataObj - the DataObject the Digest will wrap

Digest

public Digest(BigDecimal id)
       throws DataObjectNotFoundException
Retrieve a digest with the given id;

Parameters:
id - the id for the DataObject to retrieve.
Method Detail

getFrom

public Party getFrom()
              throws DataObjectNotFoundException
Gets the sender of the digest.

Returns:
the sender.
Throws:
DataObjectNotFoundException

getFromEmail

public String getFromEmail()
Gets the email address of the digest sender as a string. Used when preparing the digest for sending via email.

Returns:
the sender's email address as a String.

setFrom

public void setFrom(Party from)
Sets the common sender for the digest.

Parameters:
from - the common sender

getSubject

public String getSubject()
Gets the common subject for the digest.

Returns:
the common subject for the digest.

setSubject

public void setSubject(String subject)
Sets the common subject for the digest.

Parameters:
subject - the common subject

getHeader

public String getHeader()
Gets the common header for the digest.

Returns:
the common header for the digest.

setHeader

public void setHeader(String header)
Set the common header for the digest.

Parameters:
header - the common header

getSeparator

public String getSeparator()
Gets the current separator for elements of the digest.

Returns:
the separator

setSeparator

public void setSeparator(String separator)
Sets the separator by specifying its value as a String. For example, setSeparator("----------") will produce a dashed line that is 10 characters long.

Parameters:
separator - the value of the separator

setSeparator

public void setSeparator(char s,
                         int n)
Sets the separator by specifing a single character and a repeat count. For example, setSeparater('-',78) will set the default separator as a dashed line that is 78 characters long.

Parameters:
s - the separator character
n - the repeat count

getSignature

public String getSignature()
Gets the signature used for this digest.

Returns:
the signature for this digest.

setSignature

public void setSignature(String signature)
Sets the signature used for this digest.

Parameters:
signature - the signature for the digest

getFrequency

public Integer getFrequency()
Gets the current processing frequency (in minutes) for this digest.

Returns:
the processing frequency for this digest.

setFrequency

public void setFrequency(int frequency)
Sets the processing frequency (in minutes) for this digest.

Parameters:
frequency - the processing frequency in minutes

getNextRun

public Date getNextRun()
Get the date when this digest will next be processed.


beforeSave

protected void beforeSave()
Saves the Digest to the database so it can be used for sending notifications. Verifies that all required parameters have been specified before saving.

Overrides:
beforeSave in class ACSObject


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC