Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Index;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import net.onelitefeather.vulpes.api.generator.VulpesGenerator;
import net.onelitefeather.vulpes.api.model.project.ProjectEntity;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

import java.util.UUID;

Expand All @@ -18,6 +25,9 @@
* </p>
*/
@Entity(name = "attributes")
@Table(name = "attributes", indexes = {
@Index(name = "idx_attributes_project_id", columnList = "project_id")
})
public class AttributeEntity implements VulpesModel {

@Id
Expand All @@ -28,6 +38,10 @@ public class AttributeEntity implements VulpesModel {
private String variableName;
private double defaultValue;
private double maximumValue;
@ManyToOne
@JoinColumn(name = "project_id", nullable = false)
@OnDelete(action = OnDeleteAction.CASCADE)
private ProjectEntity project;

/**
* Default constructor for JPA and Micronaut Data.
Expand All @@ -42,18 +56,20 @@ public AttributeEntity() {
/**
* Constructs a new {@link AttributeEntity} with the specified values.
*
* @param id the unique identifier of the attribute
* @param uiName the model name associated with the attribute
* @param variableName the name of the attribute
* @param defaultValue the default value of the attribute
* @param maximumValue the maximum value of the attribute
* @param id the unique identifier of the attribute
* @param uiName the model name associated with the attribute
* @param variableName the name of the attribute
* @param defaultValue the default value of the attribute
* @param maximumValue the maximum value of the attribute
* @param project the project this attribute belongs to
*/
public AttributeEntity(UUID id, String uiName, String variableName, double defaultValue, double maximumValue) {
public AttributeEntity(UUID id, String uiName, String variableName, double defaultValue, double maximumValue, ProjectEntity project) {
this.id = id;
this.uiName = uiName;
this.variableName = variableName;
this.defaultValue = defaultValue;
this.maximumValue = maximumValue;
this.project = project;
}

// Getters and setters for each field
Expand Down Expand Up @@ -148,6 +164,24 @@ public void setMaximumValue(double maximumValue) {
this.maximumValue = maximumValue;
}

/**
* Returns the project this attribute belongs to.
*
* @return the project of the attribute
*/
public ProjectEntity getProject() {
return project;
}

/**
* Sets the project this attribute belongs to.
*
* @param project the project to set
*/
public void setProject(ProjectEntity project) {
this.project = project;
}

/**
* Provides a string representation of the AttributeModel
*
Expand All @@ -161,6 +195,7 @@ public String toString() {
", name='" + variableName + '\'' +
", defaultValue=" + defaultValue +
", maximumValue=" + maximumValue +
", project=" + project +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Index;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import net.onelitefeather.vulpes.api.generator.VulpesGenerator;
import net.onelitefeather.vulpes.api.model.font.FontStringEntity;
import net.onelitefeather.vulpes.api.model.project.ProjectEntity;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

import java.util.List;
import java.util.UUID;
Expand All @@ -22,6 +29,9 @@
* </p>
*/
@Entity(name = "fonts")
@Table(name = "fonts", indexes = {
@Index(name = "idx_fonts_project_id", columnList = "project_id")
})
public class FontEntity implements VulpesModel {

@Id
Expand All @@ -39,6 +49,11 @@
@OneToMany(mappedBy = "font", cascade = CascadeType.ALL)
private List<FontStringEntity> chars;

@ManyToOne
@JoinColumn(name = "project_id", nullable = false)
@OnDelete(action = OnDeleteAction.CASCADE)
private ProjectEntity project;

/**
* Default constructor for JPA and Micronaut Data.
* <p>
Expand All @@ -61,6 +76,7 @@
* @param height the height of the font
* @param ascent the ascent of the font
* @param chars the list of characters included in the font
* @param project the project this font belongs to
*/
public FontEntity(
UUID id,
Expand All @@ -71,7 +87,8 @@
String comment,
int height,
int ascent,
List<FontStringEntity> chars
List<FontStringEntity> chars,
ProjectEntity project
) {
this.id = id;
this.uiName = uiName;
Expand All @@ -82,6 +99,7 @@
this.height = height;
this.ascent = ascent;
this.chars = chars;
this.project = project;
}

// Getters and setters for each field
Expand All @@ -108,7 +126,7 @@
this.uiName = uiName;
}

public String getUiName() {

Check warning on line 129 in src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java

View workflow job for this annotation

GitHub Actions / build / Build (macos-latest)

no comment

Check warning on line 129 in src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java

View workflow job for this annotation

GitHub Actions / build / Build (ubuntu-latest)

no comment
return uiName;
}

Expand All @@ -116,39 +134,39 @@
this.variableName = variableName;
}

public String getVariableName() {

Check warning on line 137 in src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java

View workflow job for this annotation

GitHub Actions / build / Build (macos-latest)

no comment

Check warning on line 137 in src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java

View workflow job for this annotation

GitHub Actions / build / Build (ubuntu-latest)

no comment
return variableName;
}

public void setMapper(String mapper) {

Check warning on line 141 in src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java

View workflow job for this annotation

GitHub Actions / build / Build (macos-latest)

no comment

Check warning on line 141 in src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java

View workflow job for this annotation

GitHub Actions / build / Build (ubuntu-latest)

no comment
this.mapper = mapper;
}

public String getMapper() {

Check warning on line 145 in src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java

View workflow job for this annotation

GitHub Actions / build / Build (macos-latest)

no comment

Check warning on line 145 in src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java

View workflow job for this annotation

GitHub Actions / build / Build (ubuntu-latest)

no comment
return mapper;
}

public void setProvider(String provider) {

Check warning on line 149 in src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java

View workflow job for this annotation

GitHub Actions / build / Build (macos-latest)

no comment

Check warning on line 149 in src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java

View workflow job for this annotation

GitHub Actions / build / Build (ubuntu-latest)

no comment
this.provider = provider;
}

public String getProvider() {

Check warning on line 153 in src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java

View workflow job for this annotation

GitHub Actions / build / Build (macos-latest)

no comment

Check warning on line 153 in src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java

View workflow job for this annotation

GitHub Actions / build / Build (ubuntu-latest)

no comment
return provider;
}

public void setTexturePath(String texturePath) {

Check warning on line 157 in src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java

View workflow job for this annotation

GitHub Actions / build / Build (macos-latest)

no comment

Check warning on line 157 in src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java

View workflow job for this annotation

GitHub Actions / build / Build (ubuntu-latest)

no comment
this.texturePath = texturePath;
}

public String getTexturePath() {

Check warning on line 161 in src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java

View workflow job for this annotation

GitHub Actions / build / Build (macos-latest)

no comment

Check warning on line 161 in src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java

View workflow job for this annotation

GitHub Actions / build / Build (ubuntu-latest)

no comment
return texturePath;
}

public void setComment(String comment) {

Check warning on line 165 in src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java

View workflow job for this annotation

GitHub Actions / build / Build (macos-latest)

no comment

Check warning on line 165 in src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java

View workflow job for this annotation

GitHub Actions / build / Build (ubuntu-latest)

no comment
this.comment = comment;
}

public String getComment() {

Check warning on line 169 in src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java

View workflow job for this annotation

GitHub Actions / build / Build (macos-latest)

no comment

Check warning on line 169 in src/main/java/net/onelitefeather/vulpes/api/model/FontEntity.java

View workflow job for this annotation

GitHub Actions / build / Build (ubuntu-latest)

no comment
return comment;
}

Expand Down Expand Up @@ -206,6 +224,24 @@
this.chars = chars;
}

/**
* Returns the project this font belongs to.
*
* @return the project of the font
*/
public ProjectEntity getProject() {
return project;
}

/**
* Sets the project this font belongs to.
*
* @param project the project to set
*/
public void setProject(ProjectEntity project) {
this.project = project;
}

@Override
public String toString() {
return "FontEntity{" +
Expand All @@ -219,6 +255,7 @@
", height=" + height +
", ascent=" + ascent +
", chars=" + chars +
", project=" + project +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Index;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import net.onelitefeather.vulpes.api.generator.VulpesGenerator;
import net.onelitefeather.vulpes.api.model.item.ItemEnchantmentEntity;
import net.onelitefeather.vulpes.api.model.item.ItemFlagEntity;
import net.onelitefeather.vulpes.api.model.item.ItemLoreEntity;
import net.onelitefeather.vulpes.api.model.project.ProjectEntity;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

import java.util.List;
import java.util.UUID;
Expand All @@ -24,6 +31,9 @@
* </p>
*/
@Entity(name = "items")
@Table(name = "items", indexes = {
@Index(name = "idx_items_project_id", columnList = "project_id")
})
public class ItemEntity implements VulpesModel {

@Id
Expand All @@ -46,6 +56,11 @@ public class ItemEntity implements VulpesModel {
@OneToMany(mappedBy = "item", cascade = CascadeType.ALL)
private List<ItemFlagEntity> flags;

@ManyToOne
@JoinColumn(name = "project_id", nullable = false)
@OnDelete(action = OnDeleteAction.CASCADE)
private ProjectEntity project;

/**
* Default constructor for JPA and Micronaut Data.
* <p>
Expand All @@ -71,6 +86,7 @@ public ItemEntity() {
* @param enchantments the enchantments applied to the item
* @param lore the lore associated with the item
* @param flags the flags associated with the item
* @param project the project this item belongs to
*/
public ItemEntity(
UUID id,
Expand All @@ -84,7 +100,8 @@ public ItemEntity(
int amount,
List<ItemEnchantmentEntity> enchantments,
List<ItemLoreEntity> lore,
List<ItemFlagEntity> flags
List<ItemFlagEntity> flags,
ProjectEntity project
) {
this.id = id;
this.uiName = uiName;
Expand All @@ -98,6 +115,7 @@ public ItemEntity(
this.enchantments = enchantments;
this.lore = lore;
this.flags = flags;
this.project = project;
}

// Getters and setters for each field
Expand Down Expand Up @@ -318,6 +336,24 @@ public void setFlags(List<ItemFlagEntity> flags) {
this.flags = flags;
}

/**
* Returns the project this item belongs to.
*
* @return the project of the item
*/
public ProjectEntity getProject() {
return project;
}

/**
* Sets the project this item belongs to.
*
* @param project the project to set
*/
public void setProject(ProjectEntity project) {
this.project = project;
}

/**
* Provides a string representation of the ItemModel.
*
Expand All @@ -338,6 +374,7 @@ public String toString() {
", enchantments=" + enchantments +
", lore=" + lore +
", flags=" + flags +
", project=" + project +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Index;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import net.onelitefeather.vulpes.api.generator.VulpesGenerator;
import net.onelitefeather.vulpes.api.model.project.ProjectEntity;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

import java.util.UUID;

Expand All @@ -18,6 +25,9 @@
* </p>
*/
@Entity(name = "notifications")
@Table(name = "notifications", indexes = {
@Index(name = "idx_notifications_project_id", columnList = "project_id")
})
public class NotificationEntity implements VulpesModel {

@Id
Expand All @@ -30,6 +40,10 @@ public class NotificationEntity implements VulpesModel {
private String material;
private String frameType;
private String title;
@ManyToOne
@JoinColumn(name = "project_id", nullable = false)
@OnDelete(action = OnDeleteAction.CASCADE)
private ProjectEntity project;

/**
* Default constructor for JPA and Micronaut Data.
Expand All @@ -51,15 +65,17 @@ public NotificationEntity() {
* @param material the material type associated with the notification
* @param frameType the frame type associated with the notification
* @param title the title of the notification
* @param project the project this notification belongs to
*/
public NotificationEntity(UUID id, String uiName, String variableName, String comment, String material, String frameType, String title) {
public NotificationEntity(UUID id, String uiName, String variableName, String comment, String material, String frameType, String title, ProjectEntity project) {
this.id = id;
this.uiName = uiName;
this.variableName = variableName;
this.comment = comment;
this.material = material;
this.frameType = frameType;
this.title = title;
this.project = project;
}

/**
Expand Down Expand Up @@ -188,6 +204,24 @@ public void setTitle(String title) {
this.title = title;
}

/**
* Returns the project this notification belongs to.
*
* @return the project of the notification
*/
public ProjectEntity getProject() {
return project;
}

/**
* Sets the project this notification belongs to.
*
* @param project the project to set
*/
public void setProject(ProjectEntity project) {
this.project = project;
}

/**
* Provides a string representation of the NotificationModel
*
Expand All @@ -203,6 +237,7 @@ public String toString() {
", material='" + material + '\'' +
", frameType='" + frameType + '\'' +
", title='" + title + '\'' +
", project=" + project +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import jakarta.persistence.ManyToOne;
import net.onelitefeather.vulpes.api.generator.VulpesGenerator;
import net.onelitefeather.vulpes.api.model.FontEntity;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

import java.util.Objects;
import java.util.UUID;
Expand All @@ -21,6 +23,7 @@ public final class FontStringEntity implements Comparable<FontStringEntity> {
private String line;
@ManyToOne
@JoinColumn(name = "font_id", nullable = false)
@OnDelete(action = OnDeleteAction.CASCADE)
private FontEntity font;
private int orderIndex;

Expand Down
Loading
Loading