Class Website
- java.lang.Object
-
- lumis.portal.website.Website
-
- All Implemented Interfaces:
java.lang.Cloneable
,IWebsite
,IWebsitesSPI
public class Website extends java.lang.Object implements IWebsitesSPI, java.lang.Cloneable
Website entity implementation.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.
- Since:
- 6.2.0
- Version:
- $Revision$ $Date$
- See Also:
IWebsite
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.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 Summary
Constructors Constructor Description Website()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAdditionalBaseURL(java.lang.String domain, int port, java.lang.String path)
Adds an additional base URL for this website.void
addAdditionalBaseURL(java.lang.String domain, int port, java.lang.String path, boolean checkURLUnique)
Adds an additional base URL for this website.Website
clone()
java.util.Collection<IWebsiteBaseURL>
getAdditionalBaseURLs()
Returns the additional base URLs of this web site.java.lang.String
getGoogleAnalyticsAPIKey()
Returns the Google Analytics API access key.java.lang.String
getGoogleMapsAPIKey()
Returns the Google Maps API access key.java.lang.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.java.lang.String
getName()
Returns the name of this website.int
getPriority()
Returns the priority of this website for detecting which website responds to a request.java.lang.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.java.lang.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(java.lang.String googleAnalyticsAPIKey)
Sets the googleAnalyticsAPIKey.void
setGoogleMapsAPIKey(java.lang.String googleMapsAPIKey)
void
setMainNonSecureBaseURL(java.lang.String domain, int port, java.lang.String path)
Sets the main non-secure base URL of this website.void
setMainSecureBaseURL(java.lang.String domain, int port, java.lang.String path)
Sets the main secure base URL of this website.void
setName(java.lang.String name)
Sets the website name.void
setPriority(int priority)
Sets the priority for this website.void
setRootChannelId(java.lang.String rootChannelId)
Sets the root channel of this web site.void
setWebRootPath(java.lang.String webRootPath)
Sets the web root path defined for this website.java.lang.String
toString()
IWebsite
unmodifiable()
Returns an unmodifiable copy of this website.void
updateWebsiteBaseURL(IWebsiteBaseURL baseURL, java.lang.String domain, int port, java.lang.String path)
Updates the givenbase URL
with the given parameters.
-
-
-
Field Detail
-
NAMED_QUERY_FIND_BY_ROOT_CHANNEL_ID
public static final java.lang.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.
- Since:
- 6.2.0
- See Also:
- Constant Field Values
-
-
Method Detail
-
getId
public java.lang.String getId()
Returns the identifier of this website.
-
getName
public java.lang.String getName()
Returns the name of this website. This name is used only for display, and has no functional impact.
-
setName
public void setName(java.lang.String name) throws PortalException
Sets the website name. This name is used only for display, and has no functional impact.- Parameters:
name
- the website name.- Throws:
java.lang.IllegalArgumentException
- if the given name isnull
.PortalException
- if the given name is already been used.- Since:
- 6.2.0
-
getWebRootPath
public java.lang.String getWebRootPath()
Returns the web root path defined for this website.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.- Returns:
- the web root path.
- Since:
- 6.2.0
-
setWebRootPath
public void setWebRootPath(java.lang.String webRootPath) throws PortalException
Sets the web root path defined for this website.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 existentwebsite
, this operation must not be executed along withsetRootChannelId(String)
in the same transaction. If so, anIllegalStateException
will be raised.- Throws:
PortalException
- if the given path does not exist or is not writable.- Since:
- 6.2.0
-
getWebRootBaseFolder
public IWebRootPortalBaseFolder getWebRootBaseFolder()
Returns the base folder that corresponds to the web root folder of this website.The base folder corresponds to the folder referenced by the evaluation of the configuration in this website's
web root path
.- Specified by:
getWebRootBaseFolder
in interfaceIWebsite
- Returns:
- the web root base folder.
- Since:
- 6.2.0
- See Also:
IWebRootPortalBaseFolder
-
getRootChannelId
public java.lang.String getRootChannelId()
Returns the identifier of the root channel of this web site.- Specified by:
getRootChannelId
in interfaceIWebsite
- Returns:
- the identifier of the root channel, of
null
if there is no root channel defined for this website. - Since:
- 6.2.0
-
setRootChannelId
public void setRootChannelId(java.lang.String rootChannelId) throws PortalException
Sets the root channel of this web site.- Parameters:
rootChannelId
- the identifier of the root channel, ornull
to set no root channel for this website.- Throws:
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.
When updating an existentwebsite
, this operation must not be executed along withsetWebRootPath(String)
in the same transaction. If so, anIllegalStateException
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.- Since:
- 6.2.0
-
isDefaultWebsite
public boolean isDefaultWebsite()
Returns whether this website is the default website.The default website is used to respond to requests that did not match the base URLs of any website.
- Specified by:
isDefaultWebsite
in interfaceIWebsite
- Returns:
true
if this website is the default website,false
otherwise.- Since:
- 6.2.0
-
isForceMainURLsNavigation
public boolean isForceMainURLsNavigation()
Returns whether this website forces the navigation to occur on its main base URLs, instead of on its additional base URLs.When this property is enabled, this website redirects requests targeting the additional base URLs to the main base URLs.
- Specified by:
isForceMainURLsNavigation
in interfaceIWebsite
- Returns:
true
if this website forces the navigation to occurs on its main base URLs,false
otherwise.- Since:
- 6.2.0
-
setForceMainURLsNavigation
public 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.When this property is enabled, this website redirects requests targeting the additional base URLs to the main base URLs.
- Parameters:
forceMainURLsNavigation
-true
if this website forces the navigation to occurs on its main base URLs,false
otherwise.- Since:
- 6.2.0
-
getPriority
public int getPriority()
Returns the priority of this website for detecting which website responds to a request.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.
- Returns:
- the priority of this website.
- Since:
- 6.2.0
-
setPriority
public void setPriority(int priority) throws PortalException
Sets the priority for this website.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
.- Parameters:
priority
- the priority for this website.- Throws:
PortalException
- if some error occur in websites reorderign.- Since:
- 6.2.0
- See Also:
getPriority()
-
getGoogleAnalyticsAPIKey
public java.lang.String getGoogleAnalyticsAPIKey()
Description copied from interface:IWebsitesSPI
Returns the Google Analytics API access key.- Specified by:
getGoogleAnalyticsAPIKey
in interfaceIWebsitesSPI
- Returns:
- the Google Analytics API access key.
-
setGoogleAnalyticsAPIKey
public void setGoogleAnalyticsAPIKey(java.lang.String googleAnalyticsAPIKey)
Sets the googleAnalyticsAPIKey.- Parameters:
googleAnalyticsAPIKey
- the googleAnalyticsAPIKey value to set.- Since:
- 8.2.0
-
getMainNonSecureBaseURL
public IWebsiteMainBaseURL getMainNonSecureBaseURL()
Returns the main non-secure base URL of this website.This base URL is used to generate absolute non-secure (HTTP) URLs to this website.
- Specified by:
getMainNonSecureBaseURL
in interfaceIWebsite
- Returns:
- the main non-secure base URL of this website.
- Since:
- 6.2.0
-
setMainNonSecureBaseURL
public void setMainNonSecureBaseURL(java.lang.String domain, int port, java.lang.String path) throws PortalException
Sets the main non-secure base URL of this website.This base URL is used to generate absolute non-secure (HTTP) URLs to this website.
- Parameters:
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
- Throws:
java.lang.IllegalArgumentException
- ifdomain
isnull
orport
is non-positive.PortalException
- ifpath
doesn't start with '/',path
ends with '/', or the URL is non-unique.- Since:
- 6.2.0
-
getMainSecureBaseURL
public IWebsiteMainBaseURL getMainSecureBaseURL()
Returns the main secure base URL of this website.This base URL is used to generate absolute secure (HTTPS) URLs to this website.
- Specified by:
getMainSecureBaseURL
in interfaceIWebsite
- Returns:
- the main secure base URL of this website.
- Since:
- 6.2.0
-
setMainSecureBaseURL
public void setMainSecureBaseURL(java.lang.String domain, int port, java.lang.String path) throws PortalException
Sets the main secure base URL of this website.This base URL is used to generate absolute secure (HTTPS) URLs to this website.
- Parameters:
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
- Throws:
java.lang.IllegalArgumentException
- ifdomain
isnull
orport
is non-positive.PortalException
- ifpath
doesn't start with '/',path
ends with '/', or the URL is non-unique.- Since:
- 6.2.0
-
getAdditionalBaseURLs
public java.util.Collection<IWebsiteBaseURL> getAdditionalBaseURLs()
Returns the additional base URLs of this web site.The main base URLs are not included in the returned collection.
- Specified by:
getAdditionalBaseURLs
in interfaceIWebsite
- Returns:
- a unmodifiable collection containing the persistent additional base URLs of this website. It may not reflect changes done in the additional base URLs present in this website after it is obtained. If this website has no additional base URL, an empty collection is returned.
- Since:
- 6.2.0
-
addAdditionalBaseURL
public void addAdditionalBaseURL(java.lang.String domain, int port, java.lang.String path) throws PortalException
Adds an additional base URL for this website.- Parameters:
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
- Throws:
java.lang.IllegalArgumentException
- ifdomain
isnull
orport
is non-positive.PortalException
- ifpath
doesn't start with '/',path
ends with '/', or the URL is non-unique.- Since:
- 6.2.0
-
addAdditionalBaseURL
public void addAdditionalBaseURL(java.lang.String domain, int port, java.lang.String path, boolean checkURLUnique) throws PortalException
Adds an additional base URL for this website.- Parameters:
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.- Throws:
java.lang.IllegalArgumentException
- ifdomain
isnull
orport
is non-positive.PortalException
- ifpath
doesn't start with '/',path
ends with '/', or the URL is non-unique.- Since:
- 6.2.0
-
updateWebsiteBaseURL
public void updateWebsiteBaseURL(IWebsiteBaseURL baseURL, java.lang.String domain, int port, java.lang.String path) throws PortalException
Updates the givenbase URL
with the given parameters.- Parameters:
baseURL
- the base URL.domain
- the domain.port
- the port.path
- the path.- Throws:
PortalException
- Since:
- 7.0.0
-
removeAdditionalBaseURL
public void removeAdditionalBaseURL(IWebsiteBaseURL url) throws PortalException
Removes an additional base URL from this website.- Parameters:
url
- the additional base URL to be removed. It must have been obtained usinggetAdditionalBaseURLs()
.- Throws:
PortalException
- if the given additional base URL is in use by a page link- Since:
- 6.2.0
-
unmodifiable
public IWebsite unmodifiable()
Returns an unmodifiable copy of this website.- Returns:
- an unmodifiable copy of this website.
- Since:
- 6.2.0
-
clone
public Website clone()
- Overrides:
clone
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getGoogleMapsAPIKey
public java.lang.String getGoogleMapsAPIKey()
Description copied from interface:IWebsitesSPI
Returns the Google Maps API access key.- Specified by:
getGoogleMapsAPIKey
in interfaceIWebsitesSPI
- Returns:
- the Google Maps API access key.
-
setGoogleMapsAPIKey
public void setGoogleMapsAPIKey(java.lang.String googleMapsAPIKey)
-
-