Interface SitesService

All Known Implementing Classes:
SitesServiceImpl, SitesServiceInternalImpl

public interface SitesService
Site-related operations
  • Method Details

    • checkSiteExists

      default void checkSiteExists(String siteId) throws SiteNotFoundException
      Checks if a site exists. If it does not, it throws a SiteNotFoundException
      Parameters:
      siteId - site ID
      Throws:
      SiteNotFoundException - if no site is found for the given site ID
    • exists

      boolean exists(String siteId)
      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

      org.craftercms.commons.plugin.model.PluginDescriptor getBlueprintDescriptor(String id)
      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

      String getBlueprintLocation(String blueprintId)
      Get blueprint location
      Parameters:
      blueprintId - blueprint id
      Returns:
      blueprint location
    • getSiteBlueprintDescriptor

      org.craftercms.commons.plugin.model.PluginDescriptor getSiteBlueprintDescriptor(String id)
      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 site
      name - the name of the site
      description - the description of the site
      Throws:
      SiteNotFoundException - if the site doesn't exist
      SiteAlreadyExistsException
      InvalidParametersException
    • unlockSite

      void unlockSite(String siteId) throws SiteNotFoundException, InvalidSiteStateException
      Unlock a site which is locked with state `LOCKED`
      Parameters:
      siteId - the id of the site
      Throws:
      SiteNotFoundException - if the site doesn't exist
      InvalidSiteStateException - if the site is not in LOCKED state
    • checkSiteUuid

      boolean checkSiteUuid(String siteId, String siteUuid)
      Checks if the currently existent site with the given ID also has the same siteUuid.
      Parameters:
      siteId - ID of the site to test
      siteUuid - site UUID
      Returns:
      true if the site UUID file exists and contains the same siteUUID value, false otherwise
    • enablePublishing

      void enablePublishing(String siteId, boolean enabled)
      Enables/disables publishing for the given site
      Parameters:
      siteId - the site id
      enabled - true to enable publishing, false to disable
    • getPublishingStatus

      PublishStatus getPublishingStatus(String siteId) throws SiteNotFoundException
      Get publishing status for site
      Parameters:
      siteId - site identifier
      Returns:
      publishing status
      Throws:
      SiteNotFoundException
    • deleteSite

      void deleteSite(String siteId) throws ServiceLayerException
      Delete a site from the system
      Parameters:
      siteId - the site id
      Throws:
      SiteNotFoundException - if the site doesn't exist
      ServiceLayerException
    • checkSiteState

      void checkSiteState(String siteId, String state) throws InvalidSiteStateException, SiteNotFoundException
      Throws:
      InvalidSiteStateException
      SiteNotFoundException
    • getSite

      Site getSite(String siteId) throws SiteNotFoundException
      Get a site object from DB
      Parameters:
      siteId - site id
      Returns:
      site object
      Throws:
      SiteNotFoundException
    • updateLastCommitId

      void updateLastCommitId(String siteId, String commitId)
      Update a site's last commit id
      Parameters:
      siteId - site id
      commitId - commit id
    • getLastCommitId

      String getLastCommitId(String siteId)
      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 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
    • getSitesByState

      List<Site> getSitesByState(String state)
      Get the sites matching a given state
      Parameters:
      state - the state to match. See Site.State
      Returns:
      the list of sites matching the given state