001    /**
002     *  Licensed to the Apache Software Foundation (ASF) under one or more
003     *  contributor license agreements.  See the NOTICE file distributed with
004     *  this work for additional information regarding copyright ownership.
005     *  The ASF licenses this file to You under the Apache License, Version 2.0
006     *  (the "License"); you may not use this file except in compliance with
007     *  the License.  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     *  Unless required by applicable law or agreed to in writing, software
012     *  distributed under the License is distributed on an "AS IS" BASIS,
013     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     *  See the License for the specific language governing permissions and
015     *  limitations under the License.
016     */
017    package org.apache.geronimo.samples.daytrader;
018    
019    import javax.persistence.Entity;
020    import javax.persistence.GeneratedValue;
021    import javax.persistence.Id;
022    import javax.persistence.OneToOne;
023    import javax.persistence.Version;
024    import javax.persistence.Table;
025    import javax.persistence.Column;
026    
027    import org.apache.geronimo.samples.daytrader.util.Log;
028    
029    @Entity(name = "accountprofileejb")
030    @Table(name = "accountprofileejb")
031    public class AccountProfileDataBean
032            implements java.io.Serializable {
033    
034        /* Accessor methods for persistent fields */
035    
036        @Id
037        @GeneratedValue
038        @Column(length=250)
039        private String userID;                /* userID */
040        @Column(length=250)
041        private String passwd;            /* password */
042        @Column(length=250)
043        private String fullName;            /* fullName */
044        @Column(length=250)
045        private String address;            /* address */
046        @Column(length=250)
047        private String email;                /* email */
048        @Column(length=250)
049        private String creditCard;            /* creditCard */
050        @OneToOne(mappedBy="profile")
051        private AccountDataBean account;
052    //    @Version
053    //    private Integer optLock;
054    
055        public AccountProfileDataBean() {
056        }
057    
058        public AccountProfileDataBean(String userID,
059                String password,
060                String fullName,
061                String address,
062                String email,
063                String creditCard) {
064            setUserID(userID);
065            setPassword(password);
066            setFullName(fullName);
067            setAddress(address);
068            setEmail(email);
069            setCreditCard(creditCard);
070        }
071    
072        public static AccountProfileDataBean getRandomInstance() {
073            return new AccountProfileDataBean(
074                    TradeConfig.rndUserID(),            // userID
075                    TradeConfig.rndUserID(),            // passwd
076                    TradeConfig.rndFullName(),            // fullname
077                    TradeConfig.rndAddress(),            // address
078                    TradeConfig.rndEmail(TradeConfig.rndUserID()), //email
079                    TradeConfig.rndCreditCard()          // creditCard
080            );
081        }
082    
083        public String toString() {
084            return "\n\tAccount Profile Data for userID:" + getUserID()
085                    + "\n\t\t   passwd:" + getPassword()
086                    + "\n\t\t   fullName:" + getFullName()
087                    + "\n\t\t    address:" + getAddress()
088                    + "\n\t\t      email:" + getEmail()
089                    + "\n\t\t creditCard:" + getCreditCard()
090                    ;
091        }
092    
093        public String toHTML() {
094            return "<BR>Account Profile Data for userID: <B>" + getUserID() + "</B>"
095                    + "<LI>   passwd:" + getPassword() + "</LI>"
096                    + "<LI>   fullName:" + getFullName() + "</LI>"
097                    + "<LI>    address:" + getAddress() + "</LI>"
098                    + "<LI>      email:" + getEmail() + "</LI>"
099                    + "<LI> creditCard:" + getCreditCard() + "</LI>"
100                    ;
101        }
102    
103        public void print() {
104            Log.log(this.toString());
105        }
106    
107        /**
108         * Gets the userID
109         *
110         * @return Returns a String
111         */
112        public String getUserID() {
113            return userID;
114        }
115    
116        /**
117         * Sets the userID
118         *
119         * @param userID The userID to set
120         */
121        public void setUserID(String userID) {
122            this.userID = userID;
123        }
124    
125        /**
126         * Gets the passwd
127         *
128         * @return Returns a String
129         */
130        public String getPassword() {
131            return passwd;
132        }
133    
134        /**
135         * Sets the passwd
136         *
137         * @param password The passwd to set
138         */
139        public void setPassword(String password) {
140            this.passwd = password;
141        }
142    
143        /**
144         * Gets the fullName
145         *
146         * @return Returns a String
147         */
148        public String getFullName() {
149            return fullName;
150        }
151    
152        /**
153         * Sets the fullName
154         *
155         * @param fullName The fullName to set
156         */
157        public void setFullName(String fullName) {
158            this.fullName = fullName;
159        }
160    
161        /**
162         * Gets the address
163         *
164         * @return Returns a String
165         */
166        public String getAddress() {
167            return address;
168        }
169    
170        /**
171         * Sets the address
172         *
173         * @param address The address to set
174         */
175        public void setAddress(String address) {
176            this.address = address;
177        }
178    
179        /**
180         * Gets the email
181         *
182         * @return Returns a String
183         */
184        public String getEmail() {
185            return email;
186        }
187    
188        /**
189         * Sets the email
190         *
191         * @param email The email to set
192         */
193        public void setEmail(String email) {
194            this.email = email;
195        }
196    
197        /**
198         * Gets the creditCard
199         *
200         * @return Returns a String
201         */
202        public String getCreditCard() {
203            return creditCard;
204        }
205    
206        /**
207         * Sets the creditCard
208         *
209         * @param creditCard The creditCard to set
210         */
211        public void setCreditCard(String creditCard) {
212            this.creditCard = creditCard;
213        }
214    
215        public AccountDataBean getAccount() {
216            return account;
217        }
218    
219        public void setAccount(AccountDataBean account) {
220            this.account = account;
221        }
222    }