Package org.opencms.relations
Class CmsCategory
- java.lang.Object
-
- org.opencms.relations.CmsCategory
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<CmsCategory>
public class CmsCategory extends java.lang.Object implements java.lang.Comparable<CmsCategory>, java.io.Serializable
Represents a category, that is just a folder.The category can be centralized under
/system/categories/
, or decentralized in every folder.For instance, you can have a category folder under
/sites/default/
so, any file under/sites/default/
could be assigned to any category defined under/system/categories/
or/sites/default/categories
.But a file under
/sites/othersite/
will only be assignable to categories defined in/system/categories/
.- Since:
- 6.9.2
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CmsCategory()
Empty default constructor which is only used for serialization.CmsCategory(CmsCategory other, java.lang.String title, java.lang.String description)
Creates a new category based on another one, keeping everything except title and description, which are passed in separately.CmsCategory(CmsUUID structureId, java.lang.String rootPath, java.lang.String title, java.lang.String description, java.lang.String baseFolder)
Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(CmsCategory cat)
boolean
equals(java.lang.Object obj)
java.lang.String
getBasePath()
Returns the category's base path.static java.lang.String
getCategoryPath(java.lang.String rootPath, java.lang.String baseFolder)
Returns the category path for the given root path.java.lang.String
getDescription()
Returns the description.CmsUUID
getId()
Returns the id.java.lang.String
getName()
Returns the mere category name without it's complete path and without the trailing folder - slash.java.lang.String
getPath()
Returns the path.java.lang.String
getRootPath()
Returns the category's root path.java.lang.String
getTitle()
Returns the title.int
hashCode()
java.lang.String
toString()
-
-
-
Constructor Detail
-
CmsCategory
public CmsCategory(CmsCategory other, java.lang.String title, java.lang.String description)
Creates a new category based on another one, keeping everything except title and description, which are passed in separately.- Parameters:
other
- the other category to copy fields fromtitle
- the new titledescription
- the new description
-
CmsCategory
public CmsCategory(CmsUUID structureId, java.lang.String rootPath, java.lang.String title, java.lang.String description, java.lang.String baseFolder) throws CmsException
Default constructor.- Parameters:
structureId
- the structure id of the resource that this category representsrootPath
- the root path of the category foldertitle
- the title of the categorydescription
- the description of the categorybaseFolder
- the base categories folder- Throws:
CmsException
- if the root path does not match the given base folder
-
CmsCategory
protected CmsCategory()
Empty default constructor which is only used for serialization.
-
-
Method Detail
-
getCategoryPath
public static java.lang.String getCategoryPath(java.lang.String rootPath, java.lang.String baseFolder) throws CmsException
Returns the category path for the given root path.- Parameters:
rootPath
- the root pathbaseFolder
- the categories base folder name- Returns:
- the category path
- Throws:
CmsException
- if the root path does not match the given base folder
-
compareTo
public int compareTo(CmsCategory cat)
- Specified by:
compareTo
in interfacejava.lang.Comparable<CmsCategory>
- See Also:
Comparable.compareTo(java.lang.Object)
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
- See Also:
Object.equals(java.lang.Object)
-
getBasePath
public java.lang.String getBasePath()
Returns the category's base path.- Returns:
- the category's base path
-
getDescription
public java.lang.String getDescription()
Returns the description.- Returns:
- the description
-
getName
public java.lang.String getName()
Returns the mere category name without it's complete path and without the trailing folder - slash.- Returns:
- the mere category name without it's complete path and without the trailing folder - slash
-
getPath
public java.lang.String getPath()
Returns the path.- Returns:
- the path
-
getRootPath
public java.lang.String getRootPath()
Returns the category's root path.- Returns:
- the category's root path
-
getTitle
public java.lang.String getTitle()
Returns the title.- Returns:
- the title
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
- See Also:
Object.hashCode()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
-