Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
krisstern committed Feb 4, 2024
1 parent 9306f26 commit cbb9080
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.jenkinsci.plugins.workflow.job;

import hudson.util.FormValidation;
import jenkins.model.Jenkins;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.AncestorInPath;
import org.kohsuke.stapler.QueryParameter;

public interface AbstractItemDescriptor {
@Restricted(NoExternalUse.class)
public default FormValidation doCheckDisplayNameOrNull(@AncestorInPath WorkflowJob job, @QueryParameter String value) {
return Jenkins.get().doCheckDisplayName(value, job.getName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
import hudson.triggers.TriggerDescriptor;
import hudson.util.AlternativeUiTextProvider;
import hudson.util.DescribableList;
import hudson.util.FormValidation;
import hudson.widgets.HistoryWidget;
import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -98,12 +99,14 @@
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.DoNotUse;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.AncestorInPath;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.export.Exported;

@SuppressWarnings({"unchecked", "rawtypes"})
public final class WorkflowJob extends Job<WorkflowJob,WorkflowRun> implements LazyBuildMixIn.LazyLoadingJob<WorkflowJob,WorkflowRun>, ParameterizedJobMixIn.ParameterizedJob<WorkflowJob, WorkflowRun>, TopLevelItem, Queue.FlyweightTask, SCMTriggerItem, BlockableResume {
public final class WorkflowJob extends Job<WorkflowJob,WorkflowRun> implements LazyBuildMixIn.LazyLoadingJob<WorkflowJob,WorkflowRun>, ParameterizedJobMixIn.ParameterizedJob<WorkflowJob, WorkflowRun>, TopLevelItem, Queue.FlyweightTask, SCMTriggerItem, BlockableResume, AbstractItemDescriptor {

private static final Logger LOGGER = Logger.getLogger(WorkflowJob.class.getName());

Expand Down Expand Up @@ -193,7 +196,6 @@ public void setDefinition(FlowDefinition definition) {
getTriggersJobProperty().startTriggers(Items.currentlyUpdatingByXml());
}


@Override public void addProperty(JobProperty jobProp) throws IOException {
super.addProperty(jobProp);
if (jobProp instanceof PipelineTriggersJobProperty) {
Expand Down Expand Up @@ -254,6 +256,7 @@ public void setDefinition(FlowDefinition definition) {
return buildMixIn.getEstimatedDurationCandidates();
}


@Override protected HistoryWidget createHistoryWidget() {
return buildMixIn.createHistoryWidget();
}
Expand Down

0 comments on commit cbb9080

Please sign in to comment.