1 /* |
|
2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 package com.nokia.helium.jpa.entity.metadata; |
|
19 |
|
20 |
|
21 import javax.persistence.CascadeType; |
|
22 import javax.persistence.Entity; |
|
23 import javax.persistence.GeneratedValue; |
|
24 import javax.persistence.GenerationType; |
|
25 import javax.persistence.Id; |
|
26 import javax.persistence.ManyToOne; |
|
27 import javax.persistence.Column; |
|
28 import javax.persistence.Basic; |
|
29 import javax.persistence.JoinColumn; |
|
30 |
|
31 |
|
32 /** |
|
33 * Entity component time to store the time taken for each |
|
34 * component to build. |
|
35 */ |
|
36 @Entity |
|
37 public class ComponentTime { |
|
38 |
|
39 @Id |
|
40 @GeneratedValue(strategy = GenerationType.SEQUENCE) |
|
41 @Column(name = "COMPONENTTIME_ID") |
|
42 private int id; |
|
43 |
|
44 @Basic |
|
45 private double componentTime; |
|
46 |
|
47 @Basic |
|
48 @Column(name = "COMPONENT_ID", insertable = false, updatable = false) |
|
49 private int componentId; |
|
50 |
|
51 |
|
52 @ManyToOne(cascade = CascadeType.REMOVE) |
|
53 @JoinColumn(name = "COMPONENT_ID", referencedColumnName = "COMPONENT_ID") |
|
54 |
|
55 private Component component; |
|
56 |
|
57 /** |
|
58 * Helper function to set the associated component. |
|
59 * @param cmpt for which the time to be recorded. |
|
60 */ |
|
61 public void setComponent(Component cmpt) { |
|
62 component = cmpt; |
|
63 } |
|
64 |
|
65 |
|
66 /**Helper function to return the time taken for this component |
|
67 * to build. |
|
68 * @return duration to build this component. |
|
69 */ |
|
70 public double getDuration() { |
|
71 return componentTime; |
|
72 } |
|
73 |
|
74 /** |
|
75 * Helper function to set the duration for this component to build. |
|
76 * @param duration to build this component. |
|
77 */ |
|
78 |
|
79 public void setDuration(double duration) { |
|
80 componentTime = duration; |
|
81 } |
|
82 } |
|