1 package org.codehaus.mojo.dashboard.report.plugin.beans;
2
3 /*
4 * Copyright 2006 David Vicente
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * 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, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19
20 import java.util.Date;
21
22 /**
23 * @author <a href="dvicente72@gmail.com">David Vicente</a>
24 *
25 */
26 public abstract class AbstractReportBean implements IDashBoardReportBean, Cloneable
27 {
28
29 /**
30 *
31 */
32 private Date dateGeneration;
33
34 private long id;
35
36 private DashBoardMavenProject mavenProject;
37 /**
38 *
39 *
40 */
41 public AbstractReportBean()
42 {
43 }
44
45 public AbstractReportBean( Date dateGeneration )
46 {
47 this.dateGeneration = dateGeneration;
48 }
49 /* (non-Javadoc)
50 * @see org.codehaus.mojo.dashboard.report.plugin.beans.IDashBoardReportBean#getDateGeneration()
51 */
52 public Date getDateGeneration()
53 {
54 return dateGeneration;
55 }
56 /* (non-Javadoc)
57 * @see org.codehaus.mojo.dashboard.report.plugin.beans.IDashBoardReportBean#setDateGeneration(java.util.Date)
58 */
59 public void setDateGeneration( Date dateGeneration )
60 {
61 this.dateGeneration = dateGeneration;
62 }
63 /**
64 *
65 */
66 protected Object clone()
67 {
68 Object clone = null;
69 try
70 {
71 clone = super.clone();
72 }
73 catch ( CloneNotSupportedException e )
74 {
75 System.err.println( "AbstractReportBean can't clone" );
76 }
77 return clone;
78 }
79 public long getId()
80 {
81 return id;
82 }
83 public void setId( long id )
84 {
85 this.id = id;
86 }
87
88 public DashBoardMavenProject getMavenProject()
89 {
90 return mavenProject;
91 }
92
93 public void setMavenProject( DashBoardMavenProject mavenProject )
94 {
95 this.mavenProject = mavenProject;
96 }
97 protected double getPercentageValue( int numerator, int denominator )
98 {
99 double percentage = 0.0d;
100 if(denominator >0)
101 {
102 percentage = numerator / (double) denominator;
103 }
104 return percentage;
105 }
106
107 }