01: /**
02: *
03: * Licensed to the Apache Software Foundation (ASF) under one or more
04: * contributor license agreements. See the NOTICE file distributed with
05: * this work for additional information regarding copyright ownership.
06: * The ASF licenses this file to You under the Apache License, Version 2.0
07: * (the "License"); you may not use this file except in compliance with
08: * the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */package org.apache.openejb.test.entity.cmr.onetoone;
18:
19: import org.apache.openejb.core.cmp.cmp2.SingleValuedCmr;
20: import org.apache.openejb.core.cmp.cmp2.Cmp2Entity;
21:
22: public class ExampleABean_ABean extends PersonBean implements
23: Cmp2Entity {
24: public static Object deploymentInfo;
25: private transient boolean deleted;
26: private Integer id;
27: private String name;
28: private ExampleBBean_BBean License;
29: private SingleValuedCmr<ExampleBBean_BBean, LicenseLocal> bCmr = new SingleValuedCmr<ExampleBBean_BBean, LicenseLocal>(
30: this , "b", ExampleBBean_BBean.class, "a");
31:
32: public Integer getId() {
33: return id;
34: }
35:
36: public void setId(Integer id) {
37: this .id = id;
38: }
39:
40: public String getName() {
41: return name;
42: }
43:
44: public void setName(String name) {
45: this .name = name;
46: }
47:
48: public LicenseLocal getLicense() {
49: return bCmr.get(License);
50: }
51:
52: public void setLicense(LicenseLocal license) {
53: this .License = bCmr.set(this .License, license);
54: }
55:
56: public Object OpenEJB_getPrimaryKey() {
57: return id;
58: }
59:
60: public void OpenEJB_deleted() {
61: if (deleted) {
62: return;
63: }
64: deleted = true;
65:
66: bCmr.set(License, null);
67: }
68:
69: public Object OpenEJB_addCmr(String name, Object bean) {
70: if (deleted) {
71: return null;
72: }
73:
74: Object oldValue;
75: if ("b".equals(name)) {
76: oldValue = License;
77: License = (ExampleBBean_BBean) bean;
78: } else {
79: throw new IllegalArgumentException("Unknown cmr field "
80: + name + " on entity bean of type "
81: + getClass().getName());
82: }
83: return oldValue;
84: }
85:
86: public void OpenEJB_removeCmr(String name, Object bean) {
87: if (deleted) {
88: return;
89: }
90:
91: if ("b".equals(name)) {
92: License = null;
93: } else {
94: throw new IllegalArgumentException("Unknown cmr field "
95: + name + " on entity bean of type "
96: + getClass().getName());
97: }
98: }
99: }
|