|
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.metadata.model.metadata; |
|
19 |
|
20 |
|
21 import java.util.List; |
|
22 |
|
23 import javax.persistence.Basic; |
|
24 import javax.persistence.CascadeType; |
|
25 import javax.persistence.Column; |
|
26 import javax.persistence.Entity; |
|
27 import javax.persistence.GeneratedValue; |
|
28 import javax.persistence.GenerationType; |
|
29 import javax.persistence.Id; |
|
30 import javax.persistence.JoinColumn; |
|
31 import javax.persistence.ManyToOne; |
|
32 import javax.persistence.OneToMany; |
|
33 import javax.persistence.OneToOne; |
|
34 |
|
35 |
|
36 /** |
|
37 * Entity class to store the component information. |
|
38 */ |
|
39 @SuppressWarnings("PMD.UnusedPrivateField") |
|
40 @Entity |
|
41 public class Component { |
|
42 |
|
43 @Id |
|
44 @GeneratedValue(strategy = GenerationType.SEQUENCE) |
|
45 @Column(name = "COMPONENT_ID") |
|
46 private int id; |
|
47 |
|
48 @Basic |
|
49 @Column(nullable = false, length = 500) |
|
50 private String component; |
|
51 |
|
52 @Basic |
|
53 @Column(name = "LOGFILE_ID", insertable = false, updatable = false) |
|
54 private int logFileId; |
|
55 |
|
56 @Basic |
|
57 @Column(name = "UNIT_ID", insertable = false, updatable = false) |
|
58 private int unitId; |
|
59 |
|
60 @ManyToOne(cascade = CascadeType.REMOVE) |
|
61 @JoinColumn(name = "LOGFILE_ID", referencedColumnName = "LOGFILE_ID") |
|
62 private LogFile logFile; |
|
63 |
|
64 @OneToMany(cascade = CascadeType.REMOVE) |
|
65 @JoinColumn(name = "COMPONENT_ID", referencedColumnName = "COMPONENT_ID") |
|
66 private List<WhatLogEntry> whatLogEntries; |
|
67 |
|
68 @OneToMany(cascade = CascadeType.REMOVE) |
|
69 @JoinColumn(name = "COMPONENT_ID", referencedColumnName = "COMPONENT_ID") |
|
70 private List<ComponentTime> componentTimes; |
|
71 |
|
72 @OneToMany(cascade = CascadeType.REMOVE) |
|
73 @JoinColumn(name = "COMPONENT_ID", referencedColumnName = "COMPONENT_ID") |
|
74 private List<MetadataEntry> metadataEntries; |
|
75 |
|
76 @OneToOne |
|
77 @JoinColumn(name = "UNIT_ID", referencedColumnName = "UNIT_ID") |
|
78 private SysdefUnit sysdefUnit; |
|
79 |
|
80 /** |
|
81 * Helper function to set the identifier. |
|
82 * @param identifier to set the identifier for the component. |
|
83 */ |
|
84 public void setId(int identifier) { |
|
85 id = identifier; |
|
86 } |
|
87 |
|
88 /** |
|
89 * Helper function to set the identifier. |
|
90 * @return the identifier of the component. |
|
91 */ |
|
92 public int getId() { |
|
93 return id; |
|
94 } |
|
95 |
|
96 /** |
|
97 * Helper function to set component name. |
|
98 * @param cmp string to be set to. |
|
99 */ |
|
100 public void setComponent(String cmp) { |
|
101 component = cmp; |
|
102 } |
|
103 |
|
104 /** |
|
105 * Helper function to set log file associated |
|
106 * with this component. |
|
107 * @param file associated file to this component. |
|
108 */ |
|
109 public void setLogFile(LogFile file) { |
|
110 logFile = file; |
|
111 } |
|
112 |
|
113 /** |
|
114 * Helper function to return component string. |
|
115 * @return component name of this component. |
|
116 */ |
|
117 public String getComponent() { |
|
118 return component; |
|
119 } |
|
120 |
|
121 /** |
|
122 * Helper function to return log file associated with this component. |
|
123 * @return component name of this component. |
|
124 */ |
|
125 public LogFile getLogFile() { |
|
126 return logFile; |
|
127 } |
|
128 |
|
129 /** |
|
130 * Helper function to return logpath id. |
|
131 * @return log path id associated with this component. |
|
132 */ |
|
133 public int getLogFileId() { |
|
134 return logFileId; |
|
135 } |
|
136 |
|
137 /** |
|
138 * Set the related Package. |
|
139 * @param modelPackage the related package entity |
|
140 */ |
|
141 public void setSysdefUnit(SysdefUnit sysdefUnit) { |
|
142 this.sysdefUnit = sysdefUnit; |
|
143 } |
|
144 |
|
145 /** |
|
146 * Get the related Package. |
|
147 * @return Returns the related package entity, null if the component |
|
148 * is not link to any Package. |
|
149 */ |
|
150 |
|
151 public SysdefUnit getSysdefUnit() { |
|
152 return sysdefUnit; |
|
153 } |
|
154 |
|
155 public void setUnitId(int unitId) { |
|
156 this.unitId = unitId; |
|
157 } |
|
158 |
|
159 public int getUnitId() { |
|
160 return unitId; |
|
161 } |
|
162 } |