-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSoundEntity.java
More file actions
153 lines (136 loc) · 4.19 KB
/
SoundEntity.java
File metadata and controls
153 lines (136 loc) · 4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
package net.theevilreaper.vulpes.api.model.sound;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import net.theevilreaper.vulpes.api.generator.VulpesGenerator;
import net.theevilreaper.vulpes.api.model.VulpesModel;
import java.util.List;
import java.util.UUID;
/**
* Represents sound data in the system. This class is used as an entity for persistence
* with JPA and Micronaut Data. It contains details related to sound such as name, source,
* and a list of related sound data entities.
* <p>
* This class is mapped to the database table "vulpes_sounds" and contains fields that
* are automatically persisted by the JPA and Micronaut Data layers.
* </p>
*/
@Entity(name = "sounds")
public class SoundEntity implements VulpesModel {
@Id
@GeneratedValue(strategy = GenerationType.UUID)
@VulpesGenerator
private UUID id;
private String modelName;
private String source;
/**
* Represents the list of sound data related to this sound model.
* This is a one-to-many relationship where each sound model can have multiple sound data entities.
*/
@OneToMany(mappedBy = "id")
private List<SoundDataEntity> soundDatumEntities;
/**
* Default constructor for JPA and Micronaut Data.
* <p>
* This constructor is required for the JPA provider to instantiate the entity.
* </p>
*/
public SoundEntity() {
// No-argument constructor for JPA
}
/**
* Constructs a new {@link SoundEntity} with the specified values.
*
* @param id the unique identifier of the sound model
* @param modelName the name of the sound model
* @param source the source file or location of the sound model
* @param soundDatumEntities the list of sound data related to this sound model
*/
public SoundEntity(UUID id, String modelName, String source, List<SoundDataEntity> soundDatumEntities) {
this.id = id;
this.modelName = modelName;
this.source = source;
this.soundDatumEntities = soundDatumEntities;
}
// Getters and setters for each field
/**
* Returns the unique identifier of the sound model
*
* @return the unique identifier of the sound model
*/
public UUID getId() {
return id;
}
/**
* Sets the unique identifier of the sound model
*
* @param id the unique identifier to set
*/
public void setId(UUID id) {
this.id = id;
}
/**
* Returns the model name of the sound model
*
* @return the model name of the sound model
*/
public String getModelName() {
return modelName;
}
/**
* Sets the model name of the sound model
*
* @param modelName the model name to set
*/
public void setModelName(String modelName) {
this.modelName = modelName;
}
/**
* Returns the source of the sound model
*
* @return the source of the sound model
*/
public String getSource() {
return source;
}
/**
* Sets the source of the sound model
*
* @param source the source to set
*/
public void setSource(String source) {
this.source = source;
}
/**
* Returns the list of sound data related to this sound model
*
* @return the list of sound data
*/
public List<SoundDataEntity> getSoundData() {
return soundDatumEntities;
}
/**
* Sets the list of sound data related to this sound model
*
* @param soundDatumEntities the list of sound data to set
*/
public void setSoundData(List<SoundDataEntity> soundDatumEntities) {
this.soundDatumEntities = soundDatumEntities;
}
/**
* Provides a string representation of the SoundModel
*
* @return a string representation
*/
@Override
public String toString() {
return "SoundModel{" +
"id='" + id + '\'' +
", modelName='" + modelName + '\'' +
", source='" + source + '\'' +
", soundData=" + soundDatumEntities +
'}';
}
}