001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.test.cmp2.commerce;
023:
024: import java.util.Collection;
025: import javax.ejb.CreateException;
026: import javax.ejb.EntityBean;
027: import javax.ejb.EntityContext;
028: import javax.ejb.FinderException;
029:
030: import org.jboss.varia.autonumber.AutoNumberFactory;
031:
032: public abstract class AddressBean implements EntityBean {
033: transient private EntityContext ctx;
034:
035: public Long ejbCreate() throws CreateException {
036: setId(new Long(AutoNumberFactory.getNextInteger("Address")
037: .longValue()));
038: return null;
039: }
040:
041: public void ejbPostCreate() {
042: }
043:
044: public Long ejbCreate(Long id) throws CreateException {
045: setId(id);
046: return null;
047: }
048:
049: public void ejbPostCreate(Long id) {
050: }
051:
052: public abstract Collection ejbSelectAddresses(String street)
053: throws FinderException;
054:
055: public abstract Collection ejbSelectAddresses(int zip)
056: throws FinderException;
057:
058: public Collection ejbHomeSelectAddresses(String street)
059: throws FinderException {
060: return ejbSelectAddresses(street);
061: }
062:
063: public abstract Long getId();
064:
065: public abstract void setId(Long id);
066:
067: public abstract String getStreet();
068:
069: public abstract void setStreet(String street);
070:
071: public abstract String getCity();
072:
073: public abstract void setCity(String city);
074:
075: public abstract String getState();
076:
077: public abstract void setState(String state);
078:
079: public abstract int getZip();
080:
081: public abstract void setZip(int zip);
082:
083: public abstract int getZipPlus4();
084:
085: public abstract void setZipPlus4(int zipPlus4);
086:
087: public void setEntityContext(EntityContext ctx) {
088: this .ctx = ctx;
089: }
090:
091: public void unsetEntityContext() {
092: this .ctx = null;
093: }
094:
095: public void ejbActivate() {
096: }
097:
098: public void ejbPassivate() {
099: }
100:
101: public void ejbLoad() {
102: }
103:
104: public void ejbStore() {
105: }
106:
107: public void ejbRemove() {
108: }
109: }
|