Codota Logo
CmsCategoryService.readCategory
Code IndexAdd Codota to your IDE (free)

How to use
readCategory
method
in
org.opencms.relations.CmsCategoryService

Best Java code snippets using org.opencms.relations.CmsCategoryService.readCategory (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
origin: org.opencms/opencms-solr

/**
 * Removes a resource identified by the given resource name from the category
 * identified by the given category path.<p>
 * 
 * The resource has to be previously locked.<p>
 * 
 * @param cms the current cms context
 * @param resourceName the site relative path to the resource to remove
 * @param categoryPath the path of the category to remove the resource from
 * 
 * @throws CmsException if something goes wrong
 */
public void removeResourceFromCategory(CmsObject cms, String resourceName, String categoryPath) throws CmsException {
  CmsCategory category = readCategory(cms, categoryPath, resourceName);
  removeResourceFromCategory(cms, resourceName, category);
}
origin: org.opencms/opencms-core

/**
 * Removes a resource identified by the given resource name from the category
 * identified by the given category path.<p>
 *
 * The resource has to be previously locked.<p>
 *
 * @param cms the current cms context
 * @param resourceName the site relative path to the resource to remove
 * @param categoryPath the path of the category to remove the resource from
 *
 * @throws CmsException if something goes wrong
 */
public void removeResourceFromCategory(CmsObject cms, String resourceName, String categoryPath)
throws CmsException {
  CmsCategory category = readCategory(cms, categoryPath, resourceName);
  removeResourceFromCategory(cms, resourceName, category);
}
origin: org.opencms/opencms-core

/**
 * Adds a resource identified by the given resource name to the category
 * identified by the given category path.<p>
 *
 * Only the most global category matching the given category path for the
 * given resource will be affected.<p>
 *
 * The resource has to be locked.<p>
 *
 * @param cms the current cms context
 * @param resourceName the site relative path to the resource to add
 * @param categoryPath the path of the category to add the resource to
 *
 * @throws CmsException if something goes wrong
 */
public void addResourceToCategory(CmsObject cms, String resourceName, String categoryPath) throws CmsException {
  CmsCategory category = readCategory(cms, categoryPath, resourceName);
  addResourceToCategory(cms, resourceName, category);
}
origin: org.opencms/opencms-solr

/**
 * Adds a resource identified by the given resource name to the category
 * identified by the given category path.<p>
 * 
 * Only the most global category matching the given category path for the 
 * given resource will be affected.<p>
 * 
 * The resource has to be locked.<p>
 * 
 * @param cms the current cms context
 * @param resourceName the site relative path to the resource to add
 * @param categoryPath the path of the category to add the resource to
 * 
 * @throws CmsException if something goes wrong
 */
public void addResourceToCategory(CmsObject cms, String resourceName, String categoryPath) throws CmsException {
  CmsCategory category = readCategory(cms, categoryPath, resourceName);
  addResourceToCategory(cms, resourceName, category);
}
origin: org.opencms/opencms-core

public Object transform(Object categoryPath) {
  try {
    return CmsCategoryService.getInstance().readCategory(
      m_cms,
      (String)categoryPath,
      getRequestContext().getUri());
  } catch (CmsException e) {
    LOG.warn(e.getLocalizedMessage(), e);
    return null;
  }
}
origin: org.opencms/opencms-solr

  filter = filter.filterIncludeChildren();
CmsCategory category = readCategory(cms, categoryPath, referencePath);
Iterator itRelations = cms.getRelationsForResource(
  cms.getRequestContext().removeSiteRoot(category.getRootPath()),
origin: org.opencms/org.opencms.workplace

/**
 * @see org.opencms.workplace.list.A_CmsListDialog#fillDetails(java.lang.String)
 */
@Override
protected void fillDetails(String detailId) {
  // get content
  List<CmsListItem> items = getList().getAllContent();
  Iterator<CmsListItem> itCategories = items.iterator();
  while (itCategories.hasNext()) {
    CmsListItem item = itCategories.next();
    String categoryPath = item.getId();
    StringBuffer html = new StringBuffer(512);
    try {
      CmsCategory category = m_categoryService.readCategory(getCms(), categoryPath, getParamResource());
      if (detailId.equals(LIST_DETAIL_PATH)) {
        html.append(category.getRootPath());
      } else if (detailId.equals(LIST_DETAIL_DESCRIPTION)) {
        // Append the description if one is given
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(category.getDescription())) {
          html.append(category.getDescription());
        }
      }
    } catch (Exception e) {
      // noop
    }
    item.set(detailId, html.toString());
  }
}
origin: org.opencms/opencms-solr

/**
 * @see org.opencms.workplace.list.A_CmsListDialog#fillDetails(java.lang.String)
 */
@Override
protected void fillDetails(String detailId) {
  // get content
  List users = getList().getAllContent();
  Iterator itCategories = users.iterator();
  while (itCategories.hasNext()) {
    CmsListItem item = (CmsListItem)itCategories.next();
    String categoryPath = item.getId();
    StringBuffer html = new StringBuffer(512);
    try {
      CmsCategory category = m_categoryService.readCategory(getCms(), categoryPath, getParamResource());
      if (detailId.equals(LIST_DETAIL_PATH)) {
        html.append(category.getRootPath());
      } else if (detailId.equals(LIST_DETAIL_DESCRIPTION)) {
        // Append the description if one is given
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(category.getDescription())) {
          html.append(category.getDescription());
        }
      }
    } catch (Exception e) {
      // noop
    }
    item.set(detailId, html.toString());
  }
}
origin: org.opencms/opencms-core

  filter = filter.filterIncludeChildren();
