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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
addRemote(String siteId, String remoteName, String remoteUrl, String authenticationType, String remoteUsername, String remotePassword, String remoteToken, String remotePrivateKey)
Add remote repository for site content repositoryvoid
checkSiteExists(String site)
Checks if a site exists.boolean
checkSiteUuid(String siteId, String siteUuid)
Checks if the currently existent site with the given ID also has the same siteUuid.int
countSites()
void
createSiteFromBlueprint(String blueprintName, String siteId, String siteName, String sandboxBranch, String desc, Map<String,String> params, boolean createAsOrphan)
Create a new site based on an existing blueprintvoid
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)
Create a new site with remote option (clone from remote or push to remote repository)boolean
deleteSite(String siteId)
remove a site from the systemboolean
enablePublishing(String siteId, boolean enabled)
Enable/Disable publishing for given siteboolean
exists(String site)
Check if site already existsboolean
existsById(String id)
Check if site already existsboolean
existsByName(String name)
Check if site already existsSet<String>
getAllAvailableSites()
List<String>
getAllCreatedSites()
Get list of all sites with state = CREATEDSiteBlueprintTO[]
getAvailableBlueprints()
get a list of available blueprintsList<SiteFeed>
getDeletedSites()
Get deleted sitesString
getLastCommitId(String siteId)
get last commit id for siteString
getLastSyncedGitlogCommitId(String siteId)
get last audited git log commit id for siteString
getLastVerifiedGitlogCommitId(String siteId)
get last verified git log commit id for siteSiteFeed
getSite(String siteId)
Get site detailsList<SiteFeed>
getSitesPerUser(int start, int number)
Get sites that user is allowed access to for current userList<SiteFeed>
getSitesPerUser(String username, int start, int number)
Get sites that user is allowed access to for given usernameint
getSitesPerUserTotal()
Get total number of sites that user is allowed access to for current userint
getSitesPerUserTotal(String username)
Get total number of sites that user is allowed access to for given usernameString
getSiteState(String siteId)
boolean
isPublishedRepoCreated(String siteId)
boolean
isPublishingEnabled(String siteId)
Check if publishing is enabled for given siteList<RemoteRepositoryInfoTO>
listRemote(String siteId)
List remote repositories for given sitevoid
rebuildDatabase(String site)
Rebuild database for siteboolean
removeRemote(String siteId, String remoteName)
Remove remote with given name for sitevoid
setPublishedRepoCreated(String siteId)
void
setSiteState(String siteId, String state)
boolean
syncDatabaseWithRepo(String siteId, String fromCommitId)
Synchronize our internal database with the underlying repository.boolean
syncDatabaseWithRepo(String siteId, String fromCommitId, boolean generateAuditLog)
Synchronize our internal database with the underlying repository.void
syncRepository(String site)
Synchronize Database with repositoryvoid
updateLastCommitId(String site, String commitId)
void
updateLastSyncedGitlogCommitId(String site, String commitId)
Update last audited gitlog commit idvoid
updateLastVerifiedGitlogCommitId(String site, String commitId)
boolean
updatePublishingStatus(String siteId, String status)
Update publishing status message for given site
-
-
-
Method Detail
-
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 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, InvalidRemoteUrlException
Create 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
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 identifiercommitId
- 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 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 foundServiceLayerException
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
-
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 aSiteNotFoundException
- 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 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:
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
- usernamestart
- start position for paginationnumber
- number of sites per page- Returns:
- number of sites
- Throws:
UserNotFoundException
- user not foundServiceLayerException
- general service error
-
getSite
SiteFeed getSite(String siteId) throws SiteNotFoundException
Get site details- Parameters:
siteId
- site id- Returns:
- site details
- Throws:
SiteNotFoundException
- site not found
-
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 idenabled
- 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 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
boolean removeRemote(String siteId, String remoteName) throws SiteNotFoundException
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
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
-
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
-
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 testsiteUuid
- site UUID- Returns:
- true if the site UUID file exists and contains the same siteUUID value, false otherwise
-
-