public final class CmsResourceFilter extends java.lang.Object
Using the constant filters provided by this class you can control "special" behaviour of access to the VFS. For example, in the "Offline" project there can be deleted files, by using this filter you can control if deleted files should be included in a result set or not.
| Modifier and Type | Field and Description |
|---|---|
static CmsResourceFilter |
ALL
Filter to display all resources.
|
static CmsResourceFilter |
ALL_MODIFIED
Filter to display all modified (new/changed/deleted) resources.
|
static CmsResourceFilter |
DEFAULT
Default filter to display resources for the online project.
|
static CmsResourceFilter |
DEFAULT_FILES
Default filter to display files for the online project.
|
static CmsResourceFilter |
DEFAULT_FOLDERS
Default filter to display folders for the online project.
|
static CmsResourceFilter |
DEFAULT_ONLY_VISIBLE
Default filter to display resources for the online project.
|
static CmsResourceFilter |
IGNORE_EXPIRATION
Filter to display resources ignoring the release and expiration dates.
|
static CmsResourceFilter |
ONLY_VISIBLE
Filter to display only visible resources.
|
static CmsResourceFilter |
ONLY_VISIBLE_NO_DELETED
Filter to display only visible and not deleted resources.
|
| Modifier and Type | Method and Description |
|---|---|
CmsResourceFilter |
addExcludeFlags(int flags)
Returns an extended filter in order to avoid the given flags in the filtered resources.
|
CmsResourceFilter |
addExcludeState(CmsResourceState state)
Returns an extended filter in order to avoid the given type in the filtered resources.
|
CmsResourceFilter |
addExcludeTimerange()
Returns an extended filter to guarantee all filtered resources ignoring the time range (released and not expired) window.
|
CmsResourceFilter |
addExcludeType(I_CmsResourceType type)
Returns an extended filter in order to avoid the given type in the filtered resources.
|
CmsResourceFilter |
addExcludeType(int type)
Deprecated.
Use
addExcludeType(I_CmsResourceType) instead.
Resource types should always be referenced either by its type class (preferred) or by type name.
Use of int based resource type references will be discontinued in a future OpenCms release. |
CmsResourceFilter |
addRequireExpireAfter(long time)
Returns an extended filter to restrict the results to resources that expire in the given timerange.
|
CmsResourceFilter |
addRequireExpireBefore(long time)
Returns an extended filter to restrict the results to resources that expire in the given timerange.
|
CmsResourceFilter |
addRequireFile()
Returns an extended filter that requires all returned resources to be files.
|
CmsResourceFilter |
addRequireFlags(int flags)
Returns an extended filter to guarantee a distinct resource flags of the filtered resources.
|
CmsResourceFilter |
addRequireFolder()
Returns an extended filter that requires all returned resources to be folders.
|
CmsResourceFilter |
addRequireLastModifiedAfter(long time)
Returns an extended filter to restrict the results to resources modified in the given timerange.
|
CmsResourceFilter |
addRequireLastModifiedBefore(long time)
Returns an extended filter to restrict the results to resources modified in the given timerange.
|
CmsResourceFilter |
addRequireReleaseAfter(long time)
Returns an extended filter to restrict the results to resources that are released in the given timerange.
|
CmsResourceFilter |
addRequireReleaseBefore(long time)
Returns an extended filter to restrict the results to resources that are released in the given timerange.
|
CmsResourceFilter |
addRequireState(CmsResourceState state)
Returns an extended filter to guarantee a distinct resource state of the filtered resources.
|
CmsResourceFilter |
addRequireTimerange()
Returns an extended filter to guarantee all filtered resources are valid (released and not expired).
|
CmsResourceFilter |
addRequireType(I_CmsResourceType type)
Returns an extended filter to guarantee a distinct resource type of the filtered resources.
|
CmsResourceFilter |
addRequireType(int type)
Deprecated.
Use
addRequireType(I_CmsResourceType) instead.
Resource types should always be referenced either by its type class (preferred) or by type name.
Use of int based resource type references will be discontinued in a future OpenCms release. |
CmsResourceFilter |
addRequireVisible()
Returns an extended filter to guarantee all filtered resources are visible.
|
java.lang.Object |
clone() |
boolean |
excludeFlags()
return if the stored flags should be excluded while filtering resources.
|
boolean |
excludeState()
return if the stored state should be excluded while filtering resources.
|
boolean |
excludeType()
Returns if the stored type should be excluded while filtering resources.
|
java.lang.String |
getCacheId()
Returns the unique cache id for this filter.
|
long |
getExpireAfter()
Returns the start of the expire time range for this filter.
|
long |
getExpireBefore()
Returns the end of the expire time range for this filter.
|
int |
getFlags()
Returns the flags for this filter.
|
long |
getModifiedAfter()
Returns the start of the modification time range for this filter.
|
long |
getModifiedBefore()
Returns the end of the modification time range for this filter.
|
java.lang.Boolean |
getOnlyFolders()
Returns the state of the "only folders" flag.
|
long |
getReleaseAfter()
Returns the start of the release time range for this filter.
|
long |
getReleaseBefore()
Returns the end of the release time range for this filter.
|
CmsResourceState |
getState()
Returns the state for this filter.
|
int |
getType()
Returns the type for this filter.
|
static CmsResourceFilter |
ignoreExpirationOffline(CmsObject cms)
Returns the DEFAULT filter in the Online project, and IGNORE_EXPIRATION otherwise.
|
boolean |
includeDeleted()
Check if deleted resources should be filtered.
|
boolean |
isValid(CmsRequestContext context,
CmsResource resource)
Validates if a CmsResource fits to all filer settings.
|
boolean |
requireFlags()
Returns if the stored flags is required while filtering resources.
|
boolean |
requireState()
Returns if the stored state is required while filtering resources.
|
boolean |
requireTimerange()
Returns if the release timerange of the resource should be required.
|
boolean |
requireType()
Returns if the stored type is required while filtering resources.
|
static CmsResourceFilter |
requireType(I_CmsResourceType type)
Returns a new CmsResourceFilter requiring the given type.
|
static CmsResourceFilter |
requireType(int type)
Deprecated.
Use
requireType(I_CmsResourceType) instead.
Resource types should always be referenced either by its type class (preferred) or by type name.
Use of int based resource type references will be discontinued in a future OpenCms release. |
boolean |
requireVisible()
Returns if the visible permission should be required for resources.
|
java.lang.String |
toString()
Returns the name of the filter, if it is one of the filters used as a constant of this class and
a default message otherwise.
|
public static final CmsResourceFilter ALL
This filter uses the following rules:
public static final CmsResourceFilter ALL_MODIFIED
public static final CmsResourceFilter DEFAULT
This filter uses the following rules:
public static final CmsResourceFilter DEFAULT_FILES
public static final CmsResourceFilter DEFAULT_FOLDERS
public static final CmsResourceFilter DEFAULT_ONLY_VISIBLE
This filter uses the following rules:
public static final CmsResourceFilter IGNORE_EXPIRATION
This filter uses the following rules:
public static final CmsResourceFilter ONLY_VISIBLE
This filter used the following rules:
public static final CmsResourceFilter ONLY_VISIBLE_NO_DELETED
This filter used the following rules:
public static CmsResourceFilter ignoreExpirationOffline(CmsObject cms)
cms - the CMS context whose project to checkpublic static CmsResourceFilter requireType(I_CmsResourceType type)
type - the required resource type@Deprecated public static CmsResourceFilter requireType(int type)
requireType(I_CmsResourceType) instead.
Resource types should always be referenced either by its type class (preferred) or by type name.
Use of int based resource type references will be discontinued in a future OpenCms release.type - the required resource typepublic CmsResourceFilter addExcludeFlags(int flags)
flags - the resource flags to excludepublic CmsResourceFilter addExcludeState(CmsResourceState state)
state - the resource state to excludepublic CmsResourceFilter addExcludeTimerange()
This is the reverse of addRequireTimerange().
public CmsResourceFilter addExcludeType(I_CmsResourceType type)
type - the resource type to exclude@Deprecated public CmsResourceFilter addExcludeType(int type)
addExcludeType(I_CmsResourceType) instead.
Resource types should always be referenced either by its type class (preferred) or by type name.
Use of int based resource type references will be discontinued in a future OpenCms release.type - the resource type to excludepublic CmsResourceFilter addRequireExpireAfter(long time)
time - the required timepublic CmsResourceFilter addRequireExpireBefore(long time)
time - the required timepublic CmsResourceFilter addRequireFile()
public CmsResourceFilter addRequireFlags(int flags)
flags - the required resource flagspublic CmsResourceFilter addRequireFolder()
public CmsResourceFilter addRequireLastModifiedAfter(long time)
time - the required timepublic CmsResourceFilter addRequireLastModifiedBefore(long time)
time - the required timepublic CmsResourceFilter addRequireReleaseAfter(long time)
time - the required timepublic CmsResourceFilter addRequireReleaseBefore(long time)
time - the required timepublic CmsResourceFilter addRequireState(CmsResourceState state)
state - the required resource statepublic CmsResourceFilter addRequireTimerange()
public CmsResourceFilter addRequireType(I_CmsResourceType type)
If -1 is given as type, the filter will not be extended to require a resource type
type - the required resource type@Deprecated public CmsResourceFilter addRequireType(int type)
addRequireType(I_CmsResourceType) instead.
Resource types should always be referenced either by its type class (preferred) or by type name.
Use of int based resource type references will be discontinued in a future OpenCms release.
If -1 is given as type, the filter will not be extended to require a resource type
type - the required resource typepublic CmsResourceFilter addRequireVisible()
public java.lang.Object clone()
clone in class java.lang.ObjectObject.clone()public boolean excludeFlags()
public boolean excludeState()
public boolean excludeType()
public java.lang.String getCacheId()
public long getExpireAfter()
public long getExpireBefore()
public int getFlags()
public long getModifiedAfter()
public long getModifiedBefore()
public java.lang.Boolean getOnlyFolders()
If the result is null, then this flag is not set.
public long getReleaseAfter()
public long getReleaseBefore()
public CmsResourceState getState()
public int getType()
public boolean includeDeleted()
public boolean isValid(CmsRequestContext context, CmsResource resource)
Please note that the "visible permission" setting of the filter is NOT checked in this method since the permission information is not part of the resource. The visible permission information in the filter will be used in the permission checks
context - the current request contextresource - the resource to be validatedpublic boolean requireFlags()
public boolean requireState()
public boolean requireTimerange()
public boolean requireType()
public boolean requireVisible()
public java.lang.String toString()
toString in class java.lang.Object