1 package org.apache.ojb.broker; 2 3 import java.io.Serializable ; 4 import java.util.Collection ; 5 6 import org.apache.commons.lang.builder.EqualsBuilder; 7 import org.apache.commons.lang.builder.ToStringBuilder; 8 9 15 public class ObjectRepository 16 { 17 public static class Component 18 implements ComponentIF 19 { 20 Integer id; 21 int type; 22 String name; 23 Group group; 24 ComponentIF parentComponent; 25 Collection childComponents; 26 27 public boolean equals(Object obj) 28 { 29 boolean result = false; 30 if(obj instanceof ComponentIF) 31 { 32 ComponentIF other = (ComponentIF) obj; 33 result = new EqualsBuilder() 34 .append(this.getId(), other.getId()) 35 .append(this.getName(), other.getName()) 36 .append(this.getType(), other.getType()) 37 .isEquals(); 38 } 39 return result; 40 } 41 42 public String toString() 43 { 44 return ToStringBuilder.reflectionToString(this); 45 } 46 47 public Integer getId() 48 { 49 return id; 50 } 51 52 public void setId(Integer id) 53 { 54 this.id = id; 55 } 56 57 public Group getGroup() 58 { 59 return group; 60 } 61 62 public void setGroup(Group group) 63 { 64 this.group = group; 65 } 66 67 public ComponentIF getParentComponent() 68 { 69 return parentComponent; 70 } 71 72 public void setParentComponent(ComponentIF parentComponent) 73 { 74 this.parentComponent = parentComponent; 75 } 76 77 public Collection getChildComponents() 78 { 79 return childComponents; 80 } 81 82 public void setChildComponents(Collection childComponents) 83 { 84 this.childComponents = childComponents; 85 } 86 87 public int getType() 88 { 89 return type; 90 } 91 92 public void setType(int type) 93 { 94 this.type = type; 95 } 96 97 public String getName() 98 { 99 return name; 100 } 101 102 public void setName(String name) 103 { 104 this.name = name; 105 } 106 } 107 108 public static interface ComponentIF extends Serializable 109 { 110 Integer getId(); 111 void setId(Integer id); 112 ObjectRepository.Group getGroup(); 113 void setGroup(ObjectRepository.Group group); 114 ComponentIF getParentComponent(); 115 void setParentComponent(ComponentIF parentComponent); 116 Collection getChildComponents(); 117 void setChildComponents(Collection childComponents); 118 int getType(); 119 void setType(int type); 120 String getName(); 121 void setName(String name); 122 } 123 124 public static class Group implements Serializable 125 { 126 Integer id; 127 String name; 128 129 public Integer getId() 130 { 131 return id; 132 } 133 134 public void setId(Integer id) 135 { 136 this.id = id; 137 } 138 139 public String getName() 140 { 141 return name; 142 } 143 144 public void setName(String name) 145 { 146 this.name = name; 147 } 148 } 149 150 public static abstract class AB implements Serializable 151 { 152 private int id; 153 157 private String ojbConcreteClass; 158 159 protected AB() 160 { 161 this.ojbConcreteClass = this.getClass().getName(); 163 } 164 165 protected AB(int id) 166 { 167 this(); 168 this.id = id; 169 } 170 171 public int getId() 172 { 173 return id; 174 } 175 176 public void setId(int id) 177 { 178 this.id = id; 179 } 180 181 public String getOjbConcreteClass() 182 { 183 return ojbConcreteClass; 184 } 185 186 public void setOjbConcreteClass(String ojbConcreteClass) 187 { 188 this.ojbConcreteClass = ojbConcreteClass; 189 } 190 } 191 192 public static interface AAlone 193 { 194 } 195 196 public static class A extends AB implements AAlone 197 { 198 private int someValue; 199 private String someAField; 200 201 public A() 202 { 203 super(); 204 } 205 206 public A(int pId, int pSomeValue) 207 { 208 super(pId); 209 this.someValue = pSomeValue; 210 } 211 212 public String getSomeAField() 213 { 214 return someAField; 215 } 216 217 public void setSomeAField(String someAField) 218 { 219 this.someAField = someAField; 220 } 221 222 public int getSomeValue() 223 { 224 return someValue; 225 } 226 227 public void setSomeValue(int someValue) 228 { 229 this.someValue = someValue; 230 } 231 } 232 233 public static class B extends AB 234 { 235 private int someValue; 236 private String someBField; 237 238 public B() 239 { 240 super(); 241 } 242 243 public B(int pId, int pSomeValue) 244 { 245 super(pId); 246 this.someValue = pSomeValue; 247 } 248 249 public String getSomeBField() 250 { 251 return someBField; 252 } 253 254 public void setSomeBField(String someBField) 255 { 256 this.someBField = someBField; 257 } 258 259 public int getSomeValue() 260 { 261 return someValue; 262 } 263 264 public void setSomeValue(int someValue) 265 { 266 this.someValue = someValue; 267 } 268 } 269 270 public static class B1 extends B 271 { 272 public B1() 273 { 274 super(); 275 } 276 277 public B1(int pId, int pSomeValue) 278 { 279 super(pId, pSomeValue); 280 } 281 } 282 283 public static class C implements Serializable 284 { 285 private String ojbConcreteClass; 286 private int id; 287 private int someValue; 288 289 public C() 290 { 291 ojbConcreteClass = this.getClass().getName(); 292 } 293 294 public C(int pId, int pSomeValue) 295 { 296 this(); 297 this.id = pId; 298 this.someValue = pSomeValue; 299 } 300 301 public int getId() 302 { 303 return id; 304 } 305 306 public void setId(int id) 307 { 308 this.id = id; 309 } 310 311 public String getOjbConcreteClass() 312 { 313 return ojbConcreteClass; 314 } 315 316 public void setOjbConcreteClass(String ojbConcreteClass) 317 { 318 this.ojbConcreteClass = ojbConcreteClass; 319 } 320 321 public int getSomeValue() 322 { 323 return someValue; 324 } 325 326 public void setSomeValue(int someValue) 327 { 328 this.someValue = someValue; 329 } 330 } 331 332 public static class D extends C 333 { 334 public D() 335 { 336 super(); 337 } 338 339 public D(int pId, int pSomeValue) 340 { 341 super(pId, pSomeValue); 342 } 343 } 344 345 public static class E implements Serializable 346 { 347 private Integer id; 348 private int someSuperValue; 349 350 public Integer getId() 351 { 352 return id; 353 } 354 355 public void setId(Integer id) 356 { 357 this.id = id; 358 } 359 360 public int getSomeSuperValue() 361 { 362 return someSuperValue; 363 } 364 365 public void setSomeSuperValue(int someSuperValue) 366 { 367 this.someSuperValue = someSuperValue; 368 } 369 } 370 371 378 public static class F extends E implements Serializable 379 { 380 int someValue; 381 382 public int getSomeValue() 383 { 384 return someValue; 385 } 386 387 public void setSomeValue(int someValue) 388 { 389 this.someValue = someValue; 390 } 391 } 392 393 public static class G extends F implements Serializable 394 { 395 int someSubValue; 396 397 public int getSomeSubValue() 398 { 399 return someSubValue; 400 } 401 402 public void setSomeSubValue(int someSubValue) 403 { 404 this.someSubValue = someSubValue; 405 } 406 } 407 408 public static class F1 extends E implements Serializable 409 { 410 int someValue; 411 412 public int getSomeValue() 413 { 414 return someValue; 415 } 416 417 public void setSomeValue(int someValue) 418 { 419 this.someValue = someValue; 420 } 421 } 422 423 public static class G1 extends F1 implements Serializable 424 { 425 int someSubValue; 426 427 public int getSomeSubValue() 428 { 429 return someSubValue; 430 } 431 432 public void setSomeSubValue(int someSubValue) 433 { 434 this.someSubValue = someSubValue; 435 } 436 } 437 } 438 439 | Popular Tags |