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 Summary
Modifier and TypeMethodDescriptionbooleanaddRemote(String siteId, String remoteName, String remoteUrl, String authenticationType, String remoteUsername, String remotePassword, String remoteToken, String remotePrivateKey) Add remote repository for site content repositoryvoidcheckSiteExists(String site) Checks if a site exists.booleancheckSiteUuid(String siteId, String siteUuid) Checks if the currently existent site with the given ID also has the same siteUuid.intvoidcreateSiteFromBlueprint(String blueprintName, String siteId, String siteName, String sandboxBranch, String desc, Map<String, String> params, boolean createAsOrphan) Create a new site based on an existing blueprintvoidcreateSiteWithRemoteOption(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) Create a new site with remote option (clone from remote or push to remote repository)booleandeleteSite(String siteId) remove a site from the systembooleanenablePublishing(String siteId, boolean enabled) Enable/Disable publishing for given sitebooleanCheck if site already existsbooleanexistsById(String id) Check if site already existsbooleanexistsByName(String name) Check if site already existsGet list of all sites with state = CREATEDget a list of available blueprintsGet deleted sitesgetLastCommitId(String siteId) get last commit id for sitegetLastSyncedGitlogCommitId(String siteId) get last audited git log commit id for sitegetLastVerifiedGitlogCommitId(String siteId) get last verified git log commit id for siteGet site feed for given sitegetSiteDetails(String siteId) Get site details.getSitesPerUser(int start, int number) Get sites that user is allowed access to for current usergetSitesPerUser(String username, int start, int number) Get sites that user is allowed access to for given usernameintGet total number of sites that user is allowed access to for current userintgetSitesPerUserTotal(String username) Get total number of sites that user is allowed access to for given usernamegetSiteState(String siteId) booleanisPublishedRepoCreated(String siteId) booleanisPublishingEnabled(String siteId) Check if publishing is enabled for given sitelistRemote(String siteId) List remote repositories for given sitevoidrebuildDatabase(String site) Rebuild database for sitebooleanremoveRemote(String siteId, String remoteName) Remove remote with given name for sitevoidsetPublishedRepoCreated(String siteId) voidsetSiteState(String siteId, String state) booleansyncDatabaseWithRepo(String siteId, String fromCommitId) Synchronize our internal database with the underlying repository.booleansyncDatabaseWithRepo(String siteId, String fromCommitId, boolean generateAuditLog) Synchronize our internal database with the underlying repository.voidsyncRepository(String site) Synchronize Database with repositoryvoidupdateLastCommitId(String site, String commitId) voidupdateLastSyncedGitlogCommitId(String site, String commitId) Update last audited gitlog commit idvoidupdateLastVerifiedGitlogCommitId(String site, String commitId) booleanupdatePublishingStatus(String siteId, String status) Update publishing status message for given site
-
Method Details
-
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, MissingPluginParameterExceptionCreate a new site based on an existing blueprint- Parameters:
blueprintName- blueprint name to create sitesiteId- site identifiersiteName- site namesandboxBranch- sandbox branch namedesc- descriptionparams- site parameterscreateAsOrphan- create the site from a remote repository as orphan (no git history)- Throws:
SiteAlreadyExistsException- site already existsSiteCreationException- error during site creation processDeployerTargetException- error creating deployer targetsBlueprintNotFoundException- blueprint not foundMissingPluginParameterException- 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, InvalidRemoteUrlExceptionCreate a new site with remote option (clone from remote or push to remote repository)- Parameters:
siteId- site identifiersiteName- the name of the sitesandboxBranch- sandbox branch namedescription- descriptionblueprintName- name of the blueprint to create siteremoteName- remote repository nameremoteUrl- remote repository urlremoteBranch- remote repository branch to create site fromsingleBranch- clone single branch if true, otherwise clone whole repoauthenticationType- remote repository authentication typeremoteUsername- remote repository username to use for authenticationremotePassword- remote repository username to use for authenticationremoteToken- remote repository username to use for authenticationremotePrivateKey- remote repository username to use for authenticationcreateOption- remote repository username to use for authenticationparams- site parameterscreateAsOrphan- create the site from a remote repository as orphan (no git history)- Throws:
ServiceLayerException- general service errorInvalidRemoteRepositoryException- invalid remote repositoryInvalidRemoteRepositoryCredentialsException- invalid credentials for remote repositoryRemoteRepositoryNotFoundException- remote repository not foundInvalidRemoteUrlException- invalid remote url
-
deleteSite
remove a site from the system- Parameters:
siteId- site identifier- Returns:
- true if successfully deleted, otherwise false
-
updateLastVerifiedGitlogCommitId
-
updateLastSyncedGitlogCommitId
Update last audited gitlog commit id- Parameters:
site- site identifiercommitId- commit ID
-
syncDatabaseWithRepo
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 syncfromCommitId- commit ID to start at and sync up until current commit- Returns:
- true if successful, false otherwise
- Throws:
SiteNotFoundException- site not foundServiceLayerException
-
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 syncfromCommitId- commit ID to start at and sync up until current commitgenerateAuditLog- if true add operations to audit log- Returns:
- true if successful, false otherwise
- Throws:
SiteNotFoundException- site not foundServiceLayerExceptionUserNotFoundException
-
getAvailableBlueprints
SiteBlueprintTO[] getAvailableBlueprints()get a list of available blueprints- Returns:
- list of blueprints
-
syncRepository
Synchronize Database with repository- Parameters:
site- site id- Throws:
SiteNotFoundException- site not found
-
rebuildDatabase
Rebuild database for site- Parameters:
site- site id
-
updateLastCommitId
-
exists
Check if site already exists- Parameters:
site- site ID- Returns:
- true if site exists, false otherwise
-
checkSiteExists
Checks if a site exists. If it does not, it throws aSiteNotFoundException- Parameters:
site- site ID- Throws:
SiteNotFoundException- if no site is found for the given site ID
-
existsById
Check if site already exists- Parameters:
id- site ID in DB- Returns:
- true if site exists, false otherwise
-
existsByName
Check if site already exists- Parameters:
name- site name in DB- Returns:
- true if site exists, false otherwise
-
getSitesPerUserTotal
Get total number of sites that user is allowed access to for current user- Returns:
- number of sites
- Throws:
UserNotFoundExceptionServiceLayerException
-
getSitesPerUserTotal
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 foundServiceLayerException- 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 paginationnumber- number of sites per page- Returns:
- number of sites
- Throws:
UserNotFoundExceptionServiceLayerException
-
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- usernamestart- start position for paginationnumber- number of sites per page- Returns:
- number of sites
- Throws:
UserNotFoundException- user not foundServiceLayerException- general service error
-
getSite
Get site feed for given site- Parameters:
siteId- site id- Returns:
- SiteFeed object for the requested site
- Throws:
SiteNotFoundException- site not found
-
getSiteDetails
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
Check if publishing is enabled for given site- Parameters:
siteId- site id- Returns:
- true if publishing is enabled for given site, otherwise false
-
enablePublishing
Enable/Disable publishing for given site- Parameters:
siteId- site idenabled- true to enable publishing, false to disable publishing- Returns:
- true if operation was successful, otherwise false
- Throws:
SiteNotFoundException- site not found
-
updatePublishingStatus
Update publishing status message for given site- Parameters:
siteId- site idstatus- 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 identifierremoteName- remote nameremoteUrl- remote urlauthenticationType- authentication typeremoteUsername- remote usernameremotePassword- remote passwordremoteToken- remote tokenremotePrivateKey- remote private key- Returns:
- true if operation was successful
- Throws:
InvalidRemoteUrlException- invalid remote urlServiceLayerException- general service error
-
removeRemote
Remove remote with given name for site- Parameters:
siteId- site identifierremoteName- 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 foundorg.craftercms.commons.crypto.CryptoException- git repository helper errorServiceLayerException
-
getDeletedSites
Get deleted sites- Returns:
- List of deleted sites from DB
-
getLastCommitId
get last commit id for site- Parameters:
siteId- site identifier- Returns:
- last commit id for local studio node
-
getSiteState
-
getLastVerifiedGitlogCommitId
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
Get list of all sites with state = CREATED- Returns:
- list of sites
-
setSiteState
-
isPublishedRepoCreated
-
setPublishedRepoCreated
-
getLastSyncedGitlogCommitId
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
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
-