Source code: com/cybertivity/powerjournal/Entry.java
1 package com.cybertivity.powerjournal;
2
3 import java.sql.Timestamp;
4 import java.text.SimpleDateFormat;
5 import java.util.Date;
6
7 /**
8 * Title: PowerJournal
9 * Description: $Id: Entry.java,v 1.4 2001/12/04 02:35:15 arrowood Exp $
10 * Copyright: Copyright (c) 2001
11 * Company: <A HREF="http://www.cybertivity.com">Cybertivity</A>
12 *
13 * @author <A HREF="mailto:chris.arrowood@cybertivity.com">Chris Arrowood</A>
14 * @created November 18, 2001
15 * @version 1.0
16 */
17
18 public class Entry {
19
20 private Timestamp entryDate = null;
21 private int entryNumber = 0;
22 private String entryDescription = null;
23 private String entryContents = null;
24 private boolean isNull = true;
25 private boolean entryPrivate = false;
26 private String entryPositionMemo = "";
27 private String journalName = "";
28 public final static String DATE_FORMAT = "MM-dd-yyyy h:mm:ss a";
29
30
31 public Entry(String entryDescriptionArg, String entryContentsArg) {
32 long now = new Date().getTime();
33 entryDate = new Timestamp(now);
34 entryDescription = entryDescriptionArg;
35 entryContents = entryContentsArg;
36 isNull = false;
37 }
38
39
40 public Timestamp getEntryDate() {
41 return entryDate;
42 }
43
44
45 public String getEntryDateAsString() {
46 SimpleDateFormat df = new SimpleDateFormat(DATE_FORMAT);
47 return df.format(new Date(entryDate.getTime()));
48 }
49
50
51 public void setEntryDate(Timestamp _entryDate) {
52 entryDate = _entryDate;
53 isNull = false;
54 }
55
56
57 public int getEntryNumber() {
58 return entryNumber;
59 }
60
61
62 public void setEntryNumber(int _entryNumber) {
63 entryNumber = _entryNumber;
64 isNull = false;
65 }
66
67
68 public String getEntryDescription() {
69 return fixNull(entryDescription);
70 }
71
72
73 public void setEntryDescription(String _entryDescription) {
74 entryDescription = _entryDescription;
75 isNull = false;
76 }
77
78
79 public String getEntryContents() {
80 return fixNull(entryContents);
81 }
82
83
84 public void setEntryContents(String _entryContents) {
85 entryContents = _entryContents;
86 isNull = false;
87 }
88
89
90 public boolean getIsNull() {
91 return isNull;
92 }
93
94
95 public boolean getEntryPrivate() {
96 return entryPrivate;
97 }
98
99
100 public void setEntryPrivate(boolean _entryPrivate) {
101 entryPrivate = _entryPrivate;
102 isNull = false;
103 }
104
105
106 private String fixNull(String arg) {
107 if (arg == null) {
108 return "";
109 } else {
110 return arg;
111 }
112 }
113 public String getEntryPositionMemo() {
114 return entryPositionMemo;
115 }
116 public void setEntryPositionMemo(String _entryPositionMemo) {
117 entryPositionMemo = _entryPositionMemo;
118 }
119 public String getJournalName() {
120 return journalName;
121 }
122 public void setJournalName(String _journalName) {
123 journalName = _journalName;
124 }
125 }