nl.surfnet.coin.api
Class ApiController

java.lang.Object
  extended by nl.surfnet.coin.api.AbstractApiController
      extended by nl.surfnet.coin.api.ApiController
Direct Known Subclasses:
MockApiController, PersonController

public class ApiController
extends AbstractApiController

We wildcard all RequestMapping with ':.+' (see http://stackoverflow.com /questions/3526523/spring-mvc-pathvariable-getting-truncated)


Field Summary
protected  EngineBlock engineBlock
           
static String GROUP_ID_SELF
           
protected  GroupProviderConfiguration groupProviderConfiguration
           
protected  GroupService groupService
           
static String PERSON_ID_SELF
           
protected  PersonService personService
           
protected  TeamExternalGroupDao teamExternalGroupDao
           
 
Constructor Summary
ApiController()
           
 
Method Summary
protected  void addApiCallLogInfo(nl.surfnet.coin.shared.log.ApiCallLog log)
          Hook for subclasses to change the log record
protected  List<GroupProvider> getAllAllowedGroupProviders(GroupProviderConfiguration.Service service)
           
 Group20Entry getGroup(String userId, String groupId)
           
 Object getGroupMembers(String userId, String groupId, Integer count, Integer startIndex, String sortBy)
           
 Group20Entry getGroups(String userId, Integer count, Integer startIndex, String sortBy)
           
 GroupEntry getOsGroups(String userId, Integer count, Integer startIndex, String sortBy)
           
 PersonEntry getPerson(String userId)
           
 Object handleIllegalArgumentException(IllegalArgumentException e)
          Handler for IllegalArgument Exception.
 Object handleRuntimeException(RuntimeException e)
          Handler for RuntimeExceptions.
protected  void invariant()
           
protected  void logApiCall(String onBehalfOf)
           
protected  void sendAclMissingMail(GroupProvider groupProvider, String spEntityId, String identifier, GroupProviderConfiguration.Service service)
           
protected  void setResultOptions(AbstractEntry entry, Integer count, Integer startIndex, String sortBy)
           
 
Methods inherited from class nl.surfnet.coin.api.AbstractApiController
getClientMetaData, getOnBehalfOf, preflightCORS
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GROUP_ID_SELF

public static final String GROUP_ID_SELF
See Also:
Constant Field Values

PERSON_ID_SELF

public static final String PERSON_ID_SELF
See Also:
Constant Field Values

personService

protected PersonService personService

groupService

protected GroupService groupService

engineBlock

protected EngineBlock engineBlock

groupProviderConfiguration

protected GroupProviderConfiguration groupProviderConfiguration

teamExternalGroupDao

@Autowired
protected TeamExternalGroupDao teamExternalGroupDao
Constructor Detail

ApiController

public ApiController()
Method Detail

getPerson

@RequestMapping(method=GET,
                value="/people/{userId:.+}")
@ResponseBody
public PersonEntry getPerson(@PathVariable(value="userId")
                                                         String userId)

getGroupMembers

@RequestMapping(method=GET,
                value="/people/{userId:.+}/{groupId:.+}")
@ResponseBody
public Object getGroupMembers(@PathVariable(value="userId")
                                                          String userId,
                                                          @PathVariable(value="groupId")
                                                          String groupId,
                                                          @RequestParam(value="count",required=false)
                                                          Integer count,
                                                          @RequestParam(value="startIndex",required=false)
                                                          Integer startIndex,
                                                          @RequestParam(value="sortBy",required=false)
                                                          String sortBy)

getGroups

@RequestMapping(method=GET,
                value="/groups/{userId:.+}")
@ResponseBody
public Group20Entry getGroups(@PathVariable(value="userId")
                                                          String userId,
                                                          @RequestParam(value="count",required=false)
                                                          Integer count,
                                                          @RequestParam(value="startIndex",required=false)
                                                          Integer startIndex,
                                                          @RequestParam(value="sortBy",required=false)
                                                          String sortBy)

getOsGroups

@RequestMapping(method=GET,
                value="/osgroups/{userId:.+}")
@ResponseBody
public GroupEntry getOsGroups(@PathVariable(value="userId")
                                                          String userId,
                                                          @RequestParam(value="count",required=false)
                                                          Integer count,
                                                          @RequestParam(value="startIndex",required=false)
                                                          Integer startIndex,
                                                          @RequestParam(value="sortBy",required=false)
                                                          String sortBy)

getGroup

@RequestMapping(method=GET,
                value="/groups/{userId:.+}/{groupId}")
@ResponseBody
public Group20Entry getGroup(@PathVariable(value="userId")
                                                         String userId,
                                                         @PathVariable(value="groupId")
                                                         String groupId)

handleRuntimeException

@ResponseStatus(value=NOT_FOUND)
@ResponseBody
@ExceptionHandler(value=java.lang.RuntimeException.class)
public Object handleRuntimeException(RuntimeException e)
Handler for RuntimeExceptions. It makes API return a model containing the original exception's message.

Parameters:
e - the exception
Returns:
the response body

handleIllegalArgumentException

@ResponseStatus(value=BAD_REQUEST)
@ResponseBody
@ExceptionHandler(value=java.lang.IllegalArgumentException.class)
public Object handleIllegalArgumentException(IllegalArgumentException e)
Handler for IllegalArgument Exception.

Parameters:
e - the exception
Returns:
the response body

setResultOptions

protected void setResultOptions(AbstractEntry entry,
                                Integer count,
                                Integer startIndex,
                                String sortBy)

invariant

protected void invariant()

sendAclMissingMail

protected void sendAclMissingMail(GroupProvider groupProvider,
                                  String spEntityId,
                                  String identifier,
                                  GroupProviderConfiguration.Service service)

getAllAllowedGroupProviders

protected List<GroupProvider> getAllAllowedGroupProviders(GroupProviderConfiguration.Service service)

logApiCall

protected void logApiCall(String onBehalfOf)

addApiCallLogInfo

protected void addApiCallLogInfo(nl.surfnet.coin.shared.log.ApiCallLog log)
Hook for subclasses to change the log record

Parameters:
log - the log record


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