1 package Jt.examples; 2 3 import Jt.*; 4 5 6 import java.util.*; 7 import java.text.*; 8 9 public class Member extends JtObject { 10 private String email; 11 private String firstname; 12 private String lastname; 13 private int status; 14 private String subject; 15 private String comments; 16 private Date tstamp; 17 18 public Member() { 19 } 20 21 public int getStatus () { 22 return (status); 23 } 24 25 public void setStatus (int newStatus) { 26 status = newStatus; 27 } 28 29 public String getEmail() { 30 return email; 31 } 32 33 public void setEmail (String newEmail) { 34 email = newEmail; 35 } 36 37 public String getSubject() { 38 return subject; 39 } 40 41 public void setSubject (String newSubject) { 42 subject = newSubject; 43 } 44 45 public String getComments() { 46 return comments; 47 } 48 49 public void setComments (String newComments) { 50 comments = newComments; 51 } 52 53 public void setFirstname (String newFirstname) { 54 firstname = newFirstname; 55 } 56 57 public String getFirstname() { 58 return firstname; 59 } 60 61 public void setLastname (String newLastname) { 62 lastname = newLastname; 63 } 64 65 public String getLastname() { 66 return lastname; 67 } 68 69 70 public void setTstamp (Date tstamp) { 71 this.tstamp = tstamp; 72 } 73 74 public Date getTstamp () { 75 return tstamp; 76 } 77 78 86 87 public Object processMessage (Object event) { 88 89 String msgid = null; 90 JtMessage e = (JtMessage) event; 91 Object content; 92 JtValueObject valueObj; 93 JtMessage msg; 94 95 if (e == null) 96 return null; 97 98 msgid = (String ) e.getMsgId (); 99 100 if (msgid == null) 101 return null; 102 103 content = e.getMsgContent(); 104 105 106 107 108 if (msgid.equals ("JtREMOVE")) { 109 110 return (null); 111 112 } 113 114 if (msgid.equals ("JtVALUE_OBJECT")) { 115 valueObj = new JtValueObject (); 116 setValue (valueObj, "subject", this); 117 msg = new JtMessage ("JtACTIVATE"); 118 120 sendMessage (valueObj, msg); 121 return (valueObj); 122 123 } 124 125 handleError ("processMessage: invalid message id:" + msgid); 126 return (null); 127 128 } 129 130 132 public static void main(String [] args) { 133 134 JtObject main = new JtObject (); 135 JtMessage msg, msg1; 136 Integer count; 137 Date date = new Date (); 138 DateFormat df = DateFormat.getDateInstance(); 139 140 141 main.setObjTrace (1); 142 main.createObject ("Member", "member"); 143 msg = (JtMessage) main.createObject ("Jt.JtMessage", "message"); 144 main.setValue ("message", "msgId", "JtPRINT"); 145 main.setValue ("member", "tstamp", df.format (date)); 147 148 main.sendMessage ("member", "message"); 149 150 151 } 152 153 154 } | Popular Tags |