View Javadoc

1   package org.neuclear.ledger;
2   
3   /*
4    *  The NeuClear Project and it's libraries are
5    *  (c) 2002-2004 Antilles Software Ventures SA
6    *  For more information see: http://neuclear.org
7    *
8    *  This library is free software; you can redistribute it and/or
9    *  modify it under the terms of the GNU Lesser General Public
10   *  License as published by the Free Software Foundation; either
11   *  version 2.1 of the License, or (at your option) any later version.
12   *
13   *  This library is distributed in the hope that it will be useful,
14   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16   *  Lesser General Public License for more details.
17   *
18   *  You should have received a copy of the GNU Lesser General Public
19   *  License along with this library; if not, write to the Free Software
20   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21   */
22  
23  import java.io.Serializable;
24  import java.util.Date;
25  
26  /***
27   * User: pelleb
28   * Date: Apr 19, 2004
29   * Time: 10:51:01 AM
30   */
31  public class Ledger implements Serializable {
32      protected Ledger() {
33      }
34  
35      public Ledger(String id, String nickname, String type, String source, Date registered, Date updated, String registrationid, String unit, int decimal) {
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          this.unit = unit;
44          this.decimal = decimal;
45      }
46  
47      public Ledger(String id, Date registered) {
48          this.id = id;
49          System.out.println("ID=" + id);
50          this.nickname = (id.length() == 32) ? (
51                  id.substring(0, 4) + '-'
52                  + id.substring(4, 8)
53                  ) : id;
54          this.type = "asset";
55          this.source = null;
56          this.registered = registered;
57          this.updated = registered;
58          this.registrationid = null;
59          this.decimal = 2;
60          this.unit = "";
61      }
62  
63      public String getId() {
64          return id;
65      }
66  
67      public String getNickname() {
68          return nickname;
69      }
70  
71      public String getType() {
72          return type;
73      }
74  
75      public String getSource() {
76          return source;
77      }
78  
79      public Date getRegistered() {
80          return registered;
81      }
82  
83      public Date getUpdated() {
84          return updated;
85      }
86  
87      public String getRegistrationId() {
88          return registrationid;
89      }
90  
91      public String getUnit() {
92          return unit;
93      }
94  
95      public int getDecimalPoint() {
96          return decimal;
97      }
98  
99      protected String id;
100     protected String nickname;
101     protected String type;
102     protected String source;
103     protected Date registered;
104     protected Date updated;
105     protected String registrationid;
106     protected String unit;
107     protected int decimal;
108 }