KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > vlib > ejb > impl > BookBean


1 // Copyright 2004 The Apache Software Foundation
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15 package org.apache.tapestry.vlib.ejb.impl;
16
17 import java.rmi.RemoteException JavaDoc;
18 import java.sql.Timestamp JavaDoc;
19 import java.util.Map JavaDoc;
20
21 import javax.ejb.CreateException JavaDoc;
22
23 /**
24  * Implementation of the Book entity.
25  *
26  * <p>We're using container managed persistance.
27  *
28  * @see org.apache.tapestry.vlib.ejb.IBook
29  * @see org.apache.tapestry.vlib.ejb.IBookHome
30  *
31  * @version $Id: BookBean.java,v 1.4 2004/02/19 17:38:07 hlship Exp $
32  * @author Howard Lewis Ship
33  *
34  **/

35
36 public abstract class BookBean extends AbstractEntityBean
37 {
38     protected String JavaDoc[] getAttributePropertyNames()
39     {
40         return new String JavaDoc[] {
41             "title",
42             "description",
43             "ISBN",
44             "holderId",
45             "ownerId",
46             "publisherId",
47             "author",
48             "hidden",
49             "lendable",
50             "dateAdded" };
51     }
52
53     public abstract void setBookId(Integer JavaDoc value);
54     
55     public abstract Integer JavaDoc getBookId();
56
57     public abstract String JavaDoc getAuthor();
58
59     public abstract void setAuthor(String JavaDoc value);
60
61     public abstract String JavaDoc getDescription();
62
63     public abstract void setDescription(String JavaDoc value);
64
65     public abstract String JavaDoc getISBN();
66
67     public abstract void setISBN(String JavaDoc value);
68     
69     public abstract String JavaDoc getTitle();
70
71     public abstract void setTitle(String JavaDoc value);
72
73     public abstract Integer JavaDoc getHolderId();
74
75     public abstract void setHolderId(Integer JavaDoc value);
76     
77     public abstract Integer JavaDoc getOwnerId() throws RemoteException JavaDoc;
78
79     public abstract void setOwnerId(Integer JavaDoc value);
80
81     public abstract void setPublisherId(Integer JavaDoc value);
82
83     public abstract Integer JavaDoc getPublisherId();
84
85     public abstract boolean getHidden();
86
87     public abstract void setHidden(boolean value);
88
89     public abstract boolean getLendable();
90
91     public abstract void setLendable(boolean value);
92
93     public abstract Timestamp JavaDoc getDateAdded();
94     
95     public abstract void setDateAdded(Timestamp JavaDoc value);
96
97     // Create methods
98

99     public Integer JavaDoc ejbCreate(Map JavaDoc attributes) throws CreateException JavaDoc, RemoteException JavaDoc
100     {
101         setLendable(true);
102  
103         updateEntityAttributes(attributes);
104
105         setBookId(allocateKey());
106         
107         return null;
108     }
109
110     public void ejbPostCreate(Map JavaDoc attributes)
111     {
112         // No post create work needed but the method must be implemented
113
}
114
115 }
Popular Tags