Rev 22009 | Rev 22532 | 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.dtr;import java.io.Serializable;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.Id;import javax.persistence.NamedQueries;import javax.persistence.NamedQuery;import javax.persistence.Table;import javax.persistence.UniqueConstraint;import org.hibernate.annotations.UpdateTimestamp;import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;import com.spice.profitmandi.dao.enumuration.dtr.RetailerType;import com.spice.profitmandi.dao.enumuration.dtr.SaleValue;/*** This class basically contains api details** @author ashikali**/@Entity@Table(name="dtr.retailer", schema = "dtr", uniqueConstraints = {@UniqueConstraint(columnNames = {"number","type"})})@NamedQueries({@NamedQuery(name = "Retailer.selectCount", query = "select count(r) from Retailer r"),@NamedQuery(name = "Retailer.selectAll",query="select r from Retailer r"),@NamedQuery(name = "Retailer.selectById",query="select r from Retailer r where r.id= :id"),@NamedQuery(name = "Retailer.selectByName",query="select r from Retailer r where r.name= :name"),@NamedQuery(name = "Retailer.selectCountByNumberAndType",query="select count(r) from Retailer r where r.number= :number and r.type= :type"),@NamedQuery(name = "Retailer.selectCountByDocumentId", query="select count(r) from Retailer r where r.documentId= :documentId"),@NamedQuery(name = "Retailer.selectCountByName", query = "select count(r) from Retailer r where r.name= :name"),@NamedQuery(name = "Retailer.selectCountById", query = "select count(r) from Retailer r where r.id= :id"),@NamedQuery(name = "Retailer.deleteById",query="delete from Retailer r where r.id= :id"),@NamedQuery(name = "Retailer.selectDocumentById", query = "select d from Retailer r join Document d on d.id = r.documentId where r.id = :id"),@NamedQuery(name = "Retailer.selectFofoIdAndEmailIdByEmailId",query = "select r.id, u.emailId from User u join UserAccounts ua on ua.user_id = u.id join Retailer r on r.id = ua.account_key where u.emailId = :emailId and ua.account_type = 'saholic' and r.fofo = true")})public class Retailer implements Serializable{private static final long serialVersionUID = 1L;public Retailer() {}@Id@Column(name = "id", unique=true, updatable=false)private int id;@Column(name = "name")private String name;@Column(name = "number", length = 128)private String number;@Column(name = "type")@Enumerated(EnumType.STRING)private RetailerType type;@Column(name = "monthly_sale_value")private SaleValue monthlySaleValue;@Column(name = "smartphone_sale_value")private SaleValue smartphoneSaleValue;@Column(name = "recharge", columnDefinition="tinyint(1) default 0")private boolean recharge;@Column(name = "mobile", columnDefinition="tinyint(1) default 0")private boolean mobile;@Column(name = "accessories", columnDefinition="tinyint(1) default 0")private boolean accessories;@Column(name = "other1", length = 128)private String other1;@Column(name = "other2", length = 128)private String other2;@Column(name = "self_pickup", columnDefinition="tinyint(1) default 0")private boolean selfPickup;@Column(name = "active", columnDefinition = "tinyint(1) default 0")private boolean active;@Column(name = "migrated", columnDefinition = "tinyint(1) default 0")private boolean migrated;@Convert(converter = LocalDateTimeAttributeConverter.class)@Column(name="create_timestamp", updatable = false)private LocalDateTime createTimestamp = LocalDateTime.now();@Convert(converter = LocalDateTimeAttributeConverter.class)@Column(name="update_timestamp")@UpdateTimestampprivate LocalDateTime updateTimestamp = LocalDateTime.now();@Column(name = "document_id")private int documentId;@Column(name = "current_address_id")private int currentAddressId;@Column(name = "fofo", columnDefinition = "tinyint(1) default 0")private boolean fofo;public int getId() {return id;}public void setId(int id) {this.id = id;}public void setName(String name) {this.name = name;}public String getName() {return name;}public String getNumber() {return number;}public void setNumber(String number) {this.number = number;}public SaleValue getMonthlySaleValue() {return monthlySaleValue;}public void setMonthlySaleValue(SaleValue monthlySaleValue) {this.monthlySaleValue = monthlySaleValue;}public SaleValue getSmartphoneSaleValue() {return smartphoneSaleValue;}public void setSmartphoneSaleValue(SaleValue smartphoneSaleValue) {this.smartphoneSaleValue = smartphoneSaleValue;}public boolean isRecharge() {return recharge;}public void setRecharge(boolean recharge) {this.recharge = recharge;}public boolean isMobile() {return mobile;}public void setMobile(boolean mobile) {this.mobile = mobile;}public boolean isAccessories() {return accessories;}public void setAccessories(boolean accessories) {this.accessories = accessories;}public String getOther1() {return other1;}public void setOther1(String other1) {this.other1 = other1;}public String getOther2() {return other2;}public void setOther2(String other2) {this.other2 = other2;}public void setType(RetailerType type) {this.type = type;}public RetailerType getType() {return type;}public int getDocumentId() {return documentId;}public void setDocumentId(int documentId) {this.documentId = documentId;}public void setCurrentAddressId(int currentAddressId) {this.currentAddressId = currentAddressId;}public int getCurrentAddressId() {return currentAddressId;}public boolean isSelfPickup() {return selfPickup;}public void setSelfPickup(boolean selfPickup) {this.selfPickup = selfPickup;}public boolean isActive() {return active;}public void setActive(boolean active) {this.active = active;}public boolean isMigrated() {return migrated;}public void setMigrated(boolean migrated) {this.migrated = migrated;}public void setCreateTimestamp(LocalDateTime createTimestamp) {this.createTimestamp = createTimestamp;}public LocalDateTime getCreateTimestamp() {return createTimestamp;}public void setUpdateTimestamp(LocalDateTime updateTimestamp) {this.updateTimestamp = updateTimestamp;}public LocalDateTime getUpdateTimestamp() {return updateTimestamp;}public boolean isFofo() {return fofo;}public void setFofo(boolean fofo) {this.fofo = fofo;}@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;Retailer other = (Retailer) obj;if (id != other.id)return false;return true;}@Overridepublic String toString() {return "Retailer [id=" + id + ", name=" + name + ", number=" + number + ", type=" + type + ", monthlySaleValue="+ monthlySaleValue + ", smartphoneSaleValue=" + smartphoneSaleValue + ", recharge=" + recharge+ ", mobile=" + mobile + ", accessories=" + accessories + ", other1=" + other1 + ", other2=" + other2+ ", selfPickup=" + selfPickup + ", active=" + active + ", migrated=" + migrated + ", createTimestamp="+ createTimestamp + ", updateTimestamp=" + updateTimestamp + ", documentId="+ documentId + ", currentAddressId=" + currentAddressId + ", fofo=" + fofo + "]";}}