Back to project page intelligent-lock-pattern.
The source code is released under:
GNU General Public License
If you think the Android project intelligent-lock-pattern 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.unioeste.ilp.models; /*w w w .j ava 2 s .c om*/ import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteStatement; import de.greenrobot.dao.AbstractDao; import de.greenrobot.dao.DaoConfig; import de.greenrobot.dao.Property; import org.unioeste.ilp.models.Pattern; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. /** * DAO for table patterns. */ public class PatternDao extends AbstractDao<Pattern, Long> { public static final String TABLENAME = "patterns"; /** * Properties of entity Pattern.<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 Pattern_sha1 = new Property(1, String.class, "pattern_sha1", false, "PATTERN_SHA1"); public final static Property Pattern_string = new Property(2, String.class, "pattern_string", false, "PATTERN_STRING"); }; private DaoSession daoSession; public PatternDao(DaoConfig config) { super(config); } public PatternDao(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 + "'patterns' (" + // "'_id' INTEGER PRIMARY KEY ," + // 0: id "'PATTERN_SHA1' TEXT NOT NULL UNIQUE ," + // 1: pattern_sha1 "'PATTERN_STRING' TEXT NOT NULL );"); // 2: pattern_string } /** Drops the underlying database table. */ public static void dropTable(SQLiteDatabase db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "'patterns'"; db.execSQL(sql); } /** @inheritdoc */ @Override protected void bindValues(SQLiteStatement stmt, Pattern entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } stmt.bindString(2, entity.getPattern_sha1()); stmt.bindString(3, entity.getPattern_string()); } @Override protected void attachEntity(Pattern entity) { super.attachEntity(entity); entity.__setDaoSession(daoSession); } /** @inheritdoc */ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); } /** @inheritdoc */ @Override public Pattern readEntity(Cursor cursor, int offset) { Pattern entity = new Pattern( // cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.getString(offset + 1), // pattern_sha1 cursor.getString(offset + 2) // pattern_string ); return entity; } /** @inheritdoc */ @Override public void readEntity(Cursor cursor, Pattern entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setPattern_sha1(cursor.getString(offset + 1)); entity.setPattern_string(cursor.getString(offset + 2)); } /** @inheritdoc */ @Override protected Long updateKeyAfterInsert(Pattern entity, long rowId) { entity.setId(rowId); return rowId; } /** @inheritdoc */ @Override public Long getKey(Pattern entity) { if(entity != null) { return entity.getId(); } else { return null; } } /** @inheritdoc */ @Override protected boolean isEntityUpdateable() { return true; } }