// Path: android/app/src/main/java/com/loicortola/controller/persistence/Device.java
// public class Device {
// 
//     private Long id;
//     /** Not-null value. */
//     private String deviceId;
//     /** Not-null value. */
//     private String deviceResolver;
//     /** Not-null value. */
//     private String name;
//     private long icon;
//     /** Not-null value. */
//     private String host;
//     private String key;
// 
//     public Device() {
//     }
// 
//     public Device(Long id) {
//         this.id = id;
//     }
// 
//     public Device(Long id, String deviceId, String deviceResolver, String name, long icon, String host, String key) {
//         this.id = id;
//         this.deviceId = deviceId;
//         this.deviceResolver = deviceResolver;
//         this.name = name;
//         this.icon = icon;
//         this.host = host;
//         this.key = key;
//     }
// 
//     public Long getId() {
//         return id;
//     }
// 
//     public void setId(Long id) {
//         this.id = id;
//     }
// 
//     /** Not-null value. */
//     public String getDeviceId() {
//         return deviceId;
//     }
// 
//     /** Not-null value; ensure this value is available before it is saved to the database. */
//     public void setDeviceId(String deviceId) {
//         this.deviceId = deviceId;
//     }
// 
//     /** Not-null value. */
//     public String getDeviceResolver() {
//         return deviceResolver;
//     }
// 
//     /** Not-null value; ensure this value is available before it is saved to the database. */
//     public void setDeviceResolver(String deviceResolver) {
//         this.deviceResolver = deviceResolver;
//     }
// 
//     /** Not-null value. */
//     public String getName() {
//         return name;
//     }
// 
//     /** Not-null value; ensure this value is available before it is saved to the database. */
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public long getIcon() {
//         return icon;
//     }
// 
//     public void setIcon(long icon) {
//         this.icon = icon;
//     }
// 
//     /** Not-null value. */
//     public String getHost() {
//         return host;
//     }
// 
//     /** Not-null value; ensure this value is available before it is saved to the database. */
//     public void setHost(String host) {
//         this.host = host;
//     }
// 
//     public String getKey() {
//         return key;
//     }
// 
//     public void setKey(String key) {
//         this.key = key;
//     }
// 
// }


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.loicortola.controller.persistence.Device;
package com.loicortola.controller.persistence;




// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * DAO for table "DEVICE".
*/
public class DeviceDao extends AbstractDao<Device, Long> {

    public static final String TABLENAME = "DEVICE";

    /**
     * Properties of entity Device.<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 DeviceResolver = new Property(2, String.class, "deviceResolver", false, "DEVICE_RESOLVER");
        public final static Property Name = new Property(3, String.class, "name", false, "NAME");
        public final static Property Icon = new Property(4, long.class, "icon", false, "ICON");
        public final static Property Host = new Property(5, String.class, "host", false, "HOST");
        public final static Property Key = new Property(6, String.class, "key", false, "KEY");
    };


    public DeviceDao(DaoConfig config) {
        super(config);
    }
    
    public DeviceDao(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 + "\"DEVICE\" (" + //
                "\"_id\" INTEGER PRIMARY KEY ," + // 0: id
                "\"DEVICE_ID\" TEXT NOT NULL UNIQUE ," + // 1: deviceId
                "\"DEVICE_RESOLVER\" TEXT NOT NULL ," + // 2: deviceResolver
                "\"NAME\" TEXT NOT NULL ," + // 3: name
                "\"ICON\" INTEGER NOT NULL ," + // 4: icon
                "\"HOST\" TEXT NOT NULL ," + // 5: host
                "\"KEY\" TEXT);"); // 6: key
    }

    /** Drops the underlying database table. */
    public static void dropTable(SQLiteDatabase db, boolean ifExists) {
        String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"DEVICE\"";
        db.execSQL(sql);
    }

    /** @inheritdoc */
    @Override
    protected void bindValues(SQLiteStatement stmt, Device entity) {
        stmt.clearBindings();
 
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
        stmt.bindString(2, entity.getDeviceId());
        stmt.bindString(3, entity.getDeviceResolver());
        stmt.bindString(4, entity.getName());
        stmt.bindLong(5, entity.getIcon());
        stmt.bindString(6, entity.getHost());
 
        String key = entity.getKey();
        if (key != null) {
            stmt.bindString(7, key);
        }
    }

    /** @inheritdoc */
    @Override
    public Long readKey(Cursor cursor, int offset) {
        return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
    }    

    /** @inheritdoc */
    @Override
    public Device readEntity(Cursor cursor, int offset) {
// Path: android/app/src/main/java/com/loicortola/controller/persistence/Device.java
// public class Device {
// 
//     private Long id;
//     /** Not-null value. */
//     private String deviceId;
//     /** Not-null value. */
//     private String deviceResolver;
//     /** Not-null value. */
//     private String name;
//     private long icon;
//     /** Not-null value. */
//     private String host;
//     private String key;
// 
//     public Device() {
//     }
// 
//     public Device(Long id) {
//         this.id = id;
//     }
// 
//     public Device(Long id, String deviceId, String deviceResolver, String name, long icon, String host, String key) {
//         this.id = id;
//         this.deviceId = deviceId;
//         this.deviceResolver = deviceResolver;
//         this.name = name;
//         this.icon = icon;
//         this.host = host;
//         this.key = key;
//     }
// 
//     public Long getId() {
//         return id;
//     }
// 
//     public void setId(Long id) {
//         this.id = id;
//     }
// 
//     /** Not-null value. */
//     public String getDeviceId() {
//         return deviceId;
//     }
// 
//     /** Not-null value; ensure this value is available before it is saved to the database. */
//     public void setDeviceId(String deviceId) {
//         this.deviceId = deviceId;
//     }
// 
//     /** Not-null value. */
//     public String getDeviceResolver() {
//         return deviceResolver;
//     }
// 
//     /** Not-null value; ensure this value is available before it is saved to the database. */
//     public void setDeviceResolver(String deviceResolver) {
//         this.deviceResolver = deviceResolver;
//     }
// 
//     /** Not-null value. */
//     public String getName() {
//         return name;
//     }
// 
//     /** Not-null value; ensure this value is available before it is saved to the database. */
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public long getIcon() {
//         return icon;
//     }
// 
//     public void setIcon(long icon) {
//         this.icon = icon;
//     }
// 
//     /** Not-null value. */
//     public String getHost() {
//         return host;
//     }
// 
//     /** Not-null value; ensure this value is available before it is saved to the database. */
//     public void setHost(String host) {
//         this.host = host;
//     }
// 
//     public String getKey() {
//         return key;
//     }
// 
//     public void setKey(String key) {
//         this.key = key;
//     }
// 
// }


// Path: android/app/src/main/java/com/loicortola/controller/persistence/DeviceDao.java
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.loicortola.controller.persistence.Device;

package com.loicortola.controller.persistence;




// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * DAO for table "DEVICE".
*/
public class DeviceDao extends AbstractDao<Device, Long> {

    public static final String TABLENAME = "DEVICE";

    /**
     * Properties of entity Device.<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 DeviceResolver = new Property(2, String.class, "deviceResolver", false, "DEVICE_RESOLVER");
        public final static Property Name = new Property(3, String.class, "name", false, "NAME");
        public final static Property Icon = new Property(4, long.class, "icon", false, "ICON");
        public final static Property Host = new Property(5, String.class, "host", false, "HOST");
        public final static Property Key = new Property(6, String.class, "key", false, "KEY");
    };


    public DeviceDao(DaoConfig config) {
        super(config);
    }
    
    public DeviceDao(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 + "\"DEVICE\" (" + //
                "\"_id\" INTEGER PRIMARY KEY ," + // 0: id
                "\"DEVICE_ID\" TEXT NOT NULL UNIQUE ," + // 1: deviceId
                "\"DEVICE_RESOLVER\" TEXT NOT NULL ," + // 2: deviceResolver
                "\"NAME\" TEXT NOT NULL ," + // 3: name
                "\"ICON\" INTEGER NOT NULL ," + // 4: icon
                "\"HOST\" TEXT NOT NULL ," + // 5: host
                "\"KEY\" TEXT);"); // 6: key
    }

    /** Drops the underlying database table. */
    public static void dropTable(SQLiteDatabase db, boolean ifExists) {
        String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"DEVICE\"";
        db.execSQL(sql);
    }

    /** @inheritdoc */
    @Override
    protected void bindValues(SQLiteStatement stmt, Device entity) {
        stmt.clearBindings();
 
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
        stmt.bindString(2, entity.getDeviceId());
        stmt.bindString(3, entity.getDeviceResolver());
        stmt.bindString(4, entity.getName());
        stmt.bindLong(5, entity.getIcon());
        stmt.bindString(6, entity.getHost());
 
        String key = entity.getKey();
        if (key != null) {
            stmt.bindString(7, key);
        }
    }

    /** @inheritdoc */
    @Override
    public Long readKey(Cursor cursor, int offset) {
        return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
    }    

    /** @inheritdoc */
    @Override
    public Device readEntity(Cursor cursor, int offset) {
        Device entity = new Device( //