Subversion Repositories SmartDukaan

Rev

Rev 23638 | Rev 23640 | 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.fofo;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

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

import com.spice.profitmandi.common.enumuration.PurchaseReturnStatus;
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
import com.spice.profitmandi.dao.enumuration.fofo.ReturnType;

/**
 * This class basically contains api details
 * 
 * @author ashikali
 *
 */
/**
 * @author amit
 *
 */
@Entity
@Table(name = "fofo.purchase_return_item", schema = "fofo")

public class PurchaseReturnItem implements Serializable {

        private static final long serialVersionUID = 1L;

        @Id
        @Column(name="id", columnDefinition = "int(11)")
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private int id;
        
        @Column(name="id", columnDefinition = "int(11)")
        public int getId() {
                return id;
        }
        

        @Column(name = "status")
        @Enumerated(EnumType.STRING)
        private ReturnType returnType;
        
        public ReturnType getReturnType() {
                return returnType;
        }

        public void setReturnType(ReturnType returnType) {
                this.returnType = returnType;
        }

        @Transient
        private int quantity;
        
        public int getQuantity() {
                return quantity;
        }

        public void setQuantity(int quantity) {
                this.quantity = quantity;
        }

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

        @Override
        public String toString() {
                return "PurchaseReturnItem [id=" + id + ", returnType=" + returnType + ", quantity=" + quantity
                                + ", inventoryItemId=" + inventoryItemId + ", fofoId=" + fofoId + ", status=" + status
                                + ", debitNoteId=" + debitNoteId + ", createTimestamp=" + createTimestamp + ", approveTimestamp="
                                + approveTimestamp + ", denyTimestamp=" + denyTimestamp + ", pickupCreateTimestamp="
                                + pickupCreateTimestamp + ", scheduledPickupTimestamp=" + scheduledPickupTimestamp
                                + ", returnTimestamp=" + returnTimestamp + ", refundTimestamp=" + refundTimestamp + "]";
        }

        @Column(name = "inventory_item_id")
        private int inventoryItemId;

        @Column(name = "fofo_id")
        private int fofoId;

        @Column(name = "status")
        @Enumerated(EnumType.STRING)
        private PurchaseReturnStatus status = PurchaseReturnStatus.CREATED;

        @Column(name = "debit_note_id")
        private int debitNoteId;

        public int getDebitNoteId() {
                return debitNoteId;
        }

        public void setDebitNoteId(int debitNoteId) {
                this.debitNoteId = debitNoteId;
        }

        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name = "create_timestamp")
        private LocalDateTime createTimestamp = LocalDateTime.now();

        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name = "approve_timestamp")
        private LocalDateTime approveTimestamp;

        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name = "deny_timestamp")
        private LocalDateTime denyTimestamp;

        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name = "pickup_create_timestamp")
        private LocalDateTime pickupCreateTimestamp;

        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name = "scheduled_pickup_timestamp")
        private LocalDateTime scheduledPickupTimestamp;

        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name = "return_timestamp")
        private LocalDateTime returnTimestamp;

        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name = "refund_timestamp")
        private LocalDateTime refundTimestamp;

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

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

        public LocalDateTime getPickupCreateTimestamp() {
                return pickupCreateTimestamp;
        }

        public void setPickupCreateTimestamp(LocalDateTime pickupCreateTimestamp) {
                this.pickupCreateTimestamp = pickupCreateTimestamp;
        }

        public LocalDateTime getScheduledPickupTimestamp() {
                return scheduledPickupTimestamp;
        }

        public void setScheduledPickupTimestamp(LocalDateTime scheduledPickupTimestamp) {
                this.scheduledPickupTimestamp = scheduledPickupTimestamp;
        }

        public LocalDateTime getReturnTimestamp() {
                return returnTimestamp;
        }

        public void setReturnTimestamp(LocalDateTime returnTimestamp) {
                this.returnTimestamp = returnTimestamp;
        }

        public LocalDateTime getRefundTimestamp() {
                return refundTimestamp;
        }

        public void setRefundTimestamp(LocalDateTime refundTimestamp) {
                this.refundTimestamp = refundTimestamp;
        }

        public int getInventoryItemId() {
                return inventoryItemId;
        }

        public void setInventoryItemId(int inventoryItemId) {
                this.inventoryItemId = inventoryItemId;
        }

        public int getFofoId() {
                return fofoId;
        }

        public void setFofoId(int fofoId) {
                this.fofoId = fofoId;
        }

        public PurchaseReturnStatus getStatus() {
                return status;
        }

        public void setStatus(PurchaseReturnStatus status) {
                this.status = status;
        }

        public LocalDateTime getCreateTimestamp() {
                return createTimestamp;
        }

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

        public String getFormattedCreateTimestamp() {
                if (createTimestamp == null) {
                        return null;
                }
                DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-YYYY HH:mm");
                return createTimestamp.format(formatter);
        }

        public String getFormattedApproveTimestamp() {
                if (approveTimestamp == null) {
                        return null;
                }
                DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-YYYY HH:mm");
                return approveTimestamp.format(formatter);
        }

        public LocalDateTime getApproveTimestamp() {
                return approveTimestamp;
        }

        public void setApproveTimestamp(LocalDateTime approvedTimestamp) {
                this.approveTimestamp = approvedTimestamp;
        }

        public LocalDateTime getDenyTimestamp() {
                return denyTimestamp;
        }

        public void setDenyTimestamp(LocalDateTime denyTimestamp) {
                this.denyTimestamp = denyTimestamp;
        }
}