1 9 package test.simple; 10 11 import org.apache.log4j.Category; 12 import org.ozoneDB.OzoneObject; 13 14 import java.util.Enumeration ; 15 import java.util.Vector ; 16 17 public class AutoImpl extends OzoneObject implements Auto { 18 19 22 private static Category fLog = Category.getInstance(AutoImpl.class); 23 24 28 final static long serialVersionUID = 1L; 29 30 String name = "Ford"; 31 32 int age = 0; 33 34 Auto link; 35 36 Vector v; 37 38 39 public AutoImpl() { 40 v = new Vector (); 42 v.add("dani"); 43 44 } 45 46 47 public void onCreate() { 48 fLog.debug("onCreate()..."); 49 } 57 58 59 public void onDelete() { 60 fLog.debug("onDelete()..."); 61 if (link != null) { 62 database().deleteObject(link); 63 } 64 } 65 66 67 public boolean equals(Object obj) { 68 Auto auto = (Auto) obj; 69 return name.equals(auto.name()); 70 } 71 72 73 public String nameName() throws Exception { 74 fLog.debug(self()); 75 fLog.debug(((Auto) self()).link()); 76 fLog.debug(((Auto) self()).link().name()); 77 return ((Auto) self()).link().name(); 78 } 79 80 81 public Auto doSomthing(Auto auto) throws Exception { 82 String linkName = link.name(); 83 fLog.debug("doSomething(): linkName=" + linkName); 84 return link; 85 } 86 87 88 public Auto setLink(Auto auto) throws Exception { 89 link = auto; 91 return this; 92 } 93 94 95 public Auto link() { 96 return link; 97 } 98 99 100 public void print() { 101 fLog.debug(toString()); 102 103 fLog.debug("Vector:"); 104 for (Enumeration e = v.elements(); e.hasMoreElements();) { 105 fLog.debug(e.nextElement()); 106 } 107 } 108 109 110 public void setName(String newName) { 111 name = newName; 112 } 113 114 115 public String name() { 116 return name; 117 } 118 119 120 public void setAge(Integer newAge) { 121 age = newAge.intValue(); 122 } 124 125 126 public int setAge(int newAge) { 127 age = newAge; 128 return age; 129 } 130 131 132 public Integer age() { 133 return new Integer (age); 134 } 135 136 137 public String toString() { 138 return "Auto:" + name + ", " + String.valueOf(age); 140 } 141 142 143 public void done() throws Exception { 144 } 146 147 } 148 | Popular Tags |