Java Code Examples for android.database.Cursor#setNotificationUri()

The following examples show how to use android.database.Cursor#setNotificationUri() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LogsProvider.java    From GeoLog with Apache License 2.0 6 votes vote down vote up
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
	SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
	queryBuilder.setTables(Database.Location.TABLE_NAME);

	int uriType = URIMatcher.match(uri);
	switch (uriType) {
	case LOCATIONS:
		break;
	case LOCATION:
		queryBuilder.appendWhere(Database.Location._ID + " = " + uri.getLastPathSegment());
		break;
	default:
		throw new IllegalArgumentException("Unknown URI: " + uri);
	}

	SQLiteDatabase db = databaseHelper.getReadableDatabase();
	Cursor cursor = queryBuilder.query(db, projection, selection, selectionArgs, null, null, sortOrder);
	cursor.setNotificationUri(getContext().getContentResolver(), uri);

	return cursor;
}
 
Example 2
Source File: ContentProvider.java    From mobile-android-survey-app with MIT License 6 votes vote down vote up
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
	final Class<? extends Model> type = getModelType(uri);
	final Cursor cursor = Cache.openDatabase().query(
			Cache.getTableName(type),
			projection,
			selection,
			selectionArgs,
			null,
			null,
			sortOrder);

	cursor.setNotificationUri(getContext().getContentResolver(), uri);

	return cursor;
}
 
Example 3
Source File: OldLyricContentProvider.java    From LyricHere with Apache License 2.0 5 votes vote down vote up
@Override
public Cursor query(Uri uri, String[] projection, String selection,
                    String[] selectionArgs, String sortOrder) {
    SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
    qb.setTables(Constants.TABLE);
    switch (sURIMatcher.match(uri)) {
        case Constants.LYRIC_DIR:
            break;
        case Constants.LYRIC_ITEM:
            qb.appendWhere(Constants.Column.ID + "=" + uri.getLastPathSegment());
            break;
        default:
            throw new IllegalArgumentException("Illegal uri: " + uri);
    }

    String orderBy = (TextUtils.isEmpty(sortOrder)) ? Constants.DEFAULT_SORT : sortOrder;

    SQLiteDatabase db = dbHelper.getReadableDatabase();
    Cursor cursor = qb.query(db, projection, selection, selectionArgs,
            null, null, orderBy);

    // register for uri changes
    cursor.setNotificationUri(getContext().getContentResolver(), uri);

    //Log.d(TAG, "queried records: " + cursor.getCount());
    return cursor;
}
 
Example 4
Source File: RecipeContentProvider.java    From app-indexing with Apache License 2.0 5 votes vote down vote up
public Cursor getRecipe(Uri uri) {
    SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
    queryBuilder.setTables(RecipeTable.TABLE);
    String[] projection = {RecipeTable.ID, RecipeTable.TITLE,
            RecipeTable.DESCRIPTION, RecipeTable.PHOTO,
            RecipeTable.PREP_TIME};
    SQLiteDatabase db = database.getReadableDatabase();
    queryBuilder.appendWhere(RecipeTable.ID + "='"
            + uri.getLastPathSegment() + "'");
    Cursor cursor = queryBuilder.query(db, projection, null,
            null, null, null, null);
    cursor.setNotificationUri(getContext().getContentResolver(), uri);

    return cursor;
}
 
Example 5
Source File: DataProvider.java    From HightCopyWX with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
    synchronized (DBLock) {
        SQLiteQueryBuilder builder = new SQLiteQueryBuilder();
        String table = matchTable(uri);
        builder.setTables(table);
        SQLiteDatabase db = getDBHelper().getReadableDatabase();
        Cursor cursor = builder.query(db, projection, selection, selectionArgs, null, null, sortOrder);
        cursor.setNotificationUri(getContext().getContentResolver(), uri);
        return cursor;
    }

}
 
Example 6
Source File: IdentityDatabase.java    From Silence with GNU General Public License v3.0 5 votes vote down vote up
public Cursor getIdentities() {
  SQLiteDatabase database = databaseHelper.getReadableDatabase();
  Cursor cursor           = database.query(TABLE_NAME, null, null, null, null, null, null);

  if (cursor != null)
    cursor.setNotificationUri(context.getContentResolver(), CHANGE_URI);

  return cursor;
}
 
