Package de.xima.fc.gui.model.form_theme
Class FormThemeFileEntry
- java.lang.Object
-
- de.xima.fc.gui.model.form_theme.FormThemeFileEntry
-
- All Implemented Interfaces:
IFileSystemEntry<FormThemeFileEntry>,Serializable,Comparable<FormThemeFileEntry>
public final class FormThemeFileEntry extends Object implements IFileSystemEntry<FormThemeFileEntry>
AnIFileSystemEntryimplementation forclient form theme files. Thefile pathis a combination ofresource context, followed by thefile name.The
file namemay have slashes. Everything before the final slash is treated as a directory. The last file part is treated a file if it has any file extension (i.e. a dot followed by at least one character). Otherwise, it is treated as a directory.- Since:
- 8.3.0
- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringVOLUME_CLIENT_FORM_THEME_GROUP
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(FormThemeFileEntry o)Stringcontext()Gets theClientFormThemeFile.getResourceContext()resource context of this file key, i.e.booleanequals(Object o)StringfileExtension()Gets the file extension, i.e.StringfileName()Gets the last file part of the path, i.e.StringfilePath()Gets the file path after thecontext(), i.e.inthashCode()booleanisAnyParentOf(IFileSystemEntry<?> other)Checks whether this file system entry is a direct or indirect parent of the given file system entry, i.e.booleanisDirectory()Whether this file system entry represents a directory.booleanisImmediateParentOf(IFileSystemEntry<?> other)Checks whether this file system entry is an immediate parent of the given file system entry, i.e.booleanisVolumeGroup()Whether this entry represents the volume group that is used to group all client form themes.booleanisVolumeRoot()Whether this file system entry represents the root (top-level directory) of the file system volume.static FormThemeFileEntryofClientFormThemeFile(ClientFormThemeFile file)Creates a file key for the given client form theme file.static FormThemeFileEntryofClientFormThemeFile(ClientFormTheme theme, String context, String filePath)Creates a file key for the givenresource contextandfile path.static FormThemeFileEntryofClientFormThemeFile(UUID themeUuid, String context, String filePath)Creates a file key for the givenresource contextandfile path.static FormThemeFileEntryofVolumeAndPath(ClientFormTheme theme, String path)Creates a file key for the given volume and path.static FormThemeFileEntryofVolumeAndPath(String volume, String path)Creates a file key for the given volume and path.FormThemeFileEntryparent()Gets the file system entry representing the parent directory of this file system entry.Iterable<FormThemeFileEntry>parents()Gets all file system entries representing the parent directories of this file system entry.Stringpath()Gets the path of this file system entry, which is the concatenation of all path parts separated by the path separator.String[]pathParts()Gets the path parts of this file system entry, i.e.FormThemeFileEntryrelativeTo(FormThemeFileEntry target)Makes this entry relative to the given target.FormThemeFileEntryresolve(FormThemeFileEntry entry)Adds the given children to the list of path parts and returns a new file key representing the resulting path.FormThemeFileEntryresolve(String child)Adds the given child to the list of path parts and returns a new file key representing the resulting path.FormThemeFileEntryresolve(String... children)Adds the given children to the list of path parts and returns a new file key representing the resulting path.static FormThemeFileEntryroot(ClientFormTheme theme)Get therootfile key for the volume represented by the given client form theme.static FormThemeFileEntryroot(UUID themeUuid)Get therootfile key for the volume represented by the given client form theme UUID.static StringthemeToVolumeId(ClientFormTheme theme)Gets the volume ID for the given client form theme.UUIDthemeUuid()Gets the UUID of the client form theme from thevolume.static StringthemeUuidToVolumeId(UUID themeUuid)Gets the volume ID for the client form theme wit the given UUID.StringtoString()<FileSystemEntry>
FileSystemEntryunwrap(Class<? extends FileSystemEntry> type)Unwraps this file system entry to the given type.Stringvolume()Gets the volume of this file system entry.static FormThemeFileEntryvolumeGroup()Gets the file entry representing the volume group that is used to group all client form themes.static UUIDvolumeIdToThemeUuid(String volumeId)Converts a volume ID to a theme UUID.
-
-
-
Field Detail
-
VOLUME_CLIENT_FORM_THEME_GROUP
public static final String VOLUME_CLIENT_FORM_THEME_GROUP
- See Also:
- Constant Field Values
-
-
Method Detail
-
compareTo
public int compareTo(FormThemeFileEntry o)
- Specified by:
compareToin interfaceComparable<FormThemeFileEntry>
-
context
public String context()
Gets theClientFormThemeFile.getResourceContext()resource context of this file key, i.e. the first path part. Returns empty for the root directory.- Returns:
- The resource context.
-
fileExtension
public String fileExtension()
Description copied from interface:IFileSystemEntryGets the file extension, i.e. the part of the file name after the last '.'. Returns empty for directories.- Specified by:
fileExtensionin interfaceIFileSystemEntry<FormThemeFileEntry>- Returns:
- The file extension.
-
fileName
public String fileName()
Description copied from interface:IFileSystemEntryGets the last file part of the path, i.e. the file name or directory name.- Specified by:
fileNamein interfaceIFileSystemEntry<FormThemeFileEntry>- Returns:
- The last file part.
-
filePath
public String filePath()
Gets the file path after thecontext(), i.e. all path parts other than the first.- Returns:
- The file path.
-
isAnyParentOf
public boolean isAnyParentOf(IFileSystemEntry<?> other)
Description copied from interface:IFileSystemEntryChecks whether this file system entry is a direct or indirect parent of the given file system entry, i.e. whether this file system entry is a directory and the given file system entry is inside that directory.- Specified by:
isAnyParentOfin interfaceIFileSystemEntry<FormThemeFileEntry>- Parameters:
other- The other file system entry.- Returns:
- true if this file system entry is a direct or indirect parent of the given file system entry, false otherwise.
-
isDirectory
public boolean isDirectory()
Description copied from interface:IFileSystemEntryWhether this file system entry represents a directory.- Specified by:
isDirectoryin interfaceIFileSystemEntry<FormThemeFileEntry>- Returns:
- true if this file system entry represents a directory, false otherwise.
-
isImmediateParentOf
public boolean isImmediateParentOf(IFileSystemEntry<?> other)
Description copied from interface:IFileSystemEntryChecks whether this file system entry is an immediate parent of the given file system entry, i.e. whether this file system entry is a directory and the given file system entry is directly inside that directory.- Specified by:
isImmediateParentOfin interfaceIFileSystemEntry<FormThemeFileEntry>- Parameters:
other- The other file system entry.- Returns:
- true if this file system entry is an immediate parent of the given file system entry, false otherwise.
-
isVolumeGroup
public boolean isVolumeGroup()
Whether this entry represents the volume group that is used to group all client form themes.- Returns:
- True if this entry represents the volume group.
-
isVolumeRoot
public boolean isVolumeRoot()
Description copied from interface:IFileSystemEntryWhether this file system entry represents the root (top-level directory) of the file system volume. A volume directory is for example a Windows drive or the root of a network share such as FTP.Note that
IFileSystemEntry.parent()will return null for a volume root, and a non-null value for any other directory.- Specified by:
isVolumeRootin interfaceIFileSystemEntry<FormThemeFileEntry>- Returns:
- true if this file system entry represents the root directory, false otherwise.
-
parent
public FormThemeFileEntry parent()
Description copied from interface:IFileSystemEntryGets the file system entry representing the parent directory of this file system entry. Will return null if this file system entry represents thevolume root.- Specified by:
parentin interfaceIFileSystemEntry<FormThemeFileEntry>- Returns:
- The parent file system entry, or null if this file system entry does not have a parent directory.
-
parents
public Iterable<FormThemeFileEntry> parents()
Description copied from interface:IFileSystemEntryGets all file system entries representing the parent directories of this file system entry. The entries are returned in the order parent, grandparent, great-grandparent etc. This entry is not included in the result. If this file system entry does not have any parent directories, returns an empty iterable.- Specified by:
parentsin interfaceIFileSystemEntry<FormThemeFileEntry>- Returns:
- The parent file system entries, or empty if this file system entry does not have any parent directories.
-
path
public String path()
Description copied from interface:IFileSystemEntryGets the path of this file system entry, which is the concatenation of all path parts separated by the path separator. Returns empty for the root directory. Does not include the volume.- Specified by:
pathin interfaceIFileSystemEntry<FormThemeFileEntry>- Returns:
- The file path.
-
pathParts
public String[] pathParts()
Description copied from interface:IFileSystemEntryGets the path parts of this file system entry, i.e. the directory names and the file name.- Specified by:
pathPartsin interfaceIFileSystemEntry<FormThemeFileEntry>- Returns:
- The path parts.
-
relativeTo
public FormThemeFileEntry relativeTo(FormThemeFileEntry target)
Description copied from interface:IFileSystemEntryMakes this entry relative to the given target. I.e. remove the path parts of the target from the path parts of this entry. If this entry is not a sub-path of the target, returns this entry unchanged.- Specified by:
relativeToin interfaceIFileSystemEntry<FormThemeFileEntry>- Parameters:
target- The target to make this entry relative to.- Returns:
- The relativized entry.
-
resolve
public FormThemeFileEntry resolve(String child)
Description copied from interface:IFileSystemEntryAdds the given child to the list of path parts and returns a new file key representing the resulting path.- Specified by:
resolvein interfaceIFileSystemEntry<FormThemeFileEntry>- Parameters:
child- The child path to add. May contain slashes.- Returns:
- The new file key.
-
resolve
public FormThemeFileEntry resolve(String... children)
Description copied from interface:IFileSystemEntryAdds the given children to the list of path parts and returns a new file key representing the resulting path.- Specified by:
resolvein interfaceIFileSystemEntry<FormThemeFileEntry>- Parameters:
children- The child paths to add. May contain slashes.- Returns:
- The new file key.
-
resolve
public FormThemeFileEntry resolve(FormThemeFileEntry entry)
Description copied from interface:IFileSystemEntryAdds the given children to the list of path parts and returns a new file key representing the resulting path.- Specified by:
resolvein interfaceIFileSystemEntry<FormThemeFileEntry>- Parameters:
entry- The child paths to add. May contain slashes.- Returns:
- The new file key.
-
themeUuid
public UUID themeUuid()
Gets the UUID of the client form theme from thevolume.- Returns:
- The UUID of the client form theme.
-
unwrap
public <FileSystemEntry> FileSystemEntry unwrap(Class<? extends FileSystemEntry> type)
Description copied from interface:IFileSystemEntryUnwraps this file system entry to the given type. If this file system entry 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 entry 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 interfaceIFileSystemEntry<FormThemeFileEntry>- Type Parameters:
FileSystemEntry- The type of the desired file system entry.- Parameters:
type- The type to unwrap to.- Returns:
- The unwrapped file system entry, or null if the file system entry cannot be unwrapped to the given type.
-
volume
public String volume()
Description copied from interface:IFileSystemEntryGets the volume of this file system entry.- Specified by:
volumein interfaceIFileSystemEntry<FormThemeFileEntry>- Returns:
- The name of this entry's volume.
-
ofClientFormThemeFile
public static FormThemeFileEntry ofClientFormThemeFile(ClientFormThemeFile file)
Creates a file key for the given client form theme file.- Parameters:
file- The client form theme file.- Returns:
- The file key, or null if the file is null.
-
ofClientFormThemeFile
public static FormThemeFileEntry ofClientFormThemeFile(ClientFormTheme theme, String context, String filePath)
Creates a file key for the givenresource contextandfile path.- Parameters:
theme- The form theme representing the file system volume.context- The resource context.filePath- The file path.- Returns:
- The file key.
-
ofClientFormThemeFile
public static FormThemeFileEntry ofClientFormThemeFile(UUID themeUuid, String context, String filePath)
Creates a file key for the givenresource contextandfile path.- Parameters:
themeUuid- The UUID of the form theme representing the file system volume.context- The resource context.filePath- The file path.- Returns:
- The file key.
-
ofVolumeAndPath
public static FormThemeFileEntry ofVolumeAndPath(ClientFormTheme theme, String path)
Creates a file key for the given volume and path. The volume must be a valid UUID.- Parameters:
theme- The theme representing the volume.path- The path.- Returns:
- The file key.
- Throws:
IllegalArgumentException- If the volume is not the default volume ID.
-
ofVolumeAndPath
public static FormThemeFileEntry ofVolumeAndPath(String volume, String path)
Creates a file key for the given volume and path. The volume must be a valid UUID.- Parameters:
volume- The volume.path- The path.- Returns:
- The file key.
- Throws:
IllegalArgumentException- If the volume is not the default volume ID.
-
root
public static FormThemeFileEntry root(ClientFormTheme theme)
Get therootfile key for the volume represented by the given client form theme.- Parameters:
theme- The client form theme representing the root.- Returns:
- The root file key.
-
root
public static FormThemeFileEntry root(UUID themeUuid)
Get therootfile key for the volume represented by the given client form theme UUID.- Parameters:
themeUuid- The UUID of the client form theme representing the root.- Returns:
- The root file key.
-
themeToVolumeId
public static String themeToVolumeId(ClientFormTheme theme)
Gets the volume ID for the given client form theme.- Parameters:
theme- The client form theme.- Returns:
- The volume ID.
-
themeUuidToVolumeId
public static String themeUuidToVolumeId(UUID themeUuid)
Gets the volume ID for the client form theme wit the given UUID.- Parameters:
themeUuid- The UUID of a client form theme.- Returns:
- The volume ID.
-
volumeGroup
public static FormThemeFileEntry volumeGroup()
Gets the file entry representing the volume group that is used to group all client form themes.- Returns:
- The file entry representing the volume group.
-
volumeIdToThemeUuid
public static UUID volumeIdToThemeUuid(String volumeId)
Converts a volume ID to a theme UUID. This is the inverse ofthemeToVolumeId(ClientFormTheme).- Parameters:
volumeId- The volume ID.- Returns:
- The theme UUID, or null if the volume ID is not a valid volume ID.
-
-