Interface SiteService

All Known Implementing Classes:
SiteServiceImpl

public interface SiteService
Note: consider renaming A site in Crafter Studio is currently the name for a WEM project being managed. This service provides access to site configuration
Author:
russdanner
  • Method Details

    • getAllAvailableSites

      Set<String> getAllAvailableSites()
    • countSites

      int countSites()
    • createSiteFromBlueprint

      void createSiteFromBlueprint(String blueprintName, String siteId, String siteName, String sandboxBranch, String desc, Map<String,String> params, boolean createAsOrphan) throws SiteAlreadyExistsException, SiteCreationException, DeployerTargetException, BlueprintNotFoundException, MissingPluginParameterException
      Create a new site based on an existing blueprint
      Parameters:
      blueprintName - blueprint name to create site
      siteId - site identifier
      siteName - site name
      sandboxBranch - sandbox branch name
      desc - description
      params - site parameters
      createAsOrphan - create the site from a remote repository as orphan (no git history)
      Throws:
      SiteAlreadyExistsException - site already exists
      SiteCreationException - error during site creation process
      DeployerTargetException - error creating deployer targets
      BlueprintNotFoundException - blueprint not found
      MissingPluginParameterException - missing mandatory blueprint parameters
    • createSiteWithRemoteOption

      void createSiteWithRemoteOption(String siteId, String siteName, String sandboxBranch, String description, String blueprintName, String remoteName, String remoteUrl, String remoteBranch, boolean singleBranch, String authenticationType, String remoteUsername, String remotePassword, String remoteToken, String remotePrivateKey, String createOption, Map<String,String> params, boolean createAsOrphan) throws ServiceLayerException, InvalidRemoteRepositoryException, InvalidRemoteRepositoryCredentialsException, RemoteRepositoryNotFoundException, InvalidRemoteUrlException
      Create a new site with remote option (clone from remote or push to remote repository)
      Parameters:
      siteId - site identifier
      siteName - the name of the site
      sandboxBranch - sandbox branch name
      description - description
      blueprintName - name of the blueprint to create site
      remoteName - remote repository name
      remoteUrl - remote repository url
      remoteBranch - remote repository branch to create site from
      singleBranch - clone single branch if true, otherwise clone whole repo
      authenticationType - remote repository authentication type
      remoteUsername - remote repository username to use for authentication
      remotePassword - remote repository username to use for authentication
      remoteToken - remote repository username to use for authentication
      remotePrivateKey - remote repository username to use for authentication
      createOption - remote repository username to use for authentication
      params - site parameters
      createAsOrphan - create the site from a remote repository as orphan (no git history)
      Throws:
      ServiceLayerException - general service error
      InvalidRemoteRepositoryException - invalid remote repository
      InvalidRemoteRepositoryCredentialsException - invalid credentials for remote repository
      RemoteRepositoryNotFoundException - remote repository not found
      InvalidRemoteUrlException - invalid remote url
    • deleteSite

      boolean deleteSite(String siteId)
      remove a site from the system
      Parameters:
      siteId - site identifier
      Returns:
      true if successfully deleted, otherwise false
    • updateLastVerifiedGitlogCommitId

      void updateLastVerifiedGitlogCommitId(String site, String commitId)
    • updateLastSyncedGitlogCommitId

      void updateLastSyncedGitlogCommitId(String site, String commitId)
      Update last audited gitlog commit id
      Parameters:
      site - site identifier
      commitId - commit ID
    • syncDatabaseWithRepo

      boolean syncDatabaseWithRepo(String siteId, String fromCommitId) throws ServiceLayerException
      Synchronize our internal database with the underlying repository. This is required when a user bypasses the UI and manipulates the underlying repository directly.
      Parameters:
      siteId - site to sync
      fromCommitId - commit ID to start at and sync up until current commit
      Returns:
      true if successful, false otherwise
      Throws:
      SiteNotFoundException - site not found
      ServiceLayerException
    • syncDatabaseWithRepo

      boolean syncDatabaseWithRepo(String siteId, String fromCommitId, boolean generateAuditLog) throws ServiceLayerException, UserNotFoundException
      Synchronize our internal database with the underlying repository. This is required when a user bypasses the UI and manipulates the underlying repository directly.
      Parameters:
      siteId - site to sync
      fromCommitId - commit ID to start at and sync up until current commit
      generateAuditLog - if true add operations to audit log
      Returns:
      true if successful, false otherwise
      Throws:
      SiteNotFoundException - site not found
      ServiceLayerException
      UserNotFoundException
    • getAvailableBlueprints

      SiteBlueprintTO[] getAvailableBlueprints()
      get a list of available blueprints
      Returns:
      list of blueprints
    • syncRepository

      void syncRepository(String site) throws SiteNotFoundException
      Synchronize Database with repository
      Parameters:
      site - site id
      Throws:
      SiteNotFoundException - site not found
    • rebuildDatabase

      void rebuildDatabase(String site)
      Rebuild database for site
      Parameters:
      site - site id
    • updateLastCommitId

      void updateLastCommitId(String site, String commitId)
    • exists

      boolean exists(String site)
      Check if site already exists
      Parameters:
      site - site ID
      Returns:
      true if site exists, false otherwise
    • checkSiteExists

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

      boolean existsById(String id)
      Check if site already exists
      Parameters:
      id - site ID in DB
      Returns:
      true if site exists, false otherwise
    • existsByName

      boolean existsByName(String name)
      Check if site already exists
      Parameters:
      name - site name in DB
      Returns:
      true if site exists, false otherwise
    • getSitesPerUserTotal

      int getSitesPerUserTotal() throws UserNotFoundException, ServiceLayerException
      Get total number of sites that user is allowed access to for current user
      Returns:
      number of sites
      Throws:
      UserNotFoundException
      ServiceLayerException
    • getSitesPerUserTotal

      int getSitesPerUserTotal(String username) throws UserNotFoundException, ServiceLayerException
      Get total number of sites that user is allowed access to for given username
      Parameters:
      username - username
      Returns:
      number of sites
      Throws:
      UserNotFoundException - user not found
      ServiceLayerException - general service error
    • getSitesPerUser

      List<SiteFeed> getSitesPerUser(int start, int number) throws UserNotFoundException, ServiceLayerException
      Get sites that user is allowed access to for current user
      Parameters:
      start - start position for pagination
      number - number of sites per page
      Returns:
      number of sites
      Throws:
      UserNotFoundException
      ServiceLayerException
    • getSitesPerUser

      List<SiteFeed> getSitesPerUser(String username, int start, int number) throws UserNotFoundException, ServiceLayerException
      Get sites that user is allowed access to for given username
      Parameters:
      username - username
      start - start position for pagination
      number - number of sites per page
      Returns:
      number of sites
      Throws:
      UserNotFoundException - user not found
      ServiceLayerException - general service error
    • getSite

      SiteFeed getSite(String siteId) throws SiteNotFoundException
      Get site feed for given site
      Parameters:
      siteId - site id
      Returns:
      SiteFeed object for the requested site
      Throws:
      SiteNotFoundException - site not found
    • getSiteDetails

      SiteDetails getSiteDetails(String siteId) throws ServiceLayerException
      Get site details. This will include the site feed info and the blob store configuration details
      Parameters:
      siteId - site id
      Returns:
      SiteDetails object for the requested site
      Throws:
      ServiceLayerException - if an error occurs while retrieving the site details
    • isPublishingEnabled

      boolean isPublishingEnabled(String siteId)
      Check if publishing is enabled for given site
      Parameters:
      siteId - site id
      Returns:
      true if publishing is enabled for given site, otherwise false
    • enablePublishing

      boolean enablePublishing(String siteId, boolean enabled) throws SiteNotFoundException
      Enable/Disable publishing for given site
      Parameters:
      siteId - site id
      enabled - true to enable publishing, false to disable publishing
      Returns:
      true if operation was successful, otherwise false
      Throws:
      SiteNotFoundException - site not found
    • updatePublishingStatus

      boolean updatePublishingStatus(String siteId, String status) throws SiteNotFoundException
      Update publishing status message for given site
      Parameters:
      siteId - site id
      status - status
      Returns:
      true if publishing status message is successfully updated
      Throws:
      SiteNotFoundException - site not found
    • addRemote

      boolean addRemote(String siteId, String remoteName, String remoteUrl, String authenticationType, String remoteUsername, String remotePassword, String remoteToken, String remotePrivateKey) throws InvalidRemoteUrlException, ServiceLayerException
      Add remote repository for site content repository
      Parameters:
      siteId - site identifier
      remoteName - remote name
      remoteUrl - remote url
      authenticationType - authentication type
      remoteUsername - remote username
      remotePassword - remote password
      remoteToken - remote token
      remotePrivateKey - remote private key
      Returns:
      true if operation was successful
      Throws:
      InvalidRemoteUrlException - invalid remote url
      ServiceLayerException - general service error
    • removeRemote

      boolean removeRemote(String siteId, String remoteName) throws SiteNotFoundException
      Remove remote with given name for site
      Parameters:
      siteId - site identifier
      remoteName - remote name
      Returns:
      true if operation was successful
      Throws:
      SiteNotFoundException - site not found
    • listRemote

      List<RemoteRepositoryInfoTO> listRemote(String siteId) throws ServiceLayerException, org.craftercms.commons.crypto.CryptoException
      List remote repositories for given site
      Parameters:
      siteId - site identifier
      Returns:
      list of names of remote repositories
      Throws:
      SiteNotFoundException - site not found
      org.craftercms.commons.crypto.CryptoException - git repository helper error
      ServiceLayerException
    • getDeletedSites

      List<SiteFeed> getDeletedSites()
      Get deleted sites
      Returns:
      List of deleted sites from DB
    • getLastCommitId

      String getLastCommitId(String siteId)
      get last commit id for site
      Parameters:
      siteId - site identifier
      Returns:
      last commit id for local studio node
    • getSiteState

      String getSiteState(String siteId)
    • getLastVerifiedGitlogCommitId

      String getLastVerifiedGitlogCommitId(String siteId)
      get last verified git log commit id for site
      Parameters:
      siteId - site identifier
      Returns:
      last verified git log commit id for local studio node
    • getAllCreatedSites

      List<String> getAllCreatedSites()
      Get list of all sites with state = CREATED
      Returns:
      list of sites
    • setSiteState

      void setSiteState(String siteId, String state)
    • isPublishedRepoCreated

      boolean isPublishedRepoCreated(String siteId)
    • setPublishedRepoCreated

      void setPublishedRepoCreated(String siteId)
    • getLastSyncedGitlogCommitId

      String getLastSyncedGitlogCommitId(String siteId)
      get last audited git log commit id for site
      Parameters:
      siteId - site identifier
      Returns:
      last audited git log commit id for local studio node
    • 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