Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.jfrog.hudson.util;
 import java.util.Date;
 import java.util.List;

Tomer Cohen
public class BuildRetentionFactory {

Create a Build retention object out of the build

build The build to create the build retention out of
discardOldArtifacts Flag whether to discard artifacts of those builds that are to be discarded.
a new Build retention
    public static BuildRetention createBuildRetention(AbstractBuild buildboolean discardOldArtifacts) {
        BuildRetention buildRetention = new BuildRetention(discardOldArtifacts);
        LogRotator rotator = build.getProject().getLogRotator();
        if (rotator == null) {
            return buildRetention;
        if (rotator.getNumToKeep() > -1) {
        if (rotator.getDaysToKeep() > -1) {
            Calendar calendar = Calendar.getInstance();
            calendar.roll(., -rotator.getDaysToKeep());
            buildRetention.setMinimumBuildDate(new Date(calendar.getTimeInMillis()));
        List<StringnotToBeDeleted = ExtractorUtils.getBuildNumbersNotToBeDeleted(build);
        return buildRetention;
New to GrepCode? Check out our FAQ X