Back to project page blink.
The source code is released under:
Apache License
If you think the Android project blink listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.nashlincoln.blink.model; /*from ww w . j a v a2s .co m*/ import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteStatement; import de.greenrobot.dao.AbstractDao; import de.greenrobot.dao.Property; import de.greenrobot.dao.internal.DaoConfig; import com.nashlincoln.blink.model.Group; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. /** * DAO for table BLINK_GROUP. */ public class GroupDao extends AbstractDao<Group, Long> { public static final String TABLENAME = "BLINK_GROUP"; /** * Properties of entity Group.<br/> * Can be used for QueryBuilder and for referencing column names. */ public static class Properties { public final static Property Name = new Property(0, String.class, "name", false, "NAME"); public final static Property State = new Property(1, Integer.class, "state", false, "STATE"); public final static Property Id = new Property(2, Long.class, "id", true, "_id"); public final static Property AttributableType = new Property(3, String.class, "attributableType", false, "ATTRIBUTABLE_TYPE"); }; private DaoSession daoSession; public GroupDao(DaoConfig config) { super(config); } public GroupDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); this.daoSession = daoSession; } /** Creates the underlying database table. */ public static void createTable(SQLiteDatabase db, boolean ifNotExists) { String constraint = ifNotExists? "IF NOT EXISTS ": ""; db.execSQL("CREATE TABLE " + constraint + "'BLINK_GROUP' (" + // "'NAME' TEXT," + // 0: name "'STATE' INTEGER," + // 1: state "'_id' INTEGER PRIMARY KEY AUTOINCREMENT ," + // 2: id "'ATTRIBUTABLE_TYPE' TEXT);"); // 3: attributableType // Add Indexes db.execSQL("CREATE INDEX " + constraint + "IDX_BLINK_GROUP__id_ATTRIBUTABLE_TYPE ON BLINK_GROUP" + " (_id,ATTRIBUTABLE_TYPE);"); } /** Drops the underlying database table. */ public static void dropTable(SQLiteDatabase db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "'BLINK_GROUP'"; db.execSQL(sql); } /** @inheritdoc */ @Override protected void bindValues(SQLiteStatement stmt, Group entity) { stmt.clearBindings(); String name = entity.getName(); if (name != null) { stmt.bindString(1, name); } Integer state = entity.getState(); if (state != null) { stmt.bindLong(2, state); } Long id = entity.getId(); if (id != null) { stmt.bindLong(3, id); } String attributableType = entity.getAttributableType(); if (attributableType != null) { stmt.bindString(4, attributableType); } } @Override protected void attachEntity(Group entity) { super.attachEntity(entity); entity.__setDaoSession(daoSession); } /** @inheritdoc */ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 2) ? null : cursor.getLong(offset + 2); } /** @inheritdoc */ @Override public Group readEntity(Cursor cursor, int offset) { Group entity = new Group( // cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // name cursor.isNull(offset + 1) ? null : cursor.getInt(offset + 1), // state cursor.isNull(offset + 2) ? null : cursor.getLong(offset + 2), // id cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3) // attributableType ); return entity; } /** @inheritdoc */ @Override public void readEntity(Cursor cursor, Group entity, int offset) { entity.setName(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0)); entity.setState(cursor.isNull(offset + 1) ? null : cursor.getInt(offset + 1)); entity.setId(cursor.isNull(offset + 2) ? null : cursor.getLong(offset + 2)); entity.setAttributableType(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); } /** @inheritdoc */ @Override protected Long updateKeyAfterInsert(Group entity, long rowId) { entity.setId(rowId); return rowId; } /** @inheritdoc */ @Override public Long getKey(Group entity) { if(entity != null) { return entity.getId(); } else { return null; } } /** @inheritdoc */ @Override protected boolean isEntityUpdateable() { return true; } }