Package com.tubeonfire.entity

Examples of com.tubeonfire.entity.Tag


  }

  @SuppressWarnings("unchecked")
  public static Tag getByAlias(String alias) {
    init();
    Tag obj = new Tag();
    String prefix = cachePrefix + "alias_" + alias;
    if (cache != null && cache.containsKey(prefix)) {
      obj = (Tag) cache.get(prefix);
      System.out.println("Get tag from cache !");
    } else {
View Full Code Here


      }

      keyword = URLDecoder.decode(keyword, "UTF8");
      System.out.println("Keyword to search : " + keyword);
      TagModel tagModel = new TagModel();
      Tag tag = tagModel.getByAlias(keyword);
      if (tag != null) {       
        List<Tube> result = new ArrayList<Tube>();
        int startPoint = (page - 1) * itemPerPage;
        if (tag.getListTubeId().size() > startPoint) {
          for (int i = startPoint; i < tag.getListTubeId().size(); i++) {
            if (i == (itemPerPage + startPoint)) {
              break;
            }
            String id = tag.getListTubeId().get(i).getValue();
            System.out.println(id);
            Tube tub = TubeModel.getByTubeId(id);
            if (tub != null) {
              result.add(tub);
            }
          }
        } else {
          page = 1;
          for (int i = 0; i < tag.getListTubeId().size(); i++) {
            if (i == itemPerPage) {
              break;
            }
            String id = tag.getListTubeId().get(i).getValue();
            Tube tub = TubeModel.getByTubeId(id);
            if (tub != null) {
              result.add(tub);
            }
          }
        }
        request.setAttribute("url", request.getRequestURL());
        request.setAttribute("listCategory",
            JavaCacheHandle.getCategory());
        request.setAttribute("listChannel",
            JavaCacheHandle.getChannels());
        request.setAttribute("result", result);
        request.setAttribute("currentPage", page);
        request.setAttribute("keyword", keyword.replaceAll("\\+", " "));
        request.setAttribute("totalResult", tag.getListTubeId().size());
        request.getRequestDispatcher("/keyword_show.jsp").forward(request,
            response);
      } else {
        System.out.println("Tag is not exits.");
        response.sendRedirect("/home");
View Full Code Here

    return true;
  }

  @SuppressWarnings("unchecked")
  public Tag getByAlias(String alias) {
    Tag tag = null;
    Query query = pm.newQuery(Tag.class);
    query.setFilter("alias==tagAlias");
    query.declareParameters("java.lang.String tagAlias");
    query.setRange(0, 1);
    List<Tag> listResult = (List<Tag>) query.execute(alias);
View Full Code Here

TOP

Related Classes of com.tubeonfire.entity.Tag

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.