-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from jogrimst/master
#51 Add StoryBookLearningEvent
- Loading branch information
Showing
10 changed files
with
401 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
165 changes: 165 additions & 0 deletions
165
app/src/main/java/org/literacyapp/analytics/dao/StoryBookLearningEventDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
package org.literacyapp.analytics.dao; | ||
|
||
import android.database.Cursor; | ||
import android.database.sqlite.SQLiteStatement; | ||
|
||
import org.greenrobot.greendao.AbstractDao; | ||
import org.greenrobot.greendao.Property; | ||
import org.greenrobot.greendao.internal.DaoConfig; | ||
import org.greenrobot.greendao.database.Database; | ||
import org.greenrobot.greendao.database.DatabaseStatement; | ||
|
||
import java.util.Calendar; | ||
import org.literacyapp.analytics.dao.converter.CalendarConverter; | ||
|
||
import org.literacyapp.analytics.model.StoryBookLearningEvent; | ||
|
||
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. | ||
/** | ||
* DAO for table "STORY_BOOK_LEARNING_EVENT". | ||
*/ | ||
public class StoryBookLearningEventDao extends AbstractDao<StoryBookLearningEvent, Long> { | ||
|
||
public static final String TABLENAME = "STORY_BOOK_LEARNING_EVENT"; | ||
|
||
/** | ||
* Properties of entity StoryBookLearningEvent.<br/> | ||
* Can be used for QueryBuilder and for referencing column names. | ||
*/ | ||
public static class Properties { | ||
public final static Property Id = new Property(0, Long.class, "id", true, "_id"); | ||
public final static Property DeviceId = new Property(1, String.class, "deviceId", false, "DEVICE_ID"); | ||
public final static Property Time = new Property(2, long.class, "time", false, "TIME"); | ||
public final static Property PackageName = new Property(3, String.class, "packageName", false, "PACKAGE_NAME"); | ||
public final static Property StudentId = new Property(4, String.class, "studentId", false, "STUDENT_ID"); | ||
public final static Property StoryBookId = new Property(5, Long.class, "storyBookId", false, "STORY_BOOK_ID"); | ||
} | ||
|
||
private final CalendarConverter timeConverter = new CalendarConverter(); | ||
|
||
public StoryBookLearningEventDao(DaoConfig config) { | ||
super(config); | ||
} | ||
|
||
public StoryBookLearningEventDao(DaoConfig config, DaoSession daoSession) { | ||
super(config, daoSession); | ||
} | ||
|
||
/** Creates the underlying database table. */ | ||
public static void createTable(Database db, boolean ifNotExists) { | ||
String constraint = ifNotExists? "IF NOT EXISTS ": ""; | ||
db.execSQL("CREATE TABLE " + constraint + "\"STORY_BOOK_LEARNING_EVENT\" (" + // | ||
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id | ||
"\"DEVICE_ID\" TEXT NOT NULL ," + // 1: deviceId | ||
"\"TIME\" INTEGER NOT NULL ," + // 2: time | ||
"\"PACKAGE_NAME\" TEXT NOT NULL ," + // 3: packageName | ||
"\"STUDENT_ID\" TEXT," + // 4: studentId | ||
"\"STORY_BOOK_ID\" INTEGER);"); // 5: storyBookId | ||
} | ||
|
||
/** Drops the underlying database table. */ | ||
public static void dropTable(Database db, boolean ifExists) { | ||
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"STORY_BOOK_LEARNING_EVENT\""; | ||
db.execSQL(sql); | ||
} | ||
|
||
@Override | ||
protected final void bindValues(DatabaseStatement stmt, StoryBookLearningEvent entity) { | ||
stmt.clearBindings(); | ||
|
||
Long id = entity.getId(); | ||
if (id != null) { | ||
stmt.bindLong(1, id); | ||
} | ||
stmt.bindString(2, entity.getDeviceId()); | ||
stmt.bindLong(3, timeConverter.convertToDatabaseValue(entity.getTime())); | ||
stmt.bindString(4, entity.getPackageName()); | ||
|
||
String studentId = entity.getStudentId(); | ||
if (studentId != null) { | ||
stmt.bindString(5, studentId); | ||
} | ||
|
||
Long storyBookId = entity.getStoryBookId(); | ||
if (storyBookId != null) { | ||
stmt.bindLong(6, storyBookId); | ||
} | ||
} | ||
|
||
@Override | ||
protected final void bindValues(SQLiteStatement stmt, StoryBookLearningEvent entity) { | ||
stmt.clearBindings(); | ||
|
||
Long id = entity.getId(); | ||
if (id != null) { | ||
stmt.bindLong(1, id); | ||
} | ||
stmt.bindString(2, entity.getDeviceId()); | ||
stmt.bindLong(3, timeConverter.convertToDatabaseValue(entity.getTime())); | ||
stmt.bindString(4, entity.getPackageName()); | ||
|
||
String studentId = entity.getStudentId(); | ||
if (studentId != null) { | ||
stmt.bindString(5, studentId); | ||
} | ||
|
||
Long storyBookId = entity.getStoryBookId(); | ||
if (storyBookId != null) { | ||
stmt.bindLong(6, storyBookId); | ||
} | ||
} | ||
|
||
@Override | ||
public Long readKey(Cursor cursor, int offset) { | ||
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); | ||
} | ||
|
||
@Override | ||
public StoryBookLearningEvent readEntity(Cursor cursor, int offset) { | ||
StoryBookLearningEvent entity = new StoryBookLearningEvent( // | ||
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id | ||
cursor.getString(offset + 1), // deviceId | ||
timeConverter.convertToEntityProperty(cursor.getLong(offset + 2)), // time | ||
cursor.getString(offset + 3), // packageName | ||
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // studentId | ||
cursor.isNull(offset + 5) ? null : cursor.getLong(offset + 5) // storyBookId | ||
); | ||
return entity; | ||
} | ||
|
||
@Override | ||
public void readEntity(Cursor cursor, StoryBookLearningEvent entity, int offset) { | ||
entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); | ||
entity.setDeviceId(cursor.getString(offset + 1)); | ||
entity.setTime(timeConverter.convertToEntityProperty(cursor.getLong(offset + 2))); | ||
entity.setPackageName(cursor.getString(offset + 3)); | ||
entity.setStudentId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); | ||
entity.setStoryBookId(cursor.isNull(offset + 5) ? null : cursor.getLong(offset + 5)); | ||
} | ||
|
||
@Override | ||
protected final Long updateKeyAfterInsert(StoryBookLearningEvent entity, long rowId) { | ||
entity.setId(rowId); | ||
return rowId; | ||
} | ||
|
||
@Override | ||
public Long getKey(StoryBookLearningEvent entity) { | ||
if(entity != null) { | ||
return entity.getId(); | ||
} else { | ||
return null; | ||
} | ||
} | ||
|
||
@Override | ||
public boolean hasKey(StoryBookLearningEvent entity) { | ||
return entity.getId() != null; | ||
} | ||
|
||
@Override | ||
protected final boolean isEntityUpdateable() { | ||
return true; | ||
} | ||
|
||
} |
Oops, something went wrong.