Class WebsiteManager
- java.lang.Object
-
- lumis.portal.website.WebsiteManager
-
- All Implemented Interfaces:
IWebsiteManager
,IWebsiteManagerSPI
public class WebsiteManager extends java.lang.Object implements IWebsiteManagerSPI
Implementation of website related high-level operations.- Since:
- 6.2.0
- Version:
- $Revision$ $Date$
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WebsiteManager.UnmodifiableWebsite
UnmodifiableWebsite
implementation.
-
Constructor Summary
Constructors Constructor Description WebsiteManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
changeChannelWebsite(java.lang.String channelId, IWebsite newWebsite, IWebsite oldWebsite, boolean changeEvenIfIsWebsiteRoot)
void
deletePageWebResources(java.lang.String pageId)
Deletes the given pageweb resources
.IWebsite
get(java.lang.String id)
Returns thewebsite
with the given identifier.java.util.List<IWebsite>
getAllWebsites()
Returns all websites existent in the portal.IWebsite
getDefaultWebsite()
Returns the website flagged as the default website.IWebsiteBaseURL
getWebsiteBaseURL(java.net.URI uri)
Returns the website base URL that serves the given URI ornull
if there's no base URL that serves the given URI.
If the given URI is not absolute or is opaque,null
will be returned.
This method will not fallback to default website if no website can relativize the given URI.IWebsiteBaseURL
getWebsiteBaseURL(javax.servlet.http.HttpServletRequest request)
Returns the website's base URL that a request corresponds to.java.net.URI
getWebsiteBaseURLAsURI(java.net.URI uri)
Returns the website base URL as a URI that serves the given URI ornull
if there's no base URL that serves the given URI.
If the given URI is not absolute or is opaque,null
will be returned.
This method will not fallback to default website if no website can relativize the given URI.IWebsite
getWebsiteByChannelId(java.lang.String channelId)
Returns the website that the specific channel belongs to.IWebsite
getWebsiteByChannelId(java.lang.String channelId, javax.persistence.FlushModeType flushModeType)
Returns the website that the specific channel belongs to using the specifiedFlushModeType
.IWebsite
getWebsiteByChannelIdNonRecursively(java.lang.String channelId, javax.persistence.FlushModeType flushModeType)
Returns the channel'sWebsite
non-recursively (i.e.boolean
isWebsiteRoot(java.lang.String channelId)
Returns whether the given channel is a website root.void
moveServiceInstanceFiles(java.lang.String serviceInstanceId, IWebsite newWebsite, IWebsite oldWebsite, ITransaction transaction)
Moves the service instance files from the old website to the new one.void
setDefaultWebsite(IWebsite website)
Sets which website is the default website.
-
-
-
Method Detail
-
getAllWebsites
public java.util.List<IWebsite> getAllWebsites() throws PortalException
Returns all websites existent in the portal.Caches the list so that no further database access is needed to access them.
These objects are readonly. Any invocation to any methods that change these websites or their URLs will raise an
UnsupportedOperationException
.- Returns:
- all websites existent in the portal.
- Throws:
PortalException
- Since:
- 6.2.0
-
getDefaultWebsite
public IWebsite getDefaultWebsite() throws PortalException
Description copied from interface:IWebsiteManagerSPI
Returns the website flagged as the default website.- Specified by:
getDefaultWebsite
in interfaceIWebsiteManagerSPI
- Returns:
- the default website, or
null
if there is no website set as the default. - Throws:
PortalException
- See Also:
IWebsite.isDefaultWebsite()
,IWebsiteManagerSPI.setDefaultWebsite(IWebsite)
-
setDefaultWebsite
public void setDefaultWebsite(IWebsite website) throws PortalException
Description copied from interface:IWebsiteManagerSPI
Sets which website is the default website.If there is any website currently flagged as the default website, it will no longer be the default website. The given website (if any) will be set as the default website.
- Specified by:
setDefaultWebsite
in interfaceIWebsiteManagerSPI
- Parameters:
website
- the website to be the default, ornull
for no website to be the default.- Throws:
AccessDeniedException
- if the user does not have permission to change the default website.PortalException
- See Also:
IWebsite.isDefaultWebsite()
,IWebsiteManagerSPI.getDefaultWebsite()
-
getWebsiteByChannelId
public IWebsite getWebsiteByChannelId(java.lang.String channelId) throws PortalException
Description copied from interface:IWebsiteManagerSPI
Returns the website that the specific channel belongs to.The specified channel and its ancestral are searched for the first channel that corresponds to a website root. The channel belongs to that website, and it is returned.
If neither the channel or its ancestral is a website root, then the channel does not belong to any website, and
null
is returned.- Specified by:
getWebsiteByChannelId
in interfaceIWebsiteManagerSPI
- Parameters:
channelId
- the channel identifier.- Returns:
- the website the channel belongs to, or
null
if the channel does not belong to any website. - Throws:
PortalObjectNotFoundException
- if the channel does not exist.PortalException
-
getWebsiteBaseURL
public IWebsiteBaseURL getWebsiteBaseURL(javax.servlet.http.HttpServletRequest request) throws PortalException
Description copied from interface:IWebsiteManager
Returns the website's base URL that a request corresponds to.If the request does not correspond to any configured website base URL but there is a website configured as default, a website base URL will be dynamically generated and returned, referencing the default website in
IWebsiteBaseURL.getWebsite()
, as if it was an additional base URL of the default website.If the request does not corresponds to any configured website base URL and there is no website configured as default,
null
is returned.- Specified by:
getWebsiteBaseURL
in interfaceIWebsiteManager
- Parameters:
request
- the request.- Returns:
- the website base URL, or
null
if no website base URL corresponds to the request. - Throws:
PortalException
-
get
public IWebsite get(java.lang.String id) throws PortalException
Returns thewebsite
with the given identifier.- Parameters:
id
- the website identifier.- Returns:
- the
website
with the given identifier. - Throws:
PortalException
- Since:
- 6.2.0
-
getWebsiteByChannelIdNonRecursively
public IWebsite getWebsiteByChannelIdNonRecursively(java.lang.String channelId, javax.persistence.FlushModeType flushModeType) throws PortalException
Returns the channel'sWebsite
non-recursively (i.e. doesn't search for a website through the channel's parents).- Parameters:
channelId
- the channel identifier.flushModeType
- theFlushModeType
to be used in query, ornull
to not set any in query.- Returns:
- the channel's
Website
non-recursively (i.e. doesn't search for a website through the channel's parents). - Throws:
PortalException
- Since:
- 6.2.0
-
getWebsiteByChannelId
public IWebsite getWebsiteByChannelId(java.lang.String channelId, javax.persistence.FlushModeType flushModeType) throws PortalException
Returns the website that the specific channel belongs to using the specifiedFlushModeType
.- Parameters:
channelId
- the channel identifier.flushModeType
- theFlushModeType
to be used in query, ornull
to not set any in query.- Returns:
- the website the channel belongs to, or
null
if the channel does not belong to any website. - Throws:
PortalObjectNotFoundException
- if the channel does not exist.PortalException
- Since:
- 6.2.0
-
changeChannelWebsite
public void changeChannelWebsite(java.lang.String channelId, IWebsite newWebsite, IWebsite oldWebsite, boolean changeEvenIfIsWebsiteRoot) throws PortalException
Performs the necessary changes in the given channel by letting use the oldWebsite
and use the newWebsite
.- Parameters:
channelId
- the channel identifier.newWebsite
- the new website the channel belongs to.oldWebsite
- the old website the channel belonged to.changeEvenIfIsWebsiteRoot
- indicates whether the changes should be performed even if the given channel is a website root.- Throws:
PortalException
- Since:
- 6.2.0
-
moveServiceInstanceFiles
public void moveServiceInstanceFiles(java.lang.String serviceInstanceId, IWebsite newWebsite, IWebsite oldWebsite, ITransaction transaction) throws PortalException
Moves the service instance files from the old website to the new one.- Parameters:
serviceInstanceId
- the service instance identifier.newWebsite
- the new website.oldWebsite
- the old website.transaction
- the transaction.- Throws:
PortalException
- Since:
- 6.2.0
-
deletePageWebResources
public void deletePageWebResources(java.lang.String pageId) throws PortalException
Deletes the given pageweb resources
.- Parameters:
pageId
- the page identifier.- Throws:
PortalException
- Since:
- 6.2.0
-
isWebsiteRoot
public boolean isWebsiteRoot(java.lang.String channelId) throws PortalException
Returns whether the given channel is a website root.- Parameters:
channelId
- the channel identifier.- Returns:
- whether the given channel is a website root.
- Throws:
PortalException
- Since:
- 6.2.0
-
getWebsiteBaseURL
public IWebsiteBaseURL getWebsiteBaseURL(java.net.URI uri) throws PortalException
Description copied from interface:IWebsiteManager
Returns the website base URL that serves the given URI ornull
if there's no base URL that serves the given URI.
If the given URI is not absolute or is opaque,null
will be returned.
This method will not fallback to default website if no website can relativize the given URI.- Specified by:
getWebsiteBaseURL
in interfaceIWebsiteManager
- Parameters:
uri
- the URI.- Returns:
- the website base URL that serves the given URI or
null
if there's no base URL that serves the given URI. - Throws:
PortalException
-
getWebsiteBaseURLAsURI
public java.net.URI getWebsiteBaseURLAsURI(java.net.URI uri) throws PortalException
Description copied from interface:IWebsiteManager
Returns the website base URL as a URI that serves the given URI ornull
if there's no base URL that serves the given URI.
If the given URI is not absolute or is opaque,null
will be returned.
This method will not fallback to default website if no website can relativize the given URI.- Specified by:
getWebsiteBaseURLAsURI
in interfaceIWebsiteManager
- Parameters:
uri
- the URI.- Returns:
- the website base URL as URI that serves the given URI or
null
if there's no base URL that serves the given URI. - Throws:
PortalException
-
-