Package de.xima.fc.gui.model.form_theme
Class FormThemeFileSystemManager
- java.lang.Object
-
- de.xima.fc.gui.model.form_theme.FormThemeFileSystemManager
-
- All Implemented Interfaces:
ICommonFileSystemManager<FormThemeFileEntry>,Serializable,AutoCloseable
public final class FormThemeFileSystemManager extends Object implements ICommonFileSystemManager<FormThemeFileEntry>, Serializable
Manager for the client form themes of a client. Each form theme represents a volume in the file explorer. This manager allows retrieving available form themes, adding new form themes, and deleting existing form themes.- Since:
- 8.3.0
- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidcopy(FormThemeFileEntry from, FormThemeFileEntry to)Copies the given file entry to the given target.ICommonFileSystemVolume<FormThemeFileEntry>createNewTheme(Locale locale)Creates a new form theme for the current client with the given locale.voiddeleteThemesById(List<Long> themeIds)Deletes the form themes with the given IDs.FormThemeFileViewfileEntity(FormThemeFileEntry entry)Finds the file entity for the given entry.<FD2 extends FormThemeFileEntry>
ICommonFileSystem<FD2>fileSystemByEntry(FD2 entry)Finds the file system responsible for the given file system entry.ICommonFileSystem<FormThemeFileEntry>fileSystemByProtocol(String protocol)Gets the file system handler for the givenprotocol.ICommonFileSystem<FormThemeFileEntry>fileSystemByVolumeId(String volumeId)Gets the file system handler for the given volume ID.booleanisOpen()Checks whether this file system manager is open.Iterable<ICommonFileSystemVolume<? extends FormThemeFileEntry>>listVolumes()Lists all available file systems, sometimes also called volumes.voidrefresh()If the implementation employs any kind of caching: discards all caches so that this instance represents the most up-to-date state.voidrename(FormThemeFileEntry from, FormThemeFileEntry to)Renames the given file entry to the given target.FormThemeViewthemeByUuid(UUID uuid)Gets the client form theme for the given UUID.FormThemeViewthemeByVolumeId(String volumeId)Gets the client form theme for the given volume ID.List<FormThemeView>themes()Gets a list of all available form themes.<FileSystemManager>
FileSystemManagerunwrap(Class<? extends FileSystemManager> type)Unwraps this file system manager to the given type.FormThemeViewupdateThemeDetail(String volumeId, Consumer<FormThemeView> updater)Updates a detail of the theme with the given volume ID.ICommonFileSystemVolume<? extends FormThemeFileEntry>volumeByVolumeId(String volumeId)Gets the volume info for the given volume ID.VolumeFileSystem<? extends FormThemeFileEntry>volumeFileSystemByVolumeId(String volumeId)Gets the volume and file system handler for the given volume ID.
-
-
-
Method Detail
-
close
public void close() throws Exception- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
copy
public void copy(FormThemeFileEntry from, FormThemeFileEntry to) throws IOException
Description copied from interface:ICommonFileSystemManagerCopies the given file entry to the given target. When the entries are from the same file system or volume, the implementation may simply callICommonFileSystem.copy(Object, Object). If the entries are from different file systems, the implementation may need to read the source and write the target manually.Either both source and target are files; or both are directories.
- Specified by:
copyin interfaceICommonFileSystemManager<FormThemeFileEntry>- Parameters:
from- The file entry to copy.to- The target file entry.- Throws:
IOException- If an I/O error occurs.
-
createNewTheme
public ICommonFileSystemVolume<FormThemeFileEntry> createNewTheme(Locale locale) throws IOException
Creates a new form theme for the current client with the given locale.- Parameters:
locale- The locale for generating a new name for the form theme.- Returns:
- The volume corresponding to the newly created form theme.
- Throws:
IOException- If an I/O error occurs while creating the form theme.
-
deleteThemesById
public void deleteThemesById(List<Long> themeIds) throws IOException
Deletes the form themes with the given IDs.- Parameters:
themeIds- The IDs of the form themes to delete.- Throws:
IOException- If an I/O error occurs while deleting the form themes.
-
fileEntity
public FormThemeFileView fileEntity(FormThemeFileEntry entry)
Finds the file entity for the given entry.- Parameters:
entry- The entry to find the file entity for.- Returns:
- The file entity for the given entry, or null if no such entity exists.
-
fileSystemByEntry
public <FD2 extends FormThemeFileEntry> ICommonFileSystem<FD2> fileSystemByEntry(FD2 entry)
Description copied from interface:ICommonFileSystemManagerFinds the file system responsible for the given file system entry.- Specified by:
fileSystemByEntryin interfaceICommonFileSystemManager<FormThemeFileEntry>- Type Parameters:
FD2- The subtype of the file system entry.- Parameters:
entry- The file system entry for which to find its corresponding file system.- Returns:
- The file system for the given file system entry.
-
fileSystemByProtocol
public ICommonFileSystem<FormThemeFileEntry> fileSystemByProtocol(String protocol)
Description copied from interface:ICommonFileSystemManagerGets the file system handler for the givenprotocol. Returns null if no handler exists.- Specified by:
fileSystemByProtocolin interfaceICommonFileSystemManager<FormThemeFileEntry>- Parameters:
protocol- The protocol of the file system to get.- Returns:
- The file system with the given volume name, or null if no such file system is mounted.
-
fileSystemByVolumeId
public ICommonFileSystem<FormThemeFileEntry> fileSystemByVolumeId(String volumeId)
Description copied from interface:ICommonFileSystemManagerGets the file system handler for the given volume ID. Returns null if no handler exists. This is a shortcut for callingICommonFileSystemManager.volumeByVolumeId(String)and thenICommonFileSystemManager.fileSystemByProtocol(String).- Specified by:
fileSystemByVolumeIdin interfaceICommonFileSystemManager<FormThemeFileEntry>- Parameters:
volumeId- The ID of the volume to get.- Returns:
- The file system with the given volume ID, or null if no such file system is mounted.
-
isOpen
public boolean isOpen()
Description copied from interface:ICommonFileSystemManagerChecks whether this file system manager is open. If it is not open, all operations will fail.- Specified by:
isOpenin interfaceICommonFileSystemManager<FormThemeFileEntry>- Returns:
- True if the file system manager is open, false otherwise.
- See Also:
AutoCloseable.close()
-
listVolumes
public Iterable<ICommonFileSystemVolume<? extends FormThemeFileEntry>> listVolumes()
Description copied from interface:ICommonFileSystemManagerLists all available file systems, sometimes also called volumes. A volume could e.g. be a local file system, a database, or a remote file system such as FTP.- Specified by:
listVolumesin interfaceICommonFileSystemManager<FormThemeFileEntry>- Returns:
- All available volumes.
-
refresh
public void refresh() throws IOExceptionDescription copied from interface:ICommonFileSystemManagerIf the implementation employs any kind of caching: discards all caches so that this instance represents the most up-to-date state.Implementations should usually call
ICommonFileSystem.refresh()on all mounted file systems. In addition, implementations may also perform additional operations, such as refreshing the list of file systems.- Specified by:
refreshin interfaceICommonFileSystemManager<FormThemeFileEntry>- Throws:
IOException- If an I/O error occurs during the refresh.
-
rename
public void rename(FormThemeFileEntry from, FormThemeFileEntry to) throws IOException
Description copied from interface:ICommonFileSystemManagerRenames the given file entry to the given target. When the entries are from the same file system or volume, the implementation may simply callICommonFileSystem.rename(Object, Object). If the entries are from different file systems, the implementation may need to read the source, write to the target, and delete the source manually.Either both source and target are files; or both are directories.
- Specified by:
renamein interfaceICommonFileSystemManager<FormThemeFileEntry>- Parameters:
from- The file entry to copy.to- The target file entry.- Throws:
IOException- If an I/O error occurs.
-
themeByUuid
public FormThemeView themeByUuid(UUID uuid)
Gets the client form theme for the given UUID.- Parameters:
uuid- The UUID of the client form theme.- Returns:
- The client form theme for the given UUID, or null if no such theme exists.
-
themeByVolumeId
public FormThemeView themeByVolumeId(String volumeId)
Gets the client form theme for the given volume ID.- Parameters:
volumeId- The volume ID.- Returns:
- The client form theme for the given volume ID, or null if no such theme exists.
-
themes
public List<FormThemeView> themes()
Gets a list of all available form themes.- Returns:
- A list of all available form themes.
-
unwrap
public <FileSystemManager> FileSystemManager unwrap(Class<? extends FileSystemManager> type)
Description copied from interface:ICommonFileSystemManagerUnwraps this file system manager to the given type. If this file system manager is an instance of the given type, it is returned. Otherwise, potential wrappers are unwrapped until the given type is reached. If the file system manager cannot be unwrapped to the given type, null is returned.If multiple wrappers are present, the first one that can be unwrapped to the given type is returned.
- Specified by:
unwrapin interfaceICommonFileSystemManager<FormThemeFileEntry>- Type Parameters:
FileSystemManager- The type of the desired file system manager.- Parameters:
type- The type to unwrap to.- Returns:
- The unwrapped file system manager, or null if the file system manager cannot be unwrapped to the given type.
-
updateThemeDetail
@CanIgnoreReturnValue public FormThemeView updateThemeDetail(String volumeId, Consumer<FormThemeView> updater)
Updates a detail of the theme with the given volume ID.- Parameters:
volumeId- Volume ID of the theme to update.updater- Update function that mutates the theme.- Returns:
- The updated theme.
- Throws:
de.xima.cmn.dao.exceptions.UpdateException- If the theme with the given UUID does not exist, or if the update fails.
-
volumeByVolumeId
public ICommonFileSystemVolume<? extends FormThemeFileEntry> volumeByVolumeId(String volumeId)
Description copied from interface:ICommonFileSystemManagerGets the volume info for the given volume ID. Returns null if no such volume exists.- Specified by:
volumeByVolumeIdin interfaceICommonFileSystemManager<FormThemeFileEntry>- Parameters:
volumeId- The ID of the volume to get.- Returns:
- The volume with the given volume ID, or null if no such volume is mounted.
-
volumeFileSystemByVolumeId
public VolumeFileSystem<? extends FormThemeFileEntry> volumeFileSystemByVolumeId(String volumeId)
Description copied from interface:ICommonFileSystemManagerGets the volume and file system handler for the given volume ID. Returns null if no handler exists. This is a shortcut for callingICommonFileSystemManager.volumeByVolumeId(String)and thenICommonFileSystemManager.fileSystemByProtocol(String).- Specified by:
volumeFileSystemByVolumeIdin interfaceICommonFileSystemManager<FormThemeFileEntry>- Parameters:
volumeId- The ID of the volume to get.- Returns:
- The file system with the given volume ID, or null if no such file system is mounted.
-
-