|
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 package com.nokia.helium.metadata.model.metadata; |
|
18 |
|
19 import java.io.File; |
|
20 import java.util.List; |
|
21 |
|
22 import javax.persistence.Basic; |
|
23 import javax.persistence.CascadeType; |
|
24 import javax.persistence.Column; |
|
25 import javax.persistence.Entity; |
|
26 import javax.persistence.GeneratedValue; |
|
27 import javax.persistence.GenerationType; |
|
28 import javax.persistence.Id; |
|
29 import javax.persistence.JoinColumn; |
|
30 import javax.persistence.OneToMany; |
|
31 |
|
32 |
|
33 /** |
|
34 * Entity LogFile to store the information about the log for |
|
35 * which the data to be written to database. |
|
36 */ |
|
37 @SuppressWarnings("PMD.UnusedPrivateField") |
|
38 @Entity |
|
39 public class LogFile { |
|
40 |
|
41 @Id |
|
42 @GeneratedValue(strategy = GenerationType.SEQUENCE) |
|
43 @Column(name = "LOGFILE_ID") |
|
44 private int id; |
|
45 |
|
46 @Basic |
|
47 @Column(nullable = false, length = 500) |
|
48 private String path; |
|
49 |
|
50 @OneToMany(cascade = CascadeType.REMOVE) |
|
51 @JoinColumn(name = "LOGFILE_ID", referencedColumnName = "LOGFILE_ID") |
|
52 private List<Component> components; |
|
53 |
|
54 @OneToMany(cascade = CascadeType.REMOVE) |
|
55 @JoinColumn(name = "LOGFILE_ID", referencedColumnName = "LOGFILE_ID") |
|
56 private List<MetadataEntry> metadataEntries; |
|
57 |
|
58 @OneToMany(cascade = CascadeType.REMOVE) |
|
59 @JoinColumn(name = "LOGFILE_ID", referencedColumnName = "LOGFILE_ID") |
|
60 private List<ExecutionTime> executionTimes; |
|
61 |
|
62 |
|
63 /** |
|
64 * Helper function to set the identifier for the log file. |
|
65 * @param identifier for the log file. |
|
66 */ |
|
67 public void setId(int identifier) { |
|
68 id = identifier; |
|
69 } |
|
70 |
|
71 /** |
|
72 * Helper function to get the identifier for the log file. |
|
73 * @return identifier for this log file. |
|
74 */ |
|
75 public int getId() { |
|
76 return id; |
|
77 } |
|
78 |
|
79 /** |
|
80 * Helper function to set the path of the log file. |
|
81 * @param location of the log file. |
|
82 */ |
|
83 public void setPath(String location) { |
|
84 path = location.replace('\\', '/'); |
|
85 } |
|
86 |
|
87 /** |
|
88 * Helper function to set the path of the log file. |
|
89 * @param location of the log file. |
|
90 */ |
|
91 public void setPath(File location) { |
|
92 setPath(location.getAbsolutePath()); |
|
93 } |
|
94 |
|
95 /** |
|
96 * Helper function to get the path. |
|
97 * @return path of the log file.. |
|
98 */ |
|
99 public String getPath() { |
|
100 return path; |
|
101 } |
|
102 } |