Example 7
Source File: RecipeContentProvider.java    From app-indexing with Apache License 2.0 5 votes vote down vote up
public Cursor getNoteByRecipe(Uri uri) {
    SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
    queryBuilder.setTables(RecipeTable.TABLE + ", " + RecipeNoteTable.TABLE);
    queryBuilder.appendWhere(RecipeTable.ID + "='" + uri.getLastPathSegment() + "' AND " +
            RecipeNoteTable.RECIPE_ID + "=" + RecipeTable.ID);
    String[] projection = {RecipeNoteTable.TEXT};
    SQLiteDatabase db = database.getReadableDatabase();
    Cursor cursor = queryBuilder.query(db, projection, null, null, null, null, null);
    cursor.setNotificationUri(getContext().getContentResolver(), uri);
    return cursor;
}
 
Example 8
Source File: SquidSupportCursorLoader.java    From squidb with Apache License 2.0 5 votes vote down vote up
@Override
public SquidCursor<T> loadInBackground() {
    SquidCursor<T> result = database.query(modelClass, query);
    if (result != null) {
        result.getCount(); // Make sure the window is filled
        Cursor androidResult = (Cursor) result.getCursor();
        androidResult.registerContentObserver(observer);
        if (notificationUri != null) {
            androidResult.setNotificationUri(getContext().getContentResolver(), notificationUri);
        }
    }
    return result;
}
 
Example 9
Source File: TaskContentProvider.java    From android-dev-challenge with Apache License 2.0 5 votes vote down vote up
@Override
public Cursor query(@NonNull Uri uri, String[] projection, String selection,
                    String[] selectionArgs, String sortOrder) {

    // Get access to underlying database (read-only for query)
    final SQLiteDatabase db = mTaskDbHelper.getReadableDatabase();

    // Write URI match code and set a variable to return a Cursor
    int match = sUriMatcher.match(uri);
    Cursor retCursor;

    // Query for the tasks directory and write a default case
    switch (match) {
        // Query for the tasks directory
        case TASKS:
            retCursor =  db.query(TABLE_NAME,
                    projection,
                    selection,
                    selectionArgs,
                    null,
                    null,
                    sortOrder);
            break;
        // Default exception
        default:
            throw new UnsupportedOperationException("Unknown uri: " + uri);
    }

    // Set a notification URI on the Cursor and return that Cursor
    retCursor.setNotificationUri(getContext().getContentResolver(), uri);

    // Return the desired Cursor
    return retCursor;
}
 
Example 10
Source File: AbstractProvider.java    From simpleprovider with MIT License 5 votes vote down vote up
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
                    String sortOrder) {
    final SelectionBuilder builder = buildBaseQuery(uri);
    final Cursor cursor = builder.where(selection, selectionArgs).query(mDatabase, projection,
            sortOrder);
    if (cursor != null) {
        cursor.setNotificationUri(getContentResolver(), uri);
    }
    return cursor;
}
 
Example 11
Source File: AdsContentProvider.java    From letv with Apache License 2.0 5 votes vote down vote up
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
    int match = URI_MATCHER.match(uri);
    SQLiteDatabase db = this.sqliteDataBase.getWritableDatabase();
    switch (match) {
        case 100:
            Cursor cursor = db.query(DBConstant.TABLE_NAME, null, selection, selectionArgs, null, null, sortOrder);
            cursor.setNotificationUri(getContext().getContentResolver(), uri);
            return cursor;
        default:
            throw new UnsupportedOperationException("Unknown or unsupported URL: " + uri.toString());
    }
}
 
