Interface SitesService
- All Known Implementing Classes:
SitesServiceImpl
,SitesServiceInternalImpl
public interface SitesService
Site-related operations
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
checkSiteExists
(String siteId) Checks if a site exists.void
checkSiteState
(String siteId, String state) boolean
checkSiteUuid
(String siteId, String siteUuid) Checks if the currently existent site with the given ID also has the same siteUuid.void
deleteSite
(String siteId) Delete a site from the systemvoid
duplicate
(String sourceSiteId, String siteId, String siteName, String description, String sandboxBranch, boolean readOnlyBlobStores) Duplicate a sitevoid
enablePublishing
(String siteId, boolean enabled) Enables/disables publishing for the given siteboolean
Check if site already existsList
<org.craftercms.commons.plugin.model.PluginDescriptor> Get list of available blueprintsorg.craftercms.commons.plugin.model.PluginDescriptor
Get the blueprint descriptor from the global repogetBlueprintLocation
(String blueprintId) Get blueprint locationgetLastCommitId
(String siteId) Get the last commit id for the given sitegetPublishingStatus
(String siteId) Get publishing status for siteGet a site object from DBorg.craftercms.commons.plugin.model.PluginDescriptor
Get the blueprint descriptor from a site repogetSitesByState
(String state) Get the sites matching a given statevoid
unlockSite
(String siteId) Unlock a site which is locked with state `LOCKED`void
updateLastCommitId
(String siteId, String commitId) Update a site's last commit idvoid
updateSite
(String siteId, String name, String description) Updates the name and description for the given site
-
Method Details
-
checkSiteExists
Checks if a site exists. If it does not, it throws aSiteNotFoundException
- Parameters:
siteId
- site ID- Throws:
SiteNotFoundException
- if no site is found for the given site ID
-
exists
Check if site already exists- Parameters:
siteId
- site ID- Returns:
- true if site exists, false otherwise
-
getAvailableBlueprints
List<org.craftercms.commons.plugin.model.PluginDescriptor> getAvailableBlueprints()Get list of available blueprints- Returns:
- list of blueprints
-
getBlueprintDescriptor
Get the blueprint descriptor from the global repo- Parameters:
id
- the id of the blueprint- Returns:
- the descriptor object or null if not found
-
getBlueprintLocation
Get blueprint location- Parameters:
blueprintId
- blueprint id- Returns:
- blueprint location
-
getSiteBlueprintDescriptor
Get the blueprint descriptor from a site repo- Parameters:
id
- the id of the site- Returns:
- the blueprint object or null if not found
-
updateSite
void updateSite(String siteId, String name, String description) throws SiteNotFoundException, SiteAlreadyExistsException, InvalidParametersException Updates the name and description for the given site- Parameters:
siteId
- the id of the sitename
- the name of the sitedescription
- the description of the site- Throws:
SiteNotFoundException
- if the site doesn't existSiteAlreadyExistsException
InvalidParametersException
-
unlockSite
Unlock a site which is locked with state `LOCKED`- Parameters:
siteId
- the id of the site- Throws:
SiteNotFoundException
- if the site doesn't existInvalidSiteStateException
- if the site is not in LOCKED state
-
checkSiteUuid
Checks if the currently existent site with the given ID also has the same siteUuid.- Parameters:
siteId
- ID of the site to testsiteUuid
- site UUID- Returns:
- true if the site UUID file exists and contains the same siteUUID value, false otherwise
-
enablePublishing
Enables/disables publishing for the given site- Parameters:
siteId
- the site idenabled
- true to enable publishing, false to disable
-
getPublishingStatus
Get publishing status for site- Parameters:
siteId
- site identifier- Returns:
- publishing status
- Throws:
SiteNotFoundException
-
deleteSite
Delete a site from the system- Parameters:
siteId
- the site id- Throws:
SiteNotFoundException
- if the site doesn't existServiceLayerException
-
checkSiteState
void checkSiteState(String siteId, String state) throws InvalidSiteStateException, SiteNotFoundException -
getSite
Get a site object from DB- Parameters:
siteId
- site id- Returns:
- site object
- Throws:
SiteNotFoundException
-
updateLastCommitId
Update a site's last commit id- Parameters:
siteId
- site idcommitId
- commit id
-
getLastCommitId
Get the last commit id for the given site- Parameters:
siteId
- site id- Returns:
- the last commit id
-
duplicate
void duplicate(String sourceSiteId, String siteId, String siteName, String description, String sandboxBranch, boolean readOnlyBlobStores) throws ServiceLayerException Duplicate a site- Parameters:
sourceSiteId
- the id of the site to duplicatesiteId
- the id of the new sitesiteName
- the name of the new sitedescription
- the description of the new sitesandboxBranch
- the sandbox branch to usereadOnlyBlobStores
- whether the blob stores should be read only. Notice that this value is overridden (forced to false) if serverless delivery is enabled- Throws:
ServiceLayerException
- if there is an error duplicating the site
-
getSitesByState
Get the sites matching a given state- Parameters:
state
- the state to match. SeeSite.State
- Returns:
- the list of sites matching the given state
-