OBEROn SDK

com.oberon.ooql.sdk
Class Mail

java.lang.Object
  extended by com.oberon.ooql.sdk.OBBase
      extended by com.oberon.ooql.sdk.AdminBase
          extended by com.oberon.ooql.sdk.Mail
All Implemented Interfaces:
java.io.Serializable

public class Mail
extends AdminBase
implements java.io.Serializable

Mail object: used to access a User's mailbox and to send internal / external mail

Version:
5.0
See Also:
Serialized Form

Field Summary
static java.lang.String BCC
          Recipient type BCC - blind carbon copy
static java.lang.String CC
          Recipient type CC - carbon copy
static java.lang.String TO
          Recipient type TO
 
Fields inherited from class com.oberon.ooql.sdk.AdminBase
bsOptions, HIDDEN_OPTION
 
Constructor Summary
Mail()
          Constructor to send new mail
Mail(java.lang.String code)
          Constructor to manipulate existing user Mail object
 
Method Summary
 void addAttachFile(java.lang.String fileName)
          Attach a file to the Mail (only for external mail address)
 void addAttachObj(java.lang.String objectID)
          Attach a ObjectObj to the Mail (only for internal mail address)
 void addAttachObj(java.lang.String objectClass, java.lang.String objectName, java.lang.String objectRevision)
          Attach a ObjectObj to the Mail (only for internal mail address)
 void addBccAddress(java.lang.String mailAddress)
          Add an external mail address to the BCC recipient list
 void addBccAssignment(java.lang.String assignmentName)
          Add an Assignment to the BCC recipient list
 void addBccTeam(java.lang.String teamName)
          Add a Team to the BCC recipient list
 void addBccUser(java.lang.String userName)
          Add a User to the BCC recipient list
 void addCcAddress(java.lang.String mailAddress)
          Add an external mail address to the CC recipient list
 void addCcAssignment(java.lang.String assignmentName)
          Add an Assignment to the CC recipient list
 void addCcTeam(java.lang.String teamName)
          Add a Team to the CC recipient list
 void addCcUser(java.lang.String userName)
          Add a User to the CC recipient list
 void addRecipient(java.lang.String type, java.lang.String recipient)
          Add a User/Team/Assignment or a Mail address to the recipient list
 void addRecipient(java.lang.String type, java.lang.String userType, java.lang.String userName)
          Add a User/Team/Assignment to the recipient list
 void addRecipients(java.lang.String toList, java.lang.String ccList, java.lang.String bccList)
          Add a User/Team/Assignment to the recipient list
 void addToAddress(java.lang.String mailAddress)
          Add an external mail address to the recipient list
 void addToAssignment(java.lang.String assignmentName)
          Add an Assignment to the recipient list
 void addToTeam(java.lang.String teamName)
          Add a Team to the recipient list
 void addToUser(java.lang.String userName)
          Add a User to the recipient list
static java.lang.String convertRecipientType(int recipientType)
          Convert the recipient type from numeric code to String format
