001: /**
002: *
003: * Licensed to the Apache Software Foundation (ASF) under one or more
004: * contributor license agreements. See the NOTICE file distributed with
005: * this work for additional information regarding copyright ownership.
006: * The ASF licenses this file to You under the Apache License, Version 2.0
007: * (the "License"); you may not use this file except in compliance with
008: * the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing, software
013: * distributed under the License is distributed on an "AS IS" BASIS,
014: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: * See the License for the specific language governing permissions and
016: * limitations under the License.
017: */package org.apache.openejb.test.entity.cmr.onetoone;
018:
019: import org.apache.openejb.core.cmp.cmp2.SingleValuedCmr;
020: import org.apache.openejb.core.cmp.cmp2.Cmp2Entity;
021:
022: public class ExampleBBean_BBean extends LicenseBean implements
023: Cmp2Entity {
024: public static Object deploymentInfo;
025: private transient boolean deleted;
026: private Integer field1;
027: private String field2;
028: private Integer field3;
029: private String field4;
030: private ExampleABean_ABean a;
031: private SingleValuedCmr<ExampleABean_ABean, PersonLocal> aCmr = new SingleValuedCmr<ExampleABean_ABean, PersonLocal>(
032: this , "a", ExampleABean_ABean.class, "b");
033:
034: public Integer getId() {
035: return field1;
036: }
037:
038: public void setId(Integer field1) {
039: this .field1 = field1;
040: }
041:
042: public String getNumber() {
043: return field2;
044: }
045:
046: public void setNumber(String field2) {
047: this .field2 = field2;
048: }
049:
050: public Integer getPoints() {
051: return field3;
052: }
053:
054: public void setPoints(Integer field3) {
055: this .field3 = field3;
056: }
057:
058: public String getNotes() {
059: return field4;
060: }
061:
062: public void setNotes(String field4) {
063: this .field4 = field4;
064: }
065:
066: public PersonLocal getPerson() {
067: return aCmr.get(a);
068: }
069:
070: public void setPerson(PersonLocal person) {
071: this .a = aCmr.set(this .a, person);
072: }
073:
074: public Object OpenEJB_getPrimaryKey() {
075: return field1;
076: }
077:
078: public void OpenEJB_deleted() {
079: if (deleted) {
080: return;
081: }
082: deleted = true;
083:
084: aCmr.set(a, null);
085: }
086:
087: public Object OpenEJB_addCmr(String name, Object bean) {
088: if (deleted) {
089: return null;
090: }
091:
092: Object oldValue;
093: if ("a".equals(name)) {
094: oldValue = a;
095: a = (ExampleABean_ABean) bean;
096: } else {
097: throw new IllegalArgumentException("Unknown cmr field "
098: + name + " on entity bean of type "
099: + getClass().getName());
100: }
101: return oldValue;
102: }
103:
104: public void OpenEJB_removeCmr(String name, Object bean) {
105: if (deleted) {
106: return;
107: }
108:
109: if ("a".equals(name)) {
110: a = null;
111: } else {
112: throw new IllegalArgumentException("Unknown cmr field "
113: + name + " on entity bean of type "
114: + getClass().getName());
115: }
116: }
117: }
|