Package com.tubeonfire.entity

Examples of com.tubeonfire.entity.Tube


          for (int i = startPoint; i < cate.getListTubes().size(); i++) {
            if (i == (itemPerPage + startPoint)) {
              break;
            }

            Tube tub = new Tube();
            tub.transformString(cate.getListTubes().get(i)
                .getValue());
            result.add(tub);
          }
        } else {
          page = 1;
          for (int i = 0; i < cate.getListTubes().size(); i++) {
            if (i == itemPerPage) {
              break;
            }
            Tube tub = new Tube();
            tub.transformString(cate.getListTubes().get(i)
                .getValue());
            result.add(tub);
          }
        }
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

      else if (action.equalsIgnoreCase("add")) {
        if (request.getParameter("playlist_id") != null
            && request.getParameter("video_id") != null) {
          Playlist plToAdd = PlaylistModel.getById(request
              .getParameter("playlist_id"));
          Tube tub = TubeModel.getByTubeId(request
              .getParameter("video_id"));
          if (tub != null && plToAdd != null) {
            List<Text> listTube = new ArrayList<Text>();
            if (plToAdd.getListTubes().size() > 0) {
              listTube = plToAdd.getListTubes();
            }
            Text tmpText = new Text(tub.toString());
            for (int i = 0; i < listTube.size(); i++) {
              if (listTube.get(i).equals(tmpText)) {
                listTube.remove(i);
                break;
              }
            }
            listTube.add(new Text(tub.toString()));
            plToAdd.setListTubes(listTube);
            PlaylistModel.update(plToAdd);
            PlaylistModel.closePM();
            System.out.println("Ok, video added to playlist");
          } else {
            response.getWriter().println(
                "Cannot add video to playlist.");
          }
        } else {
          response.getWriter().println(
              "Cannot add video to playlist.");
        }
      }
      // edit playlist.
      else if (action.equalsIgnoreCase("edit")) {
        if (user != null) {
          String pid = request.getParameter("id");
          Playlist pl = PlaylistModel.getById(pid);
          if (pl.getUserFederatedId().equals(user.getUserId())) {
            request.setAttribute("result", pl);
            request.getRequestDispatcher("/playlist_edit.jsp")
                .forward(request, response);
          } else {
            response.getWriter()
                .println(
                    "You don't have permission to delete this playlist.");
          }
        } else {
          response.getWriter().println("User's not login.");
        }
      }
      // edit videos in playlist.
      else if (action.equalsIgnoreCase("edit_videos")) {
        if (user != null) {
          String pid = request.getParameter("id");
          Playlist pl = PlaylistModel.getById(pid);
          if (pl.getUserFederatedId().equals(user.getUserId())) {
            request.setAttribute("result", pl);
            request.getRequestDispatcher(
                "/playlist_edit_videos.jsp").forward(request,
                response);
          } else {
            response.getWriter()
                .println(
                    "You don't have permission to delete this playlist.");
          }
        } else {
          response.getWriter().println("User's not login.");
        }
      }
      // remove clip from a playlist.
      else if (action.equalsIgnoreCase("remove_clip")) {
        if (user != null) {
          String id = request.getParameter("id");
          String pId = request.getParameter("pId");
          System.out.println(id);
          System.out.println(pId);
          Tube tub = TubeModel.getByTubeId(id);
          Playlist pl = PlaylistModel.getById(pId);
          if (pl != null && tub != null
              && pl.getUserFederatedId().equals(user.getUserId())) {
            List<Text> newVideos = pl.getListTubes();
            for (int i = 0; i < newVideos.size(); i++) {
              Tube exitTub = new Tube();
              exitTub.transformString(newVideos.get(i).getValue());
              if (tub.getTubeId().equalsIgnoreCase(
                  exitTub.getTubeId())) {
                newVideos.remove(i);
                break;
              }
            }
            pl.setListTubes(newVideos);
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.