Example 12
Source File: RecipeContentProvider.java    From search-samples with Apache License 2.0 5 votes vote down vote up
public Cursor getInstructionsByRecipe(Uri uri) {
    SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
    queryBuilder.setTables(RecipeTable.TABLE + ", " + RecipeInstructionsTable.TABLE);
    queryBuilder.appendWhere(RecipeTable.ID + "='" + uri.getLastPathSegment() + "' AND " +
            RecipeInstructionsTable.RECIPE_ID + "=" + RecipeTable.ID);
    String[] projection = {RecipeInstructionsTable.NUM, RecipeInstructionsTable.DESCRIPTION,
            RecipeInstructionsTable.PHOTO};
    SQLiteDatabase db = database.getReadableDatabase();
    Cursor cursor = queryBuilder.query(db, projection, null, null, null, null, null);
    cursor.setNotificationUri(getContext().getContentResolver(), uri);
    return cursor;
}
 
Example 13
Source File: LocalLogContentProvider.java    From nRF-Logger-API with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private Cursor query(final Uri uri, final SQLiteDatabase db, final SQLiteQueryBuilder qb,
					 final String[] projection, final String selection,
					 final String[] selectionArgs, final String sortOrder) {
	if (projection != null && projection.length == 1 && BaseColumns._COUNT.equals(projection[0])) {
		qb.setProjectionMap(sCountProjectionMap);
	}
	final Cursor c = qb.query(db, projection, selection, selectionArgs, null, null, sortOrder);
	if (c != null) {
		c.setNotificationUri(getContext().getContentResolver(), uri);
	}
	return c;
}
 
Example 14
Source File: GutenbergProvider.java    From attendee-checkin with Apache License 2.0 5 votes vote down vote up
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
                    String sortOrder) {
    MatchResult match = Table.match(MATCHER.match(uri));
    if (match == null) {
        throw new IllegalArgumentException("Illegal URI: " + uri);
    }
    if (match.isItem()) {
        List<String> segments = uri.getPathSegments();
        if (segments == null || segments.isEmpty()) {
            throw new IllegalArgumentException("Malformed URI: " + uri);
        }
        List<String> ids = segments.subList(1, segments.size());
        String selectionById = match.getTable().getSelectionById();
        String[] selectionArgsById = ids.toArray(new String[ids.size()]);
        if (selection == null) {
            selection = selectionById;
            selectionArgs = selectionArgsById;
        } else {
            selection = selectionById + " " + selection;
            selectionArgs = ArrayUtils.concat(selectionArgsById, selectionArgs);
        }
    }
    SQLiteDatabase db = mHelper.getReadableDatabase();
    Cursor cursor = db.query(match.getTable().getBaseName(), projection, selection,
            selectionArgs, null, null, sortOrder);
    Context context = getContext();
    if (context == null) {
        return null;
    }
    cursor.setNotificationUri(context.getContentResolver(), uri);
    return cursor;
}
 
Example 15
Source File: WeatherProvider.java    From Advanced_Android_Development with Apache License 2.0 4 votes vote down vote up
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
                    String sortOrder) {
    // Here's the switch statement that, given a URI, will determine what kind of request it is,
    // and query the database accordingly.
    Cursor retCursor;
    switch (sUriMatcher.match(uri)) {
        // "weather/*/*"
        case WEATHER_WITH_LOCATION_AND_DATE:
        {
            retCursor = getWeatherByLocationSettingAndDate(uri, projection, sortOrder);
            break;
        }
        // "weather/*"
        case WEATHER_WITH_LOCATION: {
            retCursor = getWeatherByLocationSetting(uri, projection, sortOrder);
            break;
        }
        // "weather"
        case WEATHER: {
            retCursor = mOpenHelper.getReadableDatabase().query(
                    WeatherContract.WeatherEntry.TABLE_NAME,
                    projection,
                    selection,
                    selectionArgs,
                    null,
                    null,
                    sortOrder
            );
            break;
        }
        // "location"
        case LOCATION: {
            retCursor = mOpenHelper.getReadableDatabase().query(
                    WeatherContract.LocationEntry.TABLE_NAME,
                    projection,
                    selection,
                    selectionArgs,
                    null,
                    null,
                    sortOrder
            );
            break;
        }

        default:
            throw new UnsupportedOperationException("Unknown uri: " + uri);
    }
    retCursor.setNotificationUri(getContext().getContentResolver(), uri);
    return retCursor;
}
 
