Back to project page Note.
The source code is released under:
MIT License
If you think the Android project Note 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 org.bq.db; /*w w w. j a v a2 s .com*/ 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 org.bq.db.Note; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. /** * DAO for table NOTE. */ public class NoteDao extends AbstractDao<Note, Long> { public static final String TABLENAME = "NOTE"; /** * Properties of entity Note.<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 Text = new Property(1, String.class, "text", false, "TEXT"); public final static Property Type = new Property(2, Integer.class, "type", false, "TYPE"); public final static Property Widget = new Property(3, Integer.class, "widget", false, "WIDGET"); public final static Property Date = new Property(4, java.util.Date.class, "date", false, "DATE"); }; public NoteDao(DaoConfig config) { super(config); } public NoteDao(DaoConfig config, DaoSession daoSession) { super(config, 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 + "'NOTE' (" + // "'_id' INTEGER PRIMARY KEY ," + // 0: id "'TEXT' TEXT NOT NULL ," + // 1: text "'TYPE' INTEGER," + // 2: type "'WIDGET' INTEGER," + // 3: widget "'DATE' INTEGER);"); // 4: date } /** Drops the underlying database table. */ public static void dropTable(SQLiteDatabase db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "'NOTE'"; db.execSQL(sql); } /** @inheritdoc */ @Override protected void bindValues(SQLiteStatement stmt, Note entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } stmt.bindString(2, entity.getText()); Integer type = entity.getType(); if (type != null) { stmt.bindLong(3, type); } Integer widget = entity.getWidget(); if (widget != null) { stmt.bindLong(4, widget); } java.util.Date date = entity.getDate(); if (date != null) { stmt.bindLong(5, date.getTime()); } } /** @inheritdoc */ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); } /** @inheritdoc */ @Override public Note readEntity(Cursor cursor, int offset) { Note entity = new Note( // cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.getString(offset + 1), // text cursor.isNull(offset + 2) ? null : cursor.getInt(offset + 2), // type cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3), // widget cursor.isNull(offset + 4) ? null : new java.util.Date(cursor.getLong(offset + 4)) // date ); return entity; } /** @inheritdoc */ @Override public void readEntity(Cursor cursor, Note entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setText(cursor.getString(offset + 1)); entity.setType(cursor.isNull(offset + 2) ? null : cursor.getInt(offset + 2)); entity.setWidget(cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3)); entity.setDate(cursor.isNull(offset + 4) ? null : new java.util.Date(cursor.getLong(offset + 4))); } /** @inheritdoc */ @Override protected Long updateKeyAfterInsert(Note entity, long rowId) { entity.setId(rowId); return rowId; } /** @inheritdoc */ @Override public Long getKey(Note entity) { if(entity != null) { return entity.getId(); } else { return null; } } /** @inheritdoc */ @Override protected boolean isEntityUpdateable() { return true; } }