|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.cyberlab.local.db.AbstractSQLiteDBAdapter<QuizSQLiteDBAdapter>
org.cyberlab.local.db.QuizSQLiteDBAdapter
public class QuizSQLiteDBAdapter
Adapter for linking the example applications, Quiz and QuizAdmin, with their database. Rationale: This makes the application independent of the database implementation since only this class has to be changed. Rationale for moving application specific database to framework: All code shared by applications should be collected in a common component library. Over time this should help developers see new abstractions dividing application specific code into new abstract components. The hope is that some code from this class will help in that respect and over time the parts that are common between this class and another SQLiteDBAdapter class can be extracted into new components and then the parts only used by in the Quiz examples can be moved back into the applications.
Field Summary |
---|
Fields inherited from class org.cyberlab.local.db.AbstractSQLiteDBAdapter |
---|
DATABASE_NAME, mCtx, mDb, mDbHelper |
Constructor Summary | |
---|---|
QuizSQLiteDBAdapter(Context ctx)
Standard constructor for getting reference to existing database in application |
|
QuizSQLiteDBAdapter(Context ctx,
java.io.InputStream dbInputStream)
Loads pre-existing database from InputStream into application |
|
QuizSQLiteDBAdapter(Context ctx,
java.net.URL dbLocation)
Loads pre-existing database from URL into application |
Method Summary | |
---|---|
long |
addModel(LocalModel<?> model)
Add model to database |
long |
changeAssignmentModel(long assignmentId,
long modelId)
Change the model associated with an assignment. |
int |
deleteModel(long iD)
Deletes specified model from database if it is not connected to an assignment. |
int |
editModel(long iD,
java.lang.String name,
LocalModel<?> model)
Edits the specified model |
Cursor |
getAssignmentModel(long assignmentId,
boolean data)
Get all models linked with to an assignment. |
Cursor |
getCategories()
Get all categories |
Cursor |
getCategoryModels()
Get all models that initiates categories |
Cursor |
getCategoryName(long iD)
Get name of category |
Cursor |
getModel(long iD,
boolean data)
Gets specified model |
Cursor |
getModelAssignments(int setId)
Get assignments containing model answers |
Cursor |
getModels(boolean data)
Get all models and their linked assignments |
Cursor |
getModelSets()
Get all sets containing assignments with model answers. |
Cursor |
getRecognitionQuestionsAndModels(long categoryID)
Get all recognition questions and models associated with category. |
Cursor |
getTextQuestionAlternatives(long iD)
Get all alternatives to a question. |
Cursor |
getTextQuestions(long iD)
Get all Text questions in a category. |
Methods inherited from class org.cyberlab.local.db.AbstractSQLiteDBAdapter |
---|
close, exportDatabase, isOpen, open |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public QuizSQLiteDBAdapter(Context ctx)
ctx
- public QuizSQLiteDBAdapter(Context ctx, java.net.URL dbLocation) throws java.lang.Exception
ctx
- dbLocation
-
java.lang.Exception
public QuizSQLiteDBAdapter(Context ctx, java.io.InputStream dbInputStream) throws java.lang.Exception
ctx
- dbInputStream
-
java.lang.Exception
Method Detail |
---|
public long addModel(LocalModel<?> model)
name
- Unique name of modelmodel
- the model itself
public long changeAssignmentModel(long assignmentId, long modelId)
assignmentId
- modelId
-
public int deleteModel(long iD)
iD
-
public int editModel(long iD, java.lang.String name, LocalModel<?> model)
iD
- name
- model
-
public Cursor getAssignmentModel(long assignmentId, boolean data)
assignmentId
- data
- Toggles whether database should retrieve model data also. If the model is not needed choose false.
public Cursor getCategories()
public Cursor getCategoryModels()
public Cursor getCategoryName(long iD)
iD
-
public Cursor getModel(long iD, boolean data)
iD
- model identifierdata
- Toggles whether database should retrieve model data also. If the model is not needed choose false.
public Cursor getModelAssignments(int setId)
setId.
- Filter on setId. If -1 returns all assignments containing models
public Cursor getModels(boolean data)
data
- Toggles whether database should retrieve model data also. If the model is not needed choose false.
public Cursor getModelSets()
public Cursor getTextQuestionAlternatives(long iD)
iD
-
public Cursor getTextQuestions(long iD)
iD
-
public Cursor getRecognitionQuestionsAndModels(long categoryID)
categoryID
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |