Package org.opencms.gwt.shared
Class CmsUploadRestrictionInfo
- java.lang.Object
-
- org.opencms.gwt.shared.CmsUploadRestrictionInfo
-
- All Implemented Interfaces:
com.google.gwt.user.client.rpc.IsSerializable
public class CmsUploadRestrictionInfo extends java.lang.Object implements com.google.gwt.user.client.rpc.IsSerializable
Contains information about which folders should restrict uploads.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CmsUploadRestrictionInfo.Builder
Helper class for building a new CmsUploadRestrictionInfo object.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
KEY_ENABLED
The 'enabled' key.static java.lang.String
KEY_TYPES
The 'types' key.static java.lang.String
UNRESTRICTED_UPLOADS
The default upload restriction that allows everything.
-
Constructor Summary
Constructors Modifier Constructor Description protected
CmsUploadRestrictionInfo()
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
checkTypeAllowed(java.lang.String path, java.lang.String extension)
Check if a given file extension is allowed for the given upload path.java.lang.String
getAcceptAttribute(java.lang.String path)
Gets the 'accept' attribute to use for the file input element for the given upload folder.protected java.util.Set<java.lang.String>
getTypes(java.lang.String path)
Gets the valid extensions for uploads to a given upload folderboolean
isUploadEnabled(java.lang.String originalPath)
Checks if the upload should be enabled for the given upload path.
-
-
-
Field Detail
-
KEY_ENABLED
public static final java.lang.String KEY_ENABLED
The 'enabled' key.- See Also:
- Constant Field Values
-
KEY_TYPES
public static final java.lang.String KEY_TYPES
The 'types' key.- See Also:
- Constant Field Values
-
UNRESTRICTED_UPLOADS
public static final java.lang.String UNRESTRICTED_UPLOADS
The default upload restriction that allows everything.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsUploadRestrictionInfo
protected CmsUploadRestrictionInfo()
Creates a new instance.
-
-
Method Detail
-
checkTypeAllowed
public boolean checkTypeAllowed(java.lang.String path, java.lang.String extension)
Check if a given file extension is allowed for the given upload path.- Parameters:
path
- the root path of the upload folderextension
- the file extension to check- Returns:
- true if the file extension is valid for uploads to the folder
-
getAcceptAttribute
public java.lang.String getAcceptAttribute(java.lang.String path)
Gets the 'accept' attribute to use for the file input element for the given upload folder.- Parameters:
path
- the upload folder root path- Returns:
- the 'accept' attribute that should be used for the file input
-
isUploadEnabled
public boolean isUploadEnabled(java.lang.String originalPath)
Checks if the upload should be enabled for the given upload path.- Parameters:
originalPath
- the upload root path- Returns:
- true if the upload is enabled
-
getTypes
protected java.util.Set<java.lang.String> getTypes(java.lang.String path)
Gets the valid extensions for uploads to a given upload folder- Parameters:
path
- the upload folder root path- Returns:
- the valid extensions
-
-