Rev 32556 | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
package com.spice.profitmandi.dao.entity.user;import in.shop2020.model.v1.user.CartStatus;import org.hibernate.annotations.UpdateTimestamp;import javax.persistence.*;import java.time.LocalDateTime;import com.spice.profitmandi.dao.cart.v2.CartLifecycleStatus;import com.spice.profitmandi.dao.cart.v2.SaleType;/*** This class basically contains cart details** @author ashikali**/@Entity@Table(name="user.cart")public class Cart {@Id@Column(name="id", unique=true, updatable=false)@GeneratedValue(strategy = GenerationType.IDENTITY)private int id;@Column(name = "wallet_amount")private double walletAmount;@Column(name = "total_price")private double totalPrice;@Column(name = "cart_status")private CartStatus cartStatus;@Column(name = "address_id")private Integer 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")@UpdateTimestampprivate LocalDateTime updateTimestamp = LocalDateTime.now();@Version@Column(name = "version")private Long version = 0L;@Enumerated(EnumType.STRING)@Column(name = "lifecycle_status")private CartLifecycleStatus lifecycleStatus = CartLifecycleStatus.ACTIVE;@Column(name = "last_activity_at")private LocalDateTime lastActivityAt = LocalDateTime.now();@Enumerated(EnumType.STRING)@Column(name = "sale_type")private SaleType saleType = SaleType.PARTNER_PROCUREMENT;/** Populated for TERTIARY_SALE drafts; null for procurement carts. */@Column(name = "customer_id")private Integer customerId;/*** Denormalised retailer/fofo-store id so we can list a partner's* tertiary drafts with a single indexed query. Procurement carts keep* this in sync too.*/@Column(name = "retailer_id")private int retailerId;public int getId() {return id;}public void setId(int id) {this.id = id;}public double getWalletAmount() {return walletAmount;}public void setWalletAmount(double walletAmount) {this.walletAmount = walletAmount;}public double getTotalPrice() {return totalPrice;}public void setTotalPrice(double totalPrice) {this.totalPrice = totalPrice;}public CartStatus getCartStatus() {return cartStatus;}public void setCartStatus(CartStatus cartStatus) {this.cartStatus = cartStatus;}public Integer getAddressId() {return addressId;}public void setAddressId(Integer 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;}public Long getVersion() { return version; }public void setVersion(Long version) { this.version = version; }public CartLifecycleStatus getLifecycleStatus() { return lifecycleStatus; }public void setLifecycleStatus(CartLifecycleStatus lifecycleStatus) { this.lifecycleStatus = lifecycleStatus; }public LocalDateTime getLastActivityAt() { return lastActivityAt; }public void setLastActivityAt(LocalDateTime lastActivityAt) { this.lastActivityAt = lastActivityAt; }public SaleType getSaleType() { return saleType; }public void setSaleType(SaleType saleType) { this.saleType = saleType; }public Integer getCustomerId() { return customerId; }public void setCustomerId(Integer customerId) { this.customerId = customerId; }public int getRetailerId() { return retailerId; }public void setRetailerId(int retailerId) { this.retailerId = retailerId; }@Overridepublic int hashCode() {final int prime = 31;int result = 1;result = prime * result + id;return result;}@Overridepublic 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;}@Overridepublic String toString() {return "Cart [id=" + id + ", walletAmount=" + walletAmount + ", totalPrice=" + totalPrice + ", cartStatus="+ cartStatus + ", addressId=" + addressId + ", checkoutTimestamp=" + checkoutTimestamp+ ", createTimestamp=" + createTimestamp + ", updateTimestamp=" + updateTimestamp + "]";}}