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 Details

  • Method Details

    • getAvailableBlueprints

      public List<org.craftercms.commons.plugin.model.PluginDescriptor> getAvailableBlueprints()
      Description copied from interface: SitesService
      Get list of available blueprints
      Specified by:
      getAvailableBlueprints in interface SitesService
      Returns:
      list of blueprints
    • getBlueprintDescriptor

      public org.craftercms.commons.plugin.model.PluginDescriptor getBlueprintDescriptor(String id)
      Description copied from interface: SitesService
      Get the blueprint descriptor from the global repo
      Specified by:
      getBlueprintDescriptor in interface SitesService
      Parameters:
      id - the id of the blueprint
      Returns:
      the descriptor object or null if not found
    • getBlueprintLocation

      public String getBlueprintLocation(String blueprintId)
      Description copied from interface: SitesService
      Get blueprint location
      Specified by:
      getBlueprintLocation in interface SitesService
      Parameters:
      blueprintId - blueprint id
      Returns:
      blueprint location
    • getSiteBlueprintDescriptor

      public org.craftercms.commons.plugin.model.PluginDescriptor getSiteBlueprintDescriptor(String id)
      Description copied from interface: SitesService
      Get the blueprint descriptor from a site repo
      Specified by:
      getSiteBlueprintDescriptor in interface SitesService
      Parameters:
      id - the id of the site
      Returns:
      the blueprint object or null if not found
    • getBlueprintsFolders

      protected RepositoryItem[] getBlueprintsFolders()
    • getBlueprintPath

      protected Path getBlueprintPath(RepositoryItem folder)
    • loadDescriptor

      protected org.craftercms.commons.plugin.model.PluginDescriptor loadDescriptor(InputStream is)
    • 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 interface SitesService
      Parameters:
      siteId - the id of the site
      name - the name of the site
      description - the description of the site
      Throws:
      SiteNotFoundException - if the site doesn't exist
      SiteAlreadyExistsException
    • unlockSite

      public void unlockSite(String siteId)
      Description copied from interface: SitesService
      Unlock a site which is locked with state `LOCKED`
      Specified by:
      unlockSite in interface SitesService
      Parameters:
      siteId - the id of the site
    • exists

      public boolean exists(String siteId)
      Description copied from interface: SitesService
      Check if site already exists
      Specified by:
      exists in interface SitesService
      Parameters:
      siteId - site ID
      Returns:
      true if site exists, false otherwise
    • getPublishingStatus

      public PublishStatus getPublishingStatus(String siteId)
      Description copied from interface: SitesService
      Get publishing status for site
      Specified by:
      getPublishingStatus in interface SitesService
      Parameters:
      siteId - site identifier
      Returns:
      publishing status
    • clearPublishingLock

      public void clearPublishingLock(String siteId)
      Description copied from interface: SitesService
      Clear publishing lock for site
      Specified by:
      clearPublishingLock in interface SitesService
      Parameters:
      siteId - site identifier
    • checkSiteState

      public void checkSiteState(String siteId, String requiredState) throws InvalidSiteStateException, SiteNotFoundException
      Description copied from interface: SitesService
      Check if current site state is matches the given state
      Specified by:
      checkSiteState in interface SitesService
      Parameters:
      siteId - site id
      requiredState - desired state
      Throws:
      InvalidSiteStateException - if the site state doesn't match the given state
      SiteNotFoundException - if the site doesn't exist
    • 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 interface SitesService
      Parameters:
      sourceSiteId - the id of the site to duplicate
      siteId - the id of the new site
      siteName - the name of the new site
      description - the description of the new site
      sandboxBranch - the sandbox branch to use
      readOnlyBlobStores - 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

      public List<Site> getSitesByState(String state)
      Description copied from interface: SitesService
      Get the sites matching a given state
      Specified by:
      getSitesByState in interface SitesService
      Parameters:
      state - the state to match. See Site.State
      Returns:
      the list of sites matching the given state
    • auditSiteDuplicate

      protected void auditSiteDuplicate(String sourceSiteId, String siteId, String siteName)
      Creates an audit log entry for the site duplication operation, including the source site as audit params
      Parameters:
      sourceSiteId - the source site id
      siteId - the new site id
      siteName - the new site name
    • addSiteUuidFile

      protected void addSiteUuidFile(String site, String siteUuid) throws IOException
      Add a file containing the site uuid in the site folder
      Parameters:
      site - site id
      siteUuid - 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 interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException