1 10 11 package com.triactive.jdo.sco; 12 13 import com.triactive.jdo.SCO; 14 import java.io.ObjectStreamException ; 15 import javax.jdo.JDOHelper; 16 17 18 24 25 public class Date extends java.util.Date implements SCO 26 { 27 private transient Object owner; 28 private transient String fieldName; 29 30 31 39 40 public Date(Object owner, String fieldName, java.util.Date date) 41 { 42 super(date.getTime()); 43 44 this.owner = owner; 45 this.fieldName = fieldName; 46 } 47 48 49 public Object getOwner() 50 { 51 return owner; 52 } 53 54 55 public String getFieldName() 56 { 57 return fieldName; 58 } 59 60 61 public void makeDirty() 62 { 63 if (owner != null) 64 JDOHelper.makeDirty(owner, fieldName); 65 } 66 67 68 public void applyUpdates() 69 { 70 } 71 72 73 public void unsetOwner() 74 { 75 owner = null; 76 fieldName = null; 77 } 78 79 80 88 89 public Object clone() 90 { 91 Object obj = super.clone(); 92 93 ((Date)obj).unsetOwner(); 94 95 return obj; 96 } 97 98 99 public void setTime(long time) 100 { 101 super.setTime(time); 102 makeDirty(); 103 } 104 105 106 121 122 public void setYear(int year) 123 { 124 super.setYear(year); 125 makeDirty(); 126 } 127 128 129 143 144 public void setMonth(int month) 145 { 146 super.setMonth(month); 147 makeDirty(); 148 } 149 150 151 166 167 public void setDate(int date) 168 { 169 super.setDate(date); 170 makeDirty(); 171 } 172 173 174 186 187 public void setHours(int hours) 188 { 189 super.setHours(hours); 190 makeDirty(); 191 } 192 193 194 206 207 public void setMinutes(int minutes) 208 { 209 super.setMinutes(minutes); 210 makeDirty(); 211 } 212 213 214 226 227 public void setSeconds(int seconds) 228 { 229 super.setSeconds(seconds); 230 makeDirty(); 231 } 232 233 234 242 243 protected Object writeReplace() throws ObjectStreamException 244 { 245 return new java.util.Date (getTime()); 246 } 247 } 248 | Popular Tags |