1 package org.apache.maven.plugin.jira;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.plugin.MojoExecutionException;
23 import org.apache.maven.plugin.issues.Issue;
24
25 import java.util.List;
26
27
28
29
30
31
32
33
34 public class AdaptiveJiraDownloader extends AbstractJiraDownloader
35 {
36 private AbstractJiraDownloader effectiveDownloader;
37 private boolean forceClassic;
38
39
40 public void doExecute()
41 throws Exception
42 {
43 effectiveDownloader = new RestJiraDownloader();
44 copySettings( effectiveDownloader );
45 try
46 {
47 effectiveDownloader.doExecute();
48 }
49 catch ( RestJiraDownloader.NoRest nre )
50 {
51 getLog().info( "Falling back to RSS for issue download: " + nre.getMessage() );
52 effectiveDownloader = new ClassicJiraDownloader();
53 copySettings( effectiveDownloader );
54 effectiveDownloader.doExecute();
55 }
56 }
57
58 private void copySettings( AbstractJiraDownloader target )
59 {
60 target.setLog( getLog() );
61 target.setMavenProject( project );
62 target.setOutput( output );
63 target.setNbEntries( nbEntriesMax );
64 target.setComponent( component );
65 target.setFixVersionIds( fixVersionIds );
66 target.setStatusIds( statusIds );
67 target.setResolutionIds( resolutionIds );
68 target.setPriorityIds( priorityIds );
69 target.setSortColumnNames( sortColumnNames );
70 target.setFilter( filter );
71 target.setJiraDatePattern( jiraDatePattern );
72 target.setJiraUser( jiraUser );
73 target.setJiraPassword( jiraPassword );
74 target.setTypeIds( typeIds );
75 target.setWebUser( webUser );
76 target.setWebPassword( webPassword );
77 target.setSettings( settings );
78 target.setUseJql( useJql );
79 target.setOnlyCurrentVersion( onlyCurrentVersion );
80 target.setVersionPrefix( versionPrefix );
81 target.setConnectionTimeout( connectionTimeout );
82 target.setReceiveTimout( receiveTimout );
83 }
84
85
86 public List<Issue> getIssueList()
87 throws MojoExecutionException
88 {
89 return effectiveDownloader.getIssueList();
90 }
91
92 public boolean isForceClassic()
93 {
94 return forceClassic;
95 }
96
97 public void setForceClassic( boolean forceClassic )
98 {
99 this.forceClassic = forceClassic;
100 }
101 }