Commit d2ff4ab5 authored by Roberta's avatar Roberta

needs cleanup

parent 79ead07d
...@@ -87,14 +87,18 @@ public abstract class ContentProviderBase extends ContentProvider { ...@@ -87,14 +87,18 @@ public abstract class ContentProviderBase extends ContentProvider {
final SQLiteDatabase db = dbHelper.getWritableDatabase(GlobalObjectRegistry.getObject(ESCredentials.class).getUserHandle()); final SQLiteDatabase db = dbHelper.getWritableDatabase(GlobalObjectRegistry.getObject(ESCredentials.class).getUserHandle());
final MatchType matchType = codeToModel(matcher.match(uri)); final MatchType matchType = codeToModel(matcher.match(uri));
final DBModel dmb = matchType.getModel(); final DBModel dmb = matchType.getModel();
final long rowID = db.insertOrThrow(dmb.getTableName(), null, values); try {
if (rowID == -1) { final long rowID = db.insertOrThrow(dmb.getTableName(), null, values);
throw new SQLException("Insert failed"); if (rowID == -1) {
throw new SQLException("Insert failed");
}
final Uri insertedRowURI = ContentUris.withAppendedId(EncounterHistoryAPM.getContentURI(dmb), rowID);
getContext().getContentResolver().notifyChange(insertedRowURI, null);
return insertedRowURI;
} catch (Exception e) {
Log.e(TAG, e.getMessage());
} }
final Uri insertedRowURI = ContentUris.withAppendedId(EncounterHistoryAPM.getContentURI(dmb), rowID); return null;
getContext().getContentResolver().notifyChange(insertedRowURI, null);
//Log.d(TAG, "Insert done");
return insertedRowURI;
} }
public String addPKIDConditionToWhereClause(final String where, final String pkidString) { // TODO add to whereArgs instead public String addPKIDConditionToWhereClause(final String where, final String pkidString) { // TODO add to whereArgs instead
......
...@@ -99,7 +99,7 @@ public class EncounterEntriesBridge extends AbstractEncountersBridge<MEncounterE ...@@ -99,7 +99,7 @@ public class EncounterEntriesBridge extends AbstractEncountersBridge<MEncounterE
values.put(PEncounterEntries.Columns.userHandle, userHandle); values.put(PEncounterEntries.Columns.userHandle, userHandle);
try { try {
context.getContentResolver().insert(EncounterHistoryAPM.getContentURI(EncounterHistoryAPM.encounterEntries), values); context.getContentResolver().insert(EncounterHistoryAPM.getContentURI(EncounterHistoryAPM.encounterEntries), values);
} catch (SQLiteConstraintException e) { } catch (Exception e) {
Log.d(TAG, "Duplicate insert attempted"); Log.d(TAG, "Duplicate insert attempted");
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment