01 package com.bea.medrec.value;
02
03 import java.io.Serializable;
04 import java.text.SimpleDateFormat;
05
06 /**
07 * <p>Base class for all value objects.</p>
08 *
09 * @author Copyright (c) 2006 by BEA Systems. All Rights Reserved.
10 */
11 public class BaseVO implements Serializable {
12
13 // Attributes
14 private Integer id;
15
16 // Constructors
17 public BaseVO() {
18 }
19
20 public BaseVO(Integer id) {
21 this.id = id;
22 }
23
24 public BaseVO(int id) {
25 this.id = new Integer(id);
26 }
27
28 // Getters
29 public Integer getId() {
30 return this.id;
31 }
32
33 // Setters
34 public void setId(Integer id) {
35 this.id = id;
36 }
37
38 public void setId(int id) {
39 this.id = new Integer(id);
40 }
41
42 public void setId(String id) {
43 this.id = str2Integer(id);
44 }
45
46 // Utility
47 protected String getDisplayDate(java.util.Calendar pCalendar) {
48 SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy");
49 if (pCalendar != null)
50 return format.format(pCalendar.getTime());
51 else
52 return "";
53 }
54
55 protected String toStr(Object obj) {
56 if (obj != null)
57 return obj.toString();
58 else
59 return null;
60 }
61
62 protected Integer str2Integer(String str) {
63 Integer tempInt = null;
64 try {
65 if (str != null)
66 tempInt = Integer.valueOf(str);
67 } catch (NumberFormatException e) {
68 }
69 return tempInt;
70 }
71 }
|