1 37 38 package com.sun.j2ee.blueprints.address.ejb; 39 40 import javax.ejb.EntityBean; 41 import javax.ejb.EntityContext; 42 import javax.ejb.RemoveException; 43 import javax.ejb.CreateException; 44 import javax.naming.NamingException; 45 import javax.naming.InitialContext; 46 47 public abstract class AddressEJB implements EntityBean { 48 49 private EntityContext context = null; 50 51 public abstract String getStreetName1(); 54 public abstract void setStreetName1(String streetName1); 55 56 public abstract String getStreetName2(); 57 public abstract void setStreetName2(String streetName2); 58 59 public abstract String getCity(); 60 public abstract void setCity(String city); 61 62 public abstract String getState(); 63 public abstract void setState(String state); 64 65 public abstract String getZipCode(); 66 public abstract void setZipCode(String zipCode); 67 68 public abstract String getCountry(); 69 public abstract void setCountry(String country); 70 71 public Object ejbCreate(String streetName1, String streetName2, String city, 74 String state, String zipCode, String country) throws CreateException { 75 setStreetName1(streetName1); 76 setStreetName2(streetName2); 77 setCity(city); 78 setState(state); 79 setZipCode(zipCode); 80 setCountry(country); 81 return null; 82 } 83 84 public void ejbPostCreate(String streetName1, String streetName2, String city, 85 String state, String zipCode, String country) throws CreateException { } 86 87 public Object ejbCreate(Address address) throws CreateException { 88 setStreetName1(address.getStreetName1()); 89 setStreetName2(address.getStreetName2()); 90 setCity(address.getCity()); 91 setState(address.getState()); 92 setZipCode(address.getZipCode()); 93 setCountry(address.getCountry()); 94 return null; 95 } 96 97 public void ejbPostCreate(Address address) throws CreateException { } 98 99 public Object ejbCreate() throws CreateException { 100 return null; 101 } 102 103 public void ejbPostCreate() throws CreateException { } 104 105 public Address getData() { 106 Address address = new Address(); 107 address.setStreetName1(getStreetName1()); 108 address.setStreetName2(getStreetName2()); 109 address.setCity(getCity()); 110 address.setState(getState()); 111 address.setZipCode(getZipCode()); 112 address.setCountry(getCountry()); 113 return address; 114 } 115 116 public void setEntityContext(EntityContext c) { 119 context = c; 120 } 121 122 public void unsetEntityContext() { 123 context = null; 124 } 125 126 public void ejbRemove() throws RemoveException { } 127 public void ejbActivate() { } 128 public void ejbPassivate() { } 129 public void ejbStore() { } 130 public void ejbLoad() { } 131 } 132 | Popular Tags |