Android Open Source - intelligent-lock-pattern Pattern Dao






From Project

Back to project page intelligent-lock-pattern.

License

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.

Java Source Code

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;
    }
    
}




Java Source Code List

group.pals.android.lib.ui.lockpattern.LockPatternActivity.java
group.pals.android.lib.ui.lockpattern.collect.Lists.java
group.pals.android.lib.ui.lockpattern.widget.LockPatternUtils.java
group.pals.android.lib.ui.lockpattern.widget.LockPatternView.java
org.unioeste.ilp.BaseActivity.java
org.unioeste.ilp.CollectSamplesActivity.java
org.unioeste.ilp.DatabaseExporterActivity.java
org.unioeste.ilp.ILPApp.java
org.unioeste.ilp.InsertPatternActivity.java
org.unioeste.ilp.LockPatternActivity.java
org.unioeste.ilp.MainMenuActivity.java
org.unioeste.ilp.PrefsActivity.java
org.unioeste.ilp.ShowPatternsActivity.java
org.unioeste.ilp.StartExperimentActivity.java
org.unioeste.ilp.TestAuthActivity.java
org.unioeste.ilp.adapters.ExperiencesUserAdapter.java
org.unioeste.ilp.adapters.LockPatternGalleryAdapter.java
org.unioeste.ilp.db.DBHelper.java
org.unioeste.ilp.models.AttemptDao.java
org.unioeste.ilp.models.Attempt.java
org.unioeste.ilp.models.DaoMaster.java
org.unioeste.ilp.models.DaoSession.java
org.unioeste.ilp.models.ExperienceDao.java
org.unioeste.ilp.models.Experience.java
org.unioeste.ilp.models.PatternDao.java
org.unioeste.ilp.models.Pattern.java
org.unioeste.ilp.models.SampleDao.java
org.unioeste.ilp.models.Sample.java
org.unioeste.ilp.models.UserDao.java
org.unioeste.ilp.models.User.java
org.unioeste.ilp.services.SamplesCollectorService.java