Class Recipient

All Implemented Interfaces:
KeyValuePair<String,String>, Exportable, Persistent, Serializable, Cloneable

public class Recipient extends ExportablePersistentObject
The recipients of a message.
See Also:
  • Constructor Details

    • Recipient

      public Recipient()
      Create an empty recipient.
    • Recipient

      public Recipient(Persistent templ, short pos)
      Create a recipient for a template.
  • Method Details

    • getTableName

      public String getTableName()
      Description copied from interface: Persistent
      This method must return the table name of the database table in which this persistent object is stored.
      Returns:
      The table name of the database table in which this persistent object is stored.
    • getAgent

      public Agent getAgent()
      Return the agent.
    • getOrgUnit

      public OrgUnit getOrgUnit()
      Return the organizational unit, used only if agent is a role.
    • getAgentString

      public String getAgentString()
      Return the agent-string, is used for types email, stepagent, or formfield.
    • getAgentType

      public Recipient.AgentType getAgentType()
      Return the type of the agent.
    • getRecTypeShort

      public short getRecTypeShort()
      Return the recipient type as numer. 0=To, 1=CC, 2=BCC
    • getTemplate

      public Persistent getTemplate()
      Return the message template or tracker object this template belongs to.
    • setAgent

      public Recipient setAgent(Agent a)
      Set the recipient to a user or role.
    • setAgentString

      public Recipient setAgentString(String email)
      Set the recipient to an email.
    • setOrgUnit

      public Recipient setOrgUnit(OrgUnit ou)
      Set the organizational unit. Only used, if the agent is a local or hierarchical role.
    • setAgentType

      public Recipient setAgentType(Recipient.AgentType type)
      Set the agent type.
    • getRecType

      public Message.RecipientType getRecType()
      Get the recipient type (to, cc, bccc).
    • setRecType

      public Recipient setRecType(Message.RecipientType s)
      Set the recipient type (to, cc, bccc).
    • setRecTypeShort

      public Recipient setRecTypeShort(short s)
      Get the recipient type from number. See getRecTypeShort() for keys.
    • setTemplate

      public Recipient setTemplate(MessageTemplate template)
      Set the template the recipient belongs to.
    • getPos

      public short getPos()
      Return the position of the recipient in the recipient list.
    • isValid

      public void isValid()
      The recipient is valid only if type is user or role and agent is not null OR if type is email, stepagent, or formfield and agentString is not null OR type is owner.
      Specified by:
      isValid in interface Persistent
      Overrides:
      isValid in class PersistentObject
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getKeys

      public String[][] getKeys()
      Description copied from interface: Persistent
      A class may return key field groups in order to identify already existing objects of that class. A key field group must uniquely identify an object. Multiple such key field groups can be defined. Each of the key field groups must be unique for an object to be unique (thus, group1 matches OR group2 matches etc.).

      The first key field group is occasionally treated in a special manner as the primary business key. E.g. the export import functionality checks for object existence according to just the first key field group.

      If no key field groups can be provided by the implementing class an empty result must be returned - use Persistent.emptyKeys to do so.

      Specified by:
      getKeys in interface Persistent
      Overrides:
      getKeys in class PersistentObject
      Returns:
      An array of arrays containing object field names of those fields which constitute key field groups for uniquely identifying objects of classes implementing this interface. An example would be {{"name", "birthdate"},{"ssn"}} for a class defining two key field groups. The first one contains the fields name and birthdate, the second key field group has just one field ssn.
    • getLocalObjectName

      public String getLocalObjectName()
      Description copied from class: PersistentObject
      Get the object name in localized form. Subclasses should override this method!
      Specified by:
      getLocalObjectName in interface Persistent
      Overrides:
      getLocalObjectName in class PersistentObject
      Returns:
      the name of the objects in localized form