mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 16:05:44 +01:00
call pre processors in new repository api
This commit is contained in:
@@ -40,6 +40,7 @@ import com.google.common.base.Objects;
|
||||
import sonia.scm.cache.Cache;
|
||||
import sonia.scm.cache.CacheManager;
|
||||
import sonia.scm.repository.BrowserResult;
|
||||
import sonia.scm.repository.PreProcessorUtil;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.repository.RepositoryException;
|
||||
import sonia.scm.repository.spi.BrowseCommand;
|
||||
@@ -73,14 +74,16 @@ public final class BrowseCommandBuilder
|
||||
* @param logCommand implementation of the {@link LogCommand}
|
||||
* @param browseCommand
|
||||
* @param repository repository to query
|
||||
* @param preProcessorUtil
|
||||
*/
|
||||
BrowseCommandBuilder(CacheManager cacheManager, BrowseCommand browseCommand,
|
||||
Repository repository)
|
||||
Repository repository, PreProcessorUtil preProcessorUtil)
|
||||
{
|
||||
this.cache = cacheManager.getCache(CacheKey.class, BrowserResult.class,
|
||||
CACHE_NAME);
|
||||
this.browseCommand = browseCommand;
|
||||
this.repository = repository;
|
||||
this.preProcessorUtil = preProcessorUtil;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
@@ -130,6 +133,11 @@ public final class BrowseCommandBuilder
|
||||
}
|
||||
}
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
preProcessorUtil.prepareForReturn(repository, result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -268,6 +276,9 @@ public final class BrowseCommandBuilder
|
||||
/** disables the cache */
|
||||
private boolean disableCache;
|
||||
|
||||
/** Field description */
|
||||
private PreProcessorUtil preProcessorUtil;
|
||||
|
||||
/** the repsitory */
|
||||
private Repository repository;
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ import sonia.scm.cache.Cache;
|
||||
import sonia.scm.cache.CacheManager;
|
||||
import sonia.scm.repository.Changeset;
|
||||
import sonia.scm.repository.ChangesetPagingResult;
|
||||
import sonia.scm.repository.PreProcessorUtil;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.repository.RepositoryException;
|
||||
import sonia.scm.repository.spi.LogCommand;
|
||||
@@ -112,14 +113,16 @@ public final class LogCommandBuilder
|
||||
* @param cacheManager cache manager
|
||||
* @param logCommand implementation of the {@link LogCommand}
|
||||
* @param repository repository to query
|
||||
* @param preProcessorUtil
|
||||
*/
|
||||
LogCommandBuilder(CacheManager cacheManager, LogCommand logCommand,
|
||||
Repository repository)
|
||||
Repository repository, PreProcessorUtil preProcessorUtil)
|
||||
{
|
||||
this.cache = cacheManager.getCache(CacheKey.class,
|
||||
ChangesetPagingResult.class, CACHE_NAME);
|
||||
this.logCommand = logCommand;
|
||||
this.repository = repository;
|
||||
this.preProcessorUtil = preProcessorUtil;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
@@ -196,6 +199,11 @@ public final class LogCommandBuilder
|
||||
}
|
||||
}
|
||||
|
||||
if (changeset != null)
|
||||
{
|
||||
preProcessorUtil.prepareForReturn(repository, changeset);
|
||||
}
|
||||
|
||||
return changeset;
|
||||
}
|
||||
|
||||
@@ -234,6 +242,11 @@ public final class LogCommandBuilder
|
||||
}
|
||||
}
|
||||
|
||||
if (cpr != null)
|
||||
{
|
||||
preProcessorUtil.prepareForReturn(repository, cpr);
|
||||
}
|
||||
|
||||
return cpr;
|
||||
}
|
||||
|
||||
@@ -453,6 +466,9 @@ public final class LogCommandBuilder
|
||||
/** Implementation of the log command */
|
||||
private LogCommand logCommand;
|
||||
|
||||
/** Field description */
|
||||
private PreProcessorUtil preProcessorUtil;
|
||||
|
||||
/** repository to query */
|
||||
private Repository repository;
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ package sonia.scm.repository.api;
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.cache.CacheManager;
|
||||
import sonia.scm.repository.PreProcessorUtil;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.repository.spi.RepositoryServiceProvider;
|
||||
|
||||
@@ -64,13 +65,16 @@ public final class RepositoryService
|
||||
* @param cacheManager cache manager
|
||||
* @param provider implementation for {@link RepositoryServiceProvider}
|
||||
* @param repository the repository
|
||||
* @param preProcessorUtil
|
||||
*/
|
||||
RepositoryService(CacheManager cacheManager,
|
||||
RepositoryServiceProvider provider, Repository repository)
|
||||
RepositoryServiceProvider provider, Repository repository,
|
||||
PreProcessorUtil preProcessorUtil)
|
||||
{
|
||||
this.cacheManager = cacheManager;
|
||||
this.provider = provider;
|
||||
this.repository = repository;
|
||||
this.preProcessorUtil = preProcessorUtil;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
@@ -98,7 +102,7 @@ public final class RepositoryService
|
||||
public BrowseCommandBuilder getBrowseCommand()
|
||||
{
|
||||
return new BrowseCommandBuilder(cacheManager, provider.getBrowseCommand(),
|
||||
repository);
|
||||
repository, preProcessorUtil);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,7 +140,7 @@ public final class RepositoryService
|
||||
public LogCommandBuilder getLogCommand()
|
||||
{
|
||||
return new LogCommandBuilder(cacheManager, provider.getLogCommand(),
|
||||
repository);
|
||||
repository, preProcessorUtil);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,6 +161,9 @@ public final class RepositoryService
|
||||
/** cache manager */
|
||||
private CacheManager cacheManager;
|
||||
|
||||
/** Field description */
|
||||
private PreProcessorUtil preProcessorUtil;
|
||||
|
||||
/** implementation of the repository service provider */
|
||||
private RepositoryServiceProvider provider;
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ import com.google.inject.Singleton;
|
||||
import sonia.scm.cache.CacheManager;
|
||||
import sonia.scm.repository.PermissionType;
|
||||
import sonia.scm.repository.PermissionUtil;
|
||||
import sonia.scm.repository.PreProcessorUtil;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.repository.RepositoryManager;
|
||||
import sonia.scm.repository.RepositoryNotFoundException;
|
||||
@@ -98,17 +99,20 @@ public final class RepositoryServiceFactory
|
||||
* @param repositoryManager manager for repositories
|
||||
* @param securityContextProvider provider for the current security context
|
||||
* @param resolvers a set of {@link RepositoryServiceResolver}
|
||||
* @param preProcessorUtil helper object for pre processor handling
|
||||
*/
|
||||
@Inject
|
||||
public RepositoryServiceFactory(
|
||||
CacheManager cacheManager, RepositoryManager repositoryManager,
|
||||
Provider<WebSecurityContext> securityContextProvider,
|
||||
Set<RepositoryServiceResolver> resolvers)
|
||||
Set<RepositoryServiceResolver> resolvers,
|
||||
PreProcessorUtil preProcessorUtil)
|
||||
{
|
||||
this.cacheManager = cacheManager;
|
||||
this.repositoryManager = repositoryManager;
|
||||
this.securityContextProvider = securityContextProvider;
|
||||
this.resolvers = resolvers;
|
||||
this.preProcessorUtil = preProcessorUtil;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
@@ -219,7 +223,8 @@ public final class RepositoryServiceFactory
|
||||
|
||||
if (provider != null)
|
||||
{
|
||||
service = new RepositoryService(cacheManager, provider, repository);
|
||||
service = new RepositoryService(cacheManager, provider, repository,
|
||||
preProcessorUtil);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -238,6 +243,9 @@ public final class RepositoryServiceFactory
|
||||
/** Field description */
|
||||
private CacheManager cacheManager;
|
||||
|
||||
/** Field description */
|
||||
private PreProcessorUtil preProcessorUtil;
|
||||
|
||||
/** Field description */
|
||||
private RepositoryManager repositoryManager;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user