Package com.dotmarketing.portlets.categories.model

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


    List<Field> fields = st.getFields();
    for (Field field : fields) {
      if(field.getFieldType().equals(Field.FieldType.CATEGORY.toString())){
        try {
          Category category = categoryAPI.find(field.getValues(), user, respectFrontendRoles);

          if(!perAPI.doesUserHavePermission(category, perAPI.PERMISSION_READ, user))
            continue;

          Map<String, Object> catMap = category.getMap();
          String categoryName = (String) catMap.get("categoryName");
          catMap.put("categoryOrigName", categoryName);
          categoryName = "+ " + categoryName;
          catMap.put("categoryLevel",0);
          maps.add(catMap);
View Full Code Here


            List<Category> selectedCategoriesList = new ArrayList<Category>();
            String[] selectedCategories = fieldForm.getDefaultValue().trim().split("\\|");
            for (String cat : selectedCategories) {
              selectedCategoriesList.add(categoryAPI.findByName(cat, user, false));
            }
            Category category = categoryAPI.find(req.getParameter("categories"), user, false);
            List<Category> childrenCategories = categoryAPI.getChildren(category, user, false);
            if (!childrenCategories.containsAll(selectedCategoriesList)) {
              String message = "error.invalid.child.category";
              SessionMessages.add(req, "error", message);
              return false;
View Full Code Here

            catAPI.removeChild(userProxy, (Category)o, user, false);
          }
        }
        for(int i = 0;i < categories.length;i++)
        {
          Category category = catAPI.find(categories[i], user, false);
          if(InodeUtils.isSet(category.getInode()))
          {
            catAPI.addChild(userProxy, category, user, false);
          }         
        }
        HibernateUtil.commitTransaction();
View Full Code Here

        catAPI.removeChild(userProxy, (Category)o, user, respectFrontend);
      }
    }
    for(int i = 0;i < categories.length;i++)
    {
      Category category = catAPI.find(categories[i], user, respectFrontend);
      if(InodeUtils.isSet(category.getInode()))
      {
        catAPI.addChild(userProxy, category, user, respectFrontend);
      }
    }
    HibernateUtil.commitTransaction();
View Full Code Here

        } else if (field.getFieldType().equals(Field.FieldType.CATEGORY.toString()) || field.getFieldType().equals(Field.FieldType.CATEGORIES_TAB.toString())) {
          valueObj = value;
          if(UtilMethods.isSet(value)) {
            String[] categoryKeys = value.split(",");
            for(String catKey : categoryKeys) {
              Category cat = catAPI.findByKey(catKey.trim(), user, false);
              if(cat == null)
                throw new DotRuntimeException("Line #" + lineNumber + " contains errors, Column: " + field.getFieldName() +
                    ", value: " + value + ", invalid category key found, line will be ignored.");
              categories.add(cat);
            }
View Full Code Here

      }

      List<Category> categoriesList  =  new ArrayList<Category>();
      if (categoriesArray != null) {
        for (String cat : categoriesArray ) {
            Category node = (Category) catAPI.find(cat, currentUser, respectFrontendRoles);
            if(node!=null){
              categoriesList.add(node);
           }
        }
      }
View Full Code Here

        } else if (field.getFieldType().equals(Field.FieldType.CATEGORY.toString()) || field.getFieldType().equals(Field.FieldType.CATEGORIES_TAB.toString())) {
          valueObj = value;
          if(UtilMethods.isSet(value)) {
            String[] categoryKeys = value.split(",");
            for(String catKey : categoryKeys) {
              Category cat = catAPI.findByKey(catKey.trim(), user, false);
              if(cat == null)
                throw new DotRuntimeException("Line #" + lineNumber + " contains errors, Column: " + field.getFieldName() +
                    ", value: " + value + ", invalid category key found, line will be ignored.");
              categories.add(cat);
            }
View Full Code Here

      if(f.getFieldContentlet().startsWith("float")){
        decimalFields.put(st.getVelocityVarName()+"."+f.getVelocityVarName(), f);
      }
    }
    CategoryAPI catAPI = APILocator.getCategoryAPI();
    Category category=null;
    String categoriesvalues="";
    boolean first = true;
    for (String cat : categories) {
       try {
         category=catAPI.find(cat, currentUser, false);
      } catch (DotDataException e) {
        Logger.error(this, "Error trying to obtain the categories", e);
      } catch (DotSecurityException e) {
        Logger.error(this, " Permission error trying to obtain the categories", e);
      }
      if(!first){
        categoriesvalues+=" ";
      }
      categoriesvalues+="categories:"+ category.getCategoryVelocityVarName();
      first = false;
    }
    categoriesvalues = categoriesvalues.trim();
    for (int i = 0; i < fields.size(); i = i + 2) {
      String fieldName = (String) fields.get(i);
View Full Code Here

              if(conAPI.getFieldValue(content,f) != null)
                value = conAPI.getFieldValue(content,f);
              String text = "";
              if(f.getFieldType().equals(Field.FieldType.CATEGORY.toString())){

                Category category = catAPI.find(f.getValues(), user, false);
                List<Category> children = catList;
                List<Category> allChildren= catAPI.getAllChildren(category, user, false);


                if (children.size() >= 1 && catAPI.canUseCategory(category, user, false)) {
View Full Code Here

      respectCMSAnon = true;
      user = (User)request.getSession().getAttribute(WebKeys.CMS_USER);
    }
    List<Category> categories = new ArrayList<Category>();
    if(UtilMethods.isSet(categoryInode)) {
        Category cat = categoryAPI.find(categoryInode, user, respectCMSAnon);
        if(cat != null)
          categories.add(cat);
    }
    String[] tags = null;
    if(UtilMethods.isSet(tag)){
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.