org.hackystat.sensorbase.resource.sensordata
Class UserSensorDataResource

java.lang.Object
  extended by org.restlet.Handler
      extended by org.restlet.resource.Resource
          extended by org.hackystat.sensorbase.resource.sensorbase.SensorBaseResource
              extended by org.hackystat.sensorbase.resource.sensordata.UserSensorDataResource

public class UserSensorDataResource
extends SensorBaseResource

The resource for all URIs that extend sensordata. This includes:

Author:
Philip Johnson

Field Summary
 
Fields inherited from class org.hackystat.sensorbase.resource.sensorbase.SensorBaseResource
authUser, project, projectManager, projectName, responseMsg, sdtManager, sensorDataManager, server, uriUser, user, userManager
 
Constructor Summary
UserSensorDataResource(org.restlet.Context context, org.restlet.data.Request request, org.restlet.data.Response response)
          Provides the following representational variants: TEXT_XML.
 
Method Summary
 boolean allowDelete()
          Indicate the DELETE method is supported.
 boolean allowPut()
          Indicate the PUT method is supported.
 void removeRepresentations()
          Implement the DELETE method that ensures the specified sensor data instance no longer exists.
 org.restlet.resource.Representation represent(org.restlet.resource.Variant variant)
          Returns a SensorDataIndex when a GET is called with: sensordata/{email} sensordata/{email}?
 void storeRepresentation(org.restlet.resource.Representation entity)
          Implement the PUT method that creates a new sensor data instance.
 
Methods inherited from class org.hackystat.sensorbase.resource.sensorbase.SensorBaseResource
getStringRepresentation, setStatusBadTimestamp, setStatusInternalError, setStatusMiscError, validateAuthUserIsAdmin, validateAuthUserIsAdminOrUriUser, validateProjectOwner, validateProjectViewer, validateUriProjectName, validateUriUserIsUser
 
Methods inherited from class org.restlet.resource.Resource
acceptRepresentation, allowGet, allowPost, delete, getPreferredRepresentation, getPreferredVariant, getRepresentation, getVariants, handleDelete, handleGet, handlePost, handlePut, init, isAvailable, isModifiable, isNegotiateContent, isReadable, post, put, represent, setAvailable, setModifiable, setNegotiateContent, setReadable, setVariants
 
Methods inherited from class org.restlet.Handler
allowHead, allowOptions, generateRef, getAllowedMethods, getApplication, getContext, getLogger, getMatrix, getQuery, getRequest, getResponse, handleHead, handleOptions, setContext, setRequest, setResponse, updateAllowedMethods
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserSensorDataResource

public UserSensorDataResource(org.restlet.Context context,
                              org.restlet.data.Request request,
                              org.restlet.data.Response response)
Provides the following representational variants: TEXT_XML.

Parameters:
context - The context.
request - The request object.
response - The response object.
Method Detail

represent

public org.restlet.resource.Representation represent(org.restlet.resource.Variant variant)
Returns a SensorDataIndex when a GET is called with: Returns a SensorData when a GET is called with:

The user must be defined, and the authenticated user must be the uriUser or the Admin or in a project with the uriUser on that day.

Specified by:
represent in class SensorBaseResource
Parameters:
variant - The representational variant requested.
Returns:
The representation.

allowPut

public boolean allowPut()
Indicate the PUT method is supported.

Overrides:
allowPut in class org.restlet.resource.Resource
Returns:
True.

storeRepresentation

public void storeRepresentation(org.restlet.resource.Representation entity)
Implement the PUT method that creates a new sensor data instance. Note that we are not validating that this sensor data instance contains all of the Required Properties specified by the SDT. This should be done later, on demand, as part of analyses.

We are also not at this point checking to see whether the User and SDT exist.

Overrides:
storeRepresentation in class org.restlet.resource.Resource
Parameters:
entity - The XML representation of the new sensor data instance..

allowDelete

public boolean allowDelete()
Indicate the DELETE method is supported.

Overrides:
allowDelete in class org.restlet.resource.Resource
Returns:
True.

removeRepresentations

public void removeRepresentations()
Implement the DELETE method that ensures the specified sensor data instance no longer exists. If not timestamp is supplied, then all sensor data will be deleted if the user is the test user.

Overrides:
removeRepresentations in class org.restlet.resource.Resource