cacheOptional = cacheRepository.findById(Integer.valueOf(cacheID));
+ if (cacheOptional.isPresent()) {
+ Cache cache = cacheOptional.get();
+ return new Gson().toJson(cache);
+ } else {
+ throw new IllegalParameterException( "There is no cache with the ID " + cacheID);
+ }
+ }
+ }
}
diff --git a/src/main/java/hhn/labsw/bugageocaching/entities/Bearbeitet.java b/src/main/java/hhn/labsw/bugageocaching/entities/Bearbeitet.java
new file mode 100644
index 0000000..c2c284d
--- /dev/null
+++ b/src/main/java/hhn/labsw/bugageocaching/entities/Bearbeitet.java
@@ -0,0 +1,54 @@
+package hhn.labsw.bugageocaching.entities;
+
+
+import javax.persistence.*;
+
+@Entity
+@Table
+public class Bearbeitet {
+
+ @Id
+ @GeneratedValue
+ private int id;
+
+ @OneToOne
+ private User user;
+
+ @OneToOne
+ private Cache cache;
+
+ @OneToOne
+ private CacheAccesDefinition cacheAccesDefinition;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public User getUser() {
+ return user;
+ }
+
+ public void setUser(User user) {
+ this.user = user;
+ }
+
+ public Cache getCache() {
+ return cache;
+ }
+
+ public void setCache(Cache cache) {
+ this.cache = cache;
+ }
+
+ public CacheAccesDefinition getCacheAccesDefinition() {
+ return cacheAccesDefinition;
+ }
+
+ public void setCacheAccesDefinition(CacheAccesDefinition cacheAccesDefinition) {
+ this.cacheAccesDefinition = cacheAccesDefinition;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/hhn/labsw/bugageocaching/entities/CacheAccesDefinition.java b/src/main/java/hhn/labsw/bugageocaching/entities/CacheAccesDefinition.java
new file mode 100644
index 0000000..e3dd2dc
--- /dev/null
+++ b/src/main/java/hhn/labsw/bugageocaching/entities/CacheAccesDefinition.java
@@ -0,0 +1,31 @@
+package hhn.labsw.bugageocaching.entities;
+
+
+import javax.persistence.*;
+
+@Entity
+@Table
+public class CacheAccesDefinition {
+
+ @Id
+ @GeneratedValue
+ private int id;
+
+ private String description;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+}
diff --git a/src/main/java/hhn/labsw/bugageocaching/entities/Team.java b/src/main/java/hhn/labsw/bugageocaching/entities/Team.java
new file mode 100644
index 0000000..d4dd2c2
--- /dev/null
+++ b/src/main/java/hhn/labsw/bugageocaching/entities/Team.java
@@ -0,0 +1,41 @@
+package hhn.labsw.bugageocaching.entities;
+
+import javax.persistence.*;
+import java.util.ArrayList;
+import java.util.List;
+
+@Entity
+@Table
+public class Team {
+
+ @Id
+ @GeneratedValue
+ private int id;
+
+ private String name;
+ private int rankingPoints;
+
+ 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 int getRankingPoints() {
+ return rankingPoints;
+ }
+
+ public void setRankingPoints(int rankingPoints) {
+ this.rankingPoints = rankingPoints;
+ }
+}
diff --git a/src/main/java/hhn/labsw/bugageocaching/entities/User.java b/src/main/java/hhn/labsw/bugageocaching/entities/User.java
new file mode 100644
index 0000000..eb0e75d
--- /dev/null
+++ b/src/main/java/hhn/labsw/bugageocaching/entities/User.java
@@ -0,0 +1,104 @@
+package hhn.labsw.bugageocaching.entities;
+
+import javax.persistence.*;
+
+@Entity
+@Table
+public class User {
+
+ @Id
+ @GeneratedValue
+ private int id;
+
+ private String firstname;
+ private String lastname;
+ private String username;
+ private int rankingPointsSum;
+ private String discriminator; //should be Admin or Cacher
+ private String email;
+ private String password;
+ private String salt;
+
+ @ManyToOne
+ private Team team;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getFirstname() {
+ return firstname;
+ }
+
+ public void setFirstname(String firstname) {
+ this.firstname = firstname;
+ }
+
+ public String getLastname() {
+ return lastname;
+ }
+
+ public void setLastname(String lastname) {
+ this.lastname = lastname;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public int getRankingPointsSum() {
+ return rankingPointsSum;
+ }
+
+ public void setRankingPointsSum(int rankingPointsSum) {
+ this.rankingPointsSum = rankingPointsSum;
+ }
+
+ public String getDiscriminator() {
+ return discriminator;
+ }
+
+ public void setDiscriminator(String discriminator) {
+ this.discriminator = discriminator;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getSalt() {
+ return salt;
+ }
+
+ public void setSalt(String salt) {
+ this.salt = salt;
+ }
+
+ public Team getTeam() {
+ return team;
+ }
+
+ public void setTeam(Team team) {
+ this.team = team;
+ }
+}
diff --git a/src/main/java/hhn/labsw/bugageocaching/exceptions/IllegalParameterException.java b/src/main/java/hhn/labsw/bugageocaching/exceptions/IllegalParameterException.java
new file mode 100644
index 0000000..df77bae
--- /dev/null
+++ b/src/main/java/hhn/labsw/bugageocaching/exceptions/IllegalParameterException.java
@@ -0,0 +1,65 @@
+package hhn.labsw.bugageocaching.exceptions;
+
+
+/**
+ * Thrown to indicate that a method has been passed an illegal or inappropriate argument.
+ * This matches the IllegalArgumentException, but is no RuntimeException. This forces the
+ * developer to catch it.
+ *
+ */
+public class IllegalParameterException extends Exception {
+ /**
+ * Constructs a new exception with {@code null} as its detail message.
+ * The cause is not initialized, and may subsequently be initialized by a
+ * call to {@link #initCause}.
+ */
+ public IllegalParameterException() {
+ }
+
+ /**
+ * Constructs a new exception with the specified detail message. The
+ * cause is not initialized, and may subsequently be initialized by
+ * a call to {@link #initCause}.
+ *
+ * @param message the detail message. The detail message is saved for
+ * later retrieval by the {@link #getMessage()} method.
+ */
+ public IllegalParameterException(final String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new exception with the specified detail message and
+ * cause.
Note that the detail message associated with
+ * {@code cause} is not automatically incorporated in
+ * this exception's detail message.
+ *
+ * @param message the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A null value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.4
+ */
+ public IllegalParameterException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructs a new exception with the specified cause and a detail
+ * message of (cause==null ? null : cause.toString()) (which
+ * typically contains the class and detail message of cause).
+ * This constructor is useful for exceptions that are little more than
+ * wrappers for other throwables.
+ *
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A null value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ * @since 1.4
+ */
+ public IllegalParameterException(final Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/src/main/java/hhn/labsw/bugageocaching/repositories/BearbeitetRepository.java b/src/main/java/hhn/labsw/bugageocaching/repositories/BearbeitetRepository.java
new file mode 100644
index 0000000..fb4a270
--- /dev/null
+++ b/src/main/java/hhn/labsw/bugageocaching/repositories/BearbeitetRepository.java
@@ -0,0 +1,7 @@
+package hhn.labsw.bugageocaching.repositories;
+
+import hhn.labsw.bugageocaching.entities.Bearbeitet;
+import org.springframework.data.repository.CrudRepository;
+
+public interface BearbeitetRepository extends CrudRepository {
+}
diff --git a/src/main/java/hhn/labsw/bugageocaching/repositories/CacheAccesDefinitionRepository.java b/src/main/java/hhn/labsw/bugageocaching/repositories/CacheAccesDefinitionRepository.java
new file mode 100644
index 0000000..2a01cab
--- /dev/null
+++ b/src/main/java/hhn/labsw/bugageocaching/repositories/CacheAccesDefinitionRepository.java
@@ -0,0 +1,7 @@
+package hhn.labsw.bugageocaching.repositories;
+
+import hhn.labsw.bugageocaching.entities.CacheAccesDefinition;
+import org.springframework.data.repository.CrudRepository;
+
+public interface CacheAccesDefinitionRepository extends CrudRepository {
+}
diff --git a/src/main/java/hhn/labsw/bugageocaching/repositories/TeamRepository.java b/src/main/java/hhn/labsw/bugageocaching/repositories/TeamRepository.java
new file mode 100644
index 0000000..edf1d5d
--- /dev/null
+++ b/src/main/java/hhn/labsw/bugageocaching/repositories/TeamRepository.java
@@ -0,0 +1,7 @@
+package hhn.labsw.bugageocaching.repositories;
+
+import hhn.labsw.bugageocaching.entities.Team;
+import org.springframework.data.repository.CrudRepository;
+
+public interface TeamRepository extends CrudRepository {
+}
diff --git a/src/main/java/hhn/labsw/bugageocaching/repositories/UserRepository.java b/src/main/java/hhn/labsw/bugageocaching/repositories/UserRepository.java
new file mode 100644
index 0000000..f899608
--- /dev/null
+++ b/src/main/java/hhn/labsw/bugageocaching/repositories/UserRepository.java
@@ -0,0 +1,7 @@
+package hhn.labsw.bugageocaching.repositories;
+
+import hhn.labsw.bugageocaching.entities.User;
+import org.springframework.data.repository.CrudRepository;
+
+public interface UserRepository extends CrudRepository {
+}