Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Alterações de id.

  • Loading branch information...
commit e68fda897194a4392e88269eca8f422021775cd9 1 parent 863558b
@hjort hjort authored
Showing with 2 additions and 14 deletions.
  1. +2 −14 src/main/java/org/alienlabs/aliendroid/activerecord/Model.java
View
16 src/main/java/org/alienlabs/aliendroid/activerecord/Model.java
@@ -39,27 +39,16 @@
public Integer _id;
- private boolean _new;
-
public Model() {
- this._new = true;
+ super();
}
public Model(final Integer id) {
- this();
this._id = id;
//TODO: verificar esse comportamento
//load(id);
}
- public Integer getId() {
- return this._id;
- }
-
- public boolean isNew() {
- return this._new;
- }
-
private String getTableName() {
return Reflection.getSimpleClassName(this);
}
@@ -115,7 +104,7 @@ public void save() {
final String tableName = getTableName();
final DBOpenHelper helper = getHelper();
- if (_id != null && !_new) {
+ if (_id != null) {
helper.getWritableDatabase().update(tableName, values, "_id=?",
new String[] { _id.toString() });
} else {
@@ -138,7 +127,6 @@ protected void transform(final Cursor cursor) {
mapper.setValueToObject(cursor, field, this);
}
this._id = cursor.getInt(cursor.getColumnIndex("_id"));
- this._new = false;
}
public static <T extends Model> List<T> findAll(final Class<T> cls) {
Please sign in to comment.
Something went wrong with that request. Please try again.