Subversion Repositories SmartDukaan

Rev

Rev 21714 | Rev 22009 | 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.time.LocalDateTime;

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.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;

@Entity
@Table(name="fofo.scan_record", schema = "fofo")
@NamedQueries({
        @NamedQuery(name = "ScanRecord.selectCount", query = "select count(sr) from ScanRecord sr"),
        @NamedQuery(name = "ScanRecord.selectByFofoId", query = "select sr from ScanRecord sr where sr.fofoId = :fofoId")
})
public class ScanRecord {
        
        @Id
        @Column(name="id", unique=true, updatable=false)
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private int id;
        
        @Column(name = "fofo_id")
        private int fofoId;
        
        @Column(name = "inventory_item_id")
        private int inventoryItemId;
        
        @Column(name = "quantity")
        private int quantity;
        
        @Column(name = "type")
        @Enumerated(EnumType.STRING)
        private ScanType type;
        
        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name = "create_timestamp")
        private LocalDateTime createTimestamp = LocalDateTime.now();

        public int getId() {
                return id;
        }

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

        public int getFofoId() {
                return fofoId;
        }

        public void setFofoId(int fofoId) {
                this.fofoId = fofoId;
        }
        
        public int getInventoryItemId() {
                return inventoryItemId;
        }
        public void setInventoryItemId(int inventoryItemId) {
                this.inventoryItemId = inventoryItemId;
        }
        
        public int getQuantity() {
                return quantity;
        }
        public void setQuantity(int quantity) {
                this.quantity = quantity;
        }

        public ScanType getType() {
                return type;
        }

        public void setType(ScanType type) {
                this.type = type;
        }

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

        @Override
        public int hashCode() {
                final int prime = 31;
                int result = 1;
                result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
                result = prime * result + fofoId;
                result = prime * result + id;
                result = prime * result + inventoryItemId;
                result = prime * result + quantity;
                result = prime * result + ((type == null) ? 0 : type.hashCode());
                return result;
        }

        @Override
        public boolean equals(Object obj) {
                if (this == obj)
                        return true;
                if (obj == null)
                        return false;
                if (getClass() != obj.getClass())
                        return false;
                ScanRecord other = (ScanRecord) obj;
                if (createTimestamp == null) {
                        if (other.createTimestamp != null)
                                return false;
                } else if (!createTimestamp.equals(other.createTimestamp))
                        return false;
                if (fofoId != other.fofoId)
                        return false;
                if (id != other.id)
                        return false;
                if (inventoryItemId != other.inventoryItemId)
                        return false;
                if (quantity != other.quantity)
                        return false;
                if (type != other.type)
                        return false;
                return true;
        }

        @Override
        public String toString() {
                return "ScanRecord [id=" + id + ", fofoId=" + fofoId + ", inventoryItemId=" + inventoryItemId + ", quantity="
                                + quantity + ", type=" + type + ", createTimestamp=" + createTimestamp + "]";
        }
        
        
                
}