3
import java.util.Collection;
7
* This is the bean class for the PlayerBean enterprise bean.
8
* Created Mar 23, 2005 1:48:50 PM
11
public abstract class PlayerBean implements EntityBean, PlayerLocalBusiness {
12
private EntityContext context;
14
// <editor-fold defaultstate="collapsed" desc="EJB infrastructure methods. Click on the + sign on the left to edit the code.">
15
// TODO Consider creating Transfer Object to encapsulate data
16
// TODO Review finder methods
18
* @see EntityBean#setEntityContext(EntityContext)
20
public void setEntityContext(EntityContext aContext) {
25
* @see EntityBean#ejbActivate()
27
public void ejbActivate() {
32
* @see EntityBean#ejbPassivate()
34
public void ejbPassivate() {
39
* @see EntityBean#ejbRemove()
41
public void ejbRemove() {
46
* @see EntityBean#unsetEntityContext()
48
public void unsetEntityContext() {
53
* @see EntityBean#ejbLoad()
55
public void ejbLoad() {
60
* @see EntityBean#ejbStore()
62
public void ejbStore() {
67
// <editor-fold desc="CMP fields and relationships.">
69
public abstract String getPlayerId();
70
public abstract void setPlayerId(String id);
72
public abstract String getName();
73
public abstract void setName(String name);
75
public abstract String getPosition();
76
public abstract void setPosition(String position);
78
public abstract Double getSalary();
79
public abstract void setSalary(Double salary);
83
public String ejbCreate(String playerId, String name, String position, Double salary) throws CreateException {
84
if (playerId == null) {
85
throw new CreateException("The field \"id\" must not be null");
88
// TODO add additional validation code, throw CreateException if data is not valid
89
setPlayerId(playerId);
91
setPosition(position);
97
public void ejbPostCreate(String playerId, String name, String position, Double salary) {
98
// TODO populate relationships here if appropriate
102
public Collection getLeagues() throws FinderException {
103
PlayerLocal player = (PlayerLocal) context.getEJBLocalObject();
105
return ejbSelectLeagues(player);
108
public Collection getSports() throws FinderException {
109
PlayerLocal player = (PlayerLocal) context.getEJBLocalObject();
111
return ejbSelectSports(player);
113
public abstract Collection getTeams();
115
public abstract void setTeams(Collection teams);
117
public abstract Collection ejbSelectLeagues(PlayerLocal p0) throws FinderException;
119
public abstract Collection ejbSelectSports(PlayerLocal p0) throws FinderException;