Class DependencyServiceImpl
- java.lang.Object
-
- org.craftercms.studio.impl.v1.service.dependency.DependencyServiceImpl
-
- All Implemented Interfaces:
DependencyService
public class DependencyServiceImpl extends Object implements DependencyService
-
-
Field Summary
Fields Modifier and Type Field Description protected ContentRepository
contentRepository
protected ContentService
contentService
protected DependencyMapper
dependencyMapper
protected DependencyResolver
dependencyResolver
protected DependencyServiceInternal
dependencyService
protected GeneralLockService
generalLockService
protected ItemDAO
itemDao
protected RetryingDatabaseOperationFacade
retryingDatabaseOperationFacade
protected ServicesConfig
servicesConfig
protected SiteService
siteService
protected StudioConfiguration
studioConfiguration
protected org.springframework.transaction.PlatformTransactionManager
transactionManager
-
Constructor Summary
Constructors Constructor Description DependencyServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,List<CalculateDependenciesEntityTO>>
calculateDependencies(String site, List<String> paths)
Calculate dependencies for publishingSet<String>
calculateDependenciesPaths(String site, List<String> paths)
Calculate dependencies paths for publishingList<DependencyEntity>
createDependencyEntities(String site, String path, Set<String> dependencyPaths, String dependencyType, Set<String> extractedPaths)
void
deleteAllSourceDependencies(String site, String path)
void
deleteItemDependencies(String site, String path)
Delete an item dependencies from the database.void
deleteSiteDependencies(String site)
Delete all dependencies from the database for a given site.ContentRepository
getContentRepository()
ContentService
getContentService()
Set<String>
getDeleteDependencies(String site, String path)
Set<String>
getDeleteDependencies(String site, List<String> paths)
DependencyMapper
getDependencyMapper()
DependencyResolver
getDependencyResolver()
DependencyServiceInternal
getDependencyService()
GeneralLockService
getGeneralLockService()
ItemDAO
getItemDao()
Set<String>
getItemDependencies(String site, String path, int depth)
Get all item dependencies of an item.Set<String>
getItemsDependingOn(String site, String path, int depth)
Get all items that depend on this item.Set<String>
getItemSpecificDependencies(String site, String path, int depth)
Get item-specific dependencies of an item.protected List<String>
getItemSpecificDependenciesPatterns()
List<String>
getPublishingDependencies(String site, String path)
Get a all publishing dependencies of a list of items.List<String>
getPublishingDependencies(String site, List<String> paths)
Get a all publishing dependencies of a list of items.RetryingDatabaseOperationFacade
getRetryingDatabaseOperationFacade()
ServicesConfig
getServicesConfig()
SiteService
getSiteService()
StudioConfiguration
getStudioConfiguration()
org.springframework.transaction.PlatformTransactionManager
getTransactionManager()
void
insertDependenciesIntoDatabase(List<DependencyEntity> dependencyEntities)
Set<String>
moveDependencies(String site, String oldPath, String newPath)
Move an item and make sure dependency paths remain correct.void
setContentRepository(ContentRepository contentRepository)
void
setContentService(ContentService contentService)
void
setDependencyMapper(DependencyMapper dependencyMapper)
void
setDependencyResolver(DependencyResolver dependencyResolver)
void
setDependencyService(DependencyServiceInternal dependencyService)
void
setGeneralLockService(GeneralLockService generalLockService)
void
setItemDao(ItemDAO itemDao)
void
setRetryingDatabaseOperationFacade(RetryingDatabaseOperationFacade retryingDatabaseOperationFacade)
void
setServicesConfig(ServicesConfig servicesConfig)
void
setSiteService(SiteService siteService)
void
setStudioConfiguration(StudioConfiguration studioConfiguration)
void
setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
Set<String>
upsertDependencies(String site, String path)
Scan item for direct dependencies and synchronize those to the depenencies database adding the new deps, updating existing, and removing what was removed from the item.Set<String>
upsertDependencies(String site, List<String> paths)
Scan a list of items for direct dependencies and synchroniz those to the depenencies database adding the new deps, updating existing, and removing what was removed from the item.
-
-
-
Field Detail
-
dependencyMapper
protected DependencyMapper dependencyMapper
-
studioConfiguration
protected StudioConfiguration studioConfiguration
-
siteService
protected SiteService siteService
-
contentService
protected ContentService contentService
-
dependencyResolver
protected DependencyResolver dependencyResolver
-
transactionManager
protected org.springframework.transaction.PlatformTransactionManager transactionManager
-
contentRepository
protected ContentRepository contentRepository
-
servicesConfig
protected ServicesConfig servicesConfig
-
dependencyService
protected DependencyServiceInternal dependencyService
-
itemDao
protected ItemDAO itemDao
-
generalLockService
protected GeneralLockService generalLockService
-
retryingDatabaseOperationFacade
protected RetryingDatabaseOperationFacade retryingDatabaseOperationFacade
-
-
Method Detail
-
upsertDependencies
public Set<String> upsertDependencies(String site, String path) throws ServiceLayerException
Description copied from interface:DependencyService
Scan item for direct dependencies and synchronize those to the depenencies database adding the new deps, updating existing, and removing what was removed from the item.- Specified by:
upsertDependencies
in interfaceDependencyService
- Parameters:
site
- Site to operate onpath
- Path to item to scan- Returns:
- set of upserted dependencies
- Throws:
SiteNotFoundException
- Site doesn't existContentNotFoundException
- Path doesn't existServiceLayerException
- Internal error, see exception details
-
upsertDependencies
public Set<String> upsertDependencies(String site, List<String> paths) throws ServiceLayerException
Description copied from interface:DependencyService
Scan a list of items for direct dependencies and synchroniz those to the depenencies database adding the new deps, updating existing, and removing what was removed from the item.- Specified by:
upsertDependencies
in interfaceDependencyService
- Parameters:
site
- Site to operate onpaths
- List of paths to items to scan- Returns:
- set of upserted dependencies
- Throws:
SiteNotFoundException
- Site doesn't existContentNotFoundException
- One or more paths doesn't exist (database won't be updated for any of the items)ServiceLayerException
- Internal error, see exception details
-
createDependencyEntities
public List<DependencyEntity> createDependencyEntities(String site, String path, Set<String> dependencyPaths, String dependencyType, Set<String> extractedPaths)
-
insertDependenciesIntoDatabase
public void insertDependenciesIntoDatabase(List<DependencyEntity> dependencyEntities)
-
getPublishingDependencies
public List<String> getPublishingDependencies(String site, String path) throws ServiceLayerException
Description copied from interface:DependencyService
Get a all publishing dependencies of a list of items. A publishing dependency is: * Never-published item that this item depends on * Item-specific dependency that has been modified but not published- Specified by:
getPublishingDependencies
in interfaceDependencyService
- Parameters:
site
- Site to operate onpath
- Paths to item to retrieve deps for- Returns:
- list of mandatory dependencies paths for publishing
- Throws:
SiteNotFoundException
- Site doesn't existContentNotFoundException
- Path doesn't existServiceLayerException
- Internal error, see exception details
-
getPublishingDependencies
public List<String> getPublishingDependencies(String site, List<String> paths) throws ServiceLayerException
Description copied from interface:DependencyService
Get a all publishing dependencies of a list of items. A publishing dependency is: * Never-published item that this item depends on * Item-specific dependency that has been modified but not published- Specified by:
getPublishingDependencies
in interfaceDependencyService
- Parameters:
site
- Site to operate onpaths
- List of paths to items to retrieve deps for- Returns:
- list of mandatory dependencies paths for publishing
- Throws:
SiteNotFoundException
- Site doesn't existContentNotFoundException
- One or more paths doesn't existServiceLayerException
- Internal error, see exception details
-
getItemSpecificDependencies
public Set<String> getItemSpecificDependencies(String site, String path, int depth) throws ServiceLayerException
Description copied from interface:DependencyService
Get item-specific dependencies of an item. An item-specific dependency is: * Only referenced by the parent item * Sits in a special path pattern defined during content modeling- Specified by:
getItemSpecificDependencies
in interfaceDependencyService
- Parameters:
site
- Site to operate onpath
- Path to items to retrieve deps fordepth
- Depth of tree to traverse. Depth of -1 disables depth limits- Returns:
- set of hard dependencies
- Throws:
SiteNotFoundException
- Site doesn't existContentNotFoundException
- Path doesn't existServiceLayerException
- Internal error, see exception details
-
getItemDependencies
public Set<String> getItemDependencies(String site, String path, int depth) throws ServiceLayerException
Description copied from interface:DependencyService
Get all item dependencies of an item.- Specified by:
getItemDependencies
in interfaceDependencyService
- Parameters:
site
- Site to operate onpath
- Path to items to retrieve deps fordepth
- Depth of tree to traverse. Depth of -1 disables depth limits- Returns:
- set of items that given item depends on
- Throws:
SiteNotFoundException
- Site doesn't existContentNotFoundException
- Path doesn't existServiceLayerException
- Internal error, see exception details
-
getItemsDependingOn
public Set<String> getItemsDependingOn(String site, String path, int depth) throws ServiceLayerException
Description copied from interface:DependencyService
Get all items that depend on this item.- Specified by:
getItemsDependingOn
in interfaceDependencyService
- Parameters:
site
- Site to operate onpath
- Path to items to retrieve deps fordepth
- Depth of tree to traverse. Depth of -1 disables depth limits- Returns:
- set of items depending on given item path
- Throws:
SiteNotFoundException
- Site doesn't existContentNotFoundException
- Path doesn't existServiceLayerException
- Internal error, see exception details
-
moveDependencies
public Set<String> moveDependencies(String site, String oldPath, String newPath) throws ServiceLayerException
Description copied from interface:DependencyService
Move an item and make sure dependency paths remain correct.- Specified by:
moveDependencies
in interfaceDependencyService
- Parameters:
site
- Site to operate onoldPath
- Path to item to movenewPath
- Path the item moves to- Returns:
- set of updated dependencies
- Throws:
SiteNotFoundException
- Site doesn't existContentNotFoundException
- Path doesn't existServiceLayerException
- Internal error, see exception details
-
deleteItemDependencies
public void deleteItemDependencies(String site, String path) throws ServiceLayerException
Description copied from interface:DependencyService
Delete an item dependencies from the database.- Specified by:
deleteItemDependencies
in interfaceDependencyService
- Parameters:
site
- Site to operate onpath
- Path to items to retrieve deps for- Throws:
SiteNotFoundException
- Site doesn't existContentNotFoundException
- Path doesn't existServiceLayerException
- Internal error, see exception details
-
deleteSiteDependencies
public void deleteSiteDependencies(String site) throws ServiceLayerException
Description copied from interface:DependencyService
Delete all dependencies from the database for a given site.- Specified by:
deleteSiteDependencies
in interfaceDependencyService
- Parameters:
site
- Site to operate on- Throws:
ServiceLayerException
- Internal error, see exception details
-
getDeleteDependencies
public Set<String> getDeleteDependencies(String site, String path) throws ServiceLayerException
- Specified by:
getDeleteDependencies
in interfaceDependencyService
- Parameters:
site
- Site to operate onpath
- Path to item to retrieve delete dependencies for- Returns:
- Set of paths included as delete dependencies
- Throws:
SiteNotFoundException
- Site doesn't existContentNotFoundException
- Content doesn't existServiceLayerException
- Internal error
-
getDeleteDependencies
public Set<String> getDeleteDependencies(String site, List<String> paths) throws ServiceLayerException
- Specified by:
getDeleteDependencies
in interfaceDependencyService
- Parameters:
site
- Site to operate onpaths
- Paths to items to retrieve delete dependencies for- Returns:
- Set of paths included as delete dependencies
- Throws:
SiteNotFoundException
- Site doesn't existContentNotFoundException
- Content doesn't existServiceLayerException
- Internal error
-
calculateDependencies
public Map<String,List<CalculateDependenciesEntityTO>> calculateDependencies(String site, List<String> paths) throws ServiceLayerException
Description copied from interface:DependencyService
Calculate dependencies for publishing- Specified by:
calculateDependencies
in interfaceDependencyService
- Parameters:
site
- Site to operate onpaths
- List of items to calculate dependencies for- Returns:
- Formatted result set
- Throws:
ServiceLayerException
- general service error
-
calculateDependenciesPaths
public Set<String> calculateDependenciesPaths(String site, List<String> paths) throws ServiceLayerException
Description copied from interface:DependencyService
Calculate dependencies paths for publishing- Specified by:
calculateDependenciesPaths
in interfaceDependencyService
- Parameters:
site
- site to usepaths
- list of items to calculate dependencies for- Returns:
- dependencies paths
- Throws:
ServiceLayerException
- general service error
-
getStudioConfiguration
public StudioConfiguration getStudioConfiguration()
-
setStudioConfiguration
public void setStudioConfiguration(StudioConfiguration studioConfiguration)
-
getSiteService
public SiteService getSiteService()
-
setSiteService
public void setSiteService(SiteService siteService)
-
getContentService
public ContentService getContentService()
-
setContentService
public void setContentService(ContentService contentService)
-
getDependencyResolver
public DependencyResolver getDependencyResolver()
-
setDependencyResolver
public void setDependencyResolver(DependencyResolver dependencyResolver)
-
getTransactionManager
public org.springframework.transaction.PlatformTransactionManager getTransactionManager()
-
setTransactionManager
public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
-
getContentRepository
public ContentRepository getContentRepository()
-
setContentRepository
public void setContentRepository(ContentRepository contentRepository)
-
getServicesConfig
public ServicesConfig getServicesConfig()
-
setServicesConfig
public void setServicesConfig(ServicesConfig servicesConfig)
-
getDependencyMapper
public DependencyMapper getDependencyMapper()
-
setDependencyMapper
public void setDependencyMapper(DependencyMapper dependencyMapper)
-
getDependencyService
public DependencyServiceInternal getDependencyService()
-
setDependencyService
public void setDependencyService(DependencyServiceInternal dependencyService)
-
getItemDao
public ItemDAO getItemDao()
-
setItemDao
public void setItemDao(ItemDAO itemDao)
-
getGeneralLockService
public GeneralLockService getGeneralLockService()
-
setGeneralLockService
public void setGeneralLockService(GeneralLockService generalLockService)
-
getRetryingDatabaseOperationFacade
public RetryingDatabaseOperationFacade getRetryingDatabaseOperationFacade()
-
setRetryingDatabaseOperationFacade
public void setRetryingDatabaseOperationFacade(RetryingDatabaseOperationFacade retryingDatabaseOperationFacade)
-
-