|
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 import javax.persistence.Basic; |
|
21 import javax.persistence.CascadeType; |
|
22 import javax.persistence.Column; |
|
23 import javax.persistence.Entity; |
|
24 import javax.persistence.GeneratedValue; |
|
25 import javax.persistence.GenerationType; |
|
26 import javax.persistence.Id; |
|
27 import javax.persistence.JoinColumn; |
|
28 import javax.persistence.ManyToOne; |
|
29 |
|
30 |
|
31 /** |
|
32 * Entity class to store the component information. |
|
33 */ |
|
34 @Entity |
|
35 public class WhatLogEntry { |
|
36 |
|
37 public static final int PATH_MAX = 4096; |
|
38 |
|
39 @Id |
|
40 @GeneratedValue(strategy = GenerationType.SEQUENCE) |
|
41 @Column(name = "WHATLOG_ENTRY_ID") |
|
42 private int id; |
|
43 |
|
44 @Basic |
|
45 @Column(name = "COMPONENT_ID", insertable = false, updatable = false) |
|
46 private int componentId; |
|
47 |
|
48 @Basic |
|
49 @Column(name = "MEMBER", nullable = false, length = PATH_MAX) |
|
50 private String member; |
|
51 |
|
52 @Basic |
|
53 @Column(name = "MISSING") |
|
54 private boolean missing; |
|
55 |
|
56 @ManyToOne(cascade = CascadeType.ALL) |
|
57 @JoinColumn(name = "COMPONENT_ID", referencedColumnName = "COMPONENT_ID") |
|
58 private Component component; |
|
59 |
|
60 /** |
|
61 * Helper function to set the identifier. |
|
62 * @param identifier to set the identifier for the component. |
|
63 */ |
|
64 public void setId(int identifier) { |
|
65 id = identifier; |
|
66 } |
|
67 |
|
68 /** |
|
69 * Helper function to set the identifier. |
|
70 * @return the identifier of the component. |
|
71 */ |
|
72 public int getId() { |
|
73 return id; |
|
74 } |
|
75 |
|
76 /** |
|
77 * Helper function to set component name. |
|
78 * @param cmp string to be set to. |
|
79 */ |
|
80 public void setComponent(Component cmp) { |
|
81 component = cmp; |
|
82 } |
|
83 |
|
84 /** |
|
85 * Helper function to set log file associated |
|
86 * with this component. |
|
87 * @param file associated file to this component. |
|
88 */ |
|
89 public void setMember(String member) { |
|
90 // Truncate the string if it doesn't fit to the schema. |
|
91 if (member.length() > PATH_MAX) { |
|
92 member = member.substring(0, PATH_MAX); |
|
93 } |
|
94 this.member = member; |
|
95 } |
|
96 |
|
97 /** |
|
98 * Helper function to return component string. |
|
99 * @return component name of this component. |
|
100 */ |
|
101 public Component getComponent() { |
|
102 return component; |
|
103 } |
|
104 |
|
105 /** |
|
106 * Helper function to return log file associated with this component. |
|
107 * @return component name of this component. |
|
108 */ |
|
109 public String getMember() { |
|
110 return member; |
|
111 } |
|
112 |
|
113 public void setMissing(boolean nonexistance) { |
|
114 missing = nonexistance; |
|
115 } |
|
116 |
|
117 public boolean getMissing() { |
|
118 return missing; |
|
119 } |
|
120 |
|
121 public int getComponentID() { |
|
122 return componentId; |
|
123 } |
|
124 |
|
125 public void setComponentId(int componentId) { |
|
126 this.componentId = componentId; |
|
127 } |
|
128 } |