public class ParametersClientSideElement extends StaticClientSideElement
ClientSideElement.Script, ClientSideElement.ScriptFile
Modifier and Type | Field and Description |
---|---|
private FileHelper |
_fileHelper |
private static String |
_ROOT_PARAMETERS_DIRECTORY_URI |
private SourceResolver |
_srcResolver |
_currentUserProvider, _dependencies, _featureName, _id, _pluginName, _rightManager, _rights, _rightsMode, _script
Constructor and Description |
---|
ParametersClientSideElement() |
Modifier and Type | Method and Description |
---|---|
protected void |
_checkUserRight(String rightId,
String context)
Check if the user right to access the feature
|
Map<String,Object> |
addFolder(String parentRelPath,
String name)
Add a new folder
|
Map<String,Object> |
deleteFile(String relPath)
Remove a folder or a file
|
boolean |
fileExists(String parentRelPath,
String name)
Check if a file with same name already exist
|
Map<String,Object> |
renameFile(String relPath,
String name)
Rename a file or a folder
|
Map<String,Object> |
saveParameters(String relPath,
String text)
Saves parameters file.
|
void |
service(ServiceManager serviceManager) |
_configureClass, _configureParameters, _configureScript, configureInitialParameters
_configureDependencies, _configureImports, _configureRights, _configureRightsMode, configure, getDependencies, getId, getPluginName, getRights, getScripts, getScripts, hasRight, setPluginInfo, toString
getLogger, setLogger
private static final String _ROOT_PARAMETERS_DIRECTORY_URI
private FileHelper _fileHelper
private SourceResolver _srcResolver
public ParametersClientSideElement()
public void service(ServiceManager serviceManager) throws ServiceException
service
in interface Serviceable
service
in class StaticFileImportsClientSideElement
ServiceException
public Map<String,Object> saveParameters(String relPath, String text) throws IOException
relPath
- the relative file's path from parameters files root directorytext
- the UTF-8 file content to saveIOException
- If an error occurred while savingpublic Map<String,Object> addFolder(String parentRelPath, String name) throws IOException
parentRelPath
- the relative parent file's path from parameters files root directoryname
- The name of folder to createIOException
- If an error occurred while creating folderpublic Map<String,Object> deleteFile(String relPath) throws IOException
relPath
- the relative file's path from parameters files root directoryIOException
- If an error occurs while removing the folderpublic Map<String,Object> renameFile(String relPath, String name) throws IOException
relPath
- the relative file's path from parameters files root directoryname
- the new name of the file/folderIOException
- if an error occurs while renaming the file/folderpublic boolean fileExists(String parentRelPath, String name) throws Exception
parentRelPath
- the path where the file will be addedname
- the name of the fileException
- if an error occurredprotected void _checkUserRight(String rightId, String context) throws IllegalStateException
rightId
- The right idcontext
- The right contextIllegalStateException
- if the user has no right