1 27 28 package dataregistry; 29 30 import java.util.Collection ; 31 import javax.ejb.*; 32 33 36 public abstract class VendorPartBean implements EntityBean, VendorPartLocalBusiness { 37 private EntityContext context; 38 39 45 public void setEntityContext(EntityContext aContext) { 46 context = aContext; 47 } 48 49 52 public void ejbActivate() { 53 54 } 55 56 59 public void ejbPassivate() { 60 61 } 62 63 66 public void ejbRemove() { 67 68 } 69 70 73 public void unsetEntityContext() { 74 context = null; 75 } 76 77 80 public void ejbLoad() { 81 82 } 83 84 87 public void ejbStore() { 88 89 } 90 92 public abstract String getDescription(); 93 public abstract void setDescription(String description); 94 95 public abstract Double getPrice(); 96 public abstract void setPrice(Double price); 97 98 public abstract Collection getLineitemBean(); 99 public abstract void setLineitemBean(Collection lineitemBean); 100 101 public abstract PartLocal getPartBean(); 102 public abstract void setPartBean(PartLocal partBean); 103 104 105 public Object ejbCreate(String description, Double price, PartLocal partBean, VendorLocal vendorId) throws CreateException { 106 if (price == null) { 107 throw new CreateException("The field \"price\" must not be null"); 108 } 109 if (partBean == null) { 110 throw new CreateException("The field \"partBean\" must not be null"); 111 } 112 if (vendorId == null) { 113 throw new CreateException("The field \"vendorId\" must not be null"); 114 } 115 116 setDescription(description); 118 setPrice(price); 119 120 return null; 121 } 122 123 public void ejbPostCreate(String description, Double price, PartLocal partBean, VendorLocal vendorId) { 124 setPartBean(partBean); 126 setVendor(vendorId); 127 128 } 129 130 public Object ejbCreate(String description, double price, PartLocal part) throws CreateException { 131 setDescription(description); 133 setPrice(new Double (price)); 134 135 return null; 136 } 137 138 public void ejbPostCreate(String description, double price, PartLocal part) throws CreateException { 139 setPartBean(part); 141 } 142 143 public Double ejbHomeGetAvgPrice() throws FinderException { 144 return ejbSelectAvgPrice(); 146 } 147 148 public abstract Double ejbSelectAvgPrice() throws FinderException; 149 150 public Double ejbHomeGetTotalPricePerVendor(int vendorId) throws FinderException { 151 return ejbSelectTotalPricePerVendor(vendorId); 153 } 154 155 public abstract Double ejbSelectTotalPricePerVendor(int vendorId) throws FinderException; 156 157 public abstract VendorLocal getVendor(); 158 159 public abstract void setVendor(VendorLocal vendor); 160 161 } 162 | Popular Tags |