1 package org.neuclear.ledger;
2
3 import java.io.Serializable;
4 import java.util.Date;
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 /***
27 * User: pelleb
28 * Date: Apr 19, 2004
29 * Time: 10:51:01 AM
30 */
31 public class Book implements Serializable {
32 protected Book() {
33 }
34
35 public Book(String id, String nickname, String type, String source, Date registered, Date updated, String registrationid) {
36 this.id = id;
37 this.nickname = nickname;
38 this.type = type;
39 this.source = source;
40 this.registered = registered;
41 this.updated = updated;
42 this.registrationid = registrationid;
43 }
44
45 public Book(String id, Date registered) {
46 this.id = id;
47 System.out.println("ID=" + id);
48 this.nickname = (id.length() == 32) ? (
49 id.substring(0, 4) + '-'
50 + id.substring(4, 8)
51 ) : id;
52 this.type = "identity";
53 this.source = null;
54 this.registered = registered;
55 this.updated = registered;
56 this.registrationid = null;
57 }
58
59 public String getId() {
60 return id;
61 }
62
63 public String getNickname() {
64 return nickname;
65 }
66
67 public String getType() {
68 return type;
69 }
70
71 public String getSource() {
72 return source;
73 }
74
75 public Date getRegistered() {
76 return registered;
77 }
78
79 public Date getUpdated() {
80 return updated;
81 }
82
83 public String getRegistrationId() {
84 return registrationid;
85 }
86
87 public boolean equals(Object o) {
88 return o.getClass().equals(this.getClass()) && id.equals(((Book) o).getId());
89 }
90
91 public int hashCode() {
92 return id.hashCode();
93 }
94
95 protected String id;
96 protected String nickname;
97 protected String type;
98 protected String source;
99 protected Date registered;
100 protected Date updated;
101 protected String registrationid;
102 }