use blame pre processor api

This commit is contained in:
Sebastian Sdorra
2012-06-24 14:34:09 +02:00
parent d84c3ae03a
commit c05a141cf6
2 changed files with 34 additions and 4 deletions

View File

@@ -45,6 +45,7 @@ import org.slf4j.LoggerFactory;
import sonia.scm.cache.Cache; import sonia.scm.cache.Cache;
import sonia.scm.cache.CacheManager; import sonia.scm.cache.CacheManager;
import sonia.scm.repository.BlameResult; import sonia.scm.repository.BlameResult;
import sonia.scm.repository.PreProcessorUtil;
import sonia.scm.repository.Repository; import sonia.scm.repository.Repository;
import sonia.scm.repository.RepositoryCacheKey; import sonia.scm.repository.RepositoryCacheKey;
import sonia.scm.repository.RepositoryException; import sonia.scm.repository.RepositoryException;
@@ -99,14 +100,16 @@ public final class BlameCommandBuilder
* @param cacheManager cache manager * @param cacheManager cache manager
* @param blameCommand implementation of the {@link BlameCommand} * @param blameCommand implementation of the {@link BlameCommand}
* @param repository repository to query * @param repository repository to query
* @param preProcessorUtil
*/ */
BlameCommandBuilder(CacheManager cacheManager, BlameCommand blameCommand, BlameCommandBuilder(CacheManager cacheManager, BlameCommand blameCommand,
Repository repository) Repository repository, PreProcessorUtil preProcessorUtil)
{ {
this.cache = cacheManager.getCache(CacheKey.class, BlameResult.class, this.cache = cacheManager.getCache(CacheKey.class, BlameResult.class,
CACHE_NAME); CACHE_NAME);
this.blameCommand = blameCommand; this.blameCommand = blameCommand;
this.repository = repository; this.repository = repository;
this.preProcessorUtil = preProcessorUtil;
} }
//~--- methods -------------------------------------------------------------- //~--- methods --------------------------------------------------------------
@@ -183,6 +186,11 @@ public final class BlameCommandBuilder
} }
} }
if (!disablePreProcessors && (result != null))
{
preProcessorUtil.prepareForReturn(repository, result);
}
return result; return result;
} }
@@ -205,6 +213,22 @@ public final class BlameCommandBuilder
return this; return this;
} }
/**
* Disable the execution of pre processors.
*
*
* @param disablePreProcessors true to disable the pre processors execution
*
* @return {@code this}
*/
public BlameCommandBuilder setDisablePreProcessors(
boolean disablePreProcessors)
{
this.disablePreProcessors = disablePreProcessors;
return this;
}
/** /**
* Sets the start revision for the blame. * Sets the start revision for the blame.
* *
@@ -321,6 +345,12 @@ public final class BlameCommandBuilder
/** disable change */ /** disable change */
private boolean disableCache; private boolean disableCache;
/** disable the execution of pre processors */
private boolean disablePreProcessors = false;
/** Field description */
private PreProcessorUtil preProcessorUtil;
/** the repository */ /** the repository */
private Repository repository; private Repository repository;

View File

@@ -60,8 +60,8 @@ import java.io.IOException;
* is supported by the {@link RepositoryService} with the * is supported by the {@link RepositoryService} with the
* {@link RepositoryService#isSupported(Command)} method.<br /> * {@link RepositoryService#isSupported(Command)} method.<br />
* <br /> * <br />
* *
* <b>Warning:</b> You should always close the connection to the repository * <b>Warning:</b> You should always close the connection to the repository
* after work is finished. For closing the connection to the repository use the * after work is finished. For closing the connection to the repository use the
* {@link #close()} method. * {@link #close()} method.
* *
@@ -147,7 +147,7 @@ public final class RepositoryService implements Closeable
} }
return new BlameCommandBuilder(cacheManager, provider.getBlameCommand(), return new BlameCommandBuilder(cacheManager, provider.getBlameCommand(),
repository); repository, preProcessorUtil);
} }
/** /**