com.atlassian.jira.util
Class EmailFormatterImpl

java.lang.Object
  extended by com.atlassian.jira.util.EmailFormatterImpl
All Implemented Interfaces:
EmailFormatter

public class EmailFormatterImpl
extends Object
implements EmailFormatter


Constructor Summary
EmailFormatterImpl(ApplicationProperties applicationProperties)
           
 
Method Summary
 boolean emailVisible(User user)
          Emails are visible by user if email visibility is set to show (public) or mask (masked) or user (show to logged in users only)
 String formatEmail(String email, User currentUser)
          Potentially hide/mask an email address.
 String formatEmail(User user, User currentUser)
          Formats how the user's Email address is to be displayed to the currentUser determined by the user email visibility value
 String formatEmailAsLink(String email, User currentUser)
          Returns a HTML link for the e-mail if appropriate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmailFormatterImpl

public EmailFormatterImpl(ApplicationProperties applicationProperties)
Method Detail

emailVisible

public boolean emailVisible(User user)
Emails are visible by user if email visibility is set to show (public) or mask (masked) or user (show to logged in users only)

Specified by:
emailVisible in interface EmailFormatter

formatEmail

public String formatEmail(User user,
                          User currentUser)
Description copied from interface: EmailFormatter
Formats how the user's Email address is to be displayed to the currentUser determined by the user email visibility value

Specified by:
formatEmail in interface EmailFormatter
Parameters:
user - owner of the email address to format and display
currentUser - the current logged in user viewing the email address of the above user
Returns:
String - formatted email address, or null if currentUser is not allowed to view it

formatEmail

public String formatEmail(String email,
                          User currentUser)
Description copied from interface: EmailFormatter
Potentially hide/mask an email address.

Specified by:
formatEmail in interface EmailFormatter
Parameters:
email - The email address to show/mask/hide.
currentUser - The user viewing the email address.
Returns:
The email address, possibly masked, or null if the user is not allowed to view it.

formatEmailAsLink

public String formatEmailAsLink(String email,
                                User currentUser)
Returns a HTML link for the e-mail if appropriate. REMEMBER not to escape the string returned by this method as this method does this already!

Specified by:
formatEmailAsLink in interface EmailFormatter
Returns:
<a href="foo@bar.com">foo@bar.com</a> (public), <a href="foo at bar.com">foo at bar.com</a> (masked), or "" (hidden).


Copyright © 2002-2008 Atlassian. All Rights Reserved.