Package com.dotmarketing.portlets.categories.model

Examples of com.dotmarketing.portlets.categories.model.Category


  //view category for Render request
  private void _viewCategory(ActionForm form, RenderRequest req, RenderResponse res) throws Exception {

      User user = _getUser(req);

    Category cat = new Category();
    if(req.getParameter("inode") != null && !req.getParameter("inode").equals("null") && InodeUtils.isSet((req.getParameter("inode"))))
      cat = (Category) categoryAPI.find(req.getParameter("inode"), user, false);
    req.setAttribute(WebKeys.CATEGORY_EDIT, cat);
    req.setAttribute(WebKeys.CATEGORY_LIST_TOP, categoryAPI.findTopLevelCategories(user, false));
View Full Code Here


  @Override
  protected Category find(String id) throws DotDataException {
      if(!UtilMethods.isSet(id)) return null;
     
    Category cat = catCache.get(id);
    if(cat == null) {
      try {
        cat = (Category) HibernateUtil.load(Category.class, id);
      } catch (DotHibernateException e) {
        if(!(e.getCause() instanceof ObjectNotFoundException))
View Full Code Here

  @Override
  protected Category findByKey(String key) throws DotDataException {
    if(key==null){
      throw new DotDataException("null key passed in");
    }
    Category cat = catCache.getByKey(key);
    if(cat ==null){
      HibernateUtil hu = new HibernateUtil(Category.class);
      hu.setQuery("from " + Category.class.getName() + " as cat where lower(cat.key) = ? and category0__1_.type='category'");
      hu.setParam(key.toLowerCase());
      cat = (Category) hu.load();
View Full Code Here

  protected void save(Category object) throws DotDataException {
    String id = object.getInode();
    if(InodeUtils.isSet(id)) {
      try
      {
        Category cat = (Category) HibernateUtil.load(Category.class, id);
        // WE NEED TO REMOVE ORIGINAL BEFORE SAVING BECAUSE THE KEY CACHE NEEDS TO BE CLEARED
        // DOTCMS-5717
        catCache.remove(cat);
        BeanUtils.copyProperties(cat,object);
        HibernateUtil.saveOrUpdate(cat);
View Full Code Here

        }
      return cats;
  }
 
  private Category readCatFromDotConnect(Map<String,Object> m) {
      Category cat = new Category();
        cat.setActive(DbConnectionFactory.getDBTrue().equals(m.get("active")));
        cat.setInode(m.get("inode").toString());
        cat.setCategoryName(m.get("category_name")!=null ? m.get("category_name").toString() : null);
        cat.setCategoryVelocityVarName(m.get("category_velocity_var_name")!=null?m.get("category_velocity_var_name").toString():null);
        cat.setKey(m.get("category_key")!=null?m.get("category_key").toString():null);
        cat.setKeywords(m.get("keywords")!=null?m.get("keywords").toString():null);
        cat.setSortOrder(m.get("sort_order")!=null ? m.get("sort_order").toString() : "0");
        return cat;
  }
View Full Code Here

        throw new DotDataException(e.getMessage(), e);
      }
    } else {
      children = new ArrayList<Category>();
      for(String id : childrenIds) {
        Category cat = find(id);
        if(cat != null) {
          children.add(cat);
        }
      }
      Collections.sort(children,new CategoryComparator());
View Full Code Here

                throw new DotDataException( e.getMessage(), e );
            }
        } else {
            parents = new ArrayList<Category>();
            for ( String id : parentIds ) {
                Category cat = find( id );
                if ( cat != null ) {
                    parents.add( cat );
                }
            }
        }
View Full Code Here

      conn.commit();

      rs = s.executeQuery(catSQL.getSortParents());

      while(rs.next()) {
        Category cat = null;
        try {
          cat = (Category) HibernateUtil.load(Category.class, rs.getString("inode"));
        } catch (DotHibernateException e) {
          if(!(e.getCause() instanceof ObjectNotFoundException))
            throw e;
View Full Code Here

      conn.commit();
      sql = catSQL.getSortedChildren(inode);
      rs = s.executeQuery(sql);

      while(rs.next()) {
        Category cat = null;
        try {
          cat = (Category) HibernateUtil.load(Category.class, rs.getString("inode"));
        } catch (DotHibernateException e) {
          if(!(e.getCause() instanceof ObjectNotFoundException))
            throw e;
View Full Code Here

//      Add User Categories
      List<Category> catList = InodeFactory.getChildrenClass(userProxy,Category.class);
      if(catList.size() > 0){
        String[] categories = new String[catList.size()];
        for(int i = 0 ; i < catList.size() ;++i){
          Category cat = catList.get(i);
          categories[i] = String.valueOf(cat.getInode());
          userProxy.addChild(cat);
        }
      }
      BeanUtils.copyProperties(form, address);
View Full Code Here

TOP

Related Classes of com.dotmarketing.portlets.categories.model.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.