Package org.opencms.relations
Class CmsRelationType
- java.lang.Object
-
- org.opencms.relations.CmsRelationType
-
- All Implemented Interfaces:
java.io.Serializable
public final class CmsRelationType extends java.lang.Object implements java.io.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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CmsRelationType.CopyBehavior
Enum representing how relations should be handled while copying resources.
-
Field Summary
Fields Modifier and Type Field Description static CmsRelationType
CATEGORY
Constant for the category of anOpenCmsVfsFile
.static CmsRelationType
DETAIL_ONLY
Constant for the type of relations between a detail content and its detail-only container pages.static CmsRelationType
EMBEDDED_IMAGE
Constant for the<img src=''>
tag in a html page/element.static CmsRelationType
EMBEDDED_OBJECT
Constant for the<embed src=''>
tag in a html page/element.static CmsRelationType
HYPERLINK
Constant for the<a href=''>
tag in a html page/element.static CmsRelationType
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.static CmsRelationType
JSP_STRONG
Constant for the all types of links in a jsp file using thelink.strong
macro.static CmsRelationType
JSP_WEAK
Constant for the all types of links in a jsp file using thelink.weak
macro.static CmsRelationType
LOCALE_VARIANT
Constant for the type of relations between resources which are locale variants.static CmsRelationType
OU_RESOURCE
Constant for the organizational units resource associations.static CmsRelationType
XML_STRONG
Constant for theOpenCmsVfsFile
values in xml content that were defined as 'strong' links.static CmsRelationType
XML_WEAK
Constant for theOpenCmsVfsFile
values in xml content that were defined as 'weak' links.static CmsRelationType
XSD
Constant for the weak links from xmlcontent to the used xsd.
-
Constructor Summary
Constructors Constructor Description CmsRelationType(int id, java.lang.String name, java.lang.String type)
Public constructor for user defined relation types.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
static java.util.List<CmsRelationType>
filterDefinedInContent(java.util.Collection<CmsRelationType> relationTypes)
Returns all relation types in the given list that define relations in the content.static java.util.List<CmsRelationType>
filterInternal(java.util.Collection<CmsRelationType> relationTypes)
Returns all internal defined relation types in the given list.static java.util.List<CmsRelationType>
filterNotDefinedInContent(java.util.Collection<CmsRelationType> relationTypes)
Returns all relation types in the given list that are not defined in the content.static java.util.List<CmsRelationType>
filterStrong(java.util.Collection<CmsRelationType> relationTypes)
Returns all strong relation types in the given list.static java.util.List<CmsRelationType>
filterUserDefined(java.util.Collection<CmsRelationType> relationTypes)
Returns all user defined relation types in the given list.static java.util.List<CmsRelationType>
filterWeak(java.util.Collection<CmsRelationType> relationTypes)
Returns all weak relation types in the given list.static java.util.List<CmsRelationType>
getAll()
Returns all relation types.static java.util.List<CmsRelationType>
getAllDefinedInContent()
Returns all relation types for relations defined in the content.static java.util.List<CmsRelationType>
getAllInternal()
Returns all internally defined relation types.static java.util.List<CmsRelationType>
getAllNotDefinedInContent()
Returns all relation types for relations that are not defined in the content.static java.util.List<CmsRelationType>
getAllStrong()
Returns all strong relation types.static java.util.List<CmsRelationType>
getAllUserDefined()
Returns all user defined relation types.static java.util.List<CmsRelationType>
getAllWeak()
Returns all weak relation types.CmsRelationType.CopyBehavior
getCopyBehavior()
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.java.lang.String
getLocalizedName(java.util.Locale locale)
Returns a localized name for the given relation type.java.lang.String
getLocalizedName(CmsMessages messages)
Returns a localized name for the given relation type.java.lang.String
getName()
Returns the type name.java.lang.String
getNameForXml()
Returns the type name for xml output.java.lang.String
getType()
Returns the string strong or weak.int
hashCode()
boolean
isDefinedInContent()
Checks if this relation type is defined in the content of a resource or not.boolean
isInternal()
Checks if this is an internal relation type.boolean
isStrong()
Checks if the relation type is strong or weak.java.lang.String
toString()
static CmsRelationType
valueOf(int id)
Parses anint
into a relation type.static CmsRelationType
valueOf(java.lang.String name)
Parses anString
into a relation type.static CmsRelationType
valueOfJsp(java.lang.String name)
Parses the given value into a valid enumeration element for a JSP relation type.static CmsRelationType
valueOfXml(java.lang.String name)
Parses the given value into a valid enumeration element for a XML relation type.
-
-
-
Field Detail
-
CATEGORY
public static final CmsRelationType CATEGORY
Constant for the category of anOpenCmsVfsFile
.
-
EMBEDDED_IMAGE
public static final CmsRelationType EMBEDDED_IMAGE
Constant for the<img src=''>
tag in a html page/element.
-
EMBEDDED_OBJECT
public static final CmsRelationType EMBEDDED_OBJECT
Constant for the<embed src=''>
tag in a html page/element.
-
HYPERLINK
public static final CmsRelationType HYPERLINK
Constant for the<a href=''>
tag in a html page/element.
-
INDEX_CONTENT
public static final CmsRelationType 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
public static final CmsRelationType JSP_STRONG
Constant for the all types of links in a jsp file using thelink.strong
macro.
-
JSP_WEAK
public static final CmsRelationType JSP_WEAK
Constant for the all types of links in a jsp file using thelink.weak
macro.
-
OU_RESOURCE
public static final CmsRelationType OU_RESOURCE
Constant for the organizational units resource associations.
-
XML_STRONG
public static final CmsRelationType XML_STRONG
Constant for theOpenCmsVfsFile
values in xml content that were defined as 'strong' links.
-
XML_WEAK
public static final CmsRelationType XML_WEAK
Constant for theOpenCmsVfsFile
values in xml content that were defined as 'weak' links.
-
LOCALE_VARIANT
public static final CmsRelationType LOCALE_VARIANT
Constant for the type of relations between resources which are locale variants.
-
DETAIL_ONLY
public static final CmsRelationType DETAIL_ONLY
Constant for the type of relations between a detail content and its detail-only container pages.
-
XSD
public static final CmsRelationType XSD
Constant for the weak links from xmlcontent to the used xsd.
-
-
Constructor Detail
-
CmsRelationType
public CmsRelationType(int id, java.lang.String name, java.lang.String type)
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 Detail
-
filterDefinedInContent
public static java.util.List<CmsRelationType> filterDefinedInContent(java.util.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
public static java.util.List<CmsRelationType> filterInternal(java.util.Collection<CmsRelationType> relationTypes)
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 java.util.List<CmsRelationType> filterNotDefinedInContent(java.util.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
public static java.util.List<CmsRelationType> filterStrong(java.util.Collection<CmsRelationType> relationTypes)
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
public static java.util.List<CmsRelationType> filterUserDefined(java.util.Collection<CmsRelationType> relationTypes)
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
public static java.util.List<CmsRelationType> filterWeak(java.util.Collection<CmsRelationType> relationTypes)
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
public static java.util.List<CmsRelationType> getAll()
Returns all relation types.- Returns:
- a list of
CmsRelationType
objects
-
getAllDefinedInContent
public static java.util.List<CmsRelationType> getAllDefinedInContent()
Returns all relation types for relations defined in the content.- Returns:
- a list of
CmsRelationType
objects
-
getAllInternal
public static java.util.List<CmsRelationType> getAllInternal()
Returns all internally defined relation types.- Returns:
- a list of
CmsRelationType
objects
-
getAllNotDefinedInContent
public static java.util.List<CmsRelationType> getAllNotDefinedInContent()
Returns all relation types for relations that are not defined in the content.- Returns:
- a list of
CmsRelationType
objects
-
getAllStrong
public static java.util.List<CmsRelationType> getAllStrong()
Returns all strong relation types.- Returns:
- a list of
CmsRelationType
objects
-
getAllUserDefined
public static java.util.List<CmsRelationType> getAllUserDefined()
Returns all user defined relation types.- Returns:
- a list of
CmsRelationType
objects
-
getAllWeak
public static java.util.List<CmsRelationType> getAllWeak()
Returns all weak relation types.- Returns:
- a list of
CmsRelationType
objects
-
valueOf
public static CmsRelationType valueOf(int id) throws CmsIllegalArgumentException
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
public static CmsRelationType valueOf(java.lang.String name) throws CmsIllegalArgumentException
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:
valueOfXml(String)
,valueOfJsp(String)
-
valueOfJsp
public static CmsRelationType valueOfJsp(java.lang.String name)
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:
valueOf(String)
-
valueOfXml
public static CmsRelationType valueOfXml(java.lang.String name)
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:
valueOf(String)
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
- See Also:
Object.equals(java.lang.Object)
-
getCopyBehavior
public CmsRelationType.CopyBehavior 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
public int getId()
Returns the internal representation of this type.- Returns:
- the internal representation of this type
-
getLocalizedName
public java.lang.String getLocalizedName(CmsMessages messages)
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
public java.lang.String getLocalizedName(java.util.Locale locale)
Returns a localized name for the given relation type.- Parameters:
locale
- the locale- Returns:
- a localized name
-
getName
public java.lang.String getName()
Returns the type name.- Returns:
- the type name
- See Also:
valueOf(String)
-
getNameForXml
public java.lang.String 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:
getName()
,valueOfJsp(String)
,valueOfXml(String)
-
getType
public java.lang.String getType()
Returns the string strong or weak.- Returns:
- the string strong or weak
- See Also:
isStrong()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
- See Also:
Object.hashCode()
-
isDefinedInContent
public boolean 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
public boolean isInternal()
Checks if this is an internal relation type.- Returns:
true
if this is an internal relation type
-
isStrong
public boolean isStrong()
Checks if the relation type is strong or weak.- Returns:
true
if the relation type is strong
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
-