mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-07-11 22:33:47 +02:00
added option to disable the last commit during repository browsing
This commit is contained in:
@@ -106,10 +106,10 @@ public final class BrowseCommandBuilder
|
||||
* @param preProcessorUtil
|
||||
*/
|
||||
BrowseCommandBuilder(CacheManager cacheManager, BrowseCommand browseCommand,
|
||||
Repository repository, PreProcessorUtil preProcessorUtil)
|
||||
Repository repository, PreProcessorUtil preProcessorUtil)
|
||||
{
|
||||
this.cache = cacheManager.getCache(CacheKey.class, BrowserResult.class,
|
||||
CACHE_NAME);
|
||||
CACHE_NAME);
|
||||
this.browseCommand = browseCommand;
|
||||
this.repository = repository;
|
||||
this.preProcessorUtil = preProcessorUtil;
|
||||
@@ -144,7 +144,7 @@ public final class BrowseCommandBuilder
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
public BrowserResult getBrowserResult()
|
||||
throws IOException, RepositoryException
|
||||
throws IOException, RepositoryException
|
||||
{
|
||||
BrowserResult result = null;
|
||||
|
||||
@@ -153,7 +153,7 @@ public final class BrowseCommandBuilder
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("create browser result for {} with disabled cache",
|
||||
request);
|
||||
request);
|
||||
}
|
||||
|
||||
result = browseCommand.getBrowserResult(request);
|
||||
@@ -219,6 +219,24 @@ public final class BrowseCommandBuilder
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disabling the last commit means that every call to
|
||||
* {@link FileObject#getDescription()} and
|
||||
* {@link FileObject#getLastModified()) will return {@code null}, but this
|
||||
* will also reduce the execution time.
|
||||
*
|
||||
*
|
||||
* @param disableLastCommit true to disable the last commit message
|
||||
*
|
||||
* @return {@code this}
|
||||
*/
|
||||
public BrowseCommandBuilder setDisableLastCommit(boolean disableLastCommit)
|
||||
{
|
||||
this.request.setDisableLastCommit(disableLastCommit);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the execution of pre processors.
|
||||
*
|
||||
@@ -228,7 +246,7 @@ public final class BrowseCommandBuilder
|
||||
* @return {@code this}
|
||||
*/
|
||||
public BrowseCommandBuilder setDisablePreProcessors(
|
||||
boolean disablePreProcessors)
|
||||
boolean disablePreProcessors)
|
||||
{
|
||||
this.disablePreProcessors = disablePreProcessors;
|
||||
|
||||
@@ -320,7 +338,7 @@ public final class BrowseCommandBuilder
|
||||
final CacheKey other = (CacheKey) obj;
|
||||
|
||||
return Objects.equal(repositoryId, other.repositoryId)
|
||||
&& Objects.equal(request, other.request);
|
||||
&& Objects.equal(request, other.request);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,6 +33,10 @@
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -43,4 +47,119 @@ public final class BrowseCommandRequest extends FileBaseCommandRequest
|
||||
|
||||
/** Field description */
|
||||
private static final long serialVersionUID = 7956624623516803183L;
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public BrowseCommandRequest clone()
|
||||
{
|
||||
BrowseCommandRequest clone = null;
|
||||
|
||||
try
|
||||
{
|
||||
clone = (BrowseCommandRequest) super.clone();
|
||||
}
|
||||
catch (CloneNotSupportedException e)
|
||||
{
|
||||
|
||||
// this shouldn't happen, since we are Cloneable
|
||||
throw new InternalError("CatCommandRequest seems not to be cloneable");
|
||||
}
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
*
|
||||
* @param obj
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getClass() != obj.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final BrowseCommandRequest other = (BrowseCommandRequest) obj;
|
||||
|
||||
return super.equals(obj)
|
||||
&& Objects.equal(disableLastCommit, other.disableLastCommit);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return Objects.hashCode(super.hashCode(), disableLastCommit);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
//J-
|
||||
return Objects.toStringHelper(this)
|
||||
.add("path", getPath())
|
||||
.add("revision", getRevision())
|
||||
.add("disableLastCommit", disableLastCommit)
|
||||
.toString();
|
||||
//J+
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* True to disable the last commit.
|
||||
*
|
||||
*
|
||||
* @param disableLastCommit true to disable the last commit
|
||||
*/
|
||||
public void setDisableLastCommit(boolean disableLastCommit)
|
||||
{
|
||||
this.disableLastCommit = disableLastCommit;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Returns true if the last commit is disabled.
|
||||
*
|
||||
*
|
||||
* @return true if the last commit is disabled
|
||||
*/
|
||||
boolean isDisableLastCommit()
|
||||
{
|
||||
return disableLastCommit;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** disable last commit */
|
||||
private boolean disableLastCommit = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user