Package com.tubeonfire.entity

Examples of com.tubeonfire.entity.Tube


      if (splitted.length == 4) {
        id = splitted[2];
      } else {
        resp.sendRedirect("/home");
      }
      Tube obj = TubeModel.getById(id);
      if (obj != null && obj.getId().length() > 0) {
        ViewCountHelper.addViewCount(obj.getId());
        RecentViewHelper.addRecentView(obj);
        req.setAttribute("obj", obj);
        req.setAttribute("url", req.getRequestURL().toString());
        req.getRequestDispatcher("/tube_detail.jsp").forward(req, resp);
      } else {
View Full Code Here


      throws IOException, ServletException {
    try {
      HttpSession session = req.getSession();
      String id = req.getParameter("id");
      System.out.println(id);
      Tube obj = TubeModel.getById(id, true);
      if (obj != null) {
        session.setAttribute("action", "edit");
        session.setAttribute("obj", obj);
        req.getRequestDispatcher("/admin/form_tube.jsp").forward(req,
            resp);
View Full Code Here

  protected void doPost(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    try {
      HttpSession session = req.getSession();
      String id = req.getParameter("id");
      Tube obj = TubeModel.getById(id, true);
      if (obj != null) {
        if (TubeValidate.checkForm(req, resp, session, "edit", obj)) {
          TubeModel.update(obj);
          session.setAttribute("success", "Action success !");
          resp.sendRedirect("/admin/tube/edit?id=" + id);
View Full Code Here

    try {
      List<Tube> listResult = new ArrayList<Tube>();
      SpecialTube spTube = SpecialTubeModel.getByType("slide", false);
      if (spTube != null) {
        for (String strId : spTube.getListTubeId()) {
          Tube tub = TubeModel.getById(strId, true);
          if (tub != null) {
            listResult.add(tub);
          }
        }
      }
View Full Code Here

        String id = (String) req.getParameter("id");
        String playlistId = (String) req.getParameter("playlist");
        url = (String) req.getParameter("url");
        url = URLDecoder.decode(url, "UTF-8");

        Tube tube = YoutubeService.searchStaticById(id);
        Playlist pl = PlaylistModel.byId(playlistId, false);
        TreeMap recentAddTreeId = (TreeMap) session
            .getAttribute("recentAddTreeId");
        String currentPl = (String) session
            .getAttribute("currentPlaylist");
        if (currentPl != null && !currentPl.equals(pl.getId())) {
          recentAddTreeId = new TreeMap();
        } else if (recentAddTreeId == null) {
          recentAddTreeId = new TreeMap();
        }
        if (pl != null
            && TubeValidate.checkForm(req, resp, session, action,
                tube)) {
          tube = processTubeDetail(playlistId, tube);
          // add author to site.
          Queue queue = QueueFactory.getDefaultQueue();
          queue.add(TaskOptions.Builder.withUrl(
              "/task-admin?action=add-author&uri="
                  + tube.getAuthorUrl()).method(
              TaskOptions.Method.GET));
          TubeModel.insert(tube);
          recentAddTreeId.put(tube.getId(), tube.getId());
          session.setAttribute("recentAddTreeId", recentAddTreeId);
          session.setAttribute("currentPlaylist", pl.getId());
          session.setAttribute("success",
              "Action success ! Video have been added to playlist \""
                  + pl.getTitle() + "\"");
View Full Code Here

        SpecialTubeModel.insert(spTube);
      }
      List<String> listSlideTubeId = spTube.getListTubeId();
      for (int i = 0; i < ids.length; i++) {
        if (!ids[i].isEmpty()) {
          Tube tube = TubeModel.getById(ids[i], false);
          if (tube != null) {
            if (!listSlideTubeId.contains(tube.getId())) {
              if (listSlideTubeId.size() == 8) {
                listSlideTubeId.remove(0);
              }
              listSlideTubeId.add(tube.getId());
            } else {
              for (int j = 0; j < listSlideTubeId.size(); j++) {
                if (listSlideTubeId.get(j).equals(tube.getId())) {
                  listSlideTubeId.remove(j);
                  break;
                }
              }
              listSlideTubeId.add(tube.getId());
            }
          }
        }
      }
      spTube.setListTubeId(listSlideTubeId);
View Full Code Here

      batchResponse = service.batch(new URL(
          "http://gdata.youtube.com/feeds/api/videos/batch"),
          batchFeed);
      for (VideoEntry videoEntry : batchResponse.getEntries()) {
        if (BatchUtils.isSuccess(videoEntry)) {
          Tube obj = YoutubeService.videoEntryToTube(videoEntry);
          if (obj != null) {
            listResult.add(obj);
          }
        }
      }
View Full Code Here

  }

  private String setSlide(HttpSession session, HttpServletRequest request) {
    try {
      String strId = (String) request.getParameter("id");
      Tube tube = TubeModel.getById(strId, false);
      if (tube != null) {
        SpecialTube spTube = SpecialTubeModel.getByType("slide", false);
        if (spTube == null) {
          spTube = new SpecialTube();
          spTube.setId(IdUniqueHelper.getId());
          spTube.setType("slide");
          SpecialTubeModel.insert(spTube);
        }
        List<String> listSlideTubeId = spTube.getListTubeId();
        if (!listSlideTubeId.contains(tube.getId())) {
          if (listSlideTubeId.size() == 8) {
            listSlideTubeId.remove(0);
          }
          listSlideTubeId.add(tube.getId());
        } else {
          for (int j = 0; j < listSlideTubeId.size(); j++) {
            if (listSlideTubeId.get(j).equals(tube.getId())) {
              listSlideTubeId.remove(j);
              break;
            }
          }
          listSlideTubeId.add(tube.getId());
        }
        spTube.setListTubeId(listSlideTubeId);
        SpecialTubeModel.insert(spTube);
        return "";
      } else {
View Full Code Here

          recentAddTreeId = new TreeMap();
        }
        Queue queue = QueueFactory.getDefaultQueue();
        for (int i = 0; i < ids.length; i++) {
          if (!ids[i].isEmpty()) {
            Tube tube = YoutubeService.searchStaticById(ids[i]);
            if (tube != null) {
              tube = processTubeDetail(plId, tube);
              recentAddTreeId.put(ids[i], ids[i]);
              list.add(tube);
              // add author to site.
              queue.add(TaskOptions.Builder.withUrl(
                  "/task-admin?action=add-author&uri="
                      + tube.getAuthorUrl()).method(
                  TaskOptions.Method.GET));
            }
          }
        }
        TubeModel.insert(list);
View Full Code Here

      if (pl != null) {
        List<Tube> list = new ArrayList<Tube>();
        String[] ids = strIds.split(",");
        for (int i = 0; i < ids.length; i++) {
          if (!ids[i].isEmpty()) {
            Tube tube = TubeModel.getById(ids[i], false);
            if (tube != null) {
              tube.setPlaylistId(plId);
              list.add(tube);
            }
          }
        }
        TubeModel.insert(list);
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.