Coverage Report - us.daveread.basicquery.util.NewVersionInformation
 
Classes in this File Line Coverage Branch Coverage Complexity
NewVersionInformation
0%
0/30
0%
0/3
0
 
 1  
 package us.daveread.basicquery.util;
 2  
 
 3  
 import java.net.URL;
 4  
 import java.util.ArrayList;
 5  
 import java.util.List;
 6  
 
 7  
 /**
 8  
  * Populated with information for a newer version of the program.
 9  
  * 
 10  
  * @author David Read
 11  
  * 
 12  
  */
 13  
 public class NewVersionInformation {
 14  
   /**
 15  
    * The latest version number
 16  
    */
 17  
   private String latestVersionString;
 18  
 
 19  
   /**
 20  
    * The new features in the latest version
 21  
    */
 22  0
   private List<String> newFeatures = new ArrayList<String>();
 23  
 
 24  
   /**
 25  
    * The URL to the download page
 26  
    */
 27  
   private URL urlToDownloadPage;
 28  
 
 29  
   /**
 30  
    * The URL to the source code
 31  
    */
 32  
   private URL urlToSourceCode;
 33  
 
 34  
   /**
 35  
    * No operation
 36  
    */
 37  0
   public NewVersionInformation() {
 38  
 
 39  0
   }
 40  
 
 41  
   /**
 42  
    * Get the instructions for obtaining the new version.
 43  
    * 
 44  
    * TODO populate from website source
 45  
    * 
 46  
    * @return Instructions for obtaining a new version
 47  
    */
 48  
   public String getDownloadInformation() {
 49  
     StringBuilder message;
 50  
 
 51  0
     message = new StringBuilder();
 52  
 
 53  0
     if (getUrlToDownloadPage() != null) {
 54  0
       message.append("The latest installer is located at:\n");
 55  0
       message.append(getUrlToDownloadPage().toString());
 56  0
       message.append("\n");
 57  
     }
 58  
 
 59  0
     if (getUrlToSourceCode() != null) {
 60  0
       message.append("The source code is located at:\n");
 61  0
       message.append(getUrlToSourceCode().toString());
 62  0
       message.append("\n");
 63  
     }
 64  
 
 65  0
     return message.toString();
 66  
   }
 67  
 
 68  
   /**
 69  
    * Get the latest version number
 70  
    * 
 71  
    * @return The version number
 72  
    */
 73  
   public String getLatestVersion() {
 74  0
     return latestVersionString;
 75  
   }
 76  
 
 77  
   /**
 78  
    * Set the latest version number
 79  
    * 
 80  
    * @param pLatestVersionString
 81  
    *          The version number
 82  
    */
 83  
   public void setLatestVersion(String pLatestVersionString) {
 84  0
     latestVersionString = pLatestVersionString;
 85  0
   }
 86  
 
 87  
   /**
 88  
    * Get the description of new features
 89  
    * 
 90  
    * @return Listing of new features
 91  
    */
 92  
   public String getNewFeaturesDescription() {
 93  0
     final StringBuffer message = new StringBuffer();
 94  
 
 95  0
     for (String line : newFeatures) {
 96  0
       message.append(line);
 97  0
       message.append('\n');
 98  0
     }
 99  
 
 100  0
     return message.toString();
 101  
   }
 102  
 
 103  
   /**
 104  
    * Add a new feature description
 105  
    * 
 106  
    * @param newFeatureMessage
 107  
    *          New feature in the more recent version
 108  
    */
 109  
   public void addNewFeatureMessage(String newFeatureMessage) {
 110  0
     newFeatures.add("  * " + newFeatureMessage);
 111  0
   }
 112  
 
 113  
   /**
 114  
    * Get the URL for the application's download page. This will be null if the
 115  
    * value could not be loaded.
 116  
    * 
 117  
    * @return The URL to the program download web page. It will be null if the
 118  
    *         information could not be loaded.
 119  
    */
 120  
   public URL getUrlToDownloadPage() {
 121  0
     return urlToDownloadPage;
 122  
   }
 123  
 
 124  
   /**
 125  
    * Set the URL for the application's download web page.
 126  
    * 
 127  
    * @param pUrlToDownloadPage
 128  
    *          The URL for the program's download page
 129  
    */
 130  
   public void setUrlToDownloadPage(URL pUrlToDownloadPage) {
 131  0
     urlToDownloadPage = pUrlToDownloadPage;
 132  0
   }
 133  
 
 134  
   /**
 135  
    * Get the URL for the application's source code repository location. This
 136  
    * will be null if the value could not be loaded.
 137  
    * 
 138  
    * @return The URL to the program's source code download location. It will be
 139  
    *         null if the information could not be loaded.
 140  
    */
 141  
   public URL getUrlToSourceCode() {
 142  0
     return urlToSourceCode;
 143  
   }
 144  
 
 145  
   /**
 146  
    * Set the URL for the application's source code location
 147  
    * 
 148  
    * @param pUrlToSourceCode
 149  
    *          The URL for the program's source code location
 150  
    */
 151  
   public void setUrlToSourceCode(URL pUrlToSourceCode) {
 152  0
     this.urlToSourceCode = pUrlToSourceCode;
 153  0
   }
 154  
 }