SessionService

com.j0h1.contour.server.rest

## Class SessionService

- java.lang.Object
- - com.j0h1.contour.server.rest.SessionService

-     public class SessionService
      extends java.lang.Object

  The methods of this service class are invoked by requesting the defined URL paths. The response of this service is either a single Session object or a List of Session objects.
  Author:
    Johannes Riedmann

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SessionService()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `SessionResponseList` | `getTop10Sessions(int playerId, int trackId)` This method responds to it's specified path by generating a XML document containing a list of sessions for the given playerId and trackId.
    `java.lang.String` | `persistSession(javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> formParams)` Persists a session, defined in the formParams that are defined in the request, to the database.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SessionService

          public SessionService()

  - ### Method Detail

    - #### getTop10Sessions

          public SessionResponseList getTop10Sessions(int playerId,
                                                      int trackId)

      This method responds to it's specified path by generating a XML document containing a list of sessions for the given playerId and trackId. This list contains the top10 sessions for the given trackId/playerId and is ordered descending by the score.
      Parameters:
        `playerId` - If playerId equals Integer.MAX_VALUE, the global top10 sessions are returned. Otherwise this method will return the top 10 sessions for the specified playerId.
        `trackId` - Integer.MAX_VALUE as trackId indicates a query for custom sessions. For other values bigger than 0, this method responds with the top 10 sessions for the specified track.
      Returns:
        Responds with a list of the top 10 sessions, ordered descending by the achieved score, mapped to a XML document. If no sessions were found, a empty list is returned.

    - #### persistSession

          public java.lang.String persistSession(javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> formParams)

      Persists a session, defined in the formParams that are defined in the request, to the database.
      Parameters:
        `formParams` - Contain all the data that is needed to persist the drawing session successfully.
      Returns:
        A plain text String that says "success" of session is persisted successfully.