public class Website extends Object implements IWebsitesSPI, Cloneable
Implements the IWebsite
interface and stores the properties of
a website.
Due to the complexity of a website, while changing some properties of a website other features may be affected. So it is recommended to not mix the change of a website with other operations.
IWebsite
Modifier and Type | Field and Description |
---|---|
static String |
NAMED_QUERY_FIND_BY_ROOT_CHANNEL_ID
Named query to find a Website by its root channel.
Expects the following parameters: channelId : the root channel identifier.
|
Constructor and Description |
---|
Website() |
Modifier and Type | Method and Description |
---|---|
void |
addAdditionalBaseURL(String domain,
int port,
String path)
Adds an additional base URL for this website.
|
void |
addAdditionalBaseURL(String domain,
int port,
String path,
boolean checkURLUnique)
Adds an additional base URL for this website.
|
Website |
clone() |
Collection<IWebsiteBaseURL> |
getAdditionalBaseURLs()
Returns the additional base URLs of this web site.
|
String |
getGoogleAnalyticsAPIKey()
Returns the Google Analytics API access key.
|
String |
getGoogleMapsAPIKey()
Returns the Google Maps API access key.
|
String |
getId()
Returns the identifier of this website.
|
IWebsiteMainBaseURL |
getMainNonSecureBaseURL()
Returns the main non-secure base URL of this website.
|
IWebsiteMainBaseURL |
getMainSecureBaseURL()
Returns the main secure base URL of this website.
|
String |
getName()
Returns the name of this website.
|
int |
getPriority()
Returns the priority of this website for detecting which website responds
to a request.
|
String |
getRootChannelId()
Returns the identifier of the root channel of this web site.
|
IWebRootPortalBaseFolder |
getWebRootBaseFolder()
Returns the base folder that corresponds to the web root folder of this website.
|
String |
getWebRootPath()
Returns the web root path defined for this website.
|
boolean |
isDefaultWebsite()
Returns whether this website is the default website.
|
boolean |
isForceMainURLsNavigation()
Returns whether this website forces the navigation to occur on its
main base URLs, instead of on its additional base URLs.
|
void |
removeAdditionalBaseURL(IWebsiteBaseURL url)
Removes an additional base URL from this website.
|
void |
setForceMainURLsNavigation(boolean forceMainURLsNavigation)
Sets whether this website forces the navigation to occur on its
main base URLs, instead of on its additional base URLs.
|
void |
setGoogleAnalyticsAPIKey(String googleAnalyticsAPIKey)
Sets the googleAnalyticsAPIKey.
|
void |
setGoogleMapsAPIKey(String googleMapsAPIKey) |
void |
setMainNonSecureBaseURL(String domain,
int port,
String path)
Sets the main non-secure base URL of this website.
|
void |
setMainSecureBaseURL(String domain,
int port,
String path)
Sets the main secure base URL of this website.
|
void |
setName(String name)
Sets the website name.
|
void |
setPriority(int priority)
Sets the priority for this website.
|
void |
setRootChannelId(String rootChannelId)
Sets the root channel of this web site.
|
void |
setWebRootPath(String webRootPath)
Sets the web root path defined for this website.
|
String |
toString() |
IWebsite |
unmodifiable()
Returns an unmodifiable copy of this website.
|
void |
updateWebsiteBaseURL(IWebsiteBaseURL baseURL,
String domain,
int port,
String path)
Updates the given
base URL with the given
parameters. |
public static final String NAMED_QUERY_FIND_BY_ROOT_CHANNEL_ID
channelId
: the root channel identifier.public String getId()
public String getName()
public void setName(String name) throws PortalException
name
- the website name.IllegalArgumentException
- if the given name is null
.PortalException
- if the given name is already been used.public String getWebRootPath()
The path may contain references to
JVM system properties
using
the syntax ${system['propertyName']}
. Such references will
be replaced by the property value when evaluating the web root folder.
public void setWebRootPath(String webRootPath) throws PortalException
If changing the web root path of an existing website, all files of that website managed by the portal will be moved during the current transaction commit. If a file cannot be properly moved, corresponding messages will be added to the system log, but an exception will not be thrown.
The path may contain references to
JVM system properties
using
the syntax ${system['propertyName']}
. Such references will
be replaced by the property value when evaluating the web root folder.
When updating an existent website
, this operation must not be executed along with setRootChannelId(String)
in the same transaction. If so, an IllegalStateException
will be raised.
PortalException
- if the given path does not exist or is not
writable.public IWebRootPortalBaseFolder getWebRootBaseFolder()
The base folder corresponds to the folder referenced by the evaluation
of the configuration in this website's web root path
.
getWebRootBaseFolder
in interface IWebsite
IWebRootPortalBaseFolder
public String getRootChannelId()
getRootChannelId
in interface IWebsite
null
if there is
no root channel defined for this website.public void setRootChannelId(String rootChannelId) throws PortalException
rootChannelId
- the identifier of the root channel, or null
to set no root channel for this website.PortalObjectNotFoundException
- if the specified channel
does not exist.PortalException
- if the specified channel may not be a website
root channel. For example, if the channel is already the root channel
of another website, a channel template or resides inside a channel
template.website
, this operation must not be executed along with setWebRootPath(String)
in the same transaction. If so, an IllegalStateException
will be raised.PortalException
- if the given channel doesn't exist, if the given channel is template or it is inside a template tree or if it is already been used.public boolean isDefaultWebsite()
The default website is used to respond to requests that did not match the base URLs of any website.
isDefaultWebsite
in interface IWebsite
true
if this website is the default website,
false
otherwise.public boolean isForceMainURLsNavigation()
When this property is enabled, this website redirects requests targeting the additional base URLs to the main base URLs.
isForceMainURLsNavigation
in interface IWebsite
true
if this website forces the navigation to occurs on its
main base URLs, false
otherwise.public void setForceMainURLsNavigation(boolean forceMainURLsNavigation)
When this property is enabled, this website redirects requests targeting the additional base URLs to the main base URLs.
forceMainURLsNavigation
- true
if this website forces the
navigation to occurs on its main base URLs, false
otherwise.public int getPriority()
The websites with lower priority are checked first if they matches a request. If more than one website would match a request, the website with lower priority value will be used.
public void setPriority(int priority) throws PortalException
The priority values of all websites are adjusted so they start in 1 and are sequential numbers. If there is another website with the same priority as the specified value, that website will have a priority higher than this one.
If this website is transient, the priority adjustments are only applied when this website is persisted
.
priority
- the priority for this website.PortalException
- if some error occur in websites reorderign.getPriority()
public String getGoogleAnalyticsAPIKey()
IWebsitesSPI
getGoogleAnalyticsAPIKey
in interface IWebsitesSPI
public void setGoogleAnalyticsAPIKey(String googleAnalyticsAPIKey)
googleAnalyticsAPIKey
- the googleAnalyticsAPIKey value to set.public IWebsiteMainBaseURL getMainNonSecureBaseURL()
This base URL is used to generate absolute non-secure (HTTP) URLs to this website.
getMainNonSecureBaseURL
in interface IWebsite
public void setMainNonSecureBaseURL(String domain, int port, String path) throws PortalException
This base URL is used to generate absolute non-secure (HTTP) URLs to this website.
domain
- the domain of the base URL. Example: www.mysite.com
port
- the port of the base URL.path
- the path of the base URL, to be appended to the portal web application context path. null
indicates to append nothing. If specified, must start with '/' and must not end with
'/'. Example: /my/path
IllegalArgumentException
- if domain
is null
or port
is non-positive.PortalException
- if path
doesn't start with '/', path
ends with '/', or the URL is non-unique.public IWebsiteMainBaseURL getMainSecureBaseURL()
This base URL is used to generate absolute secure (HTTPS) URLs to this website.
getMainSecureBaseURL
in interface IWebsite
public void setMainSecureBaseURL(String domain, int port, String path) throws PortalException
This base URL is used to generate absolute secure (HTTPS) URLs to this website.
domain
- the domain of the base URL. Example: www.mysite.com
port
- the port of the base URL.path
- the path of the base URL, to be appended to the portal web application context path. null
indicates to append nothing. If specified, must start with '/' and must not end with
'/'. Example: /my/path
IllegalArgumentException
- if domain
is null
or port
is non-positive.PortalException
- if path
doesn't start with '/', path
ends with '/', or the URL is non-unique.public Collection<IWebsiteBaseURL> getAdditionalBaseURLs()
The main base URLs are not included in the returned collection.
getAdditionalBaseURLs
in interface IWebsite
public void addAdditionalBaseURL(String domain, int port, String path) throws PortalException
domain
- the domain of the base URL. Example: www.mysite.com
port
- the port of the base URL.path
- the path of the base URL, to be appended to the portal web application context path. null
indicates to append nothing. If specified, must start with '/' and must not end with
'/'. Example: /my/path
IllegalArgumentException
- if domain
is null
or port
is non-positive.PortalException
- if path
doesn't start with '/', path
ends with '/', or the URL is non-unique.public void addAdditionalBaseURL(String domain, int port, String path, boolean checkURLUnique) throws PortalException
domain
- the domain of the base URL. Example: www.mysite.com
port
- the port of the base URL.path
- the path of the base URL, to be appended to the portal web application context path. null
indicates to append nothing. If specified, must start with '/' and must not end with
'/'. Example: /my/path
checkURLUnique
- true
to check if the URL is unique.IllegalArgumentException
- if domain
is null
or port
is non-positive.PortalException
- if path
doesn't start with '/', path
ends with '/', or the URL is non-unique.public void updateWebsiteBaseURL(IWebsiteBaseURL baseURL, String domain, int port, String path) throws PortalException
base URL
with the given
parameters.baseURL
- the base URL.domain
- the domain.port
- the port.path
- the path.PortalException
public void removeAdditionalBaseURL(IWebsiteBaseURL url) throws PortalException
url
- the additional base URL to be removed. It must have been
obtained using getAdditionalBaseURLs()
.PortalException
- if the given additional base URL is in use by a page linkpublic IWebsite unmodifiable()
public String getGoogleMapsAPIKey()
IWebsitesSPI
getGoogleMapsAPIKey
in interface IWebsitesSPI
public void setGoogleMapsAPIKey(String googleMapsAPIKey)
LumisXP 12.4.0.200625 - Copyright © 2006–2020 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.