コード例 #1
0
  public void deleteAudioClip(String audioClipId) throws BadRequestException {
    AudioClip audioClip = getAudioClipById(audioClipId);
    datastore.delete(KeyFactory.stringToKey(audioClipId));

    // task queue to delete the associated audio and image blobs
    Queue queue = QueueFactory.getDefaultQueue();
    queue.add(
        TaskOptions.Builder.withUrl("/rest/users/" + audioClip.getOwnerId() + "/audioClips/audio")
            .method(TaskOptions.Method.DELETE)
            .param("blobkey", audioClip.getAudioId()));
    queue.add(
        TaskOptions.Builder.withUrl("/rest/users/" + audioClip.getOwnerId() + "/audioClips/image")
            .method(TaskOptions.Method.DELETE)
            .param("blobkey", audioClip.getImageId()));
  }
コード例 #2
0
 public String newAudioClipInMemcache(String ownerId, AudioClip audioClip)
     throws BadRequestException {
   validateUserExistance(ownerId);
   ArrayList<AudioClip> audioCLipList =
       (ArrayList<AudioClip>) syncCache.get(TuneInConstants.ALL_AUDIO_CLIPS);
   if (audioCLipList == null) {
     audioCLipList = new ArrayList<AudioClip>();
   }
   audioCLipList.add(audioClip);
   syncCache.put(TuneInConstants.ALL_AUDIO_CLIPS, audioCLipList, Expiration.byDeltaSeconds(60));
   return audioClip.getKeyname();
 }