Class SitesServiceInternalImpl
java.lang.Object
org.craftercms.studio.impl.v2.service.site.internal.SitesServiceInternalImpl
- All Implemented Interfaces:
SitesService
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
public class SitesServiceInternalImpl
extends Object
implements SitesService, org.springframework.context.ApplicationContextAware
-
Constructor Summary
ConstructorsConstructorDescriptionSitesServiceInternalImpl
(org.craftercms.commons.plugin.PluginDescriptorReader descriptorReader, ContentRepository contentRepository, StudioBlobAwareContentRepository blobAwareRepository, StudioConfiguration studioConfiguration, SiteFeedMapper siteFeedMapper, SiteDAO siteDao, RetryingDatabaseOperationFacade retryingDatabaseOperationFacade, SiteService siteServiceV1, Deployer deployer, ConfigurationService configurationService, SecurityService securityService, AuditServiceInternal auditServiceInternal, ItemServiceInternal itemServiceInternal) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addSiteUuidFile
(String site, String siteUuid) Add a file containing the site uuid in the site folderprotected void
auditSiteDuplicate
(String sourceSiteId, String siteId, String siteName) Creates an audit log entry for the site duplication operation, including the source site as audit paramsvoid
checkSiteState
(String siteId, String requiredState) 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 systemprotected void
destroySitePreviewContext
(String siteId) Call the engine API to destroy the site preview contextprotected void
doDuplicate
(String sourceSiteId, String siteId, String siteName, String description, String sandboxBranch, boolean readOnlyBlobStores) void
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 locationprotected Path
getBlueprintPath
(RepositoryItem folder) protected RepositoryItem[]
getLastCommitId
(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 stateprotected org.craftercms.commons.plugin.model.PluginDescriptor
protected org.craftercms.commons.plugin.model.PluginDescriptor
loadDescriptor
(RepositoryItem folder) void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) void
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 siteMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.craftercms.studio.api.v2.service.site.SitesService
checkSiteExists
-
Constructor Details
-
SitesServiceInternalImpl
@ConstructorProperties({"descriptorReader","contentRepository","blobAwareRepository","studioConfiguration","siteFeedMapper","siteDao","retryingDatabaseOperationFacade","siteServiceV1","deployer","configurationService","securityService","auditServiceInternal","itemServiceInternal"}) public SitesServiceInternalImpl(org.craftercms.commons.plugin.PluginDescriptorReader descriptorReader, ContentRepository contentRepository, StudioBlobAwareContentRepository blobAwareRepository, StudioConfiguration studioConfiguration, SiteFeedMapper siteFeedMapper, SiteDAO siteDao, RetryingDatabaseOperationFacade retryingDatabaseOperationFacade, SiteService siteServiceV1, Deployer deployer, ConfigurationService configurationService, SecurityService securityService, AuditServiceInternal auditServiceInternal, ItemServiceInternal itemServiceInternal)
-
-
Method Details
-
getAvailableBlueprints
Description copied from interface:SitesService
Get list of available blueprints- Specified by:
getAvailableBlueprints
in interfaceSitesService
- Returns:
- list of blueprints
-
getBlueprintDescriptor
Description copied from interface:SitesService
Get the blueprint descriptor from the global repo- Specified by:
getBlueprintDescriptor
in interfaceSitesService
- Parameters:
id
- the id of the blueprint- Returns:
- the descriptor object or null if not found
-
getBlueprintLocation
Description copied from interface:SitesService
Get blueprint location- Specified by:
getBlueprintLocation
in interfaceSitesService
- Parameters:
blueprintId
- blueprint id- Returns:
- blueprint location
-
getSiteBlueprintDescriptor
Description copied from interface:SitesService
Get the blueprint descriptor from a site repo- Specified by:
getSiteBlueprintDescriptor
in interfaceSitesService
- Parameters:
id
- the id of the site- Returns:
- the blueprint object or null if not found
-
getBlueprintsFolders
-
getBlueprintPath
-
loadDescriptor
-
loadDescriptor
protected org.craftercms.commons.plugin.model.PluginDescriptor loadDescriptor(RepositoryItem folder) -
updateSite
public void updateSite(String siteId, String name, String description) throws SiteNotFoundException, SiteAlreadyExistsException Description copied from interface:SitesService
Updates the name and description for the given site- Specified by:
updateSite
in interfaceSitesService
- 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
-
unlockSite
Description copied from interface:SitesService
Unlock a site which is locked with state `LOCKED`- Specified by:
unlockSite
in interfaceSitesService
- Parameters:
siteId
- the id of the site
-
exists
Description copied from interface:SitesService
Check if site already exists- Specified by:
exists
in interfaceSitesService
- Parameters:
siteId
- site ID- Returns:
- true if site exists, false otherwise
-
deleteSite
Description copied from interface:SitesService
Delete a site from the system- Specified by:
deleteSite
in interfaceSitesService
- Parameters:
siteId
- the site id- Throws:
ServiceLayerException
-
checkSiteState
public void checkSiteState(String siteId, String requiredState) throws InvalidSiteStateException, SiteNotFoundException - Specified by:
checkSiteState
in interfaceSitesService
- Throws:
InvalidSiteStateException
SiteNotFoundException
-
getSite
Description copied from interface:SitesService
Get a site object from DB- Specified by:
getSite
in interfaceSitesService
- Parameters:
siteId
- site id- Returns:
- site object
-
updateLastCommitId
Description copied from interface:SitesService
Update a site's last commit id- Specified by:
updateLastCommitId
in interfaceSitesService
- Parameters:
siteId
- site idcommitId
- commit id
-
getLastCommitId
Description copied from interface:SitesService
Get the last commit id for the given site- Specified by:
getLastCommitId
in interfaceSitesService
- Parameters:
siteId
- site id- Returns:
- the last commit id
-
checkSiteUuid
Description copied from interface:SitesService
Checks if the currently existent site with the given ID also has the same siteUuid.- Specified by:
checkSiteUuid
in interfaceSitesService
- 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
-
destroySitePreviewContext
Call the engine API to destroy the site preview context- Parameters:
siteId
- site id- Throws:
ServiceLayerException
- if the request fails or response status code is not 200
-
enablePublishing
Description copied from interface:SitesService
Enables/disables publishing for the given site- Specified by:
enablePublishing
in interfaceSitesService
- Parameters:
siteId
- the site idenabled
- true to enable publishing, false to disable
-
getPublishingStatus
Description copied from interface:SitesService
Get publishing status for site- Specified by:
getPublishingStatus
in interfaceSitesService
- Parameters:
siteId
- site identifier- Returns:
- publishing status
-
duplicate
public void duplicate(String sourceSiteId, String siteId, String siteName, String description, String sandboxBranch, boolean readOnlyBlobStores) throws ServiceLayerException Description copied from interface:SitesService
Duplicate a site- Specified by:
duplicate
in interfaceSitesService
- 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
-
doDuplicate
protected void doDuplicate(String sourceSiteId, String siteId, String siteName, String description, String sandboxBranch, boolean readOnlyBlobStores) throws ServiceLayerException - Throws:
ServiceLayerException
-
getSitesByState
Description copied from interface:SitesService
Get the sites matching a given state- Specified by:
getSitesByState
in interfaceSitesService
- Parameters:
state
- the state to match. SeeSite.State
- Returns:
- the list of sites matching the given state
-
auditSiteDuplicate
Creates an audit log entry for the site duplication operation, including the source site as audit params- Parameters:
sourceSiteId
- the source site idsiteId
- the new site idsiteName
- the new site name
-
addSiteUuidFile
Add a file containing the site uuid in the site folder- Parameters:
site
- site idsiteUuid
- site uuid- Throws:
IOException
- if the file cannot be written
-
setApplicationContext
public void setApplicationContext(@NonNull org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
- Throws:
org.springframework.beans.BeansException
-