com.atlassian.jira.service.util.handler
Class MessageUserProcessorImpl
java.lang.Object
com.atlassian.jira.service.util.handler.MessageUserProcessorImpl
- All Implemented Interfaces:
- MessageUserProcessor
@Internal
public class MessageUserProcessorImpl
- extends Object
- implements MessageUserProcessor
- Since:
- v5.0
Method Summary |
com.atlassian.crowd.embedded.api.User |
findUserByEmail(String emailAddress)
Returns the first User found with an email address that equals the given emailAddress case insensitively. |
com.atlassian.crowd.embedded.api.User |
findUserByUsername(String username)
Finds the user with the given username or returns null if there is no such User. |
com.atlassian.crowd.embedded.api.User |
getAuthorFromSender(javax.mail.Message message)
For each sender of the given message in turn, look up a User first with a case-insensitively equal email address,
and failing that, with a username equal to the email address. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MessageUserProcessorImpl
public MessageUserProcessorImpl(UserManager userManager)
getAuthorFromSender
@Nullable
public com.atlassian.crowd.embedded.api.User getAuthorFromSender(javax.mail.Message message)
throws javax.mail.MessagingException
- For each sender of the given message in turn, look up a User first with a case-insensitively equal email address,
and failing that, with a username equal to the email address.
JIRA wants to do this because when we create users in email handlers, we set email and username equal. If a user
subsequently changes their email address, we must not assume they don't exist and create them with the email
address as the username.
- Specified by:
getAuthorFromSender
in interface MessageUserProcessor
- Parameters:
message
- the message from which to get the User.
- Returns:
- the User matching the sender of the message or null if none found.
- Throws:
javax.mail.MessagingException
- if there's strife getting the message sender.
findUserByUsername
@Nullable
public com.atlassian.crowd.embedded.api.User findUserByUsername(String username)
- Finds the user with the given username or returns null if there is no such User. Convenience method which doesn't
throw up.
- Specified by:
findUserByUsername
in interface MessageUserProcessor
- Parameters:
username
- the username.
- Returns:
- the User or null.
findUserByEmail
@Nullable
public com.atlassian.crowd.embedded.api.User findUserByEmail(String emailAddress)
- Returns the first User found with an email address that equals the given emailAddress case insensitively.
- Specified by:
findUserByEmail
in interface MessageUserProcessor
- Parameters:
emailAddress
- the email address to match.
- Returns:
- the User.
Copyright © 2002-2013 Atlassian. All Rights Reserved.