// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.olio.server.request; import android.content.ContentProvider; import android.content.ContentResolver; import android.content.ContentUris; import android.content.ContentValues; import android.content.Context; import android.content.UriMatcher; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteQueryBuilder; import android.net.Uri; import android.text.TextUtils; import com.olio.util.ALog; import java.util.List; import java.util.Random; // Referenced classes of package com.olio.server.request: // RequestsDatabaseHelper public class RequestProvider extends ContentProvider { public static final String AUTHORITY = "com.olio.server.request.Requests"; public static final int BASE_REQUEST = 1; public static final int INVALID_REQUEST_ID = 3; public static final int REQUEST_WITH_ID = 2; public static final UriMatcher sUriMatcher; private RequestsDatabaseHelper mOpenHelper; Random random; public RequestProvider() { } public int delete(Uri uri, String s, String as[]) { SQLiteDatabase sqlitedatabase = mOpenHelper.getWritableDatabase(); sUriMatcher.match(uri); JVM INSTR tableswitch 1 2: default 40 // 1 67 // 2 93; goto _L1 _L2 _L3 _L1: throw new IllegalArgumentException((new StringBuilder()).append("Unknown URI ").append(uri).toString()); _L2: int i = sqlitedatabase.delete("requests", s, as); _L5: getContext().getContentResolver().notifyChange(uri, null); return i; _L3: String s2 = (new StringBuilder()).append("_id = ").append((String)uri.getPathSegments().get(1)).toString(); String s1 = s2; if (s != null) { s1 = (new StringBuilder()).append(s2).append(" AND ").append(s).toString(); } i = sqlitedatabase.delete("requests", s1, as); if (true) goto _L5; else goto _L4 _L4: } public String getType(Uri uri) { switch (sUriMatcher.match(uri)) { default: throw new IllegalArgumentException((new StringBuilder()).append("Unknown URI ").append(uri).toString()); case 1: // '\001' return "vnd.android.cursor.dir/vnd.olio.request"; case 2: // '\002' return "vnd.android.cursor.item/vnd.olio.request"; } } public Uri insert(Uri uri, ContentValues contentvalues) { if (sUriMatcher.match(uri) != 1) { throw new IllegalArgumentException((new StringBuilder()).append("Unknown URI ").append(uri).toString()); } Object obj; long l; if (contentvalues != null) { contentvalues = new ContentValues(contentvalues); } else { contentvalues = new ContentValues(); } obj = Long.valueOf(System.currentTimeMillis()); if (!contentvalues.containsKey("dateCreated")) { contentvalues.put("dateCreated", ((Long) (obj))); } if (!contentvalues.containsKey("dateModified")) { contentvalues.put("dateModified", ((Long) (obj))); } l = random.nextLong(); for (obj = RequestsContract.Requests.get(getContext().getContentResolver(), l); ((Cursor) (obj)).getCount() != 0;) { l = random.nextLong(); } ((Cursor) (obj)).close(); contentvalues.put("requestId", Long.valueOf(l)); l = mOpenHelper.getWritableDatabase().insertWithOnConflict("requests", null, contentvalues, 2); if (l > 0L) { uri = ContentUris.withAppendedId(RequestsContract.Requests.CONTENT_ID_URI_BASE, l); getContext().getContentResolver().notifyChange(uri, null); return uri; } else { throw new SQLException((new StringBuilder()).append("Failed to insert row into ").append(uri).toString()); } } public boolean onCreate() { mOpenHelper = new RequestsDatabaseHelper(getContext()); random = new Random(); return true; } public Cursor query(Uri uri, String as[], String s, String as1[], String s1) { SQLiteQueryBuilder sqlitequerybuilder; sqlitequerybuilder = new SQLiteQueryBuilder(); sqlitequerybuilder.setTables("requests"); sUriMatcher.match(uri); JVM INSTR tableswitch 1 3: default 48 // 1 111 // 2 75 // 3 160; goto _L1 _L2 _L3 _L4 _L1: throw new IllegalArgumentException((new StringBuilder()).append("Unknown URI ").append(uri).toString()); _L3: sqlitequerybuilder.appendWhere((new StringBuilder()).append("_id=").append((String)uri.getPathSegments().get(1)).toString()); _L2: if (TextUtils.isEmpty(s1)) { s1 = "dateCreated DESC"; } as = sqlitequerybuilder.query(mOpenHelper.getReadableDatabase(), as, s, as1, null, null, s1); as.setNotificationUri(getContext().getContentResolver(), uri); return as; _L4: ALog.e("RequestProvider: Invalid Request ID, usually -1", new Object[0]); if (true) goto _L1; else goto _L5 _L5: } public int update(Uri uri, ContentValues contentvalues, String s, String as[]) { SQLiteDatabase sqlitedatabase = mOpenHelper.getWritableDatabase(); sUriMatcher.match(uri); JVM INSTR tableswitch 1 3: default 44 // 1 71 // 2 99 // 3 183; goto _L1 _L2 _L3 _L4 _L1: throw new IllegalArgumentException((new StringBuilder()).append("Unknown URI ").append(uri).toString()); _L2: int i = sqlitedatabase.update("requests", contentvalues, s, as); _L6: getContext().getContentResolver().notifyChange(uri, null); return i; _L3: String s2 = (new StringBuilder()).append("_id = ").append((String)uri.getPathSegments().get(1)).toString(); String s1 = s2; if (s != null) { s1 = (new StringBuilder()).append(s2).append(" AND ").append(s).toString(); } i = sqlitedatabase.update("requests", contentvalues, s1, as); continue; /* Loop/switch isn't completed */ _L4: i = 0; ALog.e("RequestProvider: Invalid Request ID, usually -1", new Object[0]); if (true) goto _L6; else goto _L5 _L5: } static { sUriMatcher = new UriMatcher(-1); sUriMatcher.addURI("com.olio.server.request.Requests", "requests", 1); sUriMatcher.addURI("com.olio.server.request.Requests", "requests/#", 2); sUriMatcher.addURI("com.olio.server.request.Requests", "requests/-1", 3); } }