adding entity and crud
This commit is contained in:
82
src/main/java/ch/progetto152/entity/Location.java
Normal file
82
src/main/java/ch/progetto152/entity/Location.java
Normal file
@@ -0,0 +1,82 @@
|
||||
package ch.progetto152.entity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "Location", schema = "Progetto152", catalog = "")
|
||||
public class Location {
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
private int id;
|
||||
@Basic
|
||||
@Column(name = "location")
|
||||
private String location;
|
||||
@Basic
|
||||
@Column(name = "region")
|
||||
private String region;
|
||||
@Basic
|
||||
@Column(name = "lat")
|
||||
private double lat;
|
||||
@Basic
|
||||
@Column(name = "lon")
|
||||
private double lon;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
public void setRegion(String region) {
|
||||
this.region = region;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Location that = (Location) o;
|
||||
return id == that.id && Double.compare(that.lat, lat) == 0 && Double.compare(that.lon, lon) == 0 && Objects.equals(location, that.location) && Objects.equals(region, that.region);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, location, region, lat, lon);
|
||||
}
|
||||
}
|
||||
59
src/main/java/ch/progetto152/entity/LocationVisited.java
Normal file
59
src/main/java/ch/progetto152/entity/LocationVisited.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package ch.progetto152.entity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "LocationVisited", schema = "Progetto152", catalog = "")
|
||||
public class LocationVisited{
|
||||
@Basic
|
||||
@Column(name = "userId")
|
||||
private int userId;
|
||||
@Basic
|
||||
@Column(name = "locationid")
|
||||
private int locationid;
|
||||
@Id
|
||||
private Long id;
|
||||
|
||||
public int getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(int userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public int getLocationid() {
|
||||
return locationid;
|
||||
}
|
||||
|
||||
public void setLocationid(int locationid) {
|
||||
this.locationid = locationid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
LocationVisited that = (LocationVisited) o;
|
||||
return userId == that.userId && locationid == that.locationid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(userId, locationid);
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
||||
71
src/main/java/ch/progetto152/entity/User.java
Normal file
71
src/main/java/ch/progetto152/entity/User.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package ch.progetto152.entity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "User", schema = "Progetto152", catalog = "")
|
||||
public class User {
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
private int id;
|
||||
@Basic
|
||||
@Column(name = "name")
|
||||
private String name;
|
||||
@Basic
|
||||
@Column(name = "username")
|
||||
private String username;
|
||||
@Basic
|
||||
@Column(name = "password")
|
||||
private String password;
|
||||
|
||||
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 getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
User that = (User) o;
|
||||
return id == that.id && Objects.equals(name, that.name) && Objects.equals(username, that.username) && Objects.equals(password, that.password);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, name, username, password);
|
||||
}
|
||||
}
|
||||
104
src/main/java/ch/progetto152/entity/Waypoints.java
Normal file
104
src/main/java/ch/progetto152/entity/Waypoints.java
Normal file
@@ -0,0 +1,104 @@
|
||||
package ch.progetto152.entity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "Waypoints", schema = "Progetto152", catalog = "")
|
||||
public class Waypoints {
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
private int id;
|
||||
@Basic
|
||||
@Column(name = "name")
|
||||
private String name;
|
||||
@Basic
|
||||
@Column(name = "lat")
|
||||
private double lat;
|
||||
@Basic
|
||||
@Column(name = "lon")
|
||||
private double lon;
|
||||
@Basic
|
||||
@Column(name = "description")
|
||||
private String description;
|
||||
@Basic
|
||||
@Column(name = "img")
|
||||
private String img;
|
||||
@Basic
|
||||
@Column(name = "LocationId")
|
||||
private int locationId;
|
||||
|
||||
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 double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getImg() {
|
||||
return img;
|
||||
}
|
||||
|
||||
public void setImg(String img) {
|
||||
this.img = img;
|
||||
}
|
||||
|
||||
public int getLocationId() {
|
||||
return locationId;
|
||||
}
|
||||
|
||||
public void setLocationId(int locationId) {
|
||||
this.locationId = locationId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Waypoints that = (Waypoints) o;
|
||||
return id == that.id && Double.compare(that.lat, lat) == 0 && Double.compare(that.lon, lon) == 0 && locationId == that.locationId && Objects.equals(name, that.name) && Objects.equals(description, that.description) && Objects.equals(img, that.img);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, name, lat, lon, description, img, locationId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user