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  
 
 27  
 /**
 28  
  * A Trac Ticket.
 29  
  *
 30  
  * @author Noriko Kinugasa
 31  
  * @version $Id: org.apache.maven.plugin.trac.TracTicket.html 816592 2012-05-08 12:40:21Z hboutemy $
 32  
  */
 33  
 public class TracTicket
 34  
 {
 35  
     private String id;
 36  
 
 37  
     private String link;
 38  
 
 39  
     private Date timeCreated;
 40  
 
 41  
     private Date timeChanged;
 42  
 
 43  
     private String type;
 44  
 
 45  
     private String summary;
 46  
 
 47  
     private String status;
 48  
 
 49  
     private String resolution;
 50  
 
 51  
     private String milestone;
 52  
 
 53  
     private String owner;
 54  
 
 55  
     private String priority;
 56  
 
 57  
     private String reporter;
 58  
 
 59  
     private String component;
 60  
 
 61  
     public String getComponent()
 62  
     {
 63  0
         return component;
 64  
     }
 65  
 
 66  
     public void setComponent( String component )
 67  
     {
 68  0
         this.component = component;
 69  0
     }
 70  
 
 71  
     public String getPriority()
 72  
     {
 73  0
         return priority;
 74  
     }
 75  
 
 76  
     public void setPriority( String priority )
 77  
     {
 78  0
         this.priority = priority;
 79  0
     }
 80  
 
 81  
     public String getReporter()
 82  
     {
 83  0
         return reporter;
 84  
     }
 85  
 
 86  
     public void setReporter( String reporter )
 87  
     {
 88  0
         this.reporter = reporter;
 89  0
     }
 90  
 
 91  
     public TracTicket()
 92  0
     {
 93  0
     }
 94  
 
 95  
     public String getId()
 96  
     {
 97  0
         return id;
 98  
     }
 99  
 
 100  
     public void setId( String id )
 101  
     {
 102  0
         this.id = id;
 103  0
     }
 104  
 
 105  
     public String getMilestone()
 106  
     {
 107  0
         return milestone;
 108  
     }
 109  
 
 110  
     public void setMilestone( String milestone )
 111  
     {
 112  0
         this.milestone = milestone;
 113  0
     }
 114  
 
 115  
     public String getOwner()
 116  
     {
 117  0
         return owner;
 118  
     }
 119  
 
 120  
     public void setOwner( String owner )
 121  
     {
 122  0
         this.owner = owner;
 123  0
     }
 124  
 
 125  
     public String getResolution()
 126  
     {
 127  0
         return resolution;
 128  
     }
 129  
 
 130  
     public void setResolution( String resolution )
 131  
     {
 132  0
         this.resolution = resolution;
 133  0
     }
 134  
 
 135  
     public String getStatus()
 136  
     {
 137  0
         return status;
 138  
     }
 139  
 
 140  
     public void setStatus( String status )
 141  
     {
 142  0
         this.status = status;
 143  0
     }
 144  
 
 145  
     public String getSummary()
 146  
     {
 147  0
         return summary;
 148  
     }
 149  
 
 150  
     public void setSummary( String summary )
 151  
     {
 152  0
         this.summary = summary;
 153  0
     }
 154  
 
 155  
     public String getType()
 156  
     {
 157  0
         return type;
 158  
     }
 159  
 
 160  
     public void setType( String type )
 161  
     {
 162  0
         this.type = type;
 163  0
     }
 164  
 
 165  
     public Date getTimeChanged()
 166  
     {
 167  0
         return timeChanged;
 168  
     }
 169  
 
 170  
     public void setTimeChanged( String timeChanged )
 171  
     {
 172  0
         this.timeChanged = parseDate( timeChanged );
 173  0
     }
 174  
 
 175  
     public Date getTimeCreated()
 176  
     {
 177  0
         return timeCreated;
 178  
     }
 179  
 
 180  
     public void setTimeCreated( String timeCreated )
 181  
     {
 182  0
         this.timeCreated = parseDate( timeCreated );
 183  0
     }
 184  
 
 185  
     private Date parseDate( String timeCreated )
 186  
         throws RuntimeException
 187  
     {
 188  
         try
 189  
         {
 190  0
             long millis = Long.parseLong( timeCreated );
 191  0
             Calendar cld = Calendar.getInstance();
 192  0
             cld.setTimeInMillis( millis * 1000L );
 193  0
             return cld.getTime();
 194  
         }
 195  0
         catch ( NumberFormatException e )
 196  
         {
 197  0
             SimpleDateFormat format = new SimpleDateFormat( "EEE MMM dd HH:mm:ss z yyyy" );
 198  
             try
 199  
             {
 200  0
                 return format.parse( timeCreated );
 201  
             }
 202  0
             catch ( ParseException e1 )
 203  
             {
 204  0
                 throw new RuntimeException( "Failed to parse date '" + timeCreated + "' as a date.", e1 );
 205  
             }
 206  
         }
 207  
     }
 208  
 
 209  
     public String getLink()
 210  
     {
 211  0
         return link;
 212  
     }
 213  
 
 214  
     public void setLink( String link )
 215  
     {
 216  0
         this.link = link;
 217  0
     }
 218  
 
 219  
 }