Package org.opencms.relations
Class CmsRelationType
java.lang.Object
org.opencms.relations.CmsRelationType
- All Implemented Interfaces:
Serializable
Wrapper class for
the different types of relations.
The possibles values are:
HYPERLINK
EMBEDDED_IMAGE
EMBEDDED_OBJECT
XML_STRONG
XML_WEAK
JSP_STRONG
JSP_WEAK
OU_RESOURCE
CATEGORY
XSD
User defined relation types are also available.
- Since:
- 6.3.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enum representing how relations should be handled while copying resources. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CmsRelationType
Constant for the category of anOpenCmsVfsFile
.static final CmsRelationType
Constant for the type of relations between a detail content and its detail-only container pages.static final CmsRelationType
Constant for the<img src=''>
tag in a html page/element.static final CmsRelationType
Constant for the<embed src=''>
tag in a html page/element.static final CmsRelationType
Constant for the<a href=''>
tag in a html page/element.static final CmsRelationType
Constant for the index content relation, telling the content of a linked resource should be merged into the content of the linking XML.static final CmsRelationType
Constant for the all types of links in a jsp file using thelink.strong
macro.static final CmsRelationType
Constant for the all types of links in a jsp file using thelink.weak
macro.static final CmsRelationType
Constant for the type of relations between resources which are locale variants.static final CmsRelationType
Constant for the organizational units resource associations.static final CmsRelationType
Constant for theOpenCmsVfsFile
values in xml content that were defined as 'strong' links.static final CmsRelationType
Constant for theOpenCmsVfsFile
values in xml content that were defined as 'weak' links.static final CmsRelationType
Constant for the weak links from xmlcontent to the used xsd. -
Constructor Summary
ConstructorsConstructorDescriptionCmsRelationType
(int id, String name, String type) Public constructor for user defined relation types. -
Method Summary
Modifier and TypeMethodDescriptionboolean
static List<CmsRelationType>
filterDefinedInContent
(Collection<CmsRelationType> relationTypes) Returns all relation types in the given list that define relations in the content.static List<CmsRelationType>
filterInternal
(Collection<CmsRelationType> relationTypes) Returns all internal defined relation types in the given list.static List<CmsRelationType>
filterNotDefinedInContent
(Collection<CmsRelationType> relationTypes) Returns all relation types in the given list that are not defined in the content.static List<CmsRelationType>
filterStrong
(Collection<CmsRelationType> relationTypes) Returns all strong relation types in the given list.static List<CmsRelationType>
filterUserDefined
(Collection<CmsRelationType> relationTypes) Returns all user defined relation types in the given list.static List<CmsRelationType>
filterWeak
(Collection<CmsRelationType> relationTypes) Returns all weak relation types in the given list.static List<CmsRelationType>
getAll()
Returns all relation types.static List<CmsRelationType>
Returns all relation types for relations defined in the content.static List<CmsRelationType>
Returns all internally defined relation types.static List<CmsRelationType>
Returns all relation types for relations that are not defined in the content.static List<CmsRelationType>
Returns all strong relation types.static List<CmsRelationType>
Returns all user defined relation types.static List<CmsRelationType>
Returns all weak relation types.Gets the 'copy behavior' of the relation type, which is how relations of a resource should be handled when copying that resource.int
getId()
Returns the internal representation of this type.getLocalizedName
(Locale locale) Returns a localized name for the given relation type.getLocalizedName
(CmsMessages messages) Returns a localized name for the given relation type.getName()
Returns the type name.Returns the type name for xml output.getType()
Returns the string strong or weak.int
hashCode()
boolean
Checks if this relation type is defined in the content of a resource or not.boolean
Checks if this is an internal relation type.boolean
isStrong()
Checks if the relation type is strong or weak.toString()
static CmsRelationType
valueOf
(int id) Parses anint
into a relation type.static CmsRelationType
Parses anString
into a relation type.static CmsRelationType
valueOfJsp
(String name) Parses the given value into a valid enumeration element for a JSP relation type.static CmsRelationType
valueOfXml
(String name) Parses the given value into a valid enumeration element for a XML relation type.
-
Field Details
-
CATEGORY
Constant for the category of anOpenCmsVfsFile
. -
EMBEDDED_IMAGE
Constant for the<img src=''>
tag in a html page/element. -
EMBEDDED_OBJECT
Constant for the<embed src=''>
tag in a html page/element. -
HYPERLINK
Constant for the<a href=''>
tag in a html page/element. -
INDEX_CONTENT
Constant for the index content relation, telling the content of a linked resource should be merged into the content of the linking XML. -
JSP_STRONG
Constant for the all types of links in a jsp file using thelink.strong
macro. -
JSP_WEAK
Constant for the all types of links in a jsp file using thelink.weak
macro. -
OU_RESOURCE
Constant for the organizational units resource associations. -
XML_STRONG
Constant for theOpenCmsVfsFile
values in xml content that were defined as 'strong' links. -
XML_WEAK
Constant for theOpenCmsVfsFile
values in xml content that were defined as 'weak' links. -
LOCALE_VARIANT
Constant for the type of relations between resources which are locale variants. -
DETAIL_ONLY
Constant for the type of relations between a detail content and its detail-only container pages. -
XSD
Constant for the weak links from xmlcontent to the used xsd.
-
-
Constructor Details
-
CmsRelationType
Public constructor for user defined relation types.- Parameters:
id
- the id of the relation typename
- the name of the relationtype
- the type of relation type, strong or weak
-
-
Method Details
-
filterDefinedInContent
public static List<CmsRelationType> filterDefinedInContent(Collection<CmsRelationType> relationTypes) Returns all relation types in the given list that define relations in the content.- Parameters:
relationTypes
- the collection of relation types to filter- Returns:
- a list of
CmsRelationType
objects
-
filterInternal
Returns all internal defined relation types in the given list.- Parameters:
relationTypes
- the collection of relation types to filter- Returns:
- a list of
CmsRelationType
objects
-
filterNotDefinedInContent
public static List<CmsRelationType> filterNotDefinedInContent(Collection<CmsRelationType> relationTypes) Returns all relation types in the given list that are not defined in the content.- Parameters:
relationTypes
- the collection of relation types to filter- Returns:
- a list of
CmsRelationType
objects
-
filterStrong
Returns all strong relation types in the given list.- Parameters:
relationTypes
- the collection of relation types to filter- Returns:
- a list of
CmsRelationType
objects
-
filterUserDefined
Returns all user defined relation types in the given list.- Parameters:
relationTypes
- the collection of relation types to filter- Returns:
- a list of
CmsRelationType
objects
-
filterWeak
Returns all weak relation types in the given list.- Parameters:
relationTypes
- the collection of relation types to filter- Returns:
- a list of
CmsRelationType
objects
-
getAll
Returns all relation types.- Returns:
- a list of
CmsRelationType
objects
-
getAllDefinedInContent
Returns all relation types for relations defined in the content.- Returns:
- a list of
CmsRelationType
objects
-
getAllInternal
Returns all internally defined relation types.- Returns:
- a list of
CmsRelationType
objects
-
getAllNotDefinedInContent
Returns all relation types for relations that are not defined in the content.- Returns:
- a list of
CmsRelationType
objects
-
getAllStrong
Returns all strong relation types.- Returns:
- a list of
CmsRelationType
objects
-
getAllUserDefined
Returns all user defined relation types.- Returns:
- a list of
CmsRelationType
objects
-
getAllWeak
Returns all weak relation types.- Returns:
- a list of
CmsRelationType
objects
-
valueOf
Parses anint
into a relation type.- Parameters:
id
- the internal representation number to parse- Returns:
- the enumeration element
- Throws:
CmsIllegalArgumentException
- if the given value could not be matched against a
object.CmsRelationType
-
valueOf
Parses anString
into a relation type.- Parameters:
name
- the relation type name- Returns:
- the enumeration element
- Throws:
CmsIllegalArgumentException
- if the given value could not be matched against a
objectCmsRelationType
- See Also:
-
valueOfJsp
Parses the given value into a valid enumeration element for a JSP relation type.This should be used to extend Strings like "weak" or "strong" to full relation type descriptors for JSP pages like "JSP_WEAK" or "JSP_STRONG".
- Parameters:
name
- the name to get the JSP type for- Returns:
- the JSP enumeration element
- See Also:
-
valueOfXml
Parses the given value into a valid enumeration element for a XML relation type.This should be used to extend Strings like "weak" or "strong" to full relation type descriptors for XML documents like "XML_WEAK" or "XML_STRONG".
- Parameters:
name
- the name to get the XML type for- Returns:
- the XML enumeration element
- See Also:
-
equals
-
getCopyBehavior
Gets the 'copy behavior' of the relation type, which is how relations of a resource should be handled when copying that resource.- Returns:
- the copy behavior of the relation type
-
getId
Returns the internal representation of this type.- Returns:
- the internal representation of this type
-
getLocalizedName
Returns a localized name for the given relation type.- Parameters:
messages
- the message bundle to use to resolve the name- Returns:
- a localized name
-
getLocalizedName
Returns a localized name for the given relation type.- Parameters:
locale
- the locale- Returns:
- a localized name
-
getName
Returns the type name.- Returns:
- the type name
- See Also:
-
getNameForXml
Returns the type name for xml output.The short type name of XML or JSP types is only
"WEAK"
or"STRONG"
. For other types the short name is equal to the name.In case you need the full type name, use
getName()
.- Returns:
- the short type name
- See Also:
-
getType
Returns the string strong or weak.- Returns:
- the string strong or weak
- See Also:
-
hashCode
-
isDefinedInContent
Checks if this relation type is defined in the content of a resource or not.- Returns:
true
if this relation type is defined in the content of a resource
-
isInternal
Checks if this is an internal relation type.- Returns:
true
if this is an internal relation type
-
isStrong
Checks if the relation type is strong or weak.- Returns:
true
if the relation type is strong
-
toString
-