private void buildSpeaker( boolean isInsert, Speaker speaker, ArrayList<ContentProviderOperation> list) { Uri allSpeakersUri = ScheduleContractHelper.setUriAsCalledFromSyncAdapter(ScheduleContract.Speakers.CONTENT_URI); Uri thisSpeakerUri = ScheduleContractHelper.setUriAsCalledFromSyncAdapter( ScheduleContract.Speakers.buildSpeakerUri(speaker.id)); ContentProviderOperation.Builder builder; if (isInsert) { builder = ContentProviderOperation.newInsert(allSpeakersUri); } else { builder = ContentProviderOperation.newUpdate(thisSpeakerUri); } list.add( builder .withValue(ScheduleContract.SyncColumns.UPDATED, System.currentTimeMillis()) .withValue(ScheduleContract.Speakers.SPEAKER_ID, speaker.id) .withValue(ScheduleContract.Speakers.SPEAKER_NAME, speaker.name) .withValue(ScheduleContract.Speakers.SPEAKER_ABSTRACT, speaker.bio) .withValue(ScheduleContract.Speakers.SPEAKER_COMPANY, speaker.company) .withValue(ScheduleContract.Speakers.SPEAKER_IMAGE_URL, speaker.thumbnailUrl) .withValue(ScheduleContract.Speakers.SPEAKER_PLUSONE_URL, speaker.plusoneUrl) .withValue(ScheduleContract.Speakers.SPEAKER_TWITTER_URL, speaker.twitterUrl) .withValue( ScheduleContract.Speakers.SPEAKER_IMPORT_HASHCODE, speaker.getImportHashcode()) .build()); }
private void buildDeleteOperation(String speakerId, ArrayList<ContentProviderOperation> list) { Uri speakerUri = ScheduleContractHelper.setUriAsCalledFromSyncAdapter( ScheduleContract.Speakers.buildSpeakerUri(speakerId)); list.add(ContentProviderOperation.newDelete(speakerUri).build()); }