Class BlobAwareContentRepository
java.lang.Object
org.craftercms.studio.impl.v2.repository.blob.BlobAwareContentRepository
- All Implemented Interfaces:
ContentRepository,StudioBlobAwareContentRepository,ContentRepository
public class BlobAwareContentRepository
extends Object
implements ContentRepository, StudioBlobAwareContentRepository
Implementation of
ContentRepository, ContentRepository
that delegates calls to a StudioBlobStore when appropriate- Since:
- 3.1.6
- Author:
- joseross
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StudioBlobStoreResolverprotected StringThe extension for the blob filesprotected GitContentRepositoryprotected ContentRepositoryprotected final com.fasterxml.jackson.databind.ObjectMapper -
Constructor Summary
Constructors -
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 repositoryvoidcancelPublishAll(String siteId, String publishingTarget) Performs the cleanup after a failed publish all operation for the given site & targetvoidcheckContentExists(String site, String path) Checks if a content exists at a given path and throw an exception if it does not.voidcleanupRepositories(String siteId) Performs a cleanup all repositories for the given sitebooleancommitIdExists(String site, String commitId) Check if given commit id existsbooleancommitIdExists(String site, GitRepositories repoType, String commitId) Check if given commit id (or revision string) existsvoidcompletePublishAll(String siteId, String publishingTarget, RepositoryChanges changes, String comment) Performs the actual publish of all changes for the given site & targetbooleancontentExists(String site, String path) Determine if content exists in the repository at a given pathcopyContent(String site, String fromPath, String toPath) copy content from PathA to pathBintcountUnprocessedCommits(String siteId, long marker) Count unprocessed commits from databasecreateFolder(String site, String path, String name) create a folderbooleancreateSiteCloneRemote(String siteId, String sandboxBranch, String remoteName, String remoteUrl, String remoteBranch, boolean singleBranch, String authenticationType, String remoteUsername, String remotePassword, String remoteToken, String remotePrivateKey, Map<String, String> params, boolean createAsOrphan, String creator) Create new site as a clone from remote repositorybooleancreateSiteFromBlueprint(String blueprintLocation, String siteId, String sandboxBranch, Map<String, String> params, String creator) Create a new site based on a blueprintcreateVersion(String site, String path, boolean majorVersion) create a versioncreateVersion(String site, String path, String comment, boolean majorVersion) create a versiondeleteContent(String site, String path, String approver) delete contentvoiddeleteGitLogForSite(String siteId) Delete Git log for sitebooleandeleteSite(String siteId) Deletes an existing site.voidduplicateBlobs(String sourceSiteId, String siteId) Extract every blob from the source site and storeit in the target site in the blob store matching its pathvoidduplicateSite(String sourceSiteId, String siteId, String sourceSandboxBranch, String sandboxBranch) Create copies of the source site's repositories.protected Collection<String> findCompatiblePaths(org.craftercms.commons.file.blob.BlobStore blobStore, Collection<String> paths) protected StudioBlobStoregetBlobStore(String site, String... paths) getChangeSetPathsFromDelta(String site, String commitIdFrom, String commitIdTo) Get a list of paths that changed since the commit ID provided to commit ID providedgetContent(String site, String path, boolean shallow) Get content from the repositoryOptional<org.springframework.core.io.Resource> getContentByCommitId(String site, String path, String commitId) return a specific version of the contentgetContentChildren(String site, String path) get immediate children for pathgetContentItemHistory(String site, String path) Get the history of a content item.longgetContentSize(String site, String path) get file sizegetContentVersionHistory(String site, String path) get the version history for an itemgetEditCommitIds(String site, String path, String commitIdFrom, String commitIdTo) Get a list of commits for updates on a contentGet git log object from databaseorg.craftercms.core.service.ItemgetItemEnvironmentProperties(String siteId, GitRepositories repo, String environment, String path) Get environment properties for itemgetLastEditCommitId(String siteId, String path) getOperations(String site, String commitIdFrom, String commitIdTo) Get a list of operations since the commit ID provided (compare that commit to HEAD)getOperationsFromDelta(String site, String commitIdFrom, String commitIdTo) Get a list of operations since the commit ID provided (compare that commit to HEAD)protected StringgetOriginalPath(String path) protected StringgetPathFromPointerPath(String siteId, String pointerPath) protected StringgetPointerPath(String siteId, String path) getPreviousCommitId(String siteId, String commitId) Get the previous commit id from repository for given a site id and a commit idgetPublishingHistory(String siteId, String environment, String path, String publisher, ZonedDateTime fromDate, ZonedDateTime toDate, int limit) Get publishing historygetRepoFirstCommitId(String site) Get first id from repository for given sitegetRepoLastCommitId(String site) Get last commit id from repository for given site.protected StringgetRepoPath(String blobPath) Gets an asset path and translate it to the actual file path in git repo.getSubtreeItems(String site, String path, GitRepositories repoType, String branch) List subtree items for give site and pathgetUnauditedCommits(String siteId, int batchSize) Get unaudited commits from databasegetUnprocessedCommits(String siteId, long marker) Get unprocessed commits from databasevoidinitialPublish(String siteId) Execute initial publish for given sitevoidinitialPublish(String site, String sandboxBranch, String environment, String author, String comment) Initial publish to specified environment.voidinsertFullGitLog(String siteId, int processed) Insert Full Git LogvoidinsertGitLog(String siteId, String commitId, int processed) Insert Git LogvoidinsertGitLog(String siteId, String commitId, int processed, int audited) Insert Git LogbooleanCheck if content at given path is foldervoiditemUnlock(String site, String path) unlock an itemlistRemote(String siteId, String sandboxBranch) List remote repositories for given sitevoidlock an item NOTE: site will be removed from this interfacevoidlockItemForPublishing(String site, String path) lock an item NOTE: site will be removed from this interfaceprotected DeploymentItemTOvoidmarkGitLogAudited(String siteId, String commitId) Mark Git log as auditedvoidmarkGitLogProcessedBeforeMarker(String siteId, long marker, int processed) Mark all git logs as processed if they are inserted before markervoidmarkGitLogVerifiedProcessed(String siteId, String commitId) Mark Git log as verifiedvoidmarkGitLogVerifiedProcessedBulk(String siteId, List<String> commitIds) Mark Git logs as verifiedmoveContent(String site, String fromPath, String toPath, String newName) move content from PathA to pathBprotected Stringprotected booleanpointersExist(String siteId, String... paths) voidpopulateGitLog(String siteId) Populates the full git log of the sandbox repository into the databasepreparePublishAll(String siteId, String publishingTarget) Prepares the repository to publish all changes for the given site & targetvoidpublish(String site, String sandboxBranch, List<DeploymentItemTO> deploymentItems, String environment, String author, String comment) Publish content to specified environment.publishAll(String siteId, String publishingTarget, String comment) Publishes all changes for the given site & targetbooleanpublishedRepositoryExists(String siteId) Check if published repository exists for given site.booleanpullFromRemote(String siteId, String remoteName, String remoteBranch) Pull from remote repositorybooleanpushToRemote(String siteId, String remoteName, String remoteBranch) Push content to remote repositorybooleanremoveRemote(String siteId, String remoteName) Remove remote with given name for sitevoidRemove all remotes for given sitebooleanrepositoryExists(String site) Check if repository exists for given sitevoidresetStagingRepository(String siteId) Reset staging repository to live for given siterevertContent(String site, String path, String version, boolean major, String comment) revert a version (create a new version based on an old version)voidsetBlobStoreResolver(StudioBlobStoreResolver blobStoreResolver) voidsetFileExtension(String fileExtension) voidsetLocalRepositoryV1(GitContentRepository localRepositoryV1) voidsetLocalRepositoryV2(ContentRepository localRepositoryV2) voidsetServicesConfig(ServicesConfig servicesConfig) booleanshallowContentExists(String site, String path) This is a faster, but less accurate, version of contentExists.protected Collection<String> translatePaths(Collection<String> paths) voidunLockItem(String site, String path) unlock an item for publishing NOTE: site will be removed from this interfacevoidunLockItemForPublishing(String site, String path) unlock an item for publishing NOTE: site will be removed from this interfacevoidupdateGitlog(String siteId, String lastProcessedCommitId, int batchSize) Update gitlog table with commit ids from repositoryvoidupsertGitLogList(String siteId, List<String> commitIds, boolean processed, boolean audited) Upsert git logs as processed and auditedwriteContent(String site, String path, InputStream content) write contentMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.craftercms.studio.api.v1.repository.ContentRepository
getContent, moveContentMethods inherited from interface org.craftercms.studio.api.v2.repository.ContentRepository
getItemPaths, getSubtreeItems
-
Field Details
-
fileExtension
The extension for the blob files -
localRepositoryV1
-
localRepositoryV2
-
blobStoreResolver
-
objectMapper
protected final com.fasterxml.jackson.databind.ObjectMapper objectMapper
-
-
Constructor Details
-
BlobAwareContentRepository
public BlobAwareContentRepository()
-
-
Method Details
-
setServicesConfig
-
setFileExtension
-
setLocalRepositoryV1
-
setLocalRepositoryV2
-
setBlobStoreResolver
-
getOriginalPath
-
getPointerPath
-
getPathFromPointerPath
-
normalize
-
getBlobStore
- Throws:
ServiceLayerException
-
pointersExist
-
contentExists
Description copied from interface:ContentRepositoryDetermine if content exists in the repository at a given path- Specified by:
contentExistsin interfaceContentRepository- Specified by:
contentExistsin interfaceContentRepository- Parameters:
site- site id where the operation will be executedpath- path to check if content exists- Returns:
- true if site has content object at path
-
checkContentExists
Description copied from interface:ContentRepositoryChecks if a content exists at a given path and throw an exception if it does not.- Specified by:
checkContentExistsin interfaceContentRepository- Parameters:
site- id of the sitepath- the content path- Throws:
ServiceLayerException- if no content is found at the given path
-
shallowContentExists
Description copied from interface:ContentRepositoryThis is a faster, but less accurate, version of contentExists. This prioritizes performance over checking the actual underlying repository if the content is actually in the store or we simply hold a reference to the object in the actual store.- Specified by:
shallowContentExistsin interfaceContentRepository- Specified by:
shallowContentExistsin interfaceContentRepository- Returns:
- true if site has content object at path
-
getContent
Description copied from interface:ContentRepositoryGet content from the repository- Specified by:
getContentin interfaceContentRepository- Parameters:
site- the site idpath- the path of the contentshallow- if true, it will load the file from disk directly, instead of retrieving it from git repository- Returns:
- InputStream to read the content
-
getContentSize
Description copied from interface:ContentRepositoryget file size- Specified by:
getContentSizein interfaceContentRepository- Parameters:
site- site id where the operation will be executedpath- path to content- Returns:
- Size in bytes
-
writeContent
public String writeContent(String site, String path, InputStream content) throws ServiceLayerException Description copied from interface:ContentRepositorywrite content- Specified by:
writeContentin interfaceContentRepository- Parameters:
site- site id where the operation will be executedpath- path to contentcontent- stream of content to write- Returns:
- Commit Id if successful, null otherwise
- Throws:
ServiceLayerException- if error happens during write
-
createFolder
Description copied from interface:ContentRepositorycreate a folder- Specified by:
createFolderin interfaceContentRepository- Parameters:
site- site id where the operation will be executedpath- path to create a folder inname- a folder name to create- Returns:
- Commit Id if successful, null otherwise
-
deleteContent
Description copied from interface:ContentRepositorydelete content- Specified by:
deleteContentin interfaceContentRepository- Parameters:
site- site id where the operation will be executedpath- path to contentapprover- user that approves delete content- Returns:
- Commit ID if successful, null otherwise
- Throws:
ServiceLayerException
-
moveContent
Description copied from interface:ContentRepositorymove content from PathA to pathB- Specified by:
moveContentin interfaceContentRepository- Parameters:
site- site id where the operation will be executedfromPath- source contenttoPath- target pathnewName- new file name for rename- Returns:
- Commit ID if successful, empty string otherwise
-
copyContent
Description copied from interface:ContentRepositorycopy content from PathA to pathB- Specified by:
copyContentin interfaceContentRepository- Parameters:
site- site id where the operation will be executedfromPath- paths to contenttoPath- target path- Returns:
- Commit ID if successful, empty string otherwise
-
getContentChildren
Description copied from interface:ContentRepositoryget immediate children for path- Specified by:
getContentChildrenin interfaceContentRepository- Parameters:
site- site id where the operation will be executedpath- path to content- Returns:
- a list of children
-
getContentVersionHistory
Description copied from interface:ContentRepositoryget the version history for an item- Specified by:
getContentVersionHistoryin interfaceContentRepository- Parameters:
site- - the project IDpath- - the path of the item- Returns:
- a list of versions
-
getContentItemHistory
Description copied from interface:ContentRepositoryGet the history of a content item.
Note: the results of this method are not guaranteed when the path does not currently exist in the repository.- Specified by:
getContentItemHistoryin interfaceContentRepository- Parameters:
site- site idpath- path of the content item- Returns:
- list of item versions
-
duplicateSite
public void duplicateSite(String sourceSiteId, String siteId, String sourceSandboxBranch, String sandboxBranch) throws IOException, ServiceLayerException Description copied from interface:ContentRepositoryCreate copies of the source site's repositories. This method will copy sandbox and published (if exists) repositories under a new directory with the new site id. For sandbox repository, a new branch will be created (from the currently checked-out branch) with the given sandbox branch name if it does not exist.- Specified by:
duplicateSitein interfaceContentRepository- Parameters:
sourceSiteId- source site idsiteId- new site idsandboxBranch- sandbox branch name- Throws:
IOException- if there is any error while copying the directoriesServiceLayerException
-
duplicateBlobs
Description copied from interface:StudioBlobAwareContentRepositoryExtract every blob from the source site and storeit in the target site in the blob store matching its path- Specified by:
duplicateBlobsin interfaceStudioBlobAwareContentRepository- Parameters:
sourceSiteId- the source sitesiteId- the target site- Throws:
ServiceLayerException- if an error occurs during the operation
-
createVersion
Description copied from interface:ContentRepositorycreate a version- Specified by:
createVersionin interfaceContentRepository- Parameters:
site- site id where the operation will be executedpath- location of contentmajorVersion- true if major- Returns:
- the created version ID or null on failure
-
createVersion
Description copied from interface:ContentRepositorycreate a version- Specified by:
createVersionin interfaceContentRepository- Parameters:
site- site id where the operation will be executedpath- location of contentcomment- version history commentmajorVersion- true if major- Returns:
- the created version ID or null on failure
-
revertContent
public String revertContent(String site, String path, String version, boolean major, String comment) Description copied from interface:ContentRepositoryrevert a version (create a new version based on an old version)- Specified by:
revertContentin interfaceContentRepository- Parameters:
site- site id where the operation will be executedpath- - the path of the item to "revert"version- - old version ID to base to version onmajor- flag if it is major versioncomment- add comment when committing content- Returns:
- Commit ID if successful, empty string otherwise
-
getContentByCommitId
public Optional<org.springframework.core.io.Resource> getContentByCommitId(String site, String path, String commitId) Description copied from interface:ContentRepositoryreturn a specific version of the content- Specified by:
getContentByCommitIdin interfaceContentRepository- Parameters:
site- site id where the operation will be executedpath- path of the contentcommitId- version to return- Returns:
- the resource if available
-
lockItem
Description copied from interface:ContentRepositorylock an item NOTE: site will be removed from this interface- Specified by:
lockItemin interfaceContentRepository- Parameters:
site- site id where the operation will be executedpath- path of the item
-
lockItemForPublishing
Description copied from interface:ContentRepositorylock an item NOTE: site will be removed from this interface- Specified by:
lockItemForPublishingin interfaceContentRepository- Parameters:
site- site id where the operation will be executedpath- path of the item
-
unLockItem
Description copied from interface:ContentRepositoryunlock an item for publishing NOTE: site will be removed from this interface- Specified by:
unLockItemin interfaceContentRepository- Parameters:
site- site id where the operation will be executedpath- path of the item
-
unLockItemForPublishing
Description copied from interface:ContentRepositoryunlock an item for publishing NOTE: site will be removed from this interface- Specified by:
unLockItemForPublishingin interfaceContentRepository- Parameters:
site- site id where the operation will be executedpath- path of the item
-
isFolder
Description copied from interface:ContentRepositoryCheck if content at given path is folder- Specified by:
isFolderin interfaceContentRepository- Parameters:
siteId- site identifierpath- content path- Returns:
- true if path is folder, otherwise false
-
deleteSite
Description copied from interface:ContentRepositoryDeletes an existing site.- Specified by:
deleteSitein interfaceContentRepository- Parameters:
siteId- site to delete- Returns:
- true if successful, false otherwise
-
initialPublish
public void initialPublish(String site, String sandboxBranch, String environment, String author, String comment) throws DeploymentException Description copied from interface:ContentRepositoryInitial publish to specified environment.- Specified by:
initialPublishin interfaceContentRepository- Parameters:
site- site identifiersandboxBranch- sandbox branch nameenvironment- environment to publishauthor- authorcomment- comment- Throws:
DeploymentException- deployment error
-
mapDeploymentItem
-
getRepoLastCommitId
Description copied from interface:ContentRepositoryGet last commit id from repository for given site.- Specified by:
getRepoLastCommitIdin interfaceContentRepository- Specified by:
getRepoLastCommitIdin interfaceContentRepository- Parameters:
site- site id- Returns:
- last commit id (current HEAD)
-
getRepoFirstCommitId
Description copied from interface:ContentRepositoryGet first id from repository for given site- Specified by:
getRepoFirstCommitIdin interfaceContentRepository- Specified by:
getRepoFirstCommitIdin interfaceContentRepository- Parameters:
site- site id- Returns:
- first commit id
-
getEditCommitIds
public List<String> getEditCommitIds(String site, String path, String commitIdFrom, String commitIdTo) Description copied from interface:ContentRepositoryGet a list of commits for updates on a content- Specified by:
getEditCommitIdsin interfaceContentRepository- Parameters:
site- site idpath- pathcommitIdFrom- range from commit id (inclusive)commitIdTo- range to commit id (inclusive)- Returns:
- list of edit commit ids
-
insertFullGitLog
Description copied from interface:ContentRepositoryInsert Full Git Log- Specified by:
insertFullGitLogin interfaceContentRepository- Parameters:
siteId- siteprocessed- processed
-
deleteGitLogForSite
Description copied from interface:ContentRepositoryDelete Git log for site- Specified by:
deleteGitLogForSitein interfaceContentRepository- Parameters:
siteId- site identifier
-
addRemote
public boolean addRemote(String siteId, String remoteName, String remoteUrl, String authenticationType, String remoteUsername, String remotePassword, String remoteToken, String remotePrivateKey) throws InvalidRemoteUrlException, ServiceLayerException Description copied from interface:ContentRepositoryAdd remote repository for site content repository- Specified by:
addRemotein interfaceContentRepository- 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 url for remote repositoryServiceLayerException- general service error
-
removeRemoteRepositoriesForSite
Description copied from interface:ContentRepositoryRemove all remotes for given site- Specified by:
removeRemoteRepositoriesForSitein interfaceContentRepository- Parameters:
siteId- site identifier
-
listRemote
public List<RemoteRepositoryInfoTO> listRemote(String siteId, String sandboxBranch) throws ServiceLayerException Description copied from interface:ContentRepositoryList remote repositories for given site- Specified by:
listRemotein interfaceContentRepository- Parameters:
siteId- site identifiersandboxBranch- sandbox branch name- Returns:
- list of names of remote repositories
- Throws:
ServiceLayerException- general service error
-
pushToRemote
public boolean pushToRemote(String siteId, String remoteName, String remoteBranch) throws ServiceLayerException, InvalidRemoteUrlException Description copied from interface:ContentRepositoryPush content to remote repository- Specified by:
pushToRemotein interfaceContentRepository- Parameters:
siteId- site identifierremoteName- remote nameremoteBranch- remote branch- Returns:
- true if operation was successful
- Throws:
ServiceLayerException- general service errorInvalidRemoteUrlException- invalid url for remote repository
-
pullFromRemote
public boolean pullFromRemote(String siteId, String remoteName, String remoteBranch) throws ServiceLayerException, InvalidRemoteUrlException Description copied from interface:ContentRepositoryPull from remote repository- Specified by:
pullFromRemotein interfaceContentRepository- Parameters:
siteId- site identifierremoteName- remote nameremoteBranch- remote branch- Returns:
- true if operation was successful
- Throws:
ServiceLayerException- general service errorInvalidRemoteUrlException- invalid url for remote repository
-
resetStagingRepository
Description copied from interface:ContentRepositoryReset staging repository to live for given site- Specified by:
resetStagingRepositoryin interfaceContentRepository- Parameters:
siteId- site identifier to use for resetting- Throws:
ServiceLayerException- general service error
-
cleanupRepositories
Description copied from interface:ContentRepositoryPerforms a cleanup all repositories for the given site- Specified by:
cleanupRepositoriesin interfaceContentRepository- Parameters:
siteId- site identifier
-
createSiteFromBlueprint
public boolean createSiteFromBlueprint(String blueprintLocation, String siteId, String sandboxBranch, Map<String, String> params, String creator) Description copied from interface:ContentRepositoryCreate a new site based on a blueprint- Specified by:
createSiteFromBlueprintin interfaceContentRepository- Parameters:
blueprintLocation- blueprint locationsiteId- site identifiersandboxBranch- sandbox branch nameparams- site parameterscreator- site creator- Returns:
- true if successful, false otherwise
-
publish
public void publish(String site, String sandboxBranch, List<DeploymentItemTO> deploymentItems, String environment, String author, String comment) throws DeploymentException Description copied from interface:ContentRepositoryPublish content to specified environment.- Specified by:
publishin interfaceContentRepository- Parameters:
site- site identifiersandboxBranch- sandbox branch namedeploymentItems- items to be publishedenvironment- environment to publish toauthor- authorcomment- submission comment- Throws:
DeploymentException- deployment error
-
commitIdExists
Description copied from interface:ContentRepositoryCheck if given commit id exists- Specified by:
commitIdExistsin interfaceContentRepository- Parameters:
site- site idcommitId- commit id to check- Returns:
- true if it exists in site repository, otherwise false
-
commitIdExists
Description copied from interface:ContentRepositoryCheck if given commit id (or revision string) exists- Specified by:
commitIdExistsin interfaceContentRepository- Parameters:
site- site idrepoType- repository typecommitId- commit id or revision to check- Returns:
- true if it exists in site repository, otherwise false
-
createSiteCloneRemote
public boolean createSiteCloneRemote(String siteId, String sandboxBranch, String remoteName, String remoteUrl, String remoteBranch, boolean singleBranch, String authenticationType, String remoteUsername, String remotePassword, String remoteToken, String remotePrivateKey, Map<String, String> params, boolean createAsOrphan, String creator) throws InvalidRemoteRepositoryException, InvalidRemoteRepositoryCredentialsException, RemoteRepositoryNotFoundException, ServiceLayerExceptionDescription copied from interface:ContentRepositoryCreate new site as a clone from remote repository- Specified by:
createSiteCloneRemotein interfaceContentRepository- Parameters:
siteId- site identifiersandboxBranch- sandbox branch nameremoteName- remote nameremoteUrl- remote repository urlremoteBranch- remote branch namesingleBranch- flag to signal if clone single branch or full repositoryauthenticationType- type of authentication to use to connect remote repositoryremoteUsername- remote usernameremotePassword- remote passwordremoteToken- remote tokenremotePrivateKey- remote private keyparams- site parameterscreateAsOrphan- create as orphancreator- site creator- Returns:
- true if success
- Throws:
InvalidRemoteRepositoryException- invalid remote repositoryInvalidRemoteRepositoryCredentialsException- invalid credentials for remote repositoryRemoteRepositoryNotFoundException- remote repository not foundServiceLayerException- general service error
-
removeRemote
Description copied from interface:ContentRepositoryRemove remote with given name for site- Specified by:
removeRemotein interfaceContentRepository- Parameters:
siteId- site identifierremoteName- remote name- Returns:
- true if operation was successful
-
repositoryExists
Description copied from interface:ContentRepositoryCheck if repository exists for given site- Specified by:
repositoryExistsin interfaceContentRepository- Parameters:
site- site id- Returns:
- true if repository exists, otherwise false
-
getGitLog
Description copied from interface:ContentRepositoryGet git log object from database- Specified by:
getGitLogin interfaceContentRepository- Parameters:
siteId- site idcommitId- commit ID- Returns:
- git log object
-
markGitLogVerifiedProcessed
Description copied from interface:ContentRepositoryMark Git log as verified- Specified by:
markGitLogVerifiedProcessedin interfaceContentRepository- Parameters:
siteId- site identifiercommitId- commit id
-
insertGitLog
Description copied from interface:ContentRepositoryInsert Git Log- Specified by:
insertGitLogin interfaceContentRepository- Parameters:
siteId- sitecommitId- commit IDprocessed- processed
-
insertGitLog
Description copied from interface:ContentRepositoryInsert Git Log- Specified by:
insertGitLogin interfaceContentRepository- Parameters:
siteId- sitecommitId- commit IDprocessed- processedaudited- audited
-
getSubtreeItems
public List<String> getSubtreeItems(String site, String path, GitRepositories repoType, String branch) Description copied from interface:ContentRepositoryList subtree items for give site and path- Specified by:
getSubtreeItemsin interfaceContentRepository- Parameters:
site- site identifierpath- path for subtree rootrepoType- repository typebranch- A git object references expression (e.g.: HEAD, branch name, commit id)- Returns:
- list of item paths contained in the subtree
-
getOperations
Description copied from interface:ContentRepositoryGet a list of operations since the commit ID provided (compare that commit to HEAD)- Specified by:
getOperationsin interfaceContentRepository- Parameters:
site- site to usecommitIdFrom- commit ID to start atcommitIdTo- commit ID to end at- Returns:
- commit ID of current HEAD, updated operationsSinceCommit
-
getOperationsFromDelta
public List<RepoOperation> getOperationsFromDelta(String site, String commitIdFrom, String commitIdTo) Description copied from interface:ContentRepositoryGet a list of operations since the commit ID provided (compare that commit to HEAD)- Specified by:
getOperationsFromDeltain interfaceContentRepository- Parameters:
site- site to usecommitIdFrom- commit ID to start atcommitIdTo- commit ID to end at- Returns:
- commit ID of current HEAD, updated operationsSinceCommit
-
getPublishingHistory
public List<PublishingHistoryItem> getPublishingHistory(String siteId, String environment, String path, String publisher, ZonedDateTime fromDate, ZonedDateTime toDate, int limit) Description copied from interface:ContentRepositoryGet publishing history- Specified by:
getPublishingHistoryin interfaceContentRepository- Parameters:
siteId- site identifierenvironment- environmentpath- path regular expression to use as filterpublisher- user to filter byfromDate- lower boundary for published datetoDate- upper boundary for published datelimit- number of records to return- Returns:
- publishing history
-
getItem
- Specified by:
getItemin interfaceContentRepository
-
getLastEditCommitId
- Specified by:
getLastEditCommitIdin interfaceContentRepository
-
getChangeSetPathsFromDelta
public Map<String,String> getChangeSetPathsFromDelta(String site, String commitIdFrom, String commitIdTo) Description copied from interface:ContentRepositoryGet a list of paths that changed since the commit ID provided to commit ID provided- Specified by:
getChangeSetPathsFromDeltain interfaceContentRepository- Parameters:
site- site to usecommitIdFrom- commit ID to start atcommitIdTo- commit ID to end at- Returns:
- list of paths of files that changed between two commits
-
markGitLogAudited
Description copied from interface:ContentRepositoryMark Git log as audited- Specified by:
markGitLogAuditedin interfaceContentRepository- Parameters:
siteId- site identifiercommitId- commit id
-
updateGitlog
Description copied from interface:ContentRepositoryUpdate gitlog table with commit ids from repository- Specified by:
updateGitlogin interfaceContentRepository- Parameters:
siteId- site identifierlastProcessedCommitId- last processed commit idbatchSize- size of a batch to update
-
getUnauditedCommits
Description copied from interface:ContentRepositoryGet unaudited commits from database- Specified by:
getUnauditedCommitsin interfaceContentRepository- Parameters:
siteId- site identifierbatchSize- size of a batch to retrieve- Returns:
- list of gitlog records
-
getUnprocessedCommits
Description copied from interface:ContentRepositoryGet unprocessed commits from database- Specified by:
getUnprocessedCommitsin interfaceContentRepository- Parameters:
siteId- site identifiermarker- id of last verified commit Id- Returns:
- list of gitlog records
-
getItemEnvironmentProperties
public DetailedItem.Environment getItemEnvironmentProperties(String siteId, GitRepositories repo, String environment, String path) Description copied from interface:ContentRepositoryGet environment properties for item- Specified by:
getItemEnvironmentPropertiesin interfaceContentRepository- Parameters:
siteId- site identifierrepo- repository typeenvironment- branchpath- path of the item- Returns:
- environment properties
-
countUnprocessedCommits
Description copied from interface:ContentRepositoryCount unprocessed commits from database- Specified by:
countUnprocessedCommitsin interfaceContentRepository- Parameters:
siteId- site identifiermarker- id of last verified commit Id- Returns:
- number of unprocessed gitlog records
-
markGitLogProcessedBeforeMarker
Description copied from interface:ContentRepositoryMark all git logs as processed if they are inserted before marker- Specified by:
markGitLogProcessedBeforeMarkerin interfaceContentRepository- Parameters:
siteId- site identifiermarker- marker git commitprocessed- value for processed
-
getPreviousCommitId
Description copied from interface:ContentRepositoryGet the previous commit id from repository for given a site id and a commit id- Specified by:
getPreviousCommitIdin interfaceContentRepository- Parameters:
siteId- site identifiercommitId- commit Id- Returns:
-
itemUnlock
Description copied from interface:ContentRepositoryunlock an item- Specified by:
itemUnlockin interfaceContentRepository- Parameters:
site- site id where the operation will be executedpath- path of the item
-
markGitLogVerifiedProcessedBulk
Description copied from interface:ContentRepositoryMark Git logs as verified- Specified by:
markGitLogVerifiedProcessedBulkin interfaceContentRepository- Parameters:
siteId- site identifiercommitIds- list of commit ids
-
upsertGitLogList
public void upsertGitLogList(String siteId, List<String> commitIds, boolean processed, boolean audited) Description copied from interface:ContentRepositoryUpsert git logs as processed and audited- Specified by:
upsertGitLogListin interfaceContentRepository- Parameters:
siteId- site identifiercommitIds- commit idsprocessed- true if already processedaudited- true if already audited
-
publishedRepositoryExists
Description copied from interface:ContentRepositoryCheck if published repository exists for given site.- Specified by:
publishedRepositoryExistsin interfaceContentRepository- Parameters:
siteId- site identifier- Returns:
- true if PUBLISHED repository exists, otherwise false
-
initialPublish
Description copied from interface:ContentRepositoryExecute initial publish for given site- Specified by:
initialPublishin interfaceContentRepository- Parameters:
siteId- site identifier- Throws:
SiteNotFoundException
-
publishAll
public RepositoryChanges publishAll(String siteId, String publishingTarget, String comment) throws ServiceLayerException Description copied from interface:ContentRepositoryPublishes all changes for the given site & target- Specified by:
publishAllin interfaceContentRepository- Parameters:
siteId- the id of the sitepublishingTarget- the publishing targetcomment- submission comment- Throws:
ServiceLayerException
-
getRepoPath
Gets an asset path and translate it to the actual file path in git repo. e.g.: /static-assets/test/my-image.png to static-assets/test/my-image.png.blob- Parameters:
blobPath- the asset path- Returns:
- the git repo path
-
translatePaths
-
findCompatiblePaths
protected Collection<String> findCompatiblePaths(org.craftercms.commons.file.blob.BlobStore blobStore, Collection<String> paths) -
preparePublishAll
Description copied from interface:ContentRepositoryPrepares the repository to publish all changes for the given site & target- Specified by:
preparePublishAllin interfaceContentRepository- Parameters:
siteId- the id of the sitepublishingTarget- the publishing target- Returns:
- the set of changed files
-
completePublishAll
public void completePublishAll(String siteId, String publishingTarget, RepositoryChanges changes, String comment) Description copied from interface:ContentRepositoryPerforms the actual publish of all changes for the given site & target- Specified by:
completePublishAllin interfaceContentRepository- Parameters:
siteId- the id of the sitepublishingTarget- the publishing targetchanges- the set of changed filescomment- submission comment
-
cancelPublishAll
Description copied from interface:ContentRepositoryPerforms the cleanup after a failed publish all operation for the given site & target- Specified by:
cancelPublishAllin interfaceContentRepository- Parameters:
siteId- the id of the sitepublishingTarget- the publishing target
-
populateGitLog
public void populateGitLog(String siteId) throws org.eclipse.jgit.api.errors.GitAPIException, IOException Description copied from interface:ContentRepositoryPopulates the full git log of the sandbox repository into the database- Specified by:
populateGitLogin interfaceContentRepository- Parameters:
siteId- the id of the site- Throws:
org.eclipse.jgit.api.errors.GitAPIException- if there is any error reading the git logIOException- if there is any error executing the db script
-