nl.surfnet.coin.teams.util
Class ControllerUtilImpl

java.lang.Object
  extended by nl.surfnet.coin.teams.util.ControllerUtilImpl
All Implemented Interfaces:
ControllerUtil

@Component(value="controllerUtil")
public class ControllerUtilImpl
extends Object
implements ControllerUtil

This class includes methods that are often used by controllers


Constructor Summary
ControllerUtilImpl()
           
 
Method Summary
 javax.mail.internet.MimeMultipart getMimeMultipartMessageBody(String plainText, String html)
          Makes MimeMultipart with a plain text and html version of the mail
 Team getTeam(javax.servlet.http.HttpServletRequest request)
          Get the team from the HttpServletRequest request.
 Team getTeamById(String teamId)
          Get the team from the String teamId.
 boolean hasUserAdministrativePrivileges(nl.surfnet.coin.api.client.domain.Person person, String teamId)
          Checks if the current user has administrative privileges (whether he is admin OR manager) for a given team.
 boolean hasUserAdminPrivileges(nl.surfnet.coin.api.client.domain.Person person, String teamId)
          Checks if the current user has admin privileges for a given team.
 boolean isPersonMemberOfTeam(String personId, Team team)
          Check if a Person is member of the given Team
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ControllerUtilImpl

public ControllerUtilImpl()
Method Detail

getTeam

public Team getTeam(javax.servlet.http.HttpServletRequest request)
Get the team from the HttpServletRequest request.

Specified by:
getTeam in interface ControllerUtil
Parameters:
request - the HttpServletRequest
Returns:
The Team team
Throws:
RuntimeException - if the team cannot be found

getTeamById

public Team getTeamById(String teamId)
Get the team from the String teamId.

Specified by:
getTeamById in interface ControllerUtil
Parameters:
teamId - the String teamId
Returns:
The Team team
Throws:
RuntimeException - if the team cannot be found

hasUserAdministrativePrivileges

public boolean hasUserAdministrativePrivileges(nl.surfnet.coin.api.client.domain.Person person,
                                               String teamId)
Checks if the current user has administrative privileges (whether he is admin OR manager) for a given team.

Specified by:
hasUserAdministrativePrivileges in interface ControllerUtil
Parameters:
person - Person
teamId - String the team Id for which the person's privileges are checked
Returns:
boolean true/code> if the user is admin AND/OR manager false if the user isn't

hasUserAdminPrivileges

public boolean hasUserAdminPrivileges(nl.surfnet.coin.api.client.domain.Person person,
                                      String teamId)
Checks if the current user has admin privileges for a given team.

Specified by:
hasUserAdminPrivileges in interface ControllerUtil
Parameters:
person - Person
teamId - String the team Id for which the person's privileges are checked
Returns:
boolean true/code> if the user is admin AND/OR manager false if the user isn't

isPersonMemberOfTeam

public boolean isPersonMemberOfTeam(String personId,
                                    Team team)
Check if a Person is member of the given Team

Specified by:
isPersonMemberOfTeam in interface ControllerUtil
Parameters:
personId - String the person identifier
team - Team the team
Returns:
true if the user is member of the team, false if the user isn't member

getMimeMultipartMessageBody

public javax.mail.internet.MimeMultipart getMimeMultipartMessageBody(String plainText,
                                                                     String html)
                                                              throws javax.mail.MessagingException
Description copied from interface: ControllerUtil
Makes MimeMultipart with a plain text and html version of the mail

Specified by:
getMimeMultipartMessageBody in interface ControllerUtil
Parameters:
plainText - contents of the plain text part of the mail
html - contents of the html part of the mail
Returns:
MimeMultipart
Throws:
javax.mail.MessagingException


Copyright © 2009-2013 SURFnet bv, The Netherlands. All Rights Reserved.