示例#1
0
  private static void testWriteCollectionEntry(DoubanService myService) {
    try {
      CollectionEntry ce;

      Rating rating = new Rating();
      rating.setValue(4);

      ArrayList<Tag> tags = new ArrayList<Tag>(2);
      Tag t1 = new Tag();
      t1.setName("顾长卫");
      Tag t2 = new Tag();
      t2.setName("李樯");

      tags.add(t1);
      tags.add(t2);

      String movieId = "3036997"; // 立春(And the Spring Comes)
      SubjectEntry se = myService.getMovie(movieId);
      ce = myService.createCollection(new Status("watched"), se, tags, rating);

      printCollectionEntry(ce);

      myService.deleteCollection(ce);
    } catch (MalformedURLException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    } catch (ServiceException e) {
      e.printStackTrace();
    }
  }
示例#2
0
  private static void testWriteReviewEntry(DoubanService myService) {
    ReviewEntry reviewEntry;
    try {
      String movieId = "3036997"; // 立春(And the Spring Comes)

      SubjectEntry se = myService.getMovie(movieId);
      Rating rate = new Rating();
      rate.setValue(4);
      String content =
          "立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春立春";
      reviewEntry =
          myService.createReview(
              se, new PlainTextConstruct("立春"), new PlainTextConstruct(content), rate);

      printReviewEntry(reviewEntry);

      myService.deleteReview(reviewEntry);

    } catch (IOException e) {
      e.printStackTrace();
    } catch (ServiceException e) {
      e.printStackTrace();
    }
  }