summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/hjp5/examples/Directory.java
diff options
context:
space:
mode:
authorSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
committerSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
commit33613a85afc4b1481367fbe92a17ee59c240250b (patch)
tree670b842326116b376b505ec2263878912fca97e2 /Master/Reference Architectures and Patterns/hjp5/examples/Directory.java
downloadStudium-master.tar.gz
Studium-master.tar.bz2
add new repoHEADmaster
Diffstat (limited to 'Master/Reference Architectures and Patterns/hjp5/examples/Directory.java')
-rw-r--r--Master/Reference Architectures and Patterns/hjp5/examples/Directory.java90
1 files changed, 90 insertions, 0 deletions
diff --git a/Master/Reference Architectures and Patterns/hjp5/examples/Directory.java b/Master/Reference Architectures and Patterns/hjp5/examples/Directory.java
new file mode 100644
index 0000000..ec95b0b
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/hjp5/examples/Directory.java
@@ -0,0 +1,90 @@
+import javax.persistence.*;
+
+/**
+ * Diese Klasse repräsentiert die Tabelle 'dir' der 'DirDB'
+ * Jede Instanz der Klasse repräsentiert wiederum einen
+ * Datensatz
+ */
+@Entity
+@Table( name = "dir" )
+public class Directory {
+
+ // Variablen die den Attributen der Tabelle entsprechen
+ private int did;
+ private String dname;
+ private int fatherid;
+ private int entries;
+
+ /**
+ * Ein einfacher Konstruktor ohne Initialisierung der
+ * Objektvariablen
+ */
+ public Directory() {
+ }
+
+ /**
+ * Konstruktor mit Initialisierung der Variablen
+ */
+ public Directory(int did,
+ String dname,
+ int fatherid,
+ int entries)
+ {
+ this.did = did;
+ this.dname = dname;
+ this.fatherid = fatherid;
+ this.entries = entries;
+ }
+
+ // Zugriffsmethoden, um die Daten der Klasse
+ // Auslesen und Schreiben zu können
+ @Id
+ @Column( name = "id" )
+ public int getDid()
+ {
+ return did;
+ }
+
+ public void setDid(int did)
+ {
+ this.did = did;
+ }
+
+ @Column( name = "dname", nullable = false )
+ public String getDname()
+ {
+ return dname;
+ }
+
+ public void setDname(String dname)
+ {
+ this.dname = dname;
+ }
+
+ @Column ( name = "fatherid" )
+ public int getFatherid()
+ {
+ return fatherid;
+ }
+
+ public void setFatherid(int fatherid)
+ {
+ this.fatherid = fatherid;
+ }
+
+ @Column ( name = "entries" )
+ public int getEntries()
+ {
+ return entries;
+ }
+
+ public void setEntries(int entries)
+ {
+ this.entries = entries;
+ }
+
+ public String toString()
+ {
+ return "Directory[id:"+ did + ", name:" + dname + "]";
+ }
+} \ No newline at end of file