Package com.tubeonfire.entity

Examples of com.tubeonfire.entity.SpecialTube


  public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws IOException, ServletException {
    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


  private void orderSlide(HttpSession session, HttpServletRequest request) {
    String currentId = (String) request.getParameter("currentId");
    String prevId = (String) request.getParameter("prevId");
    String nextId = (String) request.getParameter("nextId");
    SpecialTube spTube = SpecialTubeModel.getByType("slide", false);
    List<String> listId = new ArrayList<String>();
    if (prevId == null) {
      listId.add(currentId);
      for (String string : spTube.getListTubeId()) {
        if (string.equals(currentId)) {
          continue;
        } else {
          listId.add(string);
        }
      }
    } else if (nextId == null) {
      for (String string : spTube.getListTubeId()) {
        if (string.equals(currentId)) {
          continue;
        } else {
          listId.add(string);
        }
      }
      listId.add(currentId);
    } else {
      for (String string : spTube.getListTubeId()) {
        if (string.equals(currentId)) {
          continue;
        }
        listId.add(string);
        if (string.equals(prevId)) {
          listId.add(currentId);
        }
      }
    }
    spTube.setListTubeId(listId);
    SpecialTubeModel.insert(spTube);

  }
View Full Code Here

  private String slideShowAll(HttpSession session, HttpServletRequest request) {
    try {
      String strIds = (String) request.getParameter("ids");
      String[] ids = strIds.split(",");
      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();
      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);
      SpecialTubeModel.insert(spTube);
      return "";
    } catch (Exception e) {
      return "Action fails ! Please try again !";
    }
View Full Code Here

  private String removeSlideAll(HttpSession session,
      HttpServletRequest request) {
    try {
      String strIds = (String) request.getParameter("ids");
      String[] ids = strIds.split(",");
      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();
      for (int i = 0; i < ids.length; i++) {
        if (!ids[i].isEmpty()) {
          for (int j = 0; j < listSlideTubeId.size(); j++) {
            if (listSlideTubeId.get(j).equals(ids[i])) {
              listSlideTubeId.remove(j);
              break;
            }
          }
        }
      }
      spTube.setListTubeId(listSlideTubeId);
      SpecialTubeModel.insert(spTube);
      return "";
    } catch (Exception e) {
      return "Action fails ! Please try again !";
    }
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 {
        return "Action fails ! Tube's not exits or have been deleted !";
      }
View Full Code Here

  private String removeSlide(HttpSession session, HttpServletRequest request) {
    try {
      String strId = (String) request.getParameter("id");
      if (strId != null && !strId.isEmpty()) {
        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();
        for (int j = 0; j < listSlideTubeId.size(); j++) {
          if (listSlideTubeId.get(j).equals(strId)) {
            listSlideTubeId.remove(j);
            break;
          }
        }
        spTube.setListTubeId(listSlideTubeId);
        SpecialTubeModel.insert(spTube);
        return "";
      } else {
        return "Action fails ! Tube's not exits or have been deleted !";
      }
View Full Code Here

      String prefix = cacheSide + cachePrefix + "slideshow";
      mapCacheKey.put(prefix, prefix);
      if (cache != null && cache.containsKey(prefix)) {
        listResult = (ArrayList<Tube>) cache.get(prefix);
      } else {
        SpecialTube spTube = SpecialTubeModel.getByType("slide", true);
        if (spTube != null) {
          for (String strId : spTube.getListTubeId()) {
            listResult.add(getById(strId));
          }
        }
        if (listResult.size() > 0) {
          cache.put(prefix, listResult);
View Full Code Here

      String prefix = cachePrefix + "slideshow";
      mapCacheKey.put(prefix, prefix);
      if (cache != null && cache.containsKey(prefix)) {
        listResult = (ArrayList<Tube>) cache.get(prefix);
      } else {
        SpecialTube spTube = SpecialTubeModel.getByType("slide", true);
        if (spTube != null) {
          for (String strId : spTube.getListTubeId()) {
            listResult.add(getById(strId));
          }
        }
        if (listResult.size() > 0) {
          cache.put(prefix, listResult);
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  public static SpecialTube byId(String id, boolean fromCache) {
    init();
    SpecialTube obj = new SpecialTube();
    String prefix = cachePrefix + "id_" + id;
    if (cache != null && cache.containsKey(prefix) && fromCache) {
      obj = (SpecialTube) cache.get(prefix);
    } else {
      try {
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  public static SpecialTube getByType(String type, boolean fromCache) {
    init();
    SpecialTube obj = new SpecialTube();
    String prefix = cachePrefix + "type_" + type;
    if (cache != null && cache.containsKey(prefix) && fromCache) {
      obj = (SpecialTube) cache.get(prefix);
      System.out.println("Get SpecialTube By Type from cache !");
    } else {
View Full Code Here

TOP

Related Classes of com.tubeonfire.entity.SpecialTube

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.