1 package org.myoodb; 25 26 public class MyOodbObject implements MyOodbLocal 27 { 28 private transient boolean m_convertFlag = true; 29 private transient org.myoodb.core.AbstractObjectContainer m_container = null; 30 31 public MyOodbObject() 32 { 33 } 34 35 public void onCreate() 36 { 37 } 38 39 public void onDelete() 40 { 41 } 42 43 public final void setConvertFlag(boolean convertFlag) 44 { 45 m_convertFlag = convertFlag; 46 } 47 48 public final boolean getConvertFlag() 49 { 50 return m_convertFlag; 51 } 52 53 public final void setContainer(org.myoodb.core.AbstractObjectContainer container) 54 { 55 m_container = container; 56 } 57 58 public final org.myoodb.core.AbstractObjectContainer getContainer() 59 { 60 if (m_container == null) 61 { 62 throw new org.myoodb.exception.PermissionException("Invalid access (" + this.getClass() + " is not (yet) associated to a database"); 63 } 64 65 return m_container; 66 } 67 68 public final MyOodbProxy getSelf() 69 { 70 return getContainer().getProxy(); 71 } 72 73 public final org.myoodb.core.Identifier getDatabaseHandle() 74 { 75 return getContainer().getObjectId(); 76 } 77 78 public final org.myoodb.core.AbstractDatabase getDatabase() 79 { 80 return org.myoodb.core.MyOodbManager.getTheManager().getDatabase(); 81 } 82 83 public final void setBean(MyOodbBean bean) 84 { 85 getContainer().setBean(bean); 86 } 87 88 public final MyOodbBean getBean() 89 { 90 return getContainer().getBean(); 91 } 92 93 public final void setXML(String xml) 94 { 95 getContainer().setXML(xml); 96 } 97 98 public final String getXML() 99 { 100 return getContainer().getXML(); 101 } 102 103 public int hashCode() 104 { 105 return getDatabaseHandle().hashCode(); 106 } 107 108 public boolean equals(Object obj) 109 { 110 if (obj == this) 111 { 112 return true; 113 } 114 else if (obj instanceof MyOodbObject) 115 { 116 return getDatabaseHandle().equals(((MyOodbObject) obj).getDatabaseHandle()); 117 } 118 else if (obj instanceof MyOodbProxy) 119 { 120 return getDatabaseHandle().equals(((MyOodbProxy) obj).getDatabaseHandle()); 121 } 122 else if (obj instanceof org.myoodb.core.Identifier) 123 { 124 return getDatabaseHandle().equals(obj); 125 } 126 else 127 { 128 return false; 129 } 130 } 131 132 public int compareTo(Object obj) 133 { 134 if (obj instanceof MyOodbObject) 135 { 136 return getDatabaseHandle().compareTo(((MyOodbObject) obj).getDatabaseHandle()); 137 } 138 else if (obj instanceof MyOodbProxy) 139 { 140 return getDatabaseHandle().compareTo(((MyOodbProxy) obj).getDatabaseHandle()); 141 } 142 else if (obj instanceof org.myoodb.core.Identifier) 143 { 144 return getDatabaseHandle().compareTo(obj); 145 } 146 else 147 { 148 return -1; 149 } 150 } 151 152 public String toString() 153 { 154 return "Object Handle: " + getDatabaseHandle(); 155 } 156 } 157 | Popular Tags |