Coverage Report - org.apache.maven.plugin.trac.TracTicket
 
Classes in this File Line Coverage Branch Coverage Complexity
TracTicket
0%
0/50
N/A
1,179
 
 1  
 package org.apache.maven.plugin.trac;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import java.text.ParseException;
 23  
 import java.text.SimpleDateFormat;
 24  
 import java.util.Calendar;
 25  
 import java.util.Date;
 26  
 import java.util.Locale;
 27  
 
 28  
 /**
 29  
  * A Trac Ticket.
 30  
  *
 31  
  * @author Noriko Kinugasa
 32  
  * @version $Id: org.apache.maven.plugin.trac.TracTicket.html 816595 2012-05-08 12:43:00Z hboutemy $
 33  
  */
 34  
 public class TracTicket
 35  
 {
 36  
     private String id;
 37  
 
 38  
     private String link;
 39  
 
 40  
     private Date timeCreated;
 41  
 
 42  
     private Date timeChanged;
 43  
 
 44  
     private String type;
 45  
 
 46  
     private String summary;
 47  
 
 48  
     private String status;
 49  
 
 50  
     private String resolution;
 51  
 
 52  
     private String milestone;
 53  
 
 54  
     private String owner;
 55  
 
 56  
     private String priority;
 57  
 
 58  
     private String reporter;
 59  
 
 60  
     private String component;
 61  
 
 62  
     public String getComponent()
 63  
     {
 64  0
         return component;
 65  
     }
 66  
 
 67  
     public void setComponent( String component )
 68  
     {
 69  0
         this.component = component;
 70  0
     }
 71  
 
 72  
     public String getPriority()
 73  
     {
 74  0
         return priority;
 75  
     }
 76  
 
 77  
     public void setPriority( String priority )
 78  
     {
 79  0
         this.priority = priority;
 80  0
     }
 81  
 
 82  
     public String getReporter()
 83  
     {
 84  0
         return reporter;
 85  
     }
 86  
 
 87  
     public void setReporter( String reporter )
 88  
     {
 89  0
         this.reporter = reporter;
 90  0
     }
 91  
 
 92  
     public TracTicket()
 93  0
     {
 94  0
     }
 95  
 
 96  
     public String getId()
 97  
     {
 98  0
         return id;
 99  
     }
 100  
 
 101  
     public void setId( String id )
 102  
     {
 103  0
         this.id = id;
 104  0
     }
 105  
 
 106  
     public String getMilestone()
 107  
     {
 108  0
         return milestone;
 109  
     }
 110  
 
 111  
     public void setMilestone( String milestone )
 112  
     {
 113  0
         this.milestone = milestone;
 114  0
     }
 115  
 
 116  
     public String getOwner()
 117  
     {
 118  0
         return owner;
 119  
     }
 120  
 
 121  
     public void setOwner( String owner )
 122  
     {
 123  0
         this.owner = owner;
 124  0
     }
 125  
 
 126  
     public String getResolution()
 127  
     {
 128  0
         return resolution;
 129  
     }
 130  
 
 131  
     public void setResolution( String resolution )
 132  
     {
 133  0
         this.resolution = resolution;
 134  0
     }
 135  
 
 136  
     public String getStatus()
 137  
     {
 138  0
         return status;
 139  
     }
 140  
 
 141  
     public void setStatus( String status )
 142  
     {
 143  0
         this.status = status;
 144  0
     }
 145  
 
 146  
     public String getSummary()
 147  
     {
 148  0
         return summary;
 149  
     }
 150  
 
 151  
     public void setSummary( String summary )
 152  
     {
 153  0
         this.summary = summary;
 154  0
     }
 155  
 
 156  
     public String getType()
 157  
     {
 158  0
         return type;
 159  
     }
 160  
 
 161  
     public void setType( String type )
 162  
     {
 163  0
         this.type = type;
 164  0
     }
 165  
 
 166  
     public Date getTimeChanged()
 167  
     {
 168  0
         return timeChanged;
 169  
     }
 170  
 
 171  
     public void setTimeChanged( String timeChanged )
 172  
     {
 173  0
         this.timeChanged = parseDate( timeChanged );
 174  0
     }
 175  
 
 176  
     public Date getTimeCreated()
 177  
     {
 178  0
         return timeCreated;
 179  
     }
 180  
 
 181  
     public void setTimeCreated( String timeCreated )
 182  
     {
 183  0
         this.timeCreated = parseDate( timeCreated );
 184  0
     }
 185  
 
 186  
     private Date parseDate( String timeCreated )
 187  
         throws RuntimeException
 188  
     {
 189  
         try
 190  
         {
 191  0
             long millis = Long.parseLong( timeCreated );
 192  0
             Calendar cld = Calendar.getInstance();
 193  0
             cld.setTimeInMillis( millis * 1000L );
 194  0
             return cld.getTime();
 195  
         }
 196  0
         catch ( NumberFormatException e )
 197  
         {
 198  0
             SimpleDateFormat format = new SimpleDateFormat( "EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH );
 199  
             try
 200  
             {
 201  0
                 return format.parse( timeCreated );
 202  
             }
 203  0
             catch ( ParseException e1 )
 204  
             {
 205  0
                 throw new RuntimeException( "Failed to parse date '" + timeCreated + "' as a date.", e1 );
 206  
             }
 207  
         }
 208  
     }
 209  
 
 210  
     public String getLink()
 211  
     {
 212  0
         return link;
 213  
     }
 214  
 
 215  
     public void setLink( String link )
 216  
     {
 217  0
         this.link = link;
 218  0
     }
 219  
 
 220  
 }