@StableMinor(version="12.2", sinceVersion="4.1") public final class PortalFilePath extends Object implements Serializable
PortalBaseFolder
and a relative path to that folder.Constructor and Description |
---|
PortalFilePath(IPortalBaseFolder baseFolder,
String relativePath)
Creates a portal file path from a base folder and a relative path.
|
PortalFilePath(PortalBaseFolder baseFolder,
String relativePath)
Creates a portal file path from a base folder and a relative path.
|
PortalFilePath(String absolutePath)
Creates a portal file path from an absolute path.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getAbsolutePath()
Deprecated.
since 8.0.0 it is not recommended to be used
anymore due to the filesystem abstraction layer. Every file
operation should use the
IFile interface, that can be
obtained from
IFileSystemManager.getFile(PortalFilePath) . The
direct usage of Java file API can produce unpredictable
portal behavior. The new filesystem API is highly recommended to be used
instead. |
PortalBaseFolder |
getBaseFolder()
Deprecated.
Since 6.2.0 replaced by
getPortalBaseFolder()
due to the deprecation of PortalBaseFolder.WWW . This
deprecated implementation works if this PortalFilePath is based
on one of the enum PortalBaseFolder options, otherwise it throws
a ClassCastException . This works on a full legacy code, since
only the those enum options exist in such case. |
String |
getName()
Returns the name of this PortalFilePath or an empty
String if this PortalFilePath is the root of base
folder. |
PortalFilePath |
getParent()
Returns the parent PortalFilePath or
null if this is already the root of base folder. |
IPortalBaseFolder |
getPortalBaseFolder()
Returns the base folder for this path.
|
String |
getRelativePath()
Returns the relative path to
getBaseFolder() . |
PortalFilePath |
getRoot()
Returns the root of this path.
|
int |
hashCode() |
boolean |
isDescendentOf(PortalFilePath path)
Returns whether the given PortalFilePath is descendent of this.
|
boolean |
isRoot()
Returns whether this PortalFilePath is the root of base folder.
|
String |
relativize(PortalFilePath other)
Relativizes the given path against this one.
|
PortalFilePath |
resolve(String path)
Resolves the given path against this PortalFilePath.
The path must not be an absolute path. |
IFile |
toFile()
Returns an
IFile constructed with this PortalFilePath. |
String |
toString() |
public PortalFilePath(PortalBaseFolder baseFolder, String relativePath)
This constructor is equivalent to
PortalFilePath(IPortalBaseFolder, String)
, but is kept for
binary backwards compatibility.
baseFolder
- the base folder.relativePath
- the relative path, relative to the base folder.public PortalFilePath(IPortalBaseFolder baseFolder, String relativePath)
baseFolder
- the base folder.relativePath
- the relative path, relative to the base folder.IllegalArgumentException
- if a PortalFilePath could not be
created due to invalid argument values.public PortalFilePath(String absolutePath)
absolutePath
- the absolute path.IllegalArgumentException
- if the given absolute path is invalid
or does not belongs to an area that may be mapped using a portal file path.@Deprecated public String getAbsolutePath()
IFile
interface, that can be
obtained from
IFileSystemManager.getFile(PortalFilePath)
. The
direct usage of Java file API can produce unpredictable
portal behavior. The new filesystem
API is highly recommended to be used
instead.public String getRelativePath()
getBaseFolder()
.@Deprecated public PortalBaseFolder getBaseFolder()
getPortalBaseFolder()
due to the deprecation of PortalBaseFolder.WWW
. This
deprecated implementation works if this PortalFilePath
is based
on one of the enum PortalBaseFolder
options, otherwise it throws
a ClassCastException
. This works on a full legacy code, since
only the those enum options exist in such case.public IPortalBaseFolder getPortalBaseFolder()
public PortalFilePath resolve(String path)
path
must not be an absolute path. In other words, it cannot begin with a /
.
The path is composed by elements separated by /
. The resolve process consists in create a new portal file
path using this path's relative path concatenated with a /
and the given relative path. If the given
relative path contains an element ..
it means this ..
and the previous element will be eliminated
(for example my/folder/../file.txt
will become my/file.txt
).
path
- the relative path to be resolved.IllegalArgumentException
- if path
is null
or it starts with a /
.public PortalFilePath getParent()
null
if this is already the root of base folder.null
if this is already the root of base folder.public String getName()
String
if this PortalFilePath is the root of base
folder. The name is the last part of the path sequence.String
if this PortalFilePath is the root of basepublic boolean isRoot()
public IFile toFile()
IFile
constructed with this PortalFilePath.IFile
constructed with this PortalFilePath.IFileSystem.getFile(PortalFilePath)
,
IFileSystemManager.getFile(PortalFilePath)
public boolean isDescendentOf(PortalFilePath path)
path
- the path to be tested.public String relativize(PortalFilePath other)
null
if the given path
couldn't be relativized. The given path can only be relativized against this one if it
is descendent of this path
.other
- the path to be relativizednull
if it couldn't be relativized.relativize(PortalFilePath)
public PortalFilePath getRoot()
LumisXP 12.2.0.200122 - Copyright © 2006–2020 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.