org.sakaiproject.mailsender.logic
Interface ExternalLogic


public interface ExternalLogic

This is the interface for logic which is external to our app logic


Field Summary
static String EVENT_EMAIL_SEND
           
static String NO_LOCATION
           
static String PERM_ADMIN
           
static String PERM_SEND
           
 
Method Summary
 boolean addToArchive(ConfigEntry config, String channelRef, String sender, String subject, String body)
          Append email to Email Archive
 String getCurrentLocationId()
           
 org.sakaiproject.site.api.Site getCurrentSite()
          Get the current site's details
 String getCurrentSiteTitle()
           
 org.sakaiproject.user.api.User getCurrentUser()
          Get details for the current user
 String getCurrentUserId()
           
 String getSiteID()
          Get the site id for the current site
 String getSiteRealmID()
          Get the realm id for the current site
 String getSiteType()
          Get the type of the current site
 org.sakaiproject.user.api.User getUser(String userId)
          Get details for a user
 String getUserDisplayName(String userId)
          Get the display name for a user by their unique id
 boolean isEmailArchiveAddedToSite()
          Check if the email archive tool is added to the current site
 boolean isUserAdmin(String userId)
          Check if this user has super admin access
 boolean isUserAllowedInLocation(String userId, String permission, String locationId)
          Check if a user has a specified permission within a context, primarily a convenience method and passthrough
 boolean isUserSiteAdmin(String userId, String locationId)
          Check if this user has site update access
 List<String> sendEmail(ConfigEntry config, String fromEmail, String fromName, Map<String,String> to, String subject, String content, List<org.sakaiproject.email.api.Attachment> attachments)
          Send email to a list of users.
 

Field Detail

NO_LOCATION

static final String NO_LOCATION
See Also:
Constant Field Values

EVENT_EMAIL_SEND

static final String EVENT_EMAIL_SEND
See Also:
Constant Field Values

PERM_ADMIN

static final String PERM_ADMIN
See Also:
Constant Field Values

PERM_SEND

static final String PERM_SEND
See Also:
Constant Field Values
Method Detail

getCurrentUserId

String getCurrentUserId()
Returns:
the current sakai user id (not username)

getCurrentUser

org.sakaiproject.user.api.User getCurrentUser()
Get details for the current user

Returns:

getUserDisplayName

String getUserDisplayName(String userId)
Get the display name for a user by their unique id

Parameters:
userId - the current sakai user id (not username)
Returns:
display name (probably firstname lastname) or "----------" (10 hyphens) if none found

getUser

org.sakaiproject.user.api.User getUser(String userId)
Get details for a user

Parameters:
userId -
Returns:

getCurrentSiteTitle

String getCurrentSiteTitle()
Parameters:
locationId - a unique id which represents the current location of the user (entity reference)
Returns:
the title for the context or "--------" (8 hyphens) if none found

getCurrentSite

org.sakaiproject.site.api.Site getCurrentSite()
Get the current site's details

Returns:

getSiteID

String getSiteID()
Get the site id for the current site

Returns:

getSiteRealmID

String getSiteRealmID()
Get the realm id for the current site

Returns:

getSiteType

String getSiteType()
Get the type of the current site

Returns:

isUserSiteAdmin

boolean isUserSiteAdmin(String userId,
                        String locationId)
Check if this user has site update access

Parameters:
userId - the internal user id (not username)
locationId - a unique id which represents the current location of the user (entity reference)
Returns:
true if the user has site update access, false otherwise

isUserAdmin

boolean isUserAdmin(String userId)
Check if this user has super admin access

Parameters:
userId - the internal user id (not username)
Returns:
true if the user has admin access, false otherwise

isUserAllowedInLocation

boolean isUserAllowedInLocation(String userId,
                                String permission,
                                String locationId)
Check if a user has a specified permission within a context, primarily a convenience method and passthrough

Parameters:
userId - the internal user id (not username)
permission - a permission string constant
locationId - a unique id which represents the current location of the user (entity reference)
Returns:
true if allowed, false otherwise

isEmailArchiveAddedToSite

boolean isEmailArchiveAddedToSite()
Check if the email archive tool is added to the current site

Returns:
true if email archive tool exists, false otherwise

sendEmail

List<String> sendEmail(ConfigEntry config,
                       String fromEmail,
                       String fromName,
                       Map<String,String> to,
                       String subject,
                       String content,
                       List<org.sakaiproject.email.api.Attachment> attachments)
                       throws MailsenderException,
                              AttachmentException
Send email to a list of users. After validation, if there are any valid email addresses available, the email is sent to those recipients and the invalid recipients are returned to the caller.

Parameters:
config -
fromEmail -
fromName -
to - Map of email address
subject -
content -
attachments -
Returns:
List of email addresses that were found to be invalid.
Throws:
AttachmentException
MailsenderException

addToArchive

boolean addToArchive(ConfigEntry config,
                     String channelRef,
                     String sender,
                     String subject,
                     String body)
Append email to Email Archive

Parameters:
config -
channelRef -
sender -
subject -
body -
Returns:
true if success

getCurrentLocationId

String getCurrentLocationId()
Returns:
the current location id of the current user


Copyright © 2007-2013 Sakai Project. All Rights Reserved.