Examples of Category


Examples of com.thinkgem.jeesite.modules.cms.entity.Category

  /**
   * 显示内容
   */
  @RequestMapping(value = "view-{categoryId}-{contentId}${urlSuffix}")
  public String view(@PathVariable String categoryId, @PathVariable String contentId, Model model) {
    Category category = categoryService.get(categoryId);
    if (category==null){
      Site site = CmsUtils.getSite(Site.defaultSiteId());
      model.addAttribute("site", site);
      return "error/404";
    }
    model.addAttribute("site", category.getSite());
    if ("article".equals(category.getModule())){
      // 如果没有子栏目,并父节点为跟节点的,栏目列表为当前栏目。
      List<Category> categoryList = Lists.newArrayList();
      if (category.getParent().getId().equals("1")){
        categoryList.add(category);
      }else{
        categoryList = categoryService.findByParentId(category.getParent().getId(), category.getSite().getId());
      }
      // 获取文章内容
      Article article = articleService.get(contentId);
      if (article==null || !Article.DEL_FLAG_NORMAL.equals(article.getDelFlag())){
        return "error/404";
      }
      // 文章阅读次数+1
      articleService.updateHitsAddOne(contentId);
      // 获取推荐文章列表
      List<Object[]> relationList = articleService.findByIds(article.getArticleData().getRelation());
      // 将数据传递到视图
      model.addAttribute("category", article.getCategory());
      model.addAttribute("categoryList", categoryList);
      model.addAttribute("article", article);
      model.addAttribute("relationList", relationList);
            setTplModelAttribute(model, article.getCategory());
            setTplModelAttribute(model, article.getViewConfig());
      return "modules/cms/front/themes/"+category.getSite().getTheme()+"/"+getTpl(article);
    }
    return "error/404";
  }
View Full Code Here

