Class ComponentFileFilterParameter
- java.lang.Object
-
- org.silverpeas.core.admin.component.model.ComponentFileFilterParameter
-
public class ComponentFileFilterParameter extends Object
This class handles component file filters (authorized or forbidden files).- Author:
- Yohann Chastagnier Date: 17/12/12
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ComponentFileFilterParameter
from(SilverpeasComponentInstance component)
Getting component file filter from component instance.SilverpeasComponentInstance
getComponent()
Gets the component instance.String
getFileFilters()
Gets the current file filter.boolean
isAuthorization()
Indicates if getMimeTypes returns authorized or forbidden files.boolean
isFileAuthorized(File file)
Checks if the given file is authorized.boolean
isFileFilterGloballySet()
Indicates if the file filter is set globally.boolean
isMimeTypeAuthorized(String mimeType)
Checks if the given mime type is authorized.void
verifyFileAuthorized(File file)
Throwing the component file filter exception (RuntimeException) if file is forbidden.
-
-
-
Method Detail
-
from
public static ComponentFileFilterParameter from(SilverpeasComponentInstance component)
Getting component file filter from component instance.- Parameters:
component
- the component instance- Returns:
- the file filter
-
getComponent
public SilverpeasComponentInstance getComponent()
Gets the component instance.- Returns:
- the component instance.
-
isAuthorization
public boolean isAuthorization()
Indicates if getMimeTypes returns authorized or forbidden files.- Returns:
- true for authorized files, false for forbidden files.
-
getFileFilters
public String getFileFilters()
Gets the current file filter.- Returns:
- the current filter filename.
-
isFileFilterGloballySet
public boolean isFileFilterGloballySet()
Indicates if the file filter is set globally.- Returns:
- true if the file filter is set globally, false otherwise.
-
isFileAuthorized
public boolean isFileAuthorized(File file)
Checks if the given file is authorized. If parameter is null, it is considered as forbidden.- Parameters:
file
- the file- Returns:
- true if the specified file is authorized, false otherwise.
-
verifyFileAuthorized
public void verifyFileAuthorized(File file)
Throwing the component file filter exception (RuntimeException) if file is forbidden.- Parameters:
file
- the file
-
isMimeTypeAuthorized
public boolean isMimeTypeAuthorized(String mimeType)
Checks if the given mime type is authorized. If parameter is null, it is considered as forbidden.- Parameters:
mimeType
- the mime-type- Returns:
- true if the mime-type is authorized, false otherwise.
-
-