Package com.multysite.entity

Examples of com.multysite.entity.Category


        if (obj != null) {
          CategoryModel cateModel = new CategoryModel();
          cateModel.prepareAll();
          if (cateModel.getListResult().size() == 0) {
            List<Category> listCate = new ArrayList<Category>();
            Category cate = new Category();
            cate.setTitle("Uncategory");
            cate.setAlias("uncategory");
            cate.setLevel(1);
            cate.setParentAlias("");
            CategoryModel.insert(cate);
            listCate.add(cate);
            req.setAttribute("listCategory", listCate);
          } else {
            req.setAttribute("listCategory",
View Full Code Here


          }

          /*
           * process category
           */
          Category cate = CategoryModel.getById(category);
          if (cate != null) {
            obj.setCategory(cate.getTitle());
            obj.setCategoryAlias(cate.getAlias());
          }
          /*
           * process tag
           */
          try {
View Full Code Here

        obj.setCategory("Uncategory");
        obj.setCategoryAlias("uncategory");
      } else {
        category = category.replaceAll(",[\\w\\W]$", "");
        String cateAlias = StringHelper.replaceVietnamese(category);
        Category cate = CategoryModel.getById(cateAlias);
        if (cate == null) {
          cate = new Category();
          cate.setTitle(category);
          cate.setAlias(cateAlias);
          cate.setLevel(1);
          cate.setParentAlias("");
          cate.setDescription("");
          CategoryModel.insert(cate);
        }
        obj.setCategory(cate.getTitle());
        obj.setCategoryAlias(cate.getAlias());
      }

      // source
      String source = "";
      try {
View Full Code Here

      if (!NamespaceManager.get().equals(Setting.getGeneralNamespace())) {
        CategoryModel cateModel = new CategoryModel();
        cateModel.prepareAll();
        if (cateModel.getListResult().size() == 0) {
          List<Category> listCate = new ArrayList<Category>();
          Category cate = new Category();
          cate.setTitle("Uncategory");
          cate.setAlias("uncategory");
          cate.setLevel(1);
          cate.setParentAlias("");
          CategoryModel.insert(cate);
          listCate.add(cate);
          req.setAttribute("listCategory", listCate);
        } else {
          req.setAttribute("listCategory", cateModel.getListResult());
View Full Code Here

        }
        /*
         * process category
         */
        Category cate = CategoryModel.getById(category);
        if (cate != null) {
          obj.setCategory(cate.getTitle());
          obj.setCategoryAlias(cate.getAlias());
        }
        /*
         * process tag
         */
        try {
View Full Code Here

  @SuppressWarnings("unchecked")
  public static Category getById(String alias) {
    try {
      init();
      boolean cached = false;
      Category obj = new Category();
      String prefix = cachePrefix + "alias_" + alias;
      try {
        obj = (Category) cache.get(prefix);
        if (obj != null) {
          cached = true;
View Full Code Here

      String action = request.getParameter("action");
      if (action != null && action.equals("add")) {
        String title = request.getParameter("title");
        title = URLDecoder.decode(title, "UTF-8");
        String alias = StringHelper.replaceVietnamese(title);
        Category obj = CategoryModel.getById(alias);
        if (obj != null) {
          response.getWriter().println("1");
        } else {
          obj = new Category();
          obj.setTitle(title);
          obj.setAlias(alias);
          String parentAlias = request.getParameter("parent");
          if (!parentAlias.equals("0")) {
            obj.setParentAlias(parentAlias);
            obj.setLevel(2);
          } else {
            obj.setLevel(1);
          }
          CategoryModel.insert(obj);
          response.setCharacterEncoding("UTF-8");
          response.getWriter().println(
              obj.getAlias() + "," + obj.getLevel());
        }
      }
    } catch (Exception e) {
      response.getWriter().println(
          "Error when processing, please try again later !");
View Full Code Here

        String[] splitted = req.getRequestURI().split("/");
        if (splitted.length == 3) {
          boolean check = false;
          String categoryAlias = splitted[2];
          categoryAlias = URLDecoder.decode(categoryAlias, "UTF-8");
          Category obj = CategoryModel.getById(categoryAlias);
          if (obj != null || check == false) {

            CompiledScript compiledscript = CompileScriptEngine
                .getCompileScript(config.getApplicationId(),
                    "category", template.getCategory());
View Full Code Here

TOP

Related Classes of com.multysite.entity.Category

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.