Skip to content
Permalink
Browse files

[JENKINS-27208] Removed obsolete way to work

  • Loading branch information
recena committed Sep 29, 2015
1 parent 2124750 commit e59455cd109db00d8a6b4b3174b2ec3a77e86b9f
@@ -68,8 +68,16 @@ private LogParserPublisher(final boolean unstableOnWarning,
}

@DataBoundConstructor
public LogParserPublisher() {
public LogParserPublisher(final boolean useProjectRule, final String parsingRulesPath, final String projectRulePath) {
super();
if (useProjectRule) {
this.projectRulePath = projectRulePath;
this.parsingRulesPath = null;
} else {
this.projectRulePath = null;
this.parsingRulesPath = parsingRulesPath;
}
this.useProjectRule = useProjectRule;
}

@DataBoundSetter
@@ -87,21 +95,6 @@ public void setShowGraphs(boolean showGraphs) {
this.showGraphs = showGraphs;
}

@DataBoundSetter
public void setUseProjectRule(final boolean useProjectRule) {
this.useProjectRule = useProjectRule;
}

@DataBoundSetter
public void setParsingRulesPath(final String parsingRulesPath) {
this.parsingRulesPath = parsingRulesPath;
}

@DataBoundSetter
public void setProjectRulePath(final String projectRulePath) {
this.projectRulePath = projectRulePath;
}

@Override
public boolean prebuild(final AbstractBuild<?, ?> build,
final BuildListener listener) {
@@ -215,38 +208,6 @@ public boolean configure(final StaplerRequest req, final JSONObject json)
save();
return true;
}

/**
* Cannot use simple DataBoundConstructor due to radioBlock usage where
* a JSON object is returned holding the selected value of the block.
*
* {@inheritDoc}
*/
@Override
public LogParserPublisher newInstance(StaplerRequest req,
JSONObject json) throws FormException {

String configuredParsingRulesPath = null;
String configuredProjectRulePath = null;
boolean configuredUseProjectRule = false;
final JSONObject useProjectRuleJSON = json.getJSONObject("useProjectRule");

if (useProjectRuleJSON != null) {
configuredUseProjectRule = useProjectRuleJSON.getBoolean("value");

if (!configuredUseProjectRule && useProjectRuleJSON.containsKey("parsingRulesPath")) {
configuredParsingRulesPath = useProjectRuleJSON.getString("parsingRulesPath");
} else if (configuredUseProjectRule && useProjectRuleJSON.containsKey("projectRulePath")) {
configuredProjectRulePath = useProjectRuleJSON.getString("projectRulePath");
}
}
return new LogParserPublisher(json.getBoolean("unstableOnWarning"),
json.getBoolean("failBuildOnError"),
json.getBoolean("showGraphs"),
configuredParsingRulesPath,
configuredUseProjectRule,
configuredProjectRulePath);
}
}

public BuildStepMonitor getRequiredMonitorService() {
@@ -9,7 +9,7 @@
<f:entry title="Show log parser graphs" help="/plugin/log-parser/parser_graphs.html">
<f:checkbox name="log-parser.showGraphs" checked="${instance.showGraphs}"/>
</f:entry>
<f:radioBlock title="Use global rule" name="log-parser.useProjectRule" value="false" checked="${instance.useProjectRule!=true}">
<f:radioBlock title="Use global rule" name="log-parser.useProjectRule" value="false" checked="${instance.useProjectRule!=true}" inline="true">
<f:entry title="Select Parsing Rules" field="currentRulePath" help="/plugin/log-parser/parse_rule_choice.html">
<select name="log-parser.parsingRulesPath">
<j:forEach var="i" items="${descriptor.parsingRulesGlobal}">
@@ -18,7 +18,7 @@
</select>
</f:entry>
</f:radioBlock>
<f:radioBlock title="Use project rule" name="log-parser.useProjectRule" value="true" checked="${instance.useProjectRule==true}">
<f:radioBlock title="Use project rule" name="log-parser.useProjectRule" value="true" checked="${instance.useProjectRule==true}" inline="true">
<f:entry title="Path to rule file in workspace" field="projectRulePath">
<f:textbox/>
</f:entry>

1 comment on commit e59455c

@orrc

This comment has been minimized.

Copy link
Member

@orrc orrc commented on e59455c Oct 14, 2015

Out of interest, why is using @DataBoundSetter obsolete?

I understand removing newInstance(), but @DataBoundSetter was explicitly added so that developers no longer need to stuff loads of data-bound parameters into the constructor.

Please sign in to comment.