Examples of com.thoughtworks.acceptance.objects.Category

        assertBothWays(list, xml);
    }
   
    public void testForSystemAttributes() {
        List list = new LinkedList();
        Category category = new Category("walness", "xstream");
        category.setProducts(list);
        list.add(category);
       
        xstream.alias("category", Category.class);
        xstream.useAttributeFor(Category.class, "id");
        xstream.aliasAttribute("class", "id");
View Full Code Here

Examples of com.trustyoram.web.storage.config.categories.Category

    }
  }

  @Override
  public int doAfterBody() throws JspException {
    Category category;

    try {
      String rs = this.getBodyContent().getString();
      this.getBodyContent().clear();
      this.getPreviousOut().println(rs);
View Full Code Here

Examples of com.tubeilike.entity.Category

      result = new ArrayList<Category>();
      List<String> cachedCategory = (List<String>) cache
          .get("cachedCategory");
      if (cachedCategory.size() > 0) {
        for (String stringCate : cachedCategory) {
          Category cate = new Category();
          cate.transformString(stringCate);
          result.add(cate);
        }
      }
    }
    return result;
View Full Code Here

Examples of com.tubemostwanted.entity.Category

        if (request.getParameter("categoryAlias") != null) {
          int page = 1;
          if (request.getParameter("page") != null) {
            page = Integer.parseInt(request.getParameter("page"));
          }
          Category cate = CategoryModel.getByCateAlias(request
              .getParameter("categoryAlias"));
          System.out.println("Ok 2");
          if (cate != null) {
            System.out.println(cate.getTitle().getValue());
            if (cate != null) {
              JSONObject object = new JSONObject();
              object.put("categoryAlias", cate.getAlias());
              object.put("thumbImageUrl", cate.getThumbImageUrl()
                  .getValue());
              object.put("count", cate.getCount());
              object.put("subTitle", cate.getSubTitle());
              object.put("description", cate.getDescription()
                  .getValue());
              object.put("listTube", TubeModel.getByCategory(
                  cate.getAlias(), page, 10));
              System.out.println("Get all ok, Category : "
                  + cate.getAlias() + ", page : " + page);
              response.getWriter().write(object.toString());
            }
          }
        }
      }
      // view category.
      else if (action.equalsIgnoreCase("view")) {
        Category cate = CategoryModel.getByCateAlias(request
            .getParameter("alias"));
        if (cate != null) {
          List<Tube> result = TubeModel.getAllByCategory(cate
              .getAlias());
          if (result.size() > 0) {
            request.setAttribute("result", result);
            request.setAttribute("cate", cate);
            request.getRequestDispatcher("/category_view.jsp")
                .forward(request, response);
          }
        } else {

        }

      }
      // create category.
      else if (action.equalsIgnoreCase("create")) {
        request.getRequestDispatcher("/category_create.jsp").forward(
            request, response);
      }
      // edit category.
      else if (action.equalsIgnoreCase("edit")) {
        response.getWriter().println("Edit.");
      }
      // delete category.
      else if (action.equalsIgnoreCase("delete")) {
        String id = request.getParameter("id");
        if (id != null) {
          Category cate = CategoryModel.getByCateAlias(id);
          if (cate != null) {
            cate.setStatus(4);
            CategoryModel.update(cate);
            CategoryModel.closePM();
            List<Tube> listTube = TubeModel.getAllByCategory(cate
                .getAlias());
            for (Tube tube : listTube) {
              tube = TubeModel.getByTubeId(tube.getTubeId());
              tube.setCategoryAlias("");
              TubeModel.update(tube);
            }
            TubeModel.closePM();
            response.sendRedirect("/admin/category/manager");
          } else {
            response.getWriter().println("Category is not exits.");
          }

        } else {
          response.getWriter().println(
              "Invalid category. Please try again.");
        }
      }// edit list clips in category.
      else if (action.equalsIgnoreCase("edit_videos")) {
        Category cate = CategoryModel.getByCateAlias(request
            .getParameter("id"));
        if (cate != null) {
          List<Tube> listTube = TubeModel.getAllByCategory(cate
              .getAlias());
          request.setAttribute("result", listTube);
          request.setAttribute("cate", cate);
          request.getRequestDispatcher("/category_edit_videos.jsp")
              .forward(request, response);
        } else {
          response.getWriter().println("Category is not exits.");
        }
      }
      // add clips to category.
      else if (action.equalsIgnoreCase("add_video")) {
        if (request.getParameter("nextId") == null
            && request.getParameter("prevId") == null) {
          Category cate = CategoryModel.getByCateAlias(request
              .getParameter("categoryAlias"));
          Tube tub = TubeModel.getByTubeId(request
              .getParameter("tubeId"));
          if (tub == null) {
            tub = TubeService.searchById(
                request.getParameter("tubeId"), true);
          }
          if (tub.getCategoryAlias() != null
              && tub.getCategoryAlias().equalsIgnoreCase(
                  cate.getAlias())) {

          } else {
            cate.setCount(cate.getCount() + 1);
          }
          tub.setCategoryAlias(cate.getAlias());
          tub.setCategoryIndex(1000000);
          TubeModel.update(tub);
          CategoryModel.update(cate);
          TubeModel.closePM();
          CategoryModel.closePM();
        } else if (request.getParameter("prevId") == null) {
          Category cate = CategoryModel.getByCateAlias(request
              .getParameter("categoryAlias"));
          Tube tub = TubeModel.getByTubeId(request
              .getParameter("tubeId"));
          if (tub == null) {
            tub = TubeService.searchById(
                request.getParameter("tubeId"), true);
          }
          if (tub.getCategoryAlias() != null
              && tub.getCategoryAlias().equalsIgnoreCase(
                  cate.getAlias())) {

          } else {
            cate.setCount(cate.getCount() + 1);
          }
          Tube nextTub = TubeModel.getByTubeId(request
              .getParameter("nextId"));
          tub.setCategoryAlias(cate.getAlias());
          tub.setCategoryIndex(nextTub.getCategoryIndex() / 2);
          TubeModel.update(tub);
          CategoryModel.update(cate);
          TubeModel.closePM();
          CategoryModel.closePM();
        } else if (request.getParameter("nextId") == null) {
          Category cate = CategoryModel.getByCateAlias(request
              .getParameter("categoryAlias"));
          Tube tub = TubeModel.getByTubeId(request
              .getParameter("tubeId"));
          if (tub == null) {
            tub = TubeService.searchById(
                request.getParameter("tubeId"), true);
          }
          if (tub.getCategoryAlias() != null
              && tub.getCategoryAlias().equalsIgnoreCase(
                  cate.getAlias())) {
          } else {
            cate.setCount(cate.getCount() + 1);
          }
          Tube prevTub = TubeModel.getByTubeId(request
              .getParameter("prevId"));
          tub.setCategoryAlias(cate.getAlias());
          tub.setCategoryIndex(prevTub.getCategoryIndex() + 1000000);
          TubeModel.update(tub);
          CategoryModel.update(cate);
          TubeModel.closePM();
          CategoryModel.closePM();
        } else {
          Category cate = CategoryModel.getByCateAlias(request
              .getParameter("categoryAlias"));
          Tube tub = TubeModel.getByTubeId(request
              .getParameter("tubeId"));
          if (tub == null) {
            tub = TubeService.searchById(
                request.getParameter("tubeId"), true);
          }
          if (tub.getCategoryAlias() != null
              && tub.getCategoryAlias().equalsIgnoreCase(
                  cate.getAlias())) {

          } else {
            cate.setCount(cate.getCount() + 1);
          }
          Tube nextTub = TubeModel.getByTubeId(request
              .getParameter("nextId"));
          Tube prevTub = TubeModel.getByTubeId(request
              .getParameter("prevId"));
          tub.setCategoryAlias(cate.getAlias());
          // calculate tub position.
          tub.setCategoryIndex((nextTub.getCategoryIndex() + prevTub
              .getCategoryIndex()) / 2);
          System.out.println(tub.getTitle().getValue()
              + " was added to category : "
              + cate.getTitle().getValue() + " between "
              + prevTub.getTitle().getValue() + " and "
              + nextTub.getTitle().getValue());
          CategoryModel.update(cate);
          TubeModel.update(tub);
          CategoryModel.closePM();
          TubeModel.closePM();
        }
        response.getWriter().println(
            "<div><p style='color:green'>Update success</p></div>");
      }

      // reorder category index
      else if (action.equalsIgnoreCase("re_order_index")) {
        if (request.getParameter("prevAlias") == null
            && request.getParameter("nextAlias") == null) {
          Category current = CategoryModel.getByCateAlias(request
              .getParameter("currentAlias"));
          current.setIndex(1000000);
          CategoryModel.update(current);
          CategoryModel.closePM();
        } else if (request.getParameter("prevAlias") == null) {
          Category current = CategoryModel.getByCateAlias(request
              .getParameter("currentAlias"));
          Category next = CategoryModel.getByCateAlias(request
              .getParameter("nextAlias"));
          current.setIndex(next.getIndex() / 2);
          CategoryModel.update(current);
          CategoryModel.closePM();

        } else if (request.getParameter("nextAlias") == null) {
          Category current = CategoryModel.getByCateAlias(request
              .getParameter("currentAlias"));
          Category pre = CategoryModel.getByCateAlias(request
              .getParameter("prevAlias"));
          current.setIndex(pre.getIndex() + 1000000);
          CategoryModel.update(current);
          CategoryModel.closePM();
        } else {
          Category current = CategoryModel.getByCateAlias(request
              .getParameter("currentAlias"));
          Category pre = CategoryModel.getByCateAlias(request
              .getParameter("prevAlias"));
          Category next = CategoryModel.getByCateAlias(request
              .getParameter("nextAlias"));
          current.setIndex((pre.getIndex() + next.getIndex()) / 2);
          CategoryModel.update(current);
          CategoryModel.closePM();
        }
        response.getWriter().println(
            "<div><p style='color:green'>Update success</p></div>");
      }

      // remove clips from category.
      else if (action.equalsIgnoreCase("remove_video")) {
        Tube tub = TubeModel
            .getByTubeId(request.getParameter("tubeId"));
        Category cate = CategoryModel.getByCateAlias(request
            .getParameter("categoryAlias"));
        if (cate.getCount() > 0) {
          cate.setCount(cate.getCount() - 1);
        }
        CategoryModel.update(cate);
        CategoryModel.closePM();
        tub.setCategoryAlias("");
        TubeModel.update(tub);
View Full Code Here

Examples of com.tubeonfire.entity.Category

      result = new ArrayList<Category>();
      List<String> cachedCategory = (List<String>) cache
          .get("cachedCategory");
      if (cachedCategory.size() > 0) {
        for (String stringCate : cachedCategory) {
          Category cate = new Category();
          cate.transformString(stringCate);
          result.add(cate);
        }
      }
    }
    return result;