Example 16
Source File: AcronymProvider.java    From mobilecloud-15 with Apache License 2.0 4 votes vote down vote up
/**
 * Hook method called to handle query requests from clients.
 */
@Override
public Cursor query(Uri uri,
                    String[] projection,
                    String selection,
                    String[] selectionArgs,
                    String sortOrder) {
    Cursor retCursor;

    // Match the id returned by UriMatcher to query appropriate
    // rows.
    switch (sUriMatcher.match(uri)) {
    case ACRONYMS: 
        // TODO -- replace "null" by writing code to query the
        // entire SQLite database based on the parameters passed
        // into the method.
        retCursor = null;
        break;
    case ACRONYM: 
        // Selection clause that matches row id with id passed
        // from Uri.
        final String rowId =
            ""
            + AcronymContract.AcronymEntry._ID
            + " = '"
            + ContentUris.parseId(uri)
            + "'";

        // TODO -- replace "null" by writing code to query the
        // SQLite database for the particular rowId based on (a
        // subset of) the parameters passed into the method.
        retCursor = null;
        break;
    default:
        throw new UnsupportedOperationException("Unknown uri: " 
                                                + uri);
    }

    // Register to watch a content URI for changes.
    retCursor.setNotificationUri(getContext().getContentResolver(), 
                                 uri);
    return retCursor;
}
 
Example 17
Source File: CapturedPlayerFriendProvider.java    From PADListener with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
	MyLog.entry("uri = " + uri);

	final SQLiteDatabase db = getDbHelper().getReadableDatabase();
	final CapturedPlayerFriendDescriptor.Paths path = CapturedPlayerFriendDescriptor.matchUri(uri);

	final SQLiteQueryBuilder builder = new SQLiteQueryBuilder();

	switch (path) {
		case ALL:
			builder.setTables(CapturedPlayerFriendDescriptor.TABLE_NAME);
			break;
		case ALL_WITH_INFO:
			final Map<String, String> columnMap = new HashMap<String, String>();
			fillColumnMapWithPrefix(columnMap, CapturedPlayerFriendDescriptor.TABLE_NAME, "", CapturedPlayerFriendDescriptor.Fields.values());

			final StringBuilder tableBuilder = new StringBuilder(CapturedPlayerFriendDescriptor.TABLE_NAME);

			final String leader1TableAlias = "L1";
			fillColumnMapWithPrefix(columnMap, leader1TableAlias, CapturedPlayerFriendDescriptor.ALL_WITH_INFO_LEADER1_PREFIX, CapturedPlayerFriendLeaderDescriptor.Fields.values());
			tableBuilder.append(" LEFT OUTER JOIN ").append(CapturedPlayerFriendLeaderDescriptor.TABLE_NAME).append(" ").append(leader1TableAlias);
			tableBuilder.append(" ON ");
			tableBuilder.append(CapturedPlayerFriendDescriptor.TABLE_NAME).append(".").append(CapturedPlayerFriendDescriptor.Fields.LEADER1_ID.getColName());
			tableBuilder.append(" = ");
			tableBuilder.append(leader1TableAlias).append(".").append(CapturedPlayerFriendLeaderDescriptor.Fields._ID.getColName());
			tableBuilder.append("");

			final String leader1InfoTableAlias = "L1_INFO";
			fillColumnMapWithPrefix(columnMap, leader1InfoTableAlias, CapturedPlayerFriendDescriptor.ALL_WITH_INFO_LEADER1_INFO_PREFIX, MonsterInfoDescriptor.Fields.values());
			tableBuilder.append(" LEFT OUTER JOIN ").append(MonsterInfoDescriptor.TABLE_NAME).append(" ").append(leader1InfoTableAlias);
			tableBuilder.append(" ON ");
			tableBuilder.append(leader1TableAlias).append(".").append(CapturedPlayerFriendLeaderDescriptor.Fields.ID_JP.getColName());
			tableBuilder.append(" = ");
			tableBuilder.append(leader1InfoTableAlias).append(".").append(MonsterInfoDescriptor.Fields.ID_JP.getColName());
			tableBuilder.append("");

			final String leader2TableAlias = "L2";
			fillColumnMapWithPrefix(columnMap, leader2TableAlias, CapturedPlayerFriendDescriptor.ALL_WITH_INFO_LEADER2_PREFIX, CapturedPlayerFriendLeaderDescriptor.Fields.values());
			tableBuilder.append(" LEFT OUTER JOIN ").append(CapturedPlayerFriendLeaderDescriptor.TABLE_NAME).append(" ").append(leader2TableAlias);
			tableBuilder.append(" ON ");
			tableBuilder.append(CapturedPlayerFriendDescriptor.TABLE_NAME).append(".").append(CapturedPlayerFriendDescriptor.Fields.LEADER2_ID.getColName());
			tableBuilder.append(" = ");
			tableBuilder.append(leader2TableAlias).append(".").append(CapturedPlayerFriendLeaderDescriptor.Fields._ID.getColName());
			tableBuilder.append("");

			final String leader2InfoTableAlias = "L2_INFO";
			fillColumnMapWithPrefix(columnMap, leader2InfoTableAlias, CapturedPlayerFriendDescriptor.ALL_WITH_INFO_LEADER2_INFO_PREFIX, MonsterInfoDescriptor.Fields.values());
			tableBuilder.append(" LEFT OUTER JOIN ").append(MonsterInfoDescriptor.TABLE_NAME).append(" ").append(leader2InfoTableAlias);
			tableBuilder.append(" ON ");
			tableBuilder.append(leader2TableAlias).append(".").append(CapturedPlayerFriendLeaderDescriptor.Fields.ID_JP.getColName());
			tableBuilder.append(" = ");
			tableBuilder.append(leader2InfoTableAlias).append(".").append(MonsterInfoDescriptor.Fields.ID_JP.getColName());
			tableBuilder.append("");

			builder.setTables(tableBuilder.toString());
			builder.setProjectionMap(columnMap);
			break;
		default:
			throw new IllegalArgumentException("Unknown URI " + uri);
	}

	final Cursor cursor = builder.query(db, projection, selection, null, null, null, sortOrder);
	cursor.setNotificationUri(getContext().getContentResolver(), uri);

	MyLog.exit();
	return cursor;
}
 