static int convertRecipientType(java.lang.String recipientType)
          Convert the recipient type from String format to numeric code
 void create(Framework framework)
          Send the Mail to relative internal / external recipients
 void destroy(Framework framework)
          Remove the Mail object from the database.
 org.jdom.Element destToXML(java.lang.String sToCc)
          Return the Mail object addresses as XML element tree
 void fromXML(org.jdom.Element rootElement)
          Load the Mail object properties from XML element tree
 java.util.Vector<java.lang.Object> getAttached()
          Get the attached ObjectObjs.
 java.lang.String getBody()
          Get the Mail message body
 java.lang.String getCcRecipientsToString(java.lang.String token)
          Return the CC recipient list as a string
 java.lang.String getCreateCommand(boolean force)
          [Inherited but not used]
 java.util.Vector<java.lang.String> getFiles()
          Get the list of attached file names
 java.lang.String getFromUser()
          Get the Sender User
 java.lang.String getProperty(java.lang.String propertyName, java.util.Vector<java.lang.Object> filterArgs, java.lang.String token, Framework framework)
          Get a property for this Mail object by its OOQL identifier
 java.util.Vector<java.lang.String[]> getRecipients()
          Return the recipient list
 java.lang.String getSaveCommand(boolean force)
          [Inherited but not used]
 java.lang.String getSendCommand(boolean bodyTag)
          Return the OOQL command for sending a mail with the settled properties
 java.util.Vector<java.lang.String> getSentUser()
          Return the full list of recipient users (without repetitions).
 java.lang.String getSubject()
          Get the Mail subject
 java.util.Vector<?> getTargetNames(java.lang.String composedName, java.util.Vector<java.lang.Object> filterArgs, Framework framework)
          Return a Vector of administrative object names extracted by using an OOQL selector
 java.lang.String getToRecipientsToString(java.lang.String token)
          Return the TO recipient list as a string
 boolean isRead()
          Check if mail is never read
 void link(Framework framework, java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
          Open the Mail object: connect the memory instance with the database instance
static void list(Selector selector, java.io.DataOutputStream outStream, Framework framework)
          List the Mail objects from the user MailBox
static Mail open(java.lang.String code, Framework framework, java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
          Open the object and read its properties from the database
 void resetRecipients()
          Remove all elements from the recipient list
 void send(Framework framework)
          Send the Mail to relative internal / external recipients
 void setBody(java.lang.String body)
          Set the Mail message body
 void setFromUser(java.lang.String userName)
          Set the Sender User
 void setId(int mailId)
          Set the Mail object id
 void setRead(boolean isRead)
          Force the read flag
 void setSubject(java.lang.String subject)
          Set the Mail subject
 void show(Selector selector, java.io.DataOutputStream outStream, Framework framework, java.lang.Boolean setRead)
          Show the Mail object properties
static void show(java.lang.String code, Selector selector, java.io.DataOutputStream outStream, Framework framework, java.lang.Boolean setRead)
          Show the properties for the given Mail
 java.lang.String toString()
          Return the Mail object properties as a single String
 java.lang.String toString(Framework framework)
          Return the Mail object properties as a single String
 org.jdom.Element toXML(boolean getImage, boolean fullDump, Framework framework)
          Return the Mail object properties as XML element tree
 org.jdom.Element toXML(Framework framework)
          Return the Mail object properties as XML element tree
 void unlink(Framework framework)
          Close the object: disconnect the memory instance from the database instance
 void write(Framework framework)
          Not used
 
Methods inherited from class com.oberon.ooql.sdk.AdminBase
addFeature, changedApplication, checkChangeName, checkCounters, checkCounters, getAdminType, getApplication, getCommonProperty, getCommonTargetNames, getCounters, getCreateBasicCommand, getCreateCommand, getCrtDate, getDescription, getEditBasicCommand, getFeature, getFeatures, getFeaturesAsString, getImage, getImage, getImage, getImageData, getImageFile, getModDate, getModUser, getName, getOldName, getPlainFeatures, getSaveCommand, getSVNRevision, getXMLFeatureList, hasImage, isHidden, setApplication, setCounters, setCrtDate, setDescription, setHidden, setImage, setImageData, setImageFile, setModDate, setModUser, setName, setSVNRevision, show, show, toCommonXML, toXML
 
Methods inherited from class com.oberon.ooql.sdk.OBBase
addChange, addUniqueChange, ChangesFromXML, ChangesToXML, getChanges, getChangesAsString, getId, isLinked, removeChange, resetChanges, setLinked
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TO

public static final java.lang.String TO
Recipient type TO

See Also:
Constant Field Values

CC

public static final java.lang.String CC
Recipient type CC - carbon copy

See Also:
Constant Field Values

BCC

public static final java.lang.String BCC
Recipient type BCC - blind carbon copy

See Also:
Constant Field Values
Constructor Detail

Mail

public Mail()
Constructor to send new mail


Mail

public Mail(java.lang.String code)
     throws OberonException
Constructor to manipulate existing user Mail object

Parameters:
code - the Mail reference code
Throws:
OberonException - if the code contains invalid characters
Method Detail

setId

public void setId(int mailId)
Set the Mail object id

Overrides:
setId in class OBBase

open

public static Mail open(java.lang.String code,
                        Framework framework,
                        java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
                 throws OberonException
Open the object and read its properties from the database

Parameters:
code - the Mail reference code
framework - the current User framework
counters - administrative object synch counters (if null read them from database)
Throws:
OberonException - usually due to DB SQL exceptions
Since:
4.0

link

public void link(Framework framework,
                 java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
          throws OberonException
Open the Mail object: connect the memory instance with the database instance

Specified by:
link in class AdminBase
Parameters:
framework - the current framework
counters - administrative object synch counters (if null read them from database)
Throws:
OberonException - usually due to DB SQL exceptions

show

public void show(Selector selector,
                 java.io.DataOutputStream outStream,
                 Framework framework,
                 java.lang.Boolean setRead)
          throws java.io.IOException,
                 OberonException
Show the Mail object properties

Parameters:
selector - selection parameters (if null return all the object properties)
outStream - the stream for the results (if null the result is stored into the framework)
framework - the current framework
setRead - if true mark the Mail object as read
Throws:
java.io.IOException - when the output stream return an exception
OberonException - for all other problems
See Also:
Framework.getResult()

show

public static void show(java.lang.String code,
                        Selector selector,
                        java.io.DataOutputStream outStream,
                        Framework framework,
                        java.lang.Boolean setRead)
                 throws java.io.IOException,
                        OberonException
Show the properties for the given Mail

Parameters:
code - the Mail reference code
selector - selection parameters (if null return all the mail properties)
outStream - the stream for the results (if null the result is stored into the framework)
framework - the current framework
setRead - if true mark the Mail object as read
Throws:
java.io.IOException - when the output stream return an exception
OberonException - for all other problems
Since:
4.0
See Also:
Framework.getResult()

unlink

public void unlink(Framework framework)
            throws OberonException
Close the object: disconnect the memory instance from the database instance

Specified by:
unlink in class AdminBase
Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions

destroy

public void destroy(Framework framework)
             throws OberonException
Remove the Mail object from the database.

Specified by:
destroy in class AdminBase
Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions

create

public void create(Framework framework)
            throws OberonException
Send the Mail to relative internal / external recipients

Specified by:
create in class AdminBase
Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL or Java Mail exceptions
See Also:
send(Framework)

send

public void send(Framework framework)
          throws OberonException
Send the Mail to relative internal / external recipients

Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL or Java Mail exceptions

list

public static void list(Selector selector,
                        java.io.DataOutputStream outStream,
                        Framework framework)
                 throws java.io.IOException,
                        OberonException
List the Mail objects from the user MailBox

Parameters:
selector - selection parameters (if null return the Mail codes)
outStream - the stream for the results (if null the result is stored into the framework)
framework - the current framework
Throws:
java.io.IOException - when the output stream return an exception
OberonException
See Also:
Framework.getResult()

write

public void write(Framework framework)
           throws OberonException
Not used

Specified by:
write in class AdminBase
Parameters:
framework - the current framework
Throws:
OberonException

setFromUser

public void setFromUser(java.lang.String userName)
Set the Sender User

Parameters:
userName - the User name

getFromUser

public java.lang.String getFromUser()
Get the Sender User


resetRecipients

public void resetRecipients()
Remove all elements from the recipient list


getRecipients

public java.util.Vector<java.lang.String[]> getRecipients()
Return the recipient list

Returns:
Vector of String[] { TO/CC/BCC , userType , userName }

addRecipients

public void addRecipients(java.lang.String toList,
                          java.lang.String ccList,
                          java.lang.String bccList)
Add a User/Team/Assignment to the recipient list

Parameters:
toList - list of TO recipients
ccList - list of CC recipients
bccList - list of BCC recipients
All lists must be in the format:
user[userName],assignment[assignName],team[teamName],email@domain.com
Since:
4.0

addRecipient

public void addRecipient(java.lang.String type,
                         java.lang.String recipient)
Add a User/Team/Assignment or a Mail address to the recipient list

Parameters:
type - the recipient type ( TO ,CC , BCC )
recipient - one of user[userName] assignment[assignName] team[teamName] or email@domain.com
Since:
4.0

addRecipient

public void addRecipient(java.lang.String type,
                         java.lang.String userType,
                         java.lang.String userName)
Add a User/Team/Assignment to the recipient list

Parameters:
type - the recipient type ( TO ,CC , BCC )
userType - the user type: one of User / Team / Assignment
userName - the user name

convertRecipientType

public static int convertRecipientType(java.lang.String recipientType)
Convert the recipient type from String format to numeric code


convertRecipientType

public static java.lang.String convertRecipientType(int recipientType)
Convert the recipient type from numeric code to String format


addToUser

public void addToUser(java.lang.String userName)
Add a User to the recipient list

Parameters:
userName - the User name

addToTeam

public void addToTeam(java.lang.String teamName)
Add a Team to the recipient list

Parameters:
teamName - the Team name

addToAssignment

public void addToAssignment(java.lang.String assignmentName)
Add an Assignment to the recipient list

Parameters:
assignmentName - the Assignment name

addToAddress

public void addToAddress(java.lang.String mailAddress)
Add an external mail address to the recipient list

Parameters:
mailAddress - the mail address

getToRecipientsToString

public java.lang.String getToRecipientsToString(java.lang.String token)
Return the TO recipient list as a string

Parameters:
token - the separator token

addCcUser

public void addCcUser(java.lang.String userName)
Add a User to the CC recipient list

Parameters:
userName - the User name

addCcTeam

public void addCcTeam(java.lang.String teamName)
Add a Team to the CC recipient list

Parameters:
teamName - the Team name

addCcAssignment

public void addCcAssignment(java.lang.String assignmentName)
Add an Assignment to the CC recipient list

Parameters:
assignmentName - the Assignment name

addCcAddress

public void addCcAddress(java.lang.String mailAddress)
Add an external mail address to the CC recipient list

Parameters:
mailAddress - the mail address

getCcRecipientsToString

public java.lang.String getCcRecipientsToString(java.lang.String token)
Return the CC recipient list as a string

Parameters:
token - the separator token

addBccUser

public void addBccUser(java.lang.String userName)
Add a User to the BCC recipient list

Parameters:
userName - the User name

addBccTeam

public void addBccTeam(java.lang.String teamName)
Add a Team to the BCC recipient list

Parameters:
teamName - the Team name

addBccAssignment

public void addBccAssignment(java.lang.String assignmentName)
Add an Assignment to the BCC recipient list

Parameters:
assignmentName - the Assignment name

addBccAddress

public void addBccAddress(java.lang.String mailAddress)
Add an external mail address to the BCC recipient list

Parameters:
mailAddress - the mail address

getSentUser

public java.util.Vector<java.lang.String> getSentUser()
Return the full list of recipient users (without repetitions). This list is available only after the send process. Vector elements can be one of: user|<userName> or team|<teamName> or assignment|<assignName> or address|<mailAddress>


setSubject

public void setSubject(java.lang.String subject)
Set the Mail subject


getSubject

public java.lang.String getSubject()
Get the Mail subject


setBody

public void setBody(java.lang.String body)
Set the Mail message body


getBody

public java.lang.String getBody()
Get the Mail message body


addAttachObj

public void addAttachObj(java.lang.String objectID)
Attach a ObjectObj to the Mail (only for internal mail address)

Parameters:
objectID - the ObjectObj ID

addAttachObj

public void addAttachObj(java.lang.String objectClass,
                         java.lang.String objectName,
                         java.lang.String objectRevision)
Attach a ObjectObj to the Mail (only for internal mail address)

Parameters:
objectClass - the ObjectObj Class name
objectName - the ObjectObj Name
objectRevision - the ObjectObj Revision

getAttached

public java.util.Vector<java.lang.Object> getAttached()
Get the attached ObjectObjs.

Returns:
a Vector of String { ObjectObj ID } or String[3] {Class-name, name, revision}

addAttachFile

public void addAttachFile(java.lang.String fileName)
Attach a file to the Mail (only for external mail address)

Parameters:
fileName - the file full path/name

getFiles

public java.util.Vector<java.lang.String> getFiles()
Get the list of attached file names


setRead

public void setRead(boolean isRead)
Force the read flag

Parameters:
isRead - if true the Mail object is marked as read

isRead

public boolean isRead()
Check if mail is never read


getProperty

public java.lang.String getProperty(java.lang.String propertyName,
                                    java.util.Vector<java.lang.Object> filterArgs,
                                    java.lang.String token,
                                    Framework framework)
Get a property for this Mail object by its OOQL identifier

Specified by:
getProperty in class OBBase
Parameters:
propertyName - OOQL property identifier/name (example: subject , sender ...)
filterArgs - extra arguments used to compute properties
token - separator token for complex properties
framework - the current framework
Returns:
the property value

getTargetNames

public java.util.Vector<?> getTargetNames(java.lang.String composedName,
                                          java.util.Vector<java.lang.Object> filterArgs,
                                          Framework framework)
Return a Vector of administrative object names extracted by using an OOQL selector

Specified by:
getTargetNames in class OBBase
Parameters:
composedName - OOQL property identifier/name (example: attach, .. )
filterArgs - extra arguments used to compute properties
framework - the current framework
Returns:
a Vector of target names, used to extract their (sub)properties values

toString

public java.lang.String toString()
Return the Mail object properties as a single String

Overrides:
toString in class AdminBase

toString

public java.lang.String toString(Framework framework)
Return the Mail object properties as a single String

Overrides:
toString in class AdminBase
Parameters:
framework - the current framework

destToXML

public org.jdom.Element destToXML(java.lang.String sToCc)
Return the Mail object addresses as XML element tree

Parameters:
sToCc - can be TO or CC

toXML

public org.jdom.Element toXML(Framework framework)
Return the Mail object properties as XML element tree

Specified by:
toXML in class AdminBase
Parameters:
framework - the current framework

toXML

public org.jdom.Element toXML(boolean getImage,
                              boolean fullDump,
                              Framework framework)
Return the Mail object properties as XML element tree

Specified by:
toXML in class AdminBase
Parameters:
getImage - true to include "imagedata" element with the base64 encoded image data
fullDump - true to include detailed information
framework - the current framework

fromXML

public void fromXML(org.jdom.Element rootElement)
Load the Mail object properties from XML element tree

Overrides:
fromXML in class AdminBase

getCreateCommand

public java.lang.String getCreateCommand(boolean force)
[Inherited but not used]

Specified by:
getCreateCommand in class AdminBase
Parameters:
force - if true append the "force" options at the end

getSaveCommand

public java.lang.String getSaveCommand(boolean force)
[Inherited but not used]

Specified by:
getSaveCommand in class AdminBase
Parameters:
force - if true append the "force" options at the end

getSendCommand

public java.lang.String getSendCommand(boolean bodyTag)
Return the OOQL command for sending a mail with the settled properties

Parameters:
bodyTag - if true, replace the body text with tag "<MAIL-BODY>"

OBEROn SDK

Copyright © 2008-2014 Mirko Solazzi. All Rights Reserved.