View Full Code Here

Examples of com.volantis.devrep.device.api.xml.definitions.Category

            dumpTypeDeclaration(typeDeclaration, buffer);

        }
        Iterator categories = definitionSet.categories();
        while (categories.hasNext()) {
            Category category = (Category) categories.next();
            dumpCategory(category, buffer);
        }

    }
View Full Code Here

Examples of cross.reputation.model.Category

            "hasCategory property of resource:"+
            resource.getURI()+" is not a resource")) {
          return null;
        }
      } else {
        Category category = (Category) getResourceFromCache(
            statement.getObject().asResource(), Category.class);
        if(category == null) {
          category = getCategory(model,
              statement.getObject().asResource());         
        }
View Full Code Here

Examples of cz.cvut.fel.wa2.interior.entity.Category

    @Autowired
    private CategoryDAO categoryDAO;

    @Override
    public CategoryDTO create(UriInfo uriInfo, CategoryDTO categoryDTO) {
        Category category = new Category(categoryDTO.getName());
        categoryDAO.persist(category);
        return new CategoryDTO(category, uriInfo);
    }
View Full Code Here

Examples of edu.brown.benchmark.auctionmark.util.Category

        }
        @Override
        protected int populateRow() {
            int col = 0;

            Category category = this.categories.poll();
            assert(category != null);
           
            // C_ID
            this.row[col++] = category.getCategoryID();
            // C_NAME
            this.row[col++] = category.getName();
            // C_PARENT_ID
            this.row[col++] = category.getParentCategoryID();
           
            return (col);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.