Package org.opencms.relations
Class CmsRelationFilter
- java.lang.Object
-
- org.opencms.relations.CmsRelationFilter
-
- All Implemented Interfaces:
java.lang.Cloneable
public final class CmsRelationFilter extends java.lang.Object implements java.lang.Cloneable
A filter to retrieve the relations for a given resource.- Since:
- 6.0.0
-
-
Field Summary
Fields Modifier and Type Field Description static CmsRelationFilter
ALL
To filter all sources and targets.static CmsRelationFilter
SOURCES
To filter all sources.static CmsRelationFilter
TARGETS
To filter all targets.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
CmsRelationFilter
filterDefinedInContent()
Returns an extended filter with defined in content type restriction.CmsRelationFilter
filterIncludeChildren()
Returns an extended filter that will extend the result to the given path and all its subresources.CmsRelationFilter
filterInternal()
Returns an extended filter with internal type restriction.CmsRelationFilter
filterNotDefinedInContent()
Returns an extended filter with not defined in content type restriction.CmsRelationFilter
filterPath(java.lang.String path)
Returns an extended filter with the given source relation path restriction.CmsRelationFilter
filterResource(CmsResource resource)
Returns an extended filter with the given resource (path and id) restriction.CmsRelationFilter
filterStrong()
Returns an extended filter with strong type restriction.CmsRelationFilter
filterStructureId(CmsUUID structureId)
Returns an extended filter with the given structure id restriction.CmsRelationFilter
filterType(CmsRelationType type)
Returns an extended filter with the given type restriction.CmsRelationFilter
filterUserDefined()
Returns an extended filter with user defined type restriction.CmsRelationFilter
filterWeak()
Returns an extended filter with weak type restriction.java.lang.String
getPath()
Returns the source relation path restriction.CmsUUID
getStructureId()
Returns the structure Id of the resource to filter.java.util.Set<CmsRelationType>
getTypes()
Returns the types to filter.boolean
includesDefinedInContent()
Checks if this filter includes relations defined in the content.boolean
isIncludeSubresources()
Returns the include subresources flag.boolean
isSource()
Returns the source flag.boolean
isTarget()
Returns the target flag.boolean
matchType(CmsRelationType type)
Returnstrue
if the given relation type matches this filter.static CmsRelationFilter
relationsFromStructureId(CmsUUID structureId)
Utility method which prepares a filter for relations which point *from* a given structure id.static CmsRelationFilter
relationsToStructureId(CmsUUID structureId)
Utility method which prepares a filter for relations which point *to* a given structure id.java.lang.String
toString()
-
-
-
Field Detail
-
ALL
public static final CmsRelationFilter ALL
To filter all sources and targets.
-
SOURCES
public static final CmsRelationFilter SOURCES
To filter all sources.
-
TARGETS
public static final CmsRelationFilter TARGETS
To filter all targets.
-
-
Method Detail
-
relationsFromStructureId
public static CmsRelationFilter relationsFromStructureId(CmsUUID structureId)
Utility method which prepares a filter for relations which point *from* a given structure id.- Parameters:
structureId
- the structure id- Returns:
- the new relation filter
-
relationsToStructureId
public static CmsRelationFilter relationsToStructureId(CmsUUID structureId)
Utility method which prepares a filter for relations which point *to* a given structure id.- Parameters:
structureId
- the structure id- Returns:
- the new relation filter
-
clone
public java.lang.Object clone()
- Overrides:
clone
in classjava.lang.Object
- See Also:
Object.clone()
-
filterDefinedInContent
public CmsRelationFilter filterDefinedInContent()
Returns an extended filter with defined in content type restriction.- Returns:
- an extended filter with defined in content type restriction
-
filterIncludeChildren
public CmsRelationFilter filterIncludeChildren()
Returns an extended filter that will extend the result to the given path and all its subresources.- Returns:
- an extended filter with including subresources
-
filterInternal
public CmsRelationFilter filterInternal()
Returns an extended filter with internal type restriction.- Returns:
- an extended filter with internal type restriction
-
filterNotDefinedInContent
public CmsRelationFilter filterNotDefinedInContent()
Returns an extended filter with not defined in content type restriction.- Returns:
- an extended filter with not defined in content type restriction
-
filterPath
public CmsRelationFilter filterPath(java.lang.String path)
Returns an extended filter with the given source relation path restriction.- Parameters:
path
- the source relation path to filter- Returns:
- an extended filter with the given source relation path restriction
-
filterResource
public CmsRelationFilter filterResource(CmsResource resource)
Returns an extended filter with the given resource (path and id) restriction.- Parameters:
resource
- the resource to filter- Returns:
- an extended filter with the given resource (path and id) restriction
-
filterStrong
public CmsRelationFilter filterStrong()
Returns an extended filter with strong type restriction.- Returns:
- an extended filter with strong type restriction
-
filterStructureId
public CmsRelationFilter filterStructureId(CmsUUID structureId)
Returns an extended filter with the given structure id restriction.- Parameters:
structureId
- the structure id to filter- Returns:
- an extended filter with the given structure id restriction
-
filterType
public CmsRelationFilter filterType(CmsRelationType type)
Returns an extended filter with the given type restriction.- Parameters:
type
- the relation type to filter- Returns:
- an extended filter with the given type restriction
-
filterUserDefined
public CmsRelationFilter filterUserDefined()
Returns an extended filter with user defined type restriction.- Returns:
- an extended filter with user defined type restriction
-
filterWeak
public CmsRelationFilter filterWeak()
Returns an extended filter with weak type restriction.- Returns:
- an extended filter with weak type restriction
-
getPath
public java.lang.String getPath()
Returns the source relation path restriction.- Returns:
- the source relation path restriction
-
getStructureId
public CmsUUID getStructureId()
Returns the structure Id of the resource to filter.- Returns:
- the structure Id of the resource to filter
-
getTypes
public java.util.Set<CmsRelationType> getTypes()
Returns the types to filter.- Returns:
- the types to filter
-
includesDefinedInContent
public boolean includesDefinedInContent()
Checks if this filter includes relations defined in the content.- Returns:
true
if this filter includes relations defined in the content
-
isIncludeSubresources
public boolean isIncludeSubresources()
Returns the include subresources flag.- Returns:
- if set the filter extends the result to the given path and all its subresources
-
isSource
public boolean isSource()
Returns the source flag.- Returns:
- if set the filter looks for matching targets
-
isTarget
public boolean isTarget()
Returns the target flag.- Returns:
- if set the filter looks for matching sources
-
matchType
public boolean matchType(CmsRelationType type)
Returnstrue
if the given relation type matches this filter.- Parameters:
type
- the relation type to test- Returns:
- if the given relation type matches this filter
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
-