Subversion Repositories SmartDukaan

Rev

Rev 22653 | Rev 22859 | 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.catalog;

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

import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
import com.spice.profitmandi.dao.enumuration.catalog.SchemeAmountType;
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;

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

@NamedQueries({
        @NamedQuery(name = "Scheme.updateActiveTimestampById", query = "update Scheme s set s.activeTimestamp = :activeTimestamp where s.id= :id"),
        @NamedQuery(name = "Scheme.updateExpireTimestampById", query = "update Scheme s set s.expireTimestamp = :expireTimestamp where s.id= :id")
})
public class Scheme implements Serializable{
        
        private static final long serialVersionUID = 1L;
        
        public Scheme() {
        }
        
        @Id
        @Column(name="id")
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private int id;
        
        @Column(name = "name")
        private String name;
        
        @Column(name = "description")
        private String description;
        
        @Column(name = "type")
        private SchemeType type;
        
        @Column(name = "amount_type")
        private SchemeAmountType amountType;
        
        @Column(name = "amount")
        private float amount;
        
        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name = "start_date")
        private LocalDateTime startDate = LocalDateTime.now();
        
        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name = "end_date")
        private LocalDateTime endDate = LocalDateTime.now();
        
        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name = "create_timestamp")
        private LocalDateTime createdTimestamp = LocalDateTime.now();
        
        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name = "active_timestamp")
        private LocalDateTime activeTimestamp = null;
        
        @Convert(converter = LocalDateTimeAttributeConverter.class)
        @Column(name = "expire_timestamp")
        private LocalDateTime expireTimestamp = null;
        
        @Column(name = "created_by")
        private int createdBy;
        
        @Column(name = "all")
        private boolean all;
        
        public int getId() {
                return id;
        }
        public void setId(int id) {
                this.id = id;
        }
        
        public String getName() {
                return name;
        }
        public void setName(String name) {
                this.name = name;
        }
        
        public String getDescription() {
                return description;
        }
        
        public void setDescription(String description) {
                this.description = description;
        }
        
        public SchemeType getType() {
                return type;
        }
        
        public void setType(SchemeType type) {
                this.type = type;
        }
        
        
        public SchemeAmountType getAmountType() {
                return amountType;
        }
        
        public void setAmountType(SchemeAmountType amountType) {
                this.amountType = amountType;
        }
        
        public float getAmount() {
                return amount;
        }
        public void setAmount(float amount) {
                this.amount = amount;
        }
        
        public LocalDateTime getStartDate() {
                return startDate;
        }
        public void setStartDate(LocalDateTime startDate) {
                this.startDate = startDate;
        }
        
        public LocalDateTime getEndDate() {
                return endDate;
        }
        public void setEndDate(LocalDateTime endDate) {
                this.endDate = endDate;
        }
        
        public LocalDateTime getCreatedTimestamp() {
                return createdTimestamp;
        }
        public void setCreatedTimestamp(LocalDateTime createdTimestamp) {
                this.createdTimestamp = createdTimestamp;
        }
        public int getCreatedBy() {
                return createdBy;
        }
        public void setCreatedBy(int createdBy) {
                this.createdBy = createdBy;
        }
        
        public LocalDateTime getActiveTimestamp() {
                return activeTimestamp;
        }
        
        public void setActiveTimestamp(LocalDateTime activeTimestamp) {
                this.activeTimestamp = activeTimestamp;
        }
    
        public LocalDateTime getExpireTimestamp() {
                return expireTimestamp;
        }
        
        public void setExpireTimestamp(LocalDateTime expireTimestamp) {
                this.expireTimestamp = expireTimestamp;
        }
        
        public boolean isAll() {
                return all;
        }
        
        public void setAll(boolean all) {
                this.all = all;
        }
        @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;
                Scheme other = (Scheme) obj;
                if (id != other.id)
                        return false;
                return true;
        }
        @Override
        public String toString() {
                return "Scheme [id=" + id + ", name=" + name + ", description=" + description + ", type=" + type
                                + ", amountType=" + amountType + ", amount=" + amount + ", startDate=" + startDate + ", endDate="
                                + endDate + ", createdTimestamp=" + createdTimestamp + ", activeTimestamp=" + activeTimestamp
                                + ", expireTimestamp=" + expireTimestamp + ", createdBy=" + createdBy + ", all=" + all + "]";
        }
        
}