PageRenderTime 46ms CodeModel.GetById 25ms app.highlight 18ms RepoModel.GetById 1ms app.codeStats 0ms

/duelos_android/src-gen/com/moob/DueloDao.java

https://bitbucket.org/jgorozco/ejemplosandroid
Java | 178 lines | 133 code | 28 blank | 17 comment | 21 complexity | a5399ddbf53839cb891f267d2efcbe4f MD5 | raw file
  1package com.moob;
  2
  3import android.database.Cursor;
  4import android.database.sqlite.SQLiteDatabase;
  5import android.database.sqlite.SQLiteStatement;
  6
  7import de.greenrobot.dao.AbstractDao;
  8import de.greenrobot.dao.DaoConfig;
  9import de.greenrobot.dao.Property;
 10
 11import com.moob.Duelo;
 12
 13// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
 14/** 
 15 * DAO for table DUELO.
 16*/
 17public class DueloDao extends AbstractDao<Duelo, Long> {
 18
 19    public static final String TABLENAME = "DUELO";
 20
 21    /**
 22     * Properties of entity Duelo.<br/>
 23     * Can be used for QueryBuilder and for referencing column names.
 24    */
 25    public static class Properties {
 26        public final static Property Id = new Property(0, Long.class, "id", true, "_id");
 27        public final static Property ContrincanteId = new Property(1, String.class, "contrincanteId", false, "CONTRINCANTE_ID");
 28        public final static Property Ganador = new Property(2, String.class, "ganador", false, "GANADOR");
 29        public final static Property TimeToShot = new Property(3, String.class, "timeToShot", false, "TIME_TO_SHOT");
 30        public final static Property MaxVelocity = new Property(4, String.class, "maxVelocity", false, "MAX_VELOCITY");
 31        public final static Property MinVelocity = new Property(5, String.class, "minVelocity", false, "MIN_VELOCITY");
 32        public final static Property Shotin = new Property(6, String.class, "shotin", false, "SHOTIN");
 33        public final static Property Puntuacion = new Property(7, String.class, "puntuacion", false, "PUNTUACION");
 34        public final static Property Date = new Property(8, java.util.Date.class, "date", false, "DATE");
 35    };
 36
 37
 38    public DueloDao(DaoConfig config) {
 39        super(config);
 40    }
 41    
 42    public DueloDao(DaoConfig config, DaoSession daoSession) {
 43        super(config, daoSession);
 44    }
 45
 46    /** Creates the underlying database table. */
 47    public static void createTable(SQLiteDatabase db, boolean ifNotExists) {
 48        String constraint = ifNotExists? "IF NOT EXISTS ": "";
 49        db.execSQL("CREATE TABLE " + constraint + "'DUELO' (" + //
 50                "'_id' INTEGER PRIMARY KEY ," + // 0: id
 51                "'CONTRINCANTE_ID' TEXT," + // 1: contrincanteId
 52                "'GANADOR' TEXT," + // 2: ganador
 53                "'TIME_TO_SHOT' TEXT," + // 3: timeToShot
 54                "'MAX_VELOCITY' TEXT," + // 4: maxVelocity
 55                "'MIN_VELOCITY' TEXT," + // 5: minVelocity
 56                "'SHOTIN' TEXT," + // 6: shotin
 57                "'PUNTUACION' TEXT," + // 7: puntuacion
 58                "'DATE' INTEGER);"); // 8: date
 59    }
 60
 61    /** Drops the underlying database table. */
 62    public static void dropTable(SQLiteDatabase db, boolean ifExists) {
 63        String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "'DUELO'";
 64        db.execSQL(sql);
 65    }
 66
 67    /** @inheritdoc */
 68    @Override
 69    protected void bindValues(SQLiteStatement stmt, Duelo entity) {
 70        stmt.clearBindings();
 71 
 72        Long id = entity.getId();
 73        if (id != null) {
 74            stmt.bindLong(1, id);
 75        }
 76 
 77        String contrincanteId = entity.getContrincanteId();
 78        if (contrincanteId != null) {
 79            stmt.bindString(2, contrincanteId);
 80        }
 81 
 82        String ganador = entity.getGanador();
 83        if (ganador != null) {
 84            stmt.bindString(3, ganador);
 85        }
 86 
 87        String timeToShot = entity.getTimeToShot();
 88        if (timeToShot != null) {
 89            stmt.bindString(4, timeToShot);
 90        }
 91 
 92        String maxVelocity = entity.getMaxVelocity();
 93        if (maxVelocity != null) {
 94            stmt.bindString(5, maxVelocity);
 95        }
 96 
 97        String minVelocity = entity.getMinVelocity();
 98        if (minVelocity != null) {
 99            stmt.bindString(6, minVelocity);
100        }
101 
102        String shotin = entity.getShotin();
103        if (shotin != null) {
104            stmt.bindString(7, shotin);
105        }
106 
107        String puntuacion = entity.getPuntuacion();
108        if (puntuacion != null) {
109            stmt.bindString(8, puntuacion);
110        }
111 
112        java.util.Date date = entity.getDate();
113        if (date != null) {
114            stmt.bindLong(9, date.getTime());
115        }
116    }
117
118    /** @inheritdoc */
119    @Override
120    public Long readKey(Cursor cursor, int offset) {
121        return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
122    }    
123
124    /** @inheritdoc */
125    @Override
126    public Duelo readEntity(Cursor cursor, int offset) {
127        Duelo entity = new Duelo( //
128            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
129            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // contrincanteId
130            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // ganador
131            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // timeToShot
132            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // maxVelocity
133            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // minVelocity
134            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // shotin
135            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // puntuacion
136            cursor.isNull(offset + 8) ? null : new java.util.Date(cursor.getLong(offset + 8)) // date
137        );
138        return entity;
139    }
140     
141    /** @inheritdoc */
142    @Override
143    public void readEntity(Cursor cursor, Duelo entity, int offset) {
144        entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
145        entity.setContrincanteId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
146        entity.setGanador(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
147        entity.setTimeToShot(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
148        entity.setMaxVelocity(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
149        entity.setMinVelocity(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
150        entity.setShotin(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
151        entity.setPuntuacion(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
152        entity.setDate(cursor.isNull(offset + 8) ? null : new java.util.Date(cursor.getLong(offset + 8)));
153     }
154    
155    /** @inheritdoc */
156    @Override
157    protected Long updateKeyAfterInsert(Duelo entity, long rowId) {
158        entity.setId(rowId);
159        return rowId;
160    }
161    
162    /** @inheritdoc */
163    @Override
164    public Long getKey(Duelo entity) {
165        if(entity != null) {
166            return entity.getId();
167        } else {
168            return null;
169        }
170    }
171
172    /** @inheritdoc */
173    @Override    
174    protected boolean isEntityUpdateable() {
175        return true;
176    }
177    
178}