Example 18
Source File: CatnutProvider.java    From catnut with MIT License 4 votes vote down vote up
@Override
	public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
		SQLiteDatabase db = mDb.getReadableDatabase();
		Cursor cursor;
		switch (matcher.match(uri)) {
			case USER:
				cursor = db.query(User.TABLE, projection, queryWithId(uri), selectionArgs, null, null, null);
				break;
			case USERS:
				cursor = db.rawQuery(selection, selectionArgs);
//				cursor = db.query(User.TABLE, projection, selection, selectionArgs, null, null, sortOrder);
				break;
			case STATUS:
				cursor = db.query(Status.TABLE, projection, queryWithId(uri), selectionArgs, null, null, null);
				break;
			case STATUSES:
				// 这里,比较特殊,直接在selection中写sql,可以包含占位符
				cursor = db.rawQuery(selection, selectionArgs);
				break;
			case DRAFT:
			case DRAFTS:
				cursor = db.query(Draft.TABLE, projection, selection, selectionArgs, selection, null, sortOrder);
				break;
			case PHOTO:
			case PHOTOS:
				cursor = db.rawQuery(selection, selectionArgs);
				break;
			case COMMENT:
				// fall through currently
			case COMMENTS:
				cursor = db.rawQuery(selection, selectionArgs);
				break;
			// plugins...starting
			case ZHIHU:
				cursor = db.query(Zhihu.TABLE, projection, queryWithId(uri), selectionArgs, null, null, sortOrder);
				break;
			case ZHIHUS:
				cursor = db.query(Zhihu.TABLE, projection, selection, selectionArgs, null, null, sortOrder);
				break;
			// plugins...ending
			default:
				Log.wtf(TAG, "unknown uri: " + uri);
				return null;
		}
		cursor.setNotificationUri(getContext().getContentResolver(), uri);
		return cursor;
	}
 
