2 * Copyright (C) 2015 Roland Haeder
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 package org.mxchange.jshopcore.model.order;
19 import java.util.Calendar;
20 import java.util.List;
21 import javax.persistence.Basic;
22 import javax.persistence.Column;
23 import javax.persistence.Entity;
24 import javax.persistence.GeneratedValue;
25 import javax.persistence.GenerationType;
26 import javax.persistence.Id;
27 import javax.persistence.JoinColumn;
28 import javax.persistence.OneToOne;
29 import javax.persistence.Table;
30 import javax.persistence.Temporal;
31 import javax.persistence.TemporalType;
32 import javax.persistence.Transient;
33 import org.mxchange.jshopcore.model.basket.AddableBasketItem;
34 import org.mxchange.jshopcore.model.customer.Customer;
35 import org.mxchange.jshopcore.model.customer.ShopCustomer;
38 * An entity class for shop orders
40 * @author Roland Haeder
42 @Entity (name = "orders")
43 @Table (name = "orders")
44 public class ShopOrder implements Orderable {
49 private static final long serialVersionUID = 19_728_938_459_834L;
54 @Basic (optional = false)
55 @Column (name = "access_key", length = 100, nullable = false, unique = true)
56 private String accessKey;
61 @Basic (optional = false)
62 @Temporal (TemporalType.TIMESTAMP)
63 @Column (name = "order_created", nullable = false)
64 private Calendar orderCreated;
69 @JoinColumn (name = "customer_id", nullable = false, updatable = false)
70 @OneToOne (targetEntity = ShopCustomer.class, optional = false)
71 private Customer customer;
74 * Item list, don't save this
77 private List<AddableBasketItem> itemList;
83 @GeneratedValue (strategy = GenerationType.IDENTITY)
84 @Column (name = "order_id", length = 20)
88 public String getAccessKey () {
89 return this.accessKey;
93 public void setAccessKey (final String accessKey) {
94 this.accessKey = accessKey;
98 public Calendar getOrderCreated () {
99 return this.orderCreated;
103 public void setOrderCreated (final Calendar orderCreated) {
104 this.orderCreated = orderCreated;
108 public Customer getCustomer () {
109 return this.customer;
113 public void setCustomer (final Customer customer) {
114 this.customer = customer;
118 public Long getOrderId () {
123 public void setOrderId (final Long orderId) {
124 this.orderId = orderId;
128 public List<AddableBasketItem> getOrderedItems () {
133 public void setOrderedItems (final List<AddableBasketItem> itemList) {
134 this.itemList = itemList;