/** * Checks if this record has an id, if the id is present this record will be updated, if it is * null, it will be inserted instead, and the inserted id assigned to this one. * * @param context The context used to save the record. */ public void save(Context context) { if (_id == null) { _id = CPOrm.insert(context, this); } else CPOrm.update(context, this); }
public <T> Uri getItemUri() { return ContentUris.withAppendedId(CPOrm.getItemUri(getClass()), getId()); }
/** @see #save(Context) */ public void save() { save(CPOrm.getApplicationContext()); }
/** @see #findById(Context, Class, long) */ public static <T> T findById(Class<T> object, long id) { return CPOrm.findByPrimaryKey(object, id); }
/** * Finds a record based on the id column * * @param context Current context * @param id the id of the record to find * @return The record, if found. */ public static <T> T findById(Context context, Class<T> object, long id) { return CPOrm.findByPrimaryKey(context, object, id); }