com.jurismarches.vradi.services.managers
Class MailingManager

java.lang.Object
  extended by java.util.TimerTask
      extended by com.jurismarches.vradi.services.managers.MailingManager
All Implemented Interfaces:
java.lang.Runnable

public class MailingManager
extends java.util.TimerTask

Mailing manager. Handle:

Author:
Yolpo, kmorin, chatellier

Field Summary
protected  org.nuiton.wikitty.WikittyProxy proxy
           
protected static java.lang.String SSL_FACTORY
           
 
Constructor Summary
MailingManager(org.nuiton.wikitty.WikittyProxy proxy)
           
 
Method Summary
protected  java.lang.String getHeaderValueInContent(java.lang.String headerName, java.lang.String content)
          Find a header definition in mail content.
protected static Sending getSendingByMessageID(java.lang.String messageID, org.nuiton.wikitty.WikittyProxy proxy)
          Find first sending entity with given messageID.
protected  java.lang.String getStreamContent(java.io.InputStream inputStream)
          Convert an input stream to String.
 java.lang.String postMail(java.lang.String recipient, java.lang.String subject, java.lang.String message, java.util.List<Form> forms, boolean receptionProof)
          Sends an email to the specified recipient with the specified subject and the specified message and the specified forms PDF.
 void receiveMails()
          Receives the emails and check if some are error emails or reception proofs and treat them in consequence.
 void run()
          Called every periodically to manage new mail on server.
protected  void setValidEmailForUser(Sending sending)
          Set User.FQ_FIELD_USER_VALIDEMAIL attribute for User associated with sending.
 
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SSL_FACTORY

protected static final java.lang.String SSL_FACTORY
See Also:
Constant Field Values

proxy

protected org.nuiton.wikitty.WikittyProxy proxy
Constructor Detail

MailingManager

public MailingManager(org.nuiton.wikitty.WikittyProxy proxy)
Method Detail

postMail

public java.lang.String postMail(java.lang.String recipient,
                                 java.lang.String subject,
                                 java.lang.String message,
                                 java.util.List<Form> forms,
                                 boolean receptionProof)
                          throws VradiException
Sends an email to the specified recipient with the specified subject and the specified message and the specified forms PDF.

Parameters:
recipient - the email address of the recipient
subject - mail subject
message - mail content
forms - the list of forms to add to the mail
receptionProof - if true, ask for a reception proof
Returns:
the message id of the email sent
Throws:
VradiException

receiveMails

public void receiveMails()
                  throws VradiException
Receives the emails and check if some are error emails or reception proofs and treat them in consequence.

Throws:
VradiException

setValidEmailForUser

protected void setValidEmailForUser(Sending sending)
Set User.FQ_FIELD_USER_VALIDEMAIL attribute for User associated with sending.

Parameters:
sending -

getStreamContent

protected java.lang.String getStreamContent(java.io.InputStream inputStream)
                                     throws java.io.IOException
Convert an input stream to String.

Parameters:
inputStream -
Returns:
Throws:
java.io.IOException

getHeaderValueInContent

protected java.lang.String getHeaderValueInContent(java.lang.String headerName,
                                                   java.lang.String content)
Find a header definition in mail content. Exemple:
 Original-Message-ID: <1833582695.1.1272991628810.JavaMail.chatellier@genux>
 Diagnostic-Code: smtp; 550 5.1.1 : Recipient address
      rejected: User unknown in local recipient table
 Message-ID: <804992706.5.1272991629788.JavaMail.chatellier@genux>
 

Parameters:
headerName -
content -
Returns:

getSendingByMessageID

protected static Sending getSendingByMessageID(java.lang.String messageID,
                                               org.nuiton.wikitty.WikittyProxy proxy)
Find first sending entity with given messageID.

Parameters:
messageID - message id to find sending
proxy - wikitty proxy
Returns:
Sending or null if none found

run

public void run()
Called every periodically to manage new mail on server.

Specified by:
run in interface java.lang.Runnable
Specified by:
run in class java.util.TimerTask
See Also:
TimerTask.run()


Copyright © 2009-2010 JurisMarches. All Rights Reserved.