-
-
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.
- Loading branch information
Jo Grimstad
committed
May 27, 2017
1 parent
b7715ba
commit 2f54ba6
Showing
6 changed files
with
203 additions
and
33 deletions.
There are no files selected for viewing
131 changes: 131 additions & 0 deletions
131
app/src/main/java/org/literacyapp/analytics/dao/BootCompletedEventDao.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,131 @@ | ||
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.BootCompletedEvent; | ||
|
||
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. | ||
/** | ||
* DAO for table "BOOT_COMPLETED_EVENT". | ||
*/ | ||
public class BootCompletedEventDao extends AbstractDao<BootCompletedEvent, Long> { | ||
|
||
public static final String TABLENAME = "BOOT_COMPLETED_EVENT"; | ||
|
||
/** | ||
* Properties of entity BootCompletedEvent.<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"); | ||
} | ||
|
||
private final CalendarConverter timeConverter = new CalendarConverter(); | ||
|
||
public BootCompletedEventDao(DaoConfig config) { | ||
super(config); | ||
} | ||
|
||
public BootCompletedEventDao(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 + "\"BOOT_COMPLETED_EVENT\" (" + // | ||
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id | ||
"\"DEVICE_ID\" TEXT NOT NULL ," + // 1: deviceId | ||
"\"TIME\" INTEGER NOT NULL );"); // 2: time | ||
} | ||
|
||
/** Drops the underlying database table. */ | ||
public static void dropTable(Database db, boolean ifExists) { | ||
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"BOOT_COMPLETED_EVENT\""; | ||
db.execSQL(sql); | ||
} | ||
|
||
@Override | ||
protected final void bindValues(DatabaseStatement stmt, BootCompletedEvent 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())); | ||
} | ||
|
||
@Override | ||
protected final void bindValues(SQLiteStatement stmt, BootCompletedEvent 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())); | ||
} | ||
|
||
@Override | ||
public Long readKey(Cursor cursor, int offset) { | ||
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); | ||
} | ||
|
||
@Override | ||
public BootCompletedEvent readEntity(Cursor cursor, int offset) { | ||
BootCompletedEvent entity = new BootCompletedEvent( // | ||
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id | ||
cursor.getString(offset + 1), // deviceId | ||
timeConverter.convertToEntityProperty(cursor.getLong(offset + 2)) // time | ||
); | ||
return entity; | ||
} | ||
|
||
@Override | ||
public void readEntity(Cursor cursor, BootCompletedEvent 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))); | ||
} | ||
|
||
@Override | ||
protected final Long updateKeyAfterInsert(BootCompletedEvent entity, long rowId) { | ||
entity.setId(rowId); | ||
return rowId; | ||
} | ||
|
||
@Override | ||
public Long getKey(BootCompletedEvent entity) { | ||
if(entity != null) { | ||
return entity.getId(); | ||
} else { | ||
return null; | ||
} | ||
} | ||
|
||
@Override | ||
public boolean hasKey(BootCompletedEvent entity) { | ||
return entity.getId() != null; | ||
} | ||
|
||
@Override | ||
protected final boolean isEntityUpdateable() { | ||
return true; | ||
} | ||
|
||
} |
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