|
1 |
|
2 /* |
|
3 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
4 * All rights reserved. |
|
5 * This component and the accompanying materials are made available |
|
6 * under the terms of the License "Eclipse Public License v1.0" |
|
7 * which accompanies this distribution, and is available |
|
8 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 * |
|
10 * Initial Contributors: |
|
11 * Nokia Corporation - initial contribution. |
|
12 * |
|
13 * Contributors: |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 package com.nokia.helium.metadata.model; |
|
19 |
|
20 import javax.persistence.Basic; |
|
21 import javax.persistence.Column; |
|
22 import javax.persistence.Entity; |
|
23 import javax.persistence.GeneratedValue; |
|
24 import javax.persistence.GenerationType; |
|
25 import javax.persistence.Id; |
|
26 |
|
27 |
|
28 |
|
29 /** |
|
30 * Entity Version to store the db version. |
|
31 */ |
|
32 @Entity |
|
33 public class Version { |
|
34 |
|
35 public static final transient int DB_VERSION = 5; |
|
36 |
|
37 |
|
38 @Id |
|
39 @GeneratedValue(strategy = GenerationType.SEQUENCE) |
|
40 @Column(name = "VERSION_ID") |
|
41 private int id; |
|
42 |
|
43 //DB_VERSION to set as default if version changes |
|
44 @Basic |
|
45 @Column(unique = true, nullable = false) |
|
46 private int version = DB_VERSION; |
|
47 |
|
48 /** |
|
49 * Helper function to set the identifier for the log file. |
|
50 * @param identifier for the log file. |
|
51 */ |
|
52 public void setId(int identifier) { |
|
53 id = identifier; |
|
54 } |
|
55 |
|
56 /** |
|
57 * Helper function to get the identifier for the db schema version. |
|
58 * @return identifier for this log file. |
|
59 */ |
|
60 public int getId() { |
|
61 return id; |
|
62 } |
|
63 |
|
64 /** |
|
65 * Helper function to set the db schema version. |
|
66 * @param location of the log file. |
|
67 */ |
|
68 public void setVersion(int ver) { |
|
69 version = ver; |
|
70 } |
|
71 |
|
72 /** |
|
73 * Helper function to return the current db schema version. |
|
74 * @return path of the log file.. |
|
75 */ |
|
76 public int getVersion() { |
|
77 return version; |
|
78 } |
|
79 } |