当前位置: 首页 > 工具软件 > Tag Suggest > 使用案例 >

java search_Java SearchSuggest类代码示例

罗祺
2023-12-01

import com.google.android.apps.iosched.provider.ScheduleContract.SearchSuggest; //导入依赖的package包/类

/** {@inheritDoc} */

@Override

public Uri insert(Uri uri, ContentValues values) {

LOGV(TAG, "insert(uri=" + uri + ", values=" + values.toString() + ")");

final SQLiteDatabase db = mOpenHelper.getWritableDatabase();

final int match = sUriMatcher.match(uri);

boolean syncToNetwork = !ScheduleContract.hasCallerIsSyncAdapterParameter(uri);

switch (match) {

case BLOCKS: {

db.insertOrThrow(Tables.BLOCKS, null, values);

notifyChange(uri, syncToNetwork);

return Blocks.buildBlockUri(values.getAsString(Blocks.BLOCK_ID));

}

case TRACKS: {

db.insertOrThrow(Tables.TRACKS, null, values);

notifyChange(uri, syncToNetwork);

return Tracks.buildTrackUri(values.getAsString(Tracks.TRACK_ID));

}

case ROOMS: {

db.insertOrThrow(Tables.ROOMS, null, values);

notifyChange(uri, syncToNetwork);

return Rooms.buildRoomUri(values.getAsString(Rooms.ROOM_ID));

}

case SESSIONS: {

db.insertOrThrow(Tables.SESSIONS, null, values);

notifyChange(uri, syncToNetwork);

return Sessions.buildSessionUri(values.getAsString(Sessions.SESSION_ID));

}

case SESSIONS_ID_SPEAKERS: {

db.insertOrThrow(Tables.SESSIONS_SPEAKERS, null, values);

notifyChange(uri, syncToNetwork);

return Speakers.buildSpeakerUri(values.getAsString(SessionsSpeakers.SPEAKER_ID));

}

case SESSIONS_ID_TRACKS: {

db.insertOrThrow(Tables.SESSIONS_TRACKS, null, values);

notifyChange(uri, syncToNetwork);

return Tracks.buildTrackUri(values.getAsString(SessionsTracks.TRACK_ID));

}

case SPEAKERS: {

db.insertOrThrow(Tables.SPEAKERS, null, values);

notifyChange(uri, syncToNetwork);

return Speakers.buildSpeakerUri(values.getAsString(Speakers.SPEAKER_ID));

}

case SANDBOX: {

db.insertOrThrow(Tables.SANDBOX, null, values);

notifyChange(uri, syncToNetwork);

return Sandbox.buildCompanyUri(values.getAsString(Sandbox.COMPANY_ID));

}

case ANNOUNCEMENTS: {

db.insertOrThrow(Tables.ANNOUNCEMENTS, null, values);

notifyChange(uri, syncToNetwork);

return Announcements.buildAnnouncementUri(values

.getAsString(Announcements.ANNOUNCEMENT_ID));

}

case SEARCH_SUGGEST: {

db.insertOrThrow(Tables.SEARCH_SUGGEST, null, values);

notifyChange(uri, syncToNetwork);

return SearchSuggest.CONTENT_URI;

}

case MAPMARKERS: {

db.insertOrThrow(Tables.MAPMARKERS, null, values);

notifyChange(uri, syncToNetwork);

return MapMarkers.buildMarkerUri(values.getAsString(MapMarkers.MARKER_ID));

}

case MAPTILES: {

db.insertOrThrow(Tables.MAPTILES, null, values);

notifyChange(uri, syncToNetwork);

return MapTiles.buildFloorUri(values.getAsString(MapTiles.TILE_FLOOR));

}

case FEEDBACK_FOR_SESSION: {

db.insertOrThrow(Tables.FEEDBACK, null, values);

notifyChange(uri, syncToNetwork);

return Feedback.buildFeedbackUri(values.getAsString(Feedback.SESSION_ID));

}

default: {

throw new UnsupportedOperationException("Unknown uri: " + uri);

}

}

}

 类似资料: