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 SqlDate extends java.sql.Date implements SCO 26 { 27 private transient Object owner; 28 private transient String fieldName; 29 30 31 39 40 public SqlDate(Object owner, String fieldName, java.sql.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 ((SqlDate)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 183 184 protected Object writeReplace() throws ObjectStreamException 185 { 186 return new java.sql.Date (getTime()); 187 } 188 } 189 | Popular Tags |