Subversion Repositories SmartDukaan

Rev

Rev 33916 | Rev 35343 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
33772 amit.gupta 1
package com.spice.profitmandi.dao.entity.catalog;
2
 
3
import javax.persistence.*;
4
import java.time.LocalDateTime;
5
import java.util.Objects;
6
 
7
@Entity
8
@Table(name = "catalog.catalog")
9
public class Catalog {
10
    @Id
11
    @GeneratedValue(strategy = GenerationType.IDENTITY)
12
    @Column(name = "id", columnDefinition = "int(11)")
13
    private int id;
14
 
15
    @Column(name="brand_id")
16
    private int brandId;
17
 
18
    @Column
19
    private String brand;
20
 
21
    @Column(name="model_number")
22
    private String modelNumber;
23
 
24
    @Column(name="model_name")
25
    private String modelName;
26
 
33888 ranu 27
    @Column(name = "category_id")
28
    private int categoryId;
29
 
33772 amit.gupta 30
    @Column(name="created_by")
31
    private String createdBy;
32
 
33
    @Column
34
    private LocalDateTime created;
35
 
36
    public int getId() {
37
        return id;
38
    }
39
 
40
    public void setId(int id) {
41
        this.id = id;
42
    }
43
 
44
    public int getBrandId() {
45
        return brandId;
46
    }
47
 
48
    public void setBrandId(int brandId) {
49
        this.brandId = brandId;
50
    }
51
 
52
    public String getBrand() {
53
        return brand;
54
    }
55
 
56
    public void setBrand(String brand) {
57
        this.brand = brand;
58
    }
59
 
60
    public String getModelNumber() {
61
        return modelNumber;
62
    }
63
 
64
    public void setModelNumber(String modelNumber) {
65
        this.modelNumber = modelNumber;
66
    }
67
 
68
    public String getModelName() {
69
        return modelName;
70
    }
71
 
72
    public void setModelName(String modelName) {
73
        this.modelName = modelName;
74
    }
75
 
76
    public String getCreatedBy() {
77
        return createdBy;
78
    }
79
 
80
    public void setCreatedBy(String createdBy) {
81
        this.createdBy = createdBy;
82
    }
83
 
84
    public LocalDateTime getCreated() {
85
        return created;
86
    }
87
 
88
    public void setCreated(LocalDateTime created) {
89
        this.created = created;
90
    }
91
 
33888 ranu 92
    public int getCategoryId() {
93
        return categoryId;
94
    }
95
 
96
    public void setCategoryId(int categoryId) {
97
        this.categoryId = categoryId;
98
    }
99
 
33772 amit.gupta 100
    @Override
101
    public boolean equals(Object o) {
102
        if (this == o) return true;
103
        if (o == null || getClass() != o.getClass()) return false;
104
        Catalog catalog = (Catalog) o;
33888 ranu 105
        return id == catalog.id && brandId == catalog.brandId && categoryId == catalog.categoryId && Objects.equals(brand, catalog.brand) && Objects.equals(modelNumber, catalog.modelNumber) && Objects.equals(modelName, catalog.modelName) && Objects.equals(createdBy, catalog.createdBy) && Objects.equals(created, catalog.created);
33772 amit.gupta 106
    }
107
 
108
    @Override
33888 ranu 109
    public int hashCode() {
110
        return Objects.hash(id, brandId, brand, modelNumber, modelName, categoryId, createdBy, created);
111
    }
112
 
33916 amit.gupta 113
    public String getDescription() {
114
        StringBuilder itemString = new StringBuilder();
115
        if (this.getBrand() != null && !this.getBrand().isEmpty()) {
116
            itemString.append(this.getBrand().trim());
117
        }
118
        itemString.append(" ");
119
        if (this.getModelName() != null && !this.getModelName().isEmpty()) {
120
            itemString.append(this.getModelName().trim());
121
        }
122
        if (this.getModelNumber() != null && !this.getModelNumber().isEmpty()) {
123
            itemString.append(" ");
124
            itemString.append(this.getModelNumber().trim());
125
        }
126
 
127
        return itemString.toString().replaceAll("\\s+", " ").trim();
128
    }
129
 
35188 amit 130
    public String getDescriptionNoBrand() {
131
        StringBuilder itemString = new StringBuilder();
132
        itemString.append(" ");
133
        if (this.getModelName() != null && !this.getModelName().isEmpty()) {
134
            itemString.append(this.getModelName().trim());
135
        }
136
        if (this.getModelNumber() != null && !this.getModelNumber().isEmpty()) {
137
            itemString.append(" ");
138
            itemString.append(this.getModelNumber().trim());
139
        }
140
 
141
        return itemString.toString().replaceAll("\\s+", " ").trim();
142
    }
143
 
33888 ranu 144
    @Override
33772 amit.gupta 145
    public String toString() {
146
        return "Catalog{" +
147
                "id=" + id +
148
                ", brandId=" + brandId +
149
                ", brand='" + brand + '\'' +
150
                ", modelNumber='" + modelNumber + '\'' +
151
                ", modelName='" + modelName + '\'' +
33888 ranu 152
                ", categoryId=" + categoryId +
33772 amit.gupta 153
                ", createdBy='" + createdBy + '\'' +
154
                ", created=" + created +
155
                '}';
156
    }
157
 
158
}
159