Subversion Repositories SmartDukaan

Rev

Rev 22352 | Rev 28653 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.spice.profitmandi.dao.entity.user;

import java.time.LocalDateTime;

import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.UpdateTimestamp;

import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;

import in.shop2020.model.v1.user.CartStatus;

/**
 * This class basically contains cart details
 * 
 * @author ashikali
 *
 */
@Entity
@Table(name="user.cart", schema = "user")

public class Cart {
        
        @Id
        @Column(name="id", unique=true, updatable=false)
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private int id;
        
        @Column(name = "wallet_amount")
        private float walletAmount;
        
        @Column(name = "total_price")
        private float totalPrice;
        
        @Column(name = "cart_status")
        private CartStatus cartStatus;
        
        @Column(name = "address_id")
        private int addressId;
        
        @Column(name="checked_out_on", updatable = false)
        private LocalDateTime checkoutTimestamp = LocalDateTime.now();
        
        @Column(name="created_on", updatable = false)
        private LocalDateTime createTimestamp = LocalDateTime.now();
        
        @Column(name="updated_on")
        @UpdateTimestamp
        private LocalDateTime updateTimestamp = LocalDateTime.now();
        

        public int getId() {
                return id;
        }

        public void setId(int id) {
                this.id = id;
        }

        

        public float getWalletAmount() {
                return walletAmount;
        }

        public void setWalletAmount(float walletAmount) {
                this.walletAmount = walletAmount;
        }

        public float getTotalPrice() {
                return totalPrice;
        }

        public void setTotalPrice(float totalPrice) {
                this.totalPrice = totalPrice;
        }

        public CartStatus getCartStatus() {
                return cartStatus;
        }

        public void setCartStatus(CartStatus cartStatus) {
                this.cartStatus = cartStatus;
        }

        public int getAddressId() {
                return addressId;
        }

        public void setAddressId(int addressId) {
                this.addressId = addressId;
        }

        public LocalDateTime getCheckoutTimestamp() {
                return checkoutTimestamp;
        }

        public void setCheckoutTimestamp(LocalDateTime checkoutTimestamp) {
                this.checkoutTimestamp = checkoutTimestamp;
        }

        public LocalDateTime getCreateTimestamp() {
                return createTimestamp;
        }

        public void setCreateTimestamp(LocalDateTime createTimestamp) {
                this.createTimestamp = createTimestamp;
        }

        public LocalDateTime getUpdateTimestamp() {
                return updateTimestamp;
        }

        public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
                this.updateTimestamp = updateTimestamp;
        }

        @Override
        public int hashCode() {
                final int prime = 31;
                int result = 1;
                result = prime * result + id;
                return result;
        }

        @Override
        public boolean equals(Object obj) {
                if (this == obj)
                        return true;
                if (obj == null)
                        return false;
                if (getClass() != obj.getClass())
                        return false;
                Cart other = (Cart) obj;
                if (id != other.id)
                        return false;
                return true;
        }

        @Override
        public String toString() {
                return "Cart [id=" + id + ", walletAmount=" + walletAmount + ", totalPrice=" + totalPrice + ", cartStatus="
                                + cartStatus + ", addressId=" + addressId + ", checkoutTimestamp=" + checkoutTimestamp
                                + ", createTimestamp=" + createTimestamp + ", updateTimestamp=" + updateTimestamp + "]";
        }

        
}