KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > common > ejbs > entity > ebstore > EBStore


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: EBStore.java 455 2006-05-16 07:29:27Z studzine $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.easybeans.tests.common.ejbs.entity.ebstore;
27
28 import javax.persistence.Entity;
29 import javax.persistence.Id;
30 import javax.persistence.Table;
31
32 /**
33  * Define a store with an id and a name.
34  * @author Eduardo Studzinski Estima de Castro
35  * @author Gisele Pinheiro Souza
36  */

37 @Entity
38 @Table(name = "STORE")
39 public class EBStore implements java.io.Serializable JavaDoc {
40
41     /**
42      * Id for serializable class.
43      */

44     private static final long serialVersionUID = 9126890320818098157L;
45
46     /**
47      * Default store name.
48      */

49     public static final String JavaDoc DEFAULT_NAME = "default";
50     /**
51      * Store Id.
52      */

53     private int id;
54
55     /**
56      * Name of the store.
57      */

58     private String JavaDoc name;
59
60     /**
61      * Default constructor.
62      */

63     public EBStore(){
64     }
65
66     /**
67      * Parametrized constructor.
68      * @param id store id
69      * @param name store name
70      */

71     public EBStore(final int id, final String JavaDoc name){
72         setId(id);
73         setName(name);
74     }
75
76     /**
77      * Creates a store with the default name.
78      * @param id store id
79      */

80     public EBStore(final int id){
81         setId(id);
82         setName(DEFAULT_NAME);
83     }
84
85     /**
86      * Gets the store Id.
87      * @return the id of the store.
88      */

89     @Id
90     public int getId() {
91         return id;
92     }
93
94     /**
95      * Sets store Id.
96      * @param id the id's store
97      */

98     public void setId(final int id) {
99         this.id = id;
100     }
101
102     /**
103      * Sets the name.
104      * @param name of store.
105      */

106     public void setName(final String JavaDoc name) {
107         this.name = name;
108     }
109
110     /**
111      * Gets the store name.
112      * @return name of the store.
113      */

114     public String JavaDoc getName() {
115         return name;
116     }
117
118     /**
119      * Computes a string representation of this store.
120      * @return string representation.
121      */

122     @Override JavaDoc
123     public String JavaDoc toString() {
124         StringBuilder JavaDoc sb = new StringBuilder JavaDoc();
125         sb.append("EBStore[id=").append(id).append(", name=").append(getName()).append("]");
126         return sb.toString();
127     }
128
129 }
130
Popular Tags