Package com.tubeonfire.entity

Examples of com.tubeonfire.entity.Tube


      System.out.println("Error path.");
      response.sendRedirect("/home");
    }
    try {
      System.out.println("Detail id : " + id);
      Tube detail = TubeService.searchById(id);
      List<TubeComment> comments = new ArrayList<TubeComment>();
      if (detail != null) {
        if (detail.getComments() != null) {
          for (Text cmtText : detail.getComments()) {
            TubeComment tubeComment = new TubeComment();
            tubeComment.transformText(cmtText.getValue());
            comments.add(tubeComment);
          }
        }
View Full Code Here


  }

  @SuppressWarnings("unchecked")
  public static Tube getByTubeId(String tubeId) {
    initPm();
    Tube tube01 = null;
    Query query = pm.newQuery(Tube.class);
    query.setFilter("tubeId==tubeIdPara");
    query.declareParameters("java.lang.String tubeIdPara");
    query.setRange(0, 1);
    List<Tube> listResult = (List<Tube>) query.execute(tubeId);
View Full Code Here

      }
      // add clips to category.
      else if (action.equalsIgnoreCase("add_video")) {
        String tubeId = request.getParameter("tubeId");
        String categoryAlias = request.getParameter("categoryAlias");
        Tube tub = TubeModel.getByTubeId(tubeId);
        Category cate = CategoryModel.getByCateAlias(categoryAlias);
        if (tub != null && cate != null) {
          List<Text> listTubes = new ArrayList<Text>();
          if (cate.getListTubes().size() > 0) {
            listTubes = cate.getListTubes();
          }         
          for (int i = 0; i < listTubes.size(); i++) {
            if (listTubes.get(i).equals(tub.getTubeId())) {
              listTubes.remove(i);
              break;
            }
          }
          listTubes.add(new Text(tub.toString()));
          cate.setListTubes(listTubes);
          CategoryModel.update(cate);
          CategoryModel.closePM();
          System.out.println("Ok, video added to playlist");
View Full Code Here

      VideoFeed videoFeed = service.query(query, VideoFeed.class);
      result.setTotalResult(videoFeed.getTotalResults());
      result.setCurrentPage(page);
      List<Tube> listSave2DB = new ArrayList<Tube>();
      for (VideoEntry videoEntry : videoFeed.getEntries()) {
        Tube tub = new Tube();
        tub.transformHalfVideoEntry(videoEntry);
        tub.setStatus(2);
        tub.setUpdated(Calendar.getInstance().getTime());
        listTube.add(tub);
        if (TubeModel.getByTubeId(tub.getTubeId()) == null) {
          listSave2DB.add(tub);
          System.out.println(tub.getTitle().getValue()
              + " ready to save !");
        }
      }
      if (listSave2DB.size() > 0) {
        TubeModel.addAll(listSave2DB);
View Full Code Here

    result.setListTube(listTube);
    return result;
  }

  public static Tube searchById(String id) {
    Tube tub = new Tube();
    try {
      tub = TubeModel.getByTubeId(id);
      if (tub != null) {
        if ((tub.getStatus() == 2) || !tub.isUpdate()) {
          System.out.println("Update from youtube : " + id);
          String videoEntryUrl = "http://gdata.youtube.com/feeds/api/videos/"
              + id;
          VideoEntry videoEntry = service.getEntry(new URL(
              videoEntryUrl), VideoEntry.class);
          tub.transformVideoEntry(videoEntry);
          TubeModel.update(tub);
          TubeModel.closePM();

          System.out.println("Save to database success !");
        } else {
View Full Code Here

      VideoFeed videoFeed = service.query(query, VideoFeed.class);
      result.setTotalResult(videoFeed.getTotalResults());
      result.setCurrentPage(page);
      List<VideoEntry> videos = videoFeed.getEntries();
      for (VideoEntry videoEntry : videos) {
        Tube tub = new Tube();
        tub.transformHalfVideoEntry(videoEntry);
        tub.setStatus(2);
        tub.setUpdated(Calendar.getInstance().getTime());
        listTube.add(tub);
        System.out.println(tub.getTubeId());
        if (TubeModel.getByTubeId(tub.getTubeId()) == null) {
          listSave2DB.add(tub);
          System.out.println(tub.getTitle() + " ready to save !");
        }
      }
      if (listSave2DB.size() > 0) {
        TubeModel.addAll(listSave2DB);
        System.out.println("Saved " + listSave2DB.size()
View Full Code Here

          "https://gdata.youtube.com/feeds/api/standardfeeds/most_popular?time="
              + time + "&max-results=6&orderby=viewCount&v=2"));
      VideoFeed videoFeed = service.query(query, VideoFeed.class);
      List<VideoEntry> videos = videoFeed.getEntries();
      for (VideoEntry videoEntry : videos) {
        Tube tub = new Tube();
        tub.transformHalfVideoEntry(videoEntry);
        tub.setStatus(2);
        tub.setUpdated(Calendar.getInstance().getTime());
        result.add(tub);
        System.out.println(tub.getTubeId());
        if (TubeModel.getByTubeId(tub.getTubeId()) == null) {
          listSave2DB.add(tub);
          System.out.println(tub.getTitle() + " ready to save !");
        }
      }
      if (listSave2DB.size() > 0) {
        TubeModel.addAll(listSave2DB);
        System.out.println("Saved " + listSave2DB.size()
View Full Code Here

          new URL(
              "https://gdata.youtube.com/feeds/api/standardfeeds/most_recent?max-results=9"));
      VideoFeed videoFeed = service.query(query, VideoFeed.class);
      List<VideoEntry> videos = videoFeed.getEntries();
      for (VideoEntry videoEntry : videos) {
        Tube tub = new Tube();
        tub.transformHalfVideoEntry(videoEntry);
        tub.setStatus(2);
        tub.setUpdated(Calendar.getInstance().getTime());
        result.add(tub);
        System.out.println(tub.getTubeId());
        if (TubeModel.getByTubeId(tub.getTubeId()) == null) {
          listSave2DB.add(tub);
          System.out.println(tub.getTitle() + " ready to save !");
        }
      }
      if (listSave2DB.size() > 0) {
        TubeModel.addAll(listSave2DB);
        System.out.println("Saved " + listSave2DB.size()
View Full Code Here

      VideoFeed videoFeed = service.query(query, VideoFeed.class);
      result.setTotalResult(videoFeed.getTotalResults());
      result.setCurrentPage(page);
      List<VideoEntry> videos = videoFeed.getEntries();
      for (VideoEntry videoEntry : videos) {
        Tube tub = new Tube();
        tub.transformHalfVideoEntry(videoEntry);
        tub.setStatus(2);
        tub.setUpdated(Calendar.getInstance().getTime());
        listTube.add(tub);
        System.out.println(tub.getTubeId());
        if (TubeModel.getByTubeId(tub.getTubeId()) == null) {
          listSave2DB.add(tub);
          System.out.println(tub.getTitle() + " ready to save !");
        }
      }
      if (listSave2DB.size() > 0) {
        TubeModel.addAll(listSave2DB);
        System.out.println("Saved " + listSave2DB.size()
View Full Code Here

      VideoFeed videoFeed = service.query(query, VideoFeed.class);
      result.setTotalResult(videoFeed.getTotalResults());
      result.setCurrentPage(page);
      List<VideoEntry> videos = videoFeed.getEntries();
      for (VideoEntry videoEntry : videos) {
        Tube tub = new Tube();
        tub.transformHalfVideoEntry(videoEntry);
        tub.setStatus(2);
        tub.setUpdated(Calendar.getInstance().getTime());
        listTube.add(tub);       
        if (TubeModel.getByTubeId(tub.getTubeId()) == null) {
          listSave2DB.add(tub);
          System.out.println(tub.getTitle() + " ready to save !");
        }
      }
      if (listSave2DB.size() > 0) {
        TubeModel.addAll(listSave2DB);
        System.out.println("Saved " + listSave2DB.size()
View Full Code Here

TOP

Related Classes of com.tubeonfire.entity.Tube

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.