package com.braunster.chatsdk.dao;
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.braunster.chatsdk.dao.BUser;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table BUSER.
*/
public class BUserDao extends AbstractDao<BUser, Long> {
public static final String TABLENAME = "BUSER";
/**
* Properties of entity BUser.<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 EntityID = new Property(1, String.class, "entityID", false, "ENTITY_ID");
public final static Property AuthenticationType = new Property(2, Integer.class, "AuthenticationType", false, "AUTHENTICATION_TYPE");
public final static Property MessageColor = new Property(3, String.class, "messageColor", false, "MESSAGE_COLOR");
public final static Property LastOnline = new Property(4, java.util.Date.class, "lastOnline", false, "LAST_ONLINE");
public final static Property LastUpdated = new Property(5, java.util.Date.class, "lastUpdated", false, "LAST_UPDATED");
public final static Property Online = new Property(6, Boolean.class, "Online", false, "ONLINE");
public final static Property Metadata = new Property(7, String.class, "Metadata", false, "metadata");
};
private DaoSession daoSession;
public BUserDao(DaoConfig config) {
super(config);
}
public BUserDao(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 + "'BUSER' (" + //
"'_id' INTEGER PRIMARY KEY ," + // 0: id
"'ENTITY_ID' TEXT," + // 1: entityID
"'AUTHENTICATION_TYPE' INTEGER," + // 2: AuthenticationType
"'MESSAGE_COLOR' TEXT," + // 3: messageColor
"'LAST_ONLINE' INTEGER," + // 4: lastOnline
"'LAST_UPDATED' INTEGER," + // 5: lastUpdated
"'ONLINE' INTEGER," + // 6: Online
"'metadata' TEXT);"); // 7: Metadata
}
/** Drops the underlying database table. */
public static void dropTable(SQLiteDatabase db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "'BUSER'";
db.execSQL(sql);
}
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, BUser entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
String entityID = entity.getEntityID();
if (entityID != null) {
stmt.bindString(2, entityID);
}
Integer AuthenticationType = entity.getAuthenticationType();
if (AuthenticationType != null) {
stmt.bindLong(3, AuthenticationType);
}
String messageColor = entity.getMessageColor();
if (messageColor != null) {
stmt.bindString(4, messageColor);
}
java.util.Date lastOnline = entity.getLastOnline();
if (lastOnline != null) {
stmt.bindLong(5, lastOnline.getTime());
}
java.util.Date lastUpdated = entity.getLastUpdated();
if (lastUpdated != null) {
stmt.bindLong(6, lastUpdated.getTime());
}
Boolean Online = entity.getOnline();
if (Online != null) {
stmt.bindLong(7, Online ? 1l: 0l);
}
String Metadata = entity.getMetadata();
if (Metadata != null) {
stmt.bindString(8, Metadata);
}
}
@Override
protected void attachEntity(BUser 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 BUser readEntity(Cursor cursor, int offset) {
BUser entity = new BUser( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // entityID
cursor.isNull(offset + 2) ? null : cursor.getInt(offset + 2), // AuthenticationType
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // messageColor
cursor.isNull(offset + 4) ? null : new java.util.Date(cursor.getLong(offset + 4)), // lastOnline
cursor.isNull(offset + 5) ? null : new java.util.Date(cursor.getLong(offset + 5)), // lastUpdated
cursor.isNull(offset + 6) ? null : cursor.getShort(offset + 6) != 0, // Online
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7) // Metadata
);
return entity;
}
/** @inheritdoc */
@Override
public void readEntity(Cursor cursor, BUser entity, int offset) {
entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
entity.setEntityID(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
entity.setAuthenticationType(cursor.isNull(offset + 2) ? null : cursor.getInt(offset + 2));
entity.setMessageColor(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
entity.setLastOnline(cursor.isNull(offset + 4) ? null : new java.util.Date(cursor.getLong(offset + 4)));
entity.setLastUpdated(cursor.isNull(offset + 5) ? null : new java.util.Date(cursor.getLong(offset + 5)));
entity.setOnline(cursor.isNull(offset + 6) ? null : cursor.getShort(offset + 6) != 0);
entity.setMetadata(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
}
/** @inheritdoc */
@Override
protected Long updateKeyAfterInsert(BUser entity, long rowId) {
entity.setId(rowId);
return rowId;
}
/** @inheritdoc */
@Override
public Long getKey(BUser entity) {
if(entity != null) {
return entity.getId();
} else {
return null;
}
}
/** @inheritdoc */
@Override
protected boolean isEntityUpdateable() {
return true;
}
}