CmsCategory category = readCategory(cms, categoryPath, referencePath);
Iterator<CmsRelation> itRelations = cms.getRelationsForResource(
  cms.getRequestContext().removeSiteRoot(category.getRootPath()),
origin: org.opencms/opencms-solr

  /**
   * @see org.opencms.workplace.tools.A_CmsHtmlIconButton#isEnabled()
   */
  @Override
  public boolean isEnabled() {
    try {
      A_CmsResourceCategoriesList wp = (A_CmsResourceCategoriesList)getWp();
      if (wp.getResourceCategories().contains(
        wp.getCategoryService().readCategory(wp.getCms(), getItem().getId(), wp.getParamResource()))) {
        return false;
      }
    } catch (CmsException e) {
      // ignore
    }
    return true;
  }
};
origin: org.opencms/org.opencms.workplace

  /**
   * @see org.opencms.workplace.tools.A_CmsHtmlIconButton#isEnabled()
   */
  @Override
  public boolean isEnabled() {
    try {
      A_CmsResourceCategoriesList wp = (A_CmsResourceCategoriesList)getWp();
      if (wp.getResourceCategories().contains(
        wp.getCategoryService().readCategory(wp.getCms(), getItem().getId(), wp.getParamResource()))) {
        return false;
      }
    } catch (CmsException e) {
      // ignore
    }
    return true;
  }
};
origin: org.opencms/opencms-solr

      + cat.getId()
      + "', '"
      + CmsCategoryService.getInstance().readCategory(
        cms,
        CmsResource.getParentFolder(cat.getPath()),
i,
options,
(selected != null ? CmsCategoryService.getInstance().readCategory(
  cms,
  CmsResource.getPathPart(selected.getPath(), i + baseLevel),
origin: org.opencms/opencms-core

  result.add(category);
} else {
  CmsCategory actualCat = readCategory(cms, category.getPath(), resourceName);
  if (!category.getId().equals(actualCat.getId())) {
    CmsCategory actualCat = readCategory(
      cms,
      CmsCategory.getCategoryPath(relation.getTargetPath(), baseFolder),
origin: org.opencms/opencms-solr

  result.add(category);
} else {
  CmsCategory actualCat = readCategory(cms, category.getPath(), resourceName);
  if (!category.getId().equals(actualCat.getId())) {
    CmsCategory actualCat = readCategory(cms, CmsCategory.getCategoryPath(
      relation.getTargetPath(),
      baseFolder), resourceName);
origin: org.opencms/opencms-core

String catPath = CmsCategoryService.getInstance().getCategory(cms, val).getPath();
String refPath = getReferencePath(cms, value);
CmsCategoryService.getInstance().readCategory(cms, catPath, refPath);
if (((CmsCategoryWidget)widget).isOnlyLeafs()) {
  if (!CmsCategoryService.getInstance().readCategories(cms, catPath, false, refPath).isEmpty()) {
origin: org.opencms/opencms-solr

String catPath = CmsCategoryService.getInstance().getCategory(cms, stringValue).getPath();
String refPath = getReferencePath(cms, value);
CmsCategoryService.getInstance().readCategory(cms, catPath, refPath);
if (((CmsCategoryWidget)widget).isOnlyLeafs()) {
  if (!CmsCategoryService.getInstance().readCategories(cms, catPath, false, refPath).isEmpty()) {
origin: org.opencms/opencms-solr

/**
 * Deletes the category identified by the given path.<p> 
 * 
 * Only the most global category matching the given category path for the 
 * given resource will be affected.<p>
 * 
 * This method will try to lock the involved resource.<p>
 * 
 * @param cms the current cms context
 * @param categoryPath the path of the category to delete
 * @param referencePath the reference path to find the category repositories
 * 
 * @throws CmsException if something goes wrong
 */
public void deleteCategory(CmsObject cms, String categoryPath, String referencePath) throws CmsException {
  CmsCategory category = readCategory(cms, categoryPath, referencePath);
  String folderPath = cms.getRequestContext().removeSiteRoot(category.getRootPath());
  CmsLock lock = cms.getLock(folderPath);
  if (lock.isNullLock()) {
    cms.lockResource(folderPath);
  } else if (lock.isLockableBy(cms.getRequestContext().currentUser())) {
    cms.changeLock(folderPath);
  }
  cms.deleteResource(folderPath, CmsResource.DELETE_PRESERVE_SIBLINGS);
}
origin: org.opencms/opencms-core

/**
 * Deletes the category identified by the given path.<p>
 *
 * Only the most global category matching the given category path for the
 * given resource will be affected.<p>
 *
 * This method will try to lock the involved resource.<p>
 *
 * @param cms the current cms context
 * @param categoryPath the path of the category to delete
 * @param referencePath the reference path to find the category repositories
 *
 * @throws CmsException if something goes wrong
 */
public void deleteCategory(CmsObject cms, String categoryPath, String referencePath) throws CmsException {
  CmsCategory category = readCategory(cms, categoryPath, referencePath);
  String folderPath = cms.getRequestContext().removeSiteRoot(category.getRootPath());
  CmsLock lock = cms.getLock(folderPath);
  if (lock.isNullLock()) {
    cms.lockResource(folderPath);
  } else if (lock.isLockableBy(cms.getRequestContext().getCurrentUser())) {
    cms.changeLock(folderPath);
  }
  cms.deleteResource(folderPath, CmsResource.DELETE_PRESERVE_SIBLINGS);
}
origin: org.opencms/opencms-core

/**
 * Renames/Moves a category from the old path to the new one.<p>
 *
 * This method will keep all categories in their original repository.<p>
 *
 * @param cms the current cms context
 * @param oldCatPath the path of the category to move
 * @param newCatPath the new category path
 * @param referencePath the reference path to find the category
 *
 * @throws CmsException if something goes wrong
 */
public void moveCategory(CmsObject cms, String oldCatPath, String newCatPath, String referencePath)
throws CmsException {
  CmsCategory category = readCategory(cms, oldCatPath, referencePath);
  String catPath = cms.getRequestContext().removeSiteRoot(category.getRootPath());
  CmsLock lock = cms.getLock(catPath);
  if (lock.isNullLock()) {
    cms.lockResource(catPath);
  } else if (lock.isLockableBy(cms.getRequestContext().getCurrentUser())) {
    cms.changeLock(catPath);
  }
  cms.moveResource(
    catPath,
    cms.getRequestContext().removeSiteRoot(internalCategoryRootPath(category.getBasePath(), newCatPath)));
}
origin: org.opencms/opencms-solr

/**
 * Renames/Moves a category from the old path to the new one.<p>
 * 
 * This method will keep all categories in their original repository.<p>
 * 
 * @param cms the current cms context
 * @param oldCatPath the path of the category to move
 * @param newCatPath the new category path
 * @param referencePath the reference path to find the category
 * 
 * @throws CmsException if something goes wrong
 */
public void moveCategory(CmsObject cms, String oldCatPath, String newCatPath, String referencePath)
throws CmsException {
  CmsCategory category = readCategory(cms, oldCatPath, referencePath);
  String catPath = cms.getRequestContext().removeSiteRoot(category.getRootPath());
  CmsLock lock = cms.getLock(catPath);
  if (lock.isNullLock()) {
    cms.lockResource(catPath);
  } else if (lock.isLockableBy(cms.getRequestContext().currentUser())) {
    cms.changeLock(catPath);
  }
  cms.moveResource(catPath, cms.getRequestContext().removeSiteRoot(
    internalCategoryRootPath(category.getBasePath(), newCatPath)));
}
org.opencms.relationsCmsCategoryServicereadCategory

Javadoc

Reads the category identified by the given category path.

This method will only lookup in the centralized repository.

Popular methods of CmsCategoryService

  • addResourceToCategory
    Adds a resource identified by the given resource name to the given category. The resource has to be
  • getInstance
    Returns the singleton instance.
  • readCategories
    Returns all categories given some search parameters.
  • readResourceCategories
    Reads the categories for a resource.
  • removeResourceFromCategory
    Removes a resource identified by the given resource name from the given category. The resource has t
  • repairRelations
    Repairs broken category relations. This could be caused by renaming/moving a category folder, or cha
  • <init>
  • clearCategoriesForResource
    Removes the given resource from all categories.
  • createCategory
    Creates a new category. Will use the same category repository as the parent if specified, or the clo
  • getCategory
    Creates a category from the given resource.
  • getCategoryRepositories
    Returns all category repositories for the given reference path.
  • getRepositoryBaseFolderName
    Returns the category repositories base folder name.
  • getCategoryRepositories,
  • getRepositoryBaseFolderName,
  • internalCategoryRootPath,
  • internalReadResourceCategories,
  • internalReadSubCategories,
  • readCategoryResources,
  • deleteCategory,
  • moveCategory,
  • readCategoriesForRepositories

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getSystemService (Context)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Properties (java.util)
    The Properties class represents a persistent set of properties. The Properties can be saved to a st
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • JLabel (javax.swing)
  • IsNull (org.hamcrest.core)
    Is the value null?
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now