@@ -246,187 +246,101 @@ private String getInputArguments() {
246246 * 7Csort:date/jenkinsci-dev/AFYHSG3NUEI/UsVJIKoE4B8J
247247 *
248248 */
249- public static class PdfArtifact extends Artifact {
250- private String pdfReportFilePath ;
251-
249+ public static class PdfArtifact extends AbstractArtifactImpl {
250+
252251 @ DataBoundConstructor
253- public PdfArtifact () {
254-
255- }
256-
257- @ DataBoundSetter
258- public void setPdfReportFilePath (String pdfReportFilePath ) {
259- this .pdfReportFilePath = pdfReportFilePath ;
260- }
261-
262- public String getPdfReportFilePath () {
263- return this .pdfReportFilePath ;
252+ public PdfArtifact (String pdfReportFilePath ) {
253+ super (pdfReportFilePath );
264254 }
265-
255+
266256 @ Override
267257 public void addFilePathArgTo (List <String > inputArgs ) {
268258 inputArgs .add (MatlabBuilderConstants .PDF_REPORT_PATH + "," + "'"
269- + getPdfReportFilePath () + "'" );
270- }
271-
272- @ Override
273- public String getFilePath () {
274- return getPdfReportFilePath ();
259+ + getFilePath () + "'" );
275260 }
276261 }
277262
278- public static class TapArtifact extends Artifact {
279- private String tapReportFilePath ;
263+ public static class TapArtifact extends AbstractArtifactImpl {
280264
281265 @ DataBoundConstructor
282- public TapArtifact () {
283-
284- }
266+ public TapArtifact (String tapReportFilePath ) {
267+ super ( tapReportFilePath );
268+ }
285269
286- @ DataBoundSetter
287- public void setTapReportFilePath (String tapReportFilePath ) {
288- this .tapReportFilePath = tapReportFilePath ;
289- }
290-
291- public String getTapReportFilePath () {
292- return tapReportFilePath ;
293- }
294270
295271 @ Override
296272 public void addFilePathArgTo (List <String > inputArgs ) {
297273 inputArgs .add (MatlabBuilderConstants .TAP_RESULTS_PATH + "," + "'"
298- + getTapReportFilePath () + "'" );
274+ + getFilePath () + "'" );
299275 }
300276
301- @ Override
302- public String getFilePath () {
303- return getTapReportFilePath ();
304- }
305277 }
306278
307- public static class JunitArtifact extends Artifact {
308- private String junitReportFilePath ;
279+ public static class JunitArtifact extends AbstractArtifactImpl {
309280
310281 @ DataBoundConstructor
311- public JunitArtifact () {
312-
313- }
314-
315- @ DataBoundSetter
316- public void setJunitReportFilePath (String junitReportFilePath ) {
317- this .junitReportFilePath = junitReportFilePath ;
318- }
319-
320- public String getJunitReportFilePath () {
321- return this .junitReportFilePath ;
322- }
282+ public JunitArtifact (String junitReportFilePath ) {
283+ super (junitReportFilePath );
284+ }
323285
324286 @ Override
325287 public void addFilePathArgTo (List <String > inputArgs ) {
326288 inputArgs .add (MatlabBuilderConstants .JUNIT_RESULTS_PATH + "," + "'"
327- + getJunitReportFilePath () + "'" );
289+ + getFilePath () + "'" );
328290 }
329291
330- @ Override
331- public String getFilePath () {
332- return getJunitReportFilePath ();
333- }
334292 }
335293
336- public static class CoberturaArtifact extends Artifact {
337- private String coberturaReportFilePath ;
294+ public static class CoberturaArtifact extends AbstractArtifactImpl {
338295
339296 @ DataBoundConstructor
340- public CoberturaArtifact () {
341-
342- }
297+ public CoberturaArtifact (String coberturaReportFilePath ) {
298+ super ( coberturaReportFilePath );
299+ }
343300
344- @ DataBoundSetter
345- public void setCoberturaReportFilePath (String coberturaReportFilePath ) {
346- this .coberturaReportFilePath = coberturaReportFilePath ;
347- }
348-
349- public String getCoberturaReportFilePath () {
350- return this .coberturaReportFilePath ;
351- }
352301
353302 @ Override
354303 public void addFilePathArgTo (List <String > inputArgs ) {
355304 inputArgs .add (MatlabBuilderConstants .COBERTURA_CODE_COVERAGE_PATH + "," + "'"
356- + getCoberturaReportFilePath () + "'" );
305+ + getFilePath () + "'" );
357306 }
358307
359- @ Override
360- public String getFilePath () {
361- return getCoberturaReportFilePath ();
362- }
363308 }
364309
365- public static class StmResultsArtifact extends Artifact {
366- private String stmResultsFilePath ;
310+ public static class StmResultsArtifact extends AbstractArtifactImpl {
367311
368312 @ DataBoundConstructor
369- public StmResultsArtifact () {
370-
371- }
313+ public StmResultsArtifact (String stmResultsFilePath ) {
314+ super ( stmResultsFilePath );
315+ }
372316
373- @ DataBoundSetter
374- public void setStmResultsFilePath (String stmResultsFilePath ) {
375- this .stmResultsFilePath = stmResultsFilePath ;
376- }
377317
378- public String getStmResultsFilePath () {
379- return stmResultsFilePath ;
380- }
381318
382319 @ Override
383320 public void addFilePathArgTo (List <String > inputArgs ) {
384321 inputArgs .add (MatlabBuilderConstants .STM_RESULTS_PATH + "," + "'"
385- + getStmResultsFilePath () + "'" );
386- }
387-
388- @ Override
389- public String getFilePath () {
390- return getStmResultsFilePath ();
322+ + getFilePath () + "'" );
391323 }
324+
392325 }
393326
394- public static class ModelCovArtifact extends Artifact {
395- private String modelCoverageFilePath ;
327+ public static class ModelCovArtifact extends AbstractArtifactImpl {
396328
397329 @ DataBoundConstructor
398- public ModelCovArtifact () {
399-
400- }
330+ public ModelCovArtifact (String modelCoverageFilePath ) {
331+ super ( modelCoverageFilePath );
332+ }
401333
402- @ DataBoundSetter
403- public void setModelCoverageFilePath (String modelCoverageFilePath ) {
404- this .modelCoverageFilePath = modelCoverageFilePath ;
405- }
406-
407- public String getModelCoverageFilePath () {
408- return modelCoverageFilePath ;
409- }
410334
411335 @ Override
412336 public void addFilePathArgTo (List <String > inputArgs ) {
413337 inputArgs .add (MatlabBuilderConstants .COBERTURA_MODEL_COVERAGE_PATH + "," + "'"
414- + getModelCoverageFilePath () + "'" );
338+ + getFilePath () + "'" );
415339 }
416340
417- @ Override
418- public String getFilePath () {
419-
420- return getModelCoverageFilePath ();
421- }
422341 }
423342
424- public static class NullArtifact extends Artifact {
425-
426- @ DataBoundConstructor
427- public NullArtifact () {
428-
429- }
343+ public static class NullArtifact implements Artifact {
430344
431345 @ Override
432346 public void addFilePathArgTo (List <String > inputArgs ) {
@@ -435,23 +349,47 @@ public void addFilePathArgTo(List<String> inputArgs) {
435349
436350 @ Override
437351 public boolean getDefault () {
352+
438353 return false ;
439354 }
440355
441356 @ Override
442357 public String getFilePath () {
358+
443359 return null ;
444360 }
445- }
446361
362+ }
447363
448- public static abstract class Artifact {
449- public abstract void addFilePathArgTo ( List < String > inputArgs );
364+ //Andys code
365+ public static abstract class AbstractArtifactImpl implements Artifact {
450366
451- public abstract String getFilePath () ;
367+ private String filePath ;
452368
453- public boolean getDefault () {
369+ protected AbstractArtifactImpl (String path ){
370+ this .filePath = path ;
371+ }
372+
373+
374+ public boolean getDefault (){
454375 return true ;
455376 }
377+
378+ public void setFilePath (String path ){
379+ this .filePath = path ;
380+ }
381+ public String getFilePath (){
382+ return this .filePath ;
383+ }
384+ }
385+
386+
387+ public interface Artifact {
388+ public void addFilePathArgTo (List <String > inputArgs );
389+
390+ public String getFilePath ();
391+
392+ public boolean getDefault ();
393+ //public List<String> getNameAndValue();
456394 }
457395}
0 commit comments