Example 19
Source File: TrackLayer.java    From android_maplib with GNU Lesser General Public License v3.0 4 votes vote down vote up
public Cursor query(
        Uri uri,
        String[] projection,
        String selection,
        String[] selectionArgs,
        String sortOrder,
        String limit) throws SQLException, IllegalArgumentException
{
    mSQLiteDatabase = mMap.getDatabase(true);
    Cursor cursor;

    switch (mUriMatcher.match(uri)) {
        case TYPE_TRACKS:
            cursor = mSQLiteDatabase.query(
                    TABLE_TRACKS, projection, selection, selectionArgs, null, null, sortOrder, limit);
            cursor.setNotificationUri(getContext().getContentResolver(), mContentUriTracks);
            return cursor;
        case TYPE_TRACKPOINTS:
            cursor = mSQLiteDatabase.query(
                    TABLE_TRACKPOINTS, projection, selection, selectionArgs, null, null,
                    sortOrder, limit);

            cursor.setNotificationUri(
                    getContext().getContentResolver(), mContentUriTrackpoints);
            return cursor;
        case TYPE_SINGLE_TRACK:
            String id = uri.getLastPathSegment();

            if (TextUtils.isEmpty(selection)) {
                selection = FIELD_SESSION + " = " + id;
            } else {
                selection = selection + " AND " + FIELD_SESSION + " = " + id;
            }

            cursor = mSQLiteDatabase.query(
                    TABLE_TRACKPOINTS, projection, selection, selectionArgs, null, null,
                    sortOrder, limit);
            return cursor;
        default:
            throw new IllegalArgumentException("Wrong tracks URI: " + uri);
    }
}
 
Example 20
Source File: ContentProviderPOS.java    From stockita-point-of-sale with MIT License 4 votes vote down vote up
@Nullable
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {

    Cursor cursor;
    switch (sUriMatcher.match(uri)) {

        case TRIGGER_ITEM_ENTRY:
            cursor = dbHelper.getReadableDatabase().query(
                    ContractData.TriggerItemMasterEntry.TABLE_NAME,
                    projection,
                    selection,
                    selection == null ? null : selectionArgs,
                    null,
                    null,
                    sortOrder
            );
            break;

        case ITEM_MASTER_ENTRY:
            cursor = dbHelper.getReadableDatabase().query(
                    ContractData.ItemMasterEntry.TABLE_NAME,
                    projection,
                    selection,
                    selection == null ? null : selectionArgs,
                    null,
                    null,
                    sortOrder
            );
            break;

        case SALES_DETAIL_PENDING_ENTRY:
            cursor = dbHelper.getReadableDatabase().query(
                    ContractData.SalesDetailPendingEntry.TABLE_NAME,
                    projection,
                    selection,
                    selection == null ? null : selectionArgs,
                    null,
                    null,
                    sortOrder
            );
            break;

        case TRIGGER_ITEM_ID:
            cursor = dbHelper.getReadableDatabase().query(
                    ContractData.TriggerItemMasterEntry.TABLE_NAME,
                    projection,
                    ContractData.TriggerItemMasterEntry._ID + " = '" + ContentUris.parseId(uri) + "'",
                    selectionArgs,
                    null,
                    null,
                    sortOrder
            );
            break;

        case ITEM_MASTER_ID:
            cursor = dbHelper.getReadableDatabase().query(
                    ContractData.ItemMasterEntry.TABLE_NAME,
                    projection,
                    ContractData.ItemMasterEntry._ID + " = '" + ContentUris.parseId(uri) + "'",
                    selectionArgs,
                    null,
                    null,
                    sortOrder
            );
            break;

        case SALES_DETAIL_PENDING_ID:
            cursor = dbHelper.getReadableDatabase().query(
                    ContractData.SalesDetailPendingEntry.TABLE_NAME,
                    projection,
                    ContractData.ItemMasterEntry._ID + " = '" + ContentUris.parseId(uri) + "'",
                    selectionArgs,
                    null,
                    null,
                    sortOrder
            );
            break;

        default:
            throw new UnsupportedOperationException(ERROR_UNKNOWN_URI + uri);
    }

    cursor.setNotificationUri(getContext().getContentResolver(), uri);
    return cursor;

}