Skip to content

Instantly share code, notes, and snippets.

@maneeshaindrachapa
Created February 18, 2022 09:29
Show Gist options
  • Save maneeshaindrachapa/58ec8c3924b2044dcc0468e1026cb429 to your computer and use it in GitHub Desktop.
Save maneeshaindrachapa/58ec8c3924b2044dcc0468e1026cb429 to your computer and use it in GitHub Desktop.
Tour model - Tour California Application
package com.explore.california.model;
import javax.persistence.*;
import java.util.Objects;
@Entity
public class Tour {
@Id
@GeneratedValue
private Integer id;
@Column
private String title;
@Column(length = 2000)
private String description;
@Column(length = 2000)
private String blurb;
@Column
private Integer price;
@Column
private String duration;
@Column(length = 2000)
private String bullets;
@Column
private String keywords;
@ManyToOne
private TourPackage tourPackage;
@Column
@Enumerated
private Difficulty difficulty;
@Column
@Enumerated
private Region region;
public Tour(String title, String description, String blurb, Integer price, String duration, String bullets,
String keywords, TourPackage tourPackage, Difficulty difficulty, Region region) {
this.title = title;
this.description = description;
this.blurb = blurb;
this.price = price;
this.duration = duration;
this.bullets = bullets;
this.keywords = keywords;
this.tourPackage = tourPackage;
this.difficulty = difficulty;
this.region = region;
}
protected Tour() {
}
public Integer getId() {
return id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getBlurb() {
return blurb;
}
public void setBlurb(String blurb) {
this.blurb = blurb;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
public String getDuration() {
return duration;
}
public void setDuration(String duration) {
this.duration = duration;
}
public String getBullets() {
return bullets;
}
public void setBullets(String bullets) {
this.bullets = bullets;
}
public String getKeywords() {
return keywords;
}
public TourPackage getTourPackage() {
return tourPackage;
}
public void setTourPackage(TourPackage tourPackage) {
this.tourPackage = tourPackage;
}
public void setKeywords(String keywords) {
this.keywords = keywords;
}
public Difficulty getDifficulty() {
return difficulty;
}
public void setDifficulty(Difficulty difficulty) {
this.difficulty = difficulty;
}
public Region getRegion() {
return region;
}
public void setRegion(Region region) {
this.region = region;
}
@Override
public String toString() {
return "Tour{" +
"id=" + id +
", title='" + title + '\'' +
", description='" + description + '\'' +
", blurb='" + blurb + '\'' +
", price=" + price +
", duration='" + duration + '\'' +
", bullets='" + bullets + '\'' +
", keywords='" + keywords + '\'' +
", tourPackage=" + tourPackage +
", difficulty=" + difficulty +
", region=" + region +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Tour tour = (Tour) o;
return Objects.equals(id, tour.id) &&
Objects.equals(title, tour.title) &&
Objects.equals(description, tour.description) &&
Objects.equals(blurb, tour.blurb) &&
Objects.equals(price, tour.price) &&
Objects.equals(duration, tour.duration) &&
Objects.equals(bullets, tour.bullets) &&
Objects.equals(keywords, tour.keywords) &&
Objects.equals(tourPackage, tour.tourPackage) &&
difficulty == tour.difficulty &&
region == tour.region;
}
@Override
public int hashCode() {
return Objects.hash(id, title, description, blurb, price, duration, bullets, keywords, tourPackage, difficulty,
region);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment