// Path: src/main/java/hudson/plugins/promoted_builds/conditions/ManualCondition.java
// public static final class ManualApproval extends InvisibleAction {
//     public String name;
//     public Badge badge;
// 
//     public ManualApproval(String name, List<ParameterValue> values) {
//         this.name = name;
//         badge = new Badge(values);
//     }
// }


import antlr.ANTLRException;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.BulkChange;
import hudson.EnvVars;
import hudson.Extension;
import hudson.Util;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.Action;
import hudson.model.AutoCompletionCandidates;
import hudson.model.ParameterValue;
import hudson.model.BuildableItemWithBuildWrappers;
import hudson.model.Cause;
import hudson.model.Cause.UserCause;
import hudson.model.DependencyGraph;
import hudson.model.Describable;
import hudson.model.Descriptor;
import hudson.model.Descriptor.FormException;
import hudson.model.Failure;
import hudson.model.FreeStyleProject;
import hudson.model.ItemGroup;
import hudson.model.JDK;
import hudson.model.Job;
import hudson.model.Label;
import hudson.model.ParameterDefinition;
import hudson.model.ParametersDefinitionProperty;
import hudson.model.PermalinkProjectAction.Permalink;
import hudson.model.Queue.Item;
import hudson.model.Run;
import hudson.model.Saveable;
import hudson.model.StringParameterValue;
import hudson.model.labels.LabelAtom;
import hudson.model.labels.LabelExpression;
import hudson.plugins.promoted_builds.conditions.ManualCondition.ManualApproval;
import hudson.security.ACL;
import hudson.tasks.BuildStep;
import hudson.tasks.BuildStepDescriptor;
import hudson.tasks.Builder;
import hudson.tasks.BuildWrapper;
import hudson.tasks.BuildWrappers;
import hudson.tasks.Publisher;
import hudson.util.DescribableList;
import hudson.util.FormValidation;
import jenkins.model.Jenkins;
import jenkins.util.TimeDuration;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.HttpResponses;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import javax.servlet.ServletException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import java.util.logging.Logger;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
            PromotionBadge b = cond.isMet(this, build);
            if(b==null)
                return null;
            badges.add(b);
        }
        return new Status(this,badges);
    }

    /**
     * @deprecated
     *      Use {@link #considerPromotion2(AbstractBuild)}
     */
    @Deprecated
    public boolean considerPromotion(AbstractBuild<?,?> build) throws IOException {
        return considerPromotion2(build)!=null;
    }

    /**
     * Checks if the build is promotable, and if so, promote it.
     *
     * @param build Build to be promoted
     * @return
     *      {@code null} if the build was not promoted, otherwise Future that kicks in when the build is completed.
     * @throws IOException
     */
    @CheckForNull
    public Future<Promotion> considerPromotion2(AbstractBuild<?, ?> build) throws IOException {
		LOGGER.fine("Considering the promotion of "+build+" via "+getName()+" without parmeters");
		// If the build has manual approvals, use the parameters from it
		List<ParameterValue> params = new ArrayList<ParameterValue>();
// Path: src/main/java/hudson/plugins/promoted_builds/conditions/ManualCondition.java
// public static final class ManualApproval extends InvisibleAction {
//     public String name;
//     public Badge badge;
// 
//     public ManualApproval(String name, List<ParameterValue> values) {
//         this.name = name;
//         badge = new Badge(values);
//     }
// }


// Path: src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java
import antlr.ANTLRException;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.BulkChange;
import hudson.EnvVars;
import hudson.Extension;
import hudson.Util;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.Action;
import hudson.model.AutoCompletionCandidates;
import hudson.model.ParameterValue;
import hudson.model.BuildableItemWithBuildWrappers;
import hudson.model.Cause;
import hudson.model.Cause.UserCause;
import hudson.model.DependencyGraph;
import hudson.model.Describable;
import hudson.model.Descriptor;
import hudson.model.Descriptor.FormException;
import hudson.model.Failure;
import hudson.model.FreeStyleProject;
import hudson.model.ItemGroup;
import hudson.model.JDK;
import hudson.model.Job;
import hudson.model.Label;
import hudson.model.ParameterDefinition;
import hudson.model.ParametersDefinitionProperty;
import hudson.model.PermalinkProjectAction.Permalink;
import hudson.model.Queue.Item;
import hudson.model.Run;
import hudson.model.Saveable;
import hudson.model.StringParameterValue;
import hudson.model.labels.LabelAtom;
import hudson.model.labels.LabelExpression;
import hudson.plugins.promoted_builds.conditions.ManualCondition.ManualApproval;
import hudson.security.ACL;
import hudson.tasks.BuildStep;
import hudson.tasks.BuildStepDescriptor;
import hudson.tasks.Builder;
import hudson.tasks.BuildWrapper;
import hudson.tasks.BuildWrappers;
import hudson.tasks.Publisher;
import hudson.util.DescribableList;
import hudson.util.FormValidation;
import jenkins.model.Jenkins;
import jenkins.util.TimeDuration;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.HttpResponses;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import javax.servlet.ServletException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import java.util.logging.Logger;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;

            PromotionBadge b = cond.isMet(this, build);
            if(b==null)
                return null;
            badges.add(b);
        }
        return new Status(this,badges);
    }

    /**
     * @deprecated
     *      Use {@link #considerPromotion2(AbstractBuild)}
     */
    @Deprecated
    public boolean considerPromotion(AbstractBuild<?,?> build) throws IOException {
        return considerPromotion2(build)!=null;
    }

    /**
     * Checks if the build is promotable, and if so, promote it.
     *
     * @param build Build to be promoted
     * @return
     *      {@code null} if the build was not promoted, otherwise Future that kicks in when the build is completed.
     * @throws IOException
     */
    @CheckForNull
    public Future<Promotion> considerPromotion2(AbstractBuild<?, ?> build) throws IOException {
		LOGGER.fine("Considering the promotion of "+build+" via "+getName()+" without parmeters");
		// If the build has manual approvals, use the parameters from it
		List<ParameterValue> params = new ArrayList<ParameterValue>();
		List<ManualApproval> approvals = build.getActions(ManualApproval.class);