chore: Add dataset and type classes

This commit is contained in:
2024-06-14 15:30:12 +02:00
parent 01b457d100
commit b189a8f022
2 changed files with 117 additions and 0 deletions

View File

@@ -0,0 +1,111 @@
package de.uni_passau.fim.PADAS.group3.DataDash.model;
import java.sql.Date;
import java.util.UUID;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
@Entity
public class dataset {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private UUID id;
@Enumerated(EnumType.STRING)
private type type;
private String title;
private String abst;
private String description;
private String author;
private Date date;
private float raiting;
private int votes;
private String[] Categories;
public String getAbst() {
return abst;
}
public String getAuthor() {
return author;
}
public String[] getCategories() {
return Categories;
}
public Date getDate() {
return date;
}
public String getDescription() {
return description;
}
public UUID getId() {
return id;
}
public float getRaiting() {
return raiting;
}
public String getTitle() {
return title;
}
public type getType() {
return type;
}
public int getVotes() {
return votes;
}
public void setAbst(String abst) {
this.abst = abst.substring(0, Math.min(abst.length(), 100));
}
public void setAuthor(String author) {
this.author = author;
}
public void setCategories(String[] categories) {
Categories = categories;
}
public void setDate(Date date) {
this.date = date;
}
public void setDescription(String description) {
this.description = description;
}
public void setTitle(String title) {
this.title = title;
}
public void setType(type type) {
this.type = type;
}
public void vote(int stars) {
raiting = (raiting*votes + stars) / (++votes);
}
}

View File

@@ -0,0 +1,6 @@
package de.uni_passau.fim.PADAS.group3.DataDash.model;
public enum type {
DATASET,
API
}