Coverage Report - org.apache.maven.plugin.jira.AdaptiveJiraDownloader
 
Classes in this File Line Coverage Branch Coverage Complexity
AdaptiveJiraDownloader
0%
0/37
N/A
1.2
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *   http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing,
 13  
  * software distributed under the License is distributed on an
 14  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15  
  * KIND, either express or implied.  See the License for the
 16  
  * specific language governing permissions and limitations
 17  
  * under the License.
 18  
  */
 19  
 
 20  
 package org.apache.maven.plugin.jira;
 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  
  * Jira downloader that uses REST or RSS, depending.
 29  
  * This code is not very attractive. However, JIRA has
 30  
  * supported REST for a very long time, and so the
 31  
  * fallback is only relevant for people with very old
 32  
  * copies of JIRA.
 33  
  */
 34  0
 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  0
         effectiveDownloader = new RestJiraDownloader();
 44  0
         copySettings( effectiveDownloader );
 45  
         try
 46  
         {
 47  0
             effectiveDownloader.doExecute();
 48  
         }
 49  0
         catch( RestJiraDownloader.NoRest nre )
 50  
         {
 51  0
             getLog().info( "Falling back to RSS for issue download: " + nre.getMessage() );
 52  0
             effectiveDownloader = new ClassicJiraDownloader();
 53  0
             copySettings( effectiveDownloader );
 54  0
             effectiveDownloader.doExecute();
 55  0
         }
 56  0
     }
 57  
     
 58  
     private void copySettings( AbstractJiraDownloader target )
 59  
     {
 60  0
         target.setLog( getLog() );
 61  0
         target.setMavenProject( project );
 62  0
         target.setOutput( output );
 63  0
         target.setNbEntries( nbEntriesMax );
 64  0
         target.setComponent( component );
 65  0
         target.setFixVersionIds( fixVersionIds );
 66  0
         target.setStatusIds( statusIds );
 67  0
         target.setResolutionIds( resolutionIds );
 68  0
         target.setPriorityIds( priorityIds );
 69  0
         target.setSortColumnNames( sortColumnNames );
 70  0
         target.setFilter( filter );
 71  0
         target.setJiraDatePattern( jiraDatePattern );
 72  0
         target.setJiraUser( jiraUser );
 73  0
         target.setJiraPassword( jiraPassword );
 74  0
         target.setTypeIds( typeIds );
 75  0
         target.setWebUser( webUser );
 76  0
         target.setWebPassword( webPassword );
 77  0
         target.setSettings( settings );
 78  0
         target.setUseJql( useJql );
 79  0
         target.setOnlyCurrentVersion( onlyCurrentVersion );
 80  0
         target.setVersionPrefix( versionPrefix );
 81  0
     }
 82  
 
 83  
 
 84  
     public List<Issue> getIssueList()
 85  
         throws MojoExecutionException
 86  
     {
 87  0
         return effectiveDownloader.getIssueList();
 88  
     }
 89  
 
 90  
     public boolean isForceClassic()
 91  
     {
 92  0
         return forceClassic;
 93  
     }
 94  
 
 95  
     public void setForceClassic( boolean forceClassic )
 96  
     {
 97  0
         this.forceClassic = forceClassic;
 98  0
     }
 99  
 }