Android Mobile Physical Therapy Exercise Documenter

com.communipatient.amptedapp.data
Class PersistenceHelper

java.lang.Object
  extended by com.communipatient.amptedapp.data.PersistenceHelper

public class PersistenceHelper
extends java.lang.Object

The class that interacts with the SQLite database to make the exercise plan data persistent.


Field Summary
private  android.content.Context context
          The context for the database.
private  MyDatabaseHelper helper
          The helper that is used to get an instance of the database.
 
Constructor Summary
PersistenceHelper(android.content.Context context)
          Initializes a new instance of the PersistenceHelper class.
 
Method Summary
 int getActivePlanId()
          Gets the id of the plan that is currently set as active.
private  java.util.List<Exercise> getExercises(int planId)
          Gets the list of Exercises that belong to the specified plan.
private  java.util.List<Feedback> getFeedback(int exId)
          The list of feedback for a given exercise.
private  java.util.List<ExerciseImage> getImages(int exId)
          The list of Images associated with an Exercise.
private  java.util.List<ExerciseModifier> getModifiers(int exId)
          The list of Modifiers associated with an Exercise.
 ExercisePlan getPlan(int planIdentifier)
          Gets all of the ExercisePlans that are stored in the database.
 int getPlanId(java.lang.String mid)
          Retrieves the requested plan id given a message identifier If the message identifier is not found, -1 will be returned.
 java.util.List<ExercisePlan> getPlanList()
          Gets the list of exercise plans.
 ExercisePlan getPlanWithFeedback(int planIdentifier)
          Gets all of the ExercisePlans that are stored in the database.
 long insert(ExercisePlan plan)
          Inserts a new ExercisePlan into the database including all of the sub objects.
 long insert(Feedback feedback, int exId)
          Insert a new feedback entry into the database.
 void setPlanActive(int planId, boolean active)
          Sets the active flag for a plan.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

private android.content.Context context
The context for the database.


helper

private MyDatabaseHelper helper
The helper that is used to get an instance of the database.

Constructor Detail

PersistenceHelper

public PersistenceHelper(android.content.Context context)
Initializes a new instance of the PersistenceHelper class.

Parameters:
context - The context used.
Method Detail

insert

public long insert(ExercisePlan plan)
Inserts a new ExercisePlan into the database including all of the sub objects.

Parameters:
plan - The ExercisePlan.
Returns:
The identifier of the ExercisePlan that was inserted.

insert

public long insert(Feedback feedback,
                   int exId)
Insert a new feedback entry into the database.

Parameters:
feedback - The feedback.
exId - The exercise identifier.
Returns:
The feedback identifier.

setPlanActive

public void setPlanActive(int planId,
                          boolean active)
Sets the active flag for a plan. Setting a plan as active will automatically set other plans that were previously set as active as inactive.

Parameters:
planId - The plan identifier.
active - True to set as active; false for inactive.

getActivePlanId

public int getActivePlanId()
Gets the id of the plan that is currently set as active. If no plan is set as active then -1 is returned.

Returns:
The active plan id.

getPlanId

public int getPlanId(java.lang.String mid)
Retrieves the requested plan id given a message identifier If the message identifier is not found, -1 will be returned.

Parameters:
mid - The message identifier.
Returns:
The plan identifier.

getPlanList

public java.util.List<ExercisePlan> getPlanList()
Gets the list of exercise plans. This does not include the exercises associated with the plan.

Returns:
The list of plans.

getPlan

public ExercisePlan getPlan(int planIdentifier)
Gets all of the ExercisePlans that are stored in the database. This method may return null if the plan was not retrieved.

Parameters:
planIdentifier - The id of the plan to retrieve.
Returns:
The exercise plan.

getPlanWithFeedback

public ExercisePlan getPlanWithFeedback(int planIdentifier)
Gets all of the ExercisePlans that are stored in the database. This method may return null if the plan was not retrieved. This is an enhanced method that includes the feedback captured from the user.

Parameters:
planIdentifier - The id of the plan to retrieve.
Returns:
The exercise plan with feedback included..

getExercises

private java.util.List<Exercise> getExercises(int planId)
Gets the list of Exercises that belong to the specified plan.

Parameters:
planId - The plan identifier used as part of the query.
Returns:
The list of Exercises.

getModifiers

private java.util.List<ExerciseModifier> getModifiers(int exId)
The list of Modifiers associated with an Exercise.

Parameters:
exId - The Exercise identifier used as part of the query.
Returns:
The list of Modifiers.

getImages

private java.util.List<ExerciseImage> getImages(int exId)
The list of Images associated with an Exercise.

Parameters:
exId - The Exercise identifier used as part of the query.
Returns:
The list of Images.

getFeedback

private java.util.List<Feedback> getFeedback(int exId)
The list of feedback for a given exercise.

Parameters:
exId - The exercise identifier.
Returns:
The list of feedback items.

Revision: 109 Generated on Sat Dec 10 07:00:03 UTC 2011