diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java
index a45eb6b..e76d1f3 100644
--- a/.mvn/wrapper/MavenWrapperDownloader.java
+++ b/.mvn/wrapper/MavenWrapperDownloader.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
import java.net.*;
import java.io.*;
import java.nio.channels.*;
@@ -26,7 +25,7 @@ public class MavenWrapperDownloader {
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
- + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
+ + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
@@ -55,7 +54,7 @@ public static void main(String args[]) {
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
- if (mavenWrapperPropertyFile.exists()) {
+ if(mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
@@ -66,7 +65,7 @@ public static void main(String args[]) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
- if (mavenWrapperPropertyFileInputStream != null) {
+ if(mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
@@ -77,8 +76,8 @@ public static void main(String args[]) {
System.out.println("- Downloading from: " + url);
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
- if (!outputFile.getParentFile().exists()) {
- if (!outputFile.getParentFile().mkdirs()) {
+ if(!outputFile.getParentFile().exists()) {
+ if(!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
diff --git a/PROJECT_NOTES.md b/PROJECT_NOTES.md
new file mode 100644
index 0000000..f4f8587
--- /dev/null
+++ b/PROJECT_NOTES.md
@@ -0,0 +1,17 @@
+# Getting Started
+
+### Project Documentation
+Please follow this guide to see the entire documentation for the project:
+
+* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
+* DepartmentController
+ -
+
+### Guides
+The following guides illustrate how to use some features concretely:
+
+* [Accessing data with MySQL](https://spring.io/guides/gs/accessing-data-mysql/)
+* [Accessing Relational Data using JDBC with Spring](https://spring.io/guides/gs/relational-data-access/)
+* [Managing Transactions](https://spring.io/guides/gs/managing-transactions/)
+* [Accessing Data with JPA](https://spring.io/guides/gs/accessing-data-jpa/)
+
diff --git a/mvnw b/mvnw
index 3c8a553..a16b543 100644
--- a/mvnw
+++ b/mvnw
@@ -34,135 +34,128 @@
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
-if [ -z "$MAVEN_SKIP_RC" ]; then
+if [ -z "$MAVEN_SKIP_RC" ] ; then
- if [ -f /etc/mavenrc ]; then
+ if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
- if [ -f "$HOME/.mavenrc" ]; then
+ if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
-cygwin=false
-darwin=false
+cygwin=false;
+darwin=false;
mingw=false
-case "$(uname)" in
-CYGWIN*) cygwin=true ;;
-MINGW*) mingw=true ;;
-Darwin*)
- darwin=true
- # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
- # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
- if [ -z "$JAVA_HOME" ]; then
- if [ -x "/usr/libexec/java_home" ]; then
- export JAVA_HOME="$(/usr/libexec/java_home)"
- else
- export JAVA_HOME="/Library/Java/Home"
+case "`uname`" in
+ CYGWIN*) cygwin=true ;;
+ MINGW*) mingw=true;;
+ Darwin*) darwin=true
+ # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
+ # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
+ if [ -z "$JAVA_HOME" ]; then
+ if [ -x "/usr/libexec/java_home" ]; then
+ export JAVA_HOME="`/usr/libexec/java_home`"
+ else
+ export JAVA_HOME="/Library/Java/Home"
+ fi
fi
- fi
- ;;
+ ;;
esac
-if [ -z "$JAVA_HOME" ]; then
- if [ -r /etc/gentoo-release ]; then
- JAVA_HOME=$(java-config --jre-home)
+if [ -z "$JAVA_HOME" ] ; then
+ if [ -r /etc/gentoo-release ] ; then
+ JAVA_HOME=`java-config --jre-home`
fi
fi
-if [ -z "$M2_HOME" ]; then
+if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
- while [ -h "$PRG" ]; do
- ls=$(ls -ld "$PRG")
- link=$(expr "$ls" : '.*-> \(.*\)$')
- if expr "$link" : '/.*' >/dev/null; then
+ while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
- PRG="$(dirname "$PRG")/$link"
+ PRG="`dirname "$PRG"`/$link"
fi
done
- saveddir=$(pwd)
+ saveddir=`pwd`
- M2_HOME=$(dirname "$PRG")/..
+ M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
- M2_HOME=$(cd "$M2_HOME" && pwd)
+ M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
-if $cygwin; then
+if $cygwin ; then
[ -n "$M2_HOME" ] &&
- M2_HOME=$(cygpath --unix "$M2_HOME")
+ M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
- JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
- CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
+ CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
-if $mingw; then
+if $mingw ; then
[ -n "$M2_HOME" ] &&
- M2_HOME="$( (
- cd "$M2_HOME"
- pwd
- ))"
+ M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
- JAVA_HOME="$( (
- cd "$JAVA_HOME"
- pwd
- ))"
+ JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
fi
if [ -z "$JAVA_HOME" ]; then
- javaExecutable="$(which javac)"
- if [ -n "$javaExecutable" ] && ! [ "$(expr \"$javaExecutable\" : '\([^ ]*\)')" = "no" ]; then
+ javaExecutable="`which javac`"
+ if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
- readLink=$(which readlink)
- if [ ! $(expr "$readLink" : '\([^ ]*\)') = "no" ]; then
- if $darwin; then
- javaHome="$(dirname \"$javaExecutable\")"
- javaExecutable="$(cd \"$javaHome\" && pwd -P)/javac"
+ readLink=`which readlink`
+ if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
+ if $darwin ; then
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
- javaExecutable="$(readlink -f \"$javaExecutable\")"
+ javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
- javaHome="$(dirname \"$javaExecutable\")"
- javaHome=$(expr "$javaHome" : '\(.*\)/bin')
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
-if [ -z "$JAVACMD" ]; then
- if [ -n "$JAVA_HOME" ]; then
- if [ -x "$JAVA_HOME/jre/sh/java" ]; then
+if [ -z "$JAVACMD" ] ; then
+ if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
- JAVACMD="$(which java)"
+ JAVACMD="`which java`"
fi
fi
-if [ ! -x "$JAVACMD" ]; then
+if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
-if [ -z "$JAVA_HOME" ]; then
+if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
@@ -172,24 +165,22 @@ CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
- if [ -z "$1" ]; then
+ if [ -z "$1" ]
+ then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
- while [ "$wdir" != '/' ]; do
- if [ -d "$wdir"/.mvn ]; then
+ while [ "$wdir" != '/' ] ; do
+ if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
- wdir=$(
- cd "$wdir/.."
- pwd
- )
+ wdir=`cd "$wdir/.."; pwd`
fi
# end of workaround
done
@@ -199,13 +190,13 @@ find_maven_basedir() {
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
- echo "$(tr -s '\n' ' ' <"$1")"
+ echo "$(tr -s '\n' ' ' < "$1")"
fi
}
-BASE_DIR=$(find_maven_basedir "$(pwd)")
+BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
- exit 1
+ exit 1;
fi
##########################################################################################
@@ -213,78 +204,75 @@ fi
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
- if [ "$MVNW_VERBOSE" = true ]; then
- echo "Found .mvn/wrapper/maven-wrapper.jar"
- fi
-else
- if [ "$MVNW_VERBOSE" = true ]; then
- echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
- fi
- if [ -n "$MVNW_REPOURL" ]; then
- jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
- else
- jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
- fi
- while IFS="=" read key value; do
- case "$key" in wrapperUrl)
- jarUrl="$value"
- break
- ;;
- esac
- done <"$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
- if [ "$MVNW_VERBOSE" = true ]; then
- echo "Downloading from: $jarUrl"
- fi
- wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
- if $cygwin; then
- wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
- fi
-
- if command -v wget >/dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
- echo "Found wget ... using wget"
+ echo "Found .mvn/wrapper/maven-wrapper.jar"
fi
- if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
- wget "$jarUrl" -O "$wrapperJarPath"
- else
- wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
- fi
- elif command -v curl >/dev/null; then
+else
if [ "$MVNW_VERBOSE" = true ]; then
- echo "Found curl ... using curl"
+ echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
fi
- if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
- curl -o "$wrapperJarPath" "$jarUrl" -f
+ if [ -n "$MVNW_REPOURL" ]; then
+ jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
else
- curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
+ jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
fi
-
- else
+ while IFS="=" read key value; do
+ case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
+ esac
+ done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
if [ "$MVNW_VERBOSE" = true ]; then
- echo "Falling back to using Java to download"
+ echo "Downloading from: $jarUrl"
fi
- javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
- # For Cygwin, switch paths to Windows format before running javac
+ wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
if $cygwin; then
- javaClass=$(cygpath --path --windows "$javaClass")
+ wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
fi
- if [ -e "$javaClass" ]; then
- if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+
+ if command -v wget > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
- echo " - Compiling MavenWrapperDownloader.java ..."
+ echo "Found wget ... using wget"
fi
- # Compiling the Java class
- ("$JAVA_HOME/bin/javac" "$javaClass")
- fi
- if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
- # Running the downloader
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+ wget "$jarUrl" -O "$wrapperJarPath"
+ else
+ wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
+ fi
+ elif command -v curl > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
- echo " - Running MavenWrapperDownloader.java ..."
+ echo "Found curl ... using curl"
+ fi
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+ curl -o "$wrapperJarPath" "$jarUrl" -f
+ else
+ curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
+ fi
+
+ else
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Falling back to using Java to download"
+ fi
+ javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
+ # For Cygwin, switch paths to Windows format before running javac
+ if $cygwin; then
+ javaClass=`cygpath --path --windows "$javaClass"`
+ fi
+ if [ -e "$javaClass" ]; then
+ if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo " - Compiling MavenWrapperDownloader.java ..."
+ fi
+ # Compiling the Java class
+ ("$JAVA_HOME/bin/javac" "$javaClass")
+ fi
+ if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+ # Running the downloader
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo " - Running MavenWrapperDownloader.java ..."
+ fi
+ ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
+ fi
fi
- ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
- fi
fi
- fi
fi
##########################################################################################
# End of extension
@@ -299,13 +287,13 @@ MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
- M2_HOME=$(cygpath --path --windows "$M2_HOME")
+ M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
- JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
- CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
- MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
+ MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
# Provide a "standardized" way to retrieve the CLI args that will
diff --git a/pom.xml b/pom.xml
index 04ef2c9..6c51ccd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,58 +1,85 @@
- 4.0.0
-
- org.springframework.boot
- spring-boot-starter-parent
- 2.3.3.RELEASE
-
-
- com.Ausy_Technologies
- demospring
- 0.0.1-SNAPSHOT
- demospring
- Demo project for Spring Boot
-
-
- 1.8
-
-
-
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
-
- org.springframework.boot
- spring-boot-starter-web
-
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.3.3.RELEASE
+
+
+ com.example
+ demo
+ 0.0.1-SNAPSHOT
+ SpringEmployee
+ Demo project for Spring Boot
+
+ 11
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
+
+ org.springframework.boot
+ spring-boot-starter-jdbc
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+
+ mysql
+ mysql-connector-java
+ runtime
+
+
+
+ com.microsoft.sqlserver
+ mssql-jdbc
+ runtime
+
+
+ mysql
+ mysql-connector-java
+ runtime
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.junit.vintage
+ junit-vintage-engine
+
+
+
- mysql
- mysql-connector-java
- runtime
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- org.junit.vintage
- junit-vintage-engine
-
-
+ com.example
+ demo
+ 0.0.1-SNAPSHOT
+
+
+ org.modelmapper
+ modelmapper
+ 2.3.0
+
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
diff --git a/src/main/java/com/ausy_technologies/demospring/Controller/UserController.java b/src/main/java/com/ausy_technologies/demospring/Controller/UserController.java
deleted file mode 100644
index 97265cb..0000000
--- a/src/main/java/com/ausy_technologies/demospring/Controller/UserController.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.ausy_technologies.demospring.Controller;
-
-import com.ausy_technologies.demospring.Model.DAO.Role;
-import com.ausy_technologies.demospring.Model.DAO.User;
-import com.ausy_technologies.demospring.Service.UserService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-@RestController
-@RequestMapping("/api/users")
-public class UserController {
-
- @Autowired
- private UserService userService;
-
-
-
- @PostMapping("/addRole")
- public Role saveRole(@RequestBody Role role) {
-
-
- Role roleAdded = this.userService.saveRole(role);
- return roleAdded;
- }
-
-
-
-
- @PostMapping("/addUser")
- public User saveUser(@RequestBody User user) {
- User userAdded = this.userService.saveUser(user);
- return userAdded;
- }
-
- @PostMapping("/addUser2/{idRole}")
- public User saveUser2(@RequestBody User user, @PathVariable int idRole)
- {
- return this.userService.saveUser2(user,idRole);
-
- }
-
- @PostMapping("/addUser3/{roleList}")
- public User saveUser3(@RequestBody User user , @PathVariable List roleList)
- {
- return this.userService.saveUser3(user,roleList);
- }
-
- @GetMapping("/findRoleBy/{id}")
- public Role findRoleById(@PathVariable int id)
- {
- return this.userService.findRoleById(id);
- }
-
- @GetMapping("/findAllRoles")
- public List findAllRoles()
- {
- return userService.findAllRoles();
- }
-
-
- @GetMapping("/allUsers")
- public List findAllUsers()
- {
- return this.userService.findAllUsers();
- }
-
- @DeleteMapping("/deleteUserById/{id}")
- public void deleteUser(@PathVariable int id)
- {
- this.userService.deleteUserById(id);
-
- }
-
-}
diff --git a/src/main/java/com/ausy_technologies/demospring/DemospringApplication.java b/src/main/java/com/ausy_technologies/demospring/DemospringApplication.java
deleted file mode 100644
index 76466f6..0000000
--- a/src/main/java/com/ausy_technologies/demospring/DemospringApplication.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.ausy_technologies.demospring;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-@SpringBootApplication
-public class DemospringApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(DemospringApplication.class, args);
- }
-
-}
diff --git a/src/main/java/com/ausy_technologies/demospring/Model/DAO/Role.java b/src/main/java/com/ausy_technologies/demospring/Model/DAO/Role.java
deleted file mode 100644
index 06af2e9..0000000
--- a/src/main/java/com/ausy_technologies/demospring/Model/DAO/Role.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.ausy_technologies.demospring.Model.DAO;
-
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-import javax.persistence.*;
-import java.util.List;
-
-@Entity
-@Table(name = "role")
-public class Role {
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id")
- private int id;
- @Column(name = "name")
- private String name;
-
- 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;
- }
-
-}
diff --git a/src/main/java/com/ausy_technologies/demospring/Model/DAO/User.java b/src/main/java/com/ausy_technologies/demospring/Model/DAO/User.java
deleted file mode 100644
index 1d57bc7..0000000
--- a/src/main/java/com/ausy_technologies/demospring/Model/DAO/User.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package com.ausy_technologies.demospring.Model.DAO;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-
-import javax.persistence.*;
-import java.time.LocalDate;
-import java.util.List;
-import java.util.Set;
-
-@Entity
-@Table(name = "user")
-public class User {
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "iduser")
- private int id;
- @Column(name = "firstName")
- private String firstName;
- @Column(name = "lastName")
- private String lastName;
- private String username;
- private String password;
- private String email;
- @Column(name = "birthday")
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy")
- private LocalDate birthday;
-
-
- @ManyToMany(fetch = FetchType.EAGER,cascade = CascadeType.ALL )
- @JoinTable(
- name = "user_role",
- joinColumns = @JoinColumn(name = "user_id"),
- inverseJoinColumns = @JoinColumn(name = "role_id"))
- private List roleList;
-
-
- @Transient
- private boolean isAdmin;
-
- 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 String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public LocalDate getBirthday() {
- return birthday;
- }
-
- public void setBirthday(LocalDate birthday) {
- this.birthday = birthday;
- }
-
-
- public List getRoleList() {
- return roleList;
- }
-
- public void setRoleList(List roleList) {
- this.roleList = roleList;
- }
-
- @Override
- public String toString() {
- return "User{" +
- "id=" + id +
- ", firstName='" + firstName + '\'' +
- ", lastName='" + lastName + '\'' +
- ", username='" + username + '\'' +
- ", password='" + password + '\'' +
- ", email='" + email + '\'' +
- ", dateTime=" + birthday +
- ", rolesSet=" + roleList +
- ", isAdmin=" + isAdmin +
- '}';
- }
-}
diff --git a/src/main/java/com/ausy_technologies/demospring/Model/DTO/UserDto.java b/src/main/java/com/ausy_technologies/demospring/Model/DTO/UserDto.java
deleted file mode 100644
index b306bf6..0000000
--- a/src/main/java/com/ausy_technologies/demospring/Model/DTO/UserDto.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.ausy_technologies.demospring.Model.DTO;
-
-
-import java.util.List;
-
-public class UserDto {
-
-
- private int id;
-
- private String username;
-
- private String email;
-
- private List roleList;
-
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
- public String getUsername() {
- return username;
- }
-
- public void setUsername(String username) {
- this.username = username;
- }
-
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public List getRoleList() {
- return roleList;
- }
-
- public void setRoleList(List roleList) {
- this.roleList = roleList;
- }
-
-
- @Override
- public String toString() {
- return "UserDto{" +
- "id=" + id +
- ", username='" + username + '\'' +
- ", email='" + email + '\'' +
- ", roleList=" + roleList +
- '}';
- }
-}
diff --git a/src/main/java/com/ausy_technologies/demospring/Repository/RoleRepository.java b/src/main/java/com/ausy_technologies/demospring/Repository/RoleRepository.java
deleted file mode 100644
index 6c6715d..0000000
--- a/src/main/java/com/ausy_technologies/demospring/Repository/RoleRepository.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.ausy_technologies.demospring.Repository;
-
-
-import com.ausy_technologies.demospring.Model.DAO.Role;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-import java.util.Optional;
-
-
-@Repository
-public interface RoleRepository extends JpaRepository {
-
- @Override
- List findAll();
-
- @Override
- Optional findById(Integer integer);
-
-
-
-
- Role findByName(String name);
-
- // Role findByUser(User user);
-
-}
diff --git a/src/main/java/com/ausy_technologies/demospring/Repository/UserRepository.java b/src/main/java/com/ausy_technologies/demospring/Repository/UserRepository.java
deleted file mode 100644
index 64d432b..0000000
--- a/src/main/java/com/ausy_technologies/demospring/Repository/UserRepository.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.ausy_technologies.demospring.Repository;
-
-
-import com.ausy_technologies.demospring.Model.DAO.User;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface UserRepository extends JpaRepository {
-
- User findById(int id);
-
- User findByUsername(String username);
-
-
-}
diff --git a/src/main/java/com/ausy_technologies/demospring/Service/UserService.java b/src/main/java/com/ausy_technologies/demospring/Service/UserService.java
deleted file mode 100644
index 7c260ee..0000000
--- a/src/main/java/com/ausy_technologies/demospring/Service/UserService.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package com.ausy_technologies.demospring.Service;
-
-import com.ausy_technologies.demospring.Model.DAO.Role;
-import com.ausy_technologies.demospring.Model.DAO.User;
-import com.ausy_technologies.demospring.Repository.RoleRepository;
-import com.ausy_technologies.demospring.Repository.UserRepository;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-@Service
-public class UserService {
-
- @Autowired
- private UserRepository userRepository;
- @Autowired
- private RoleRepository roleRepository;
-
-
- public Role saveRole(Role role) {
-
-
- return this.roleRepository.save(role);
- }
-
-
- public User saveUser(User user) {
-
-
- return this.userRepository.save(user);
- }
-
- public User saveUser2(User user ,int idRole)
- {
-
- Role role= this.roleRepository.findById(idRole).get();
-
- List roleList =new ArrayList<>();
- roleList.add(role);
-
- if(role!=null) {
-
- user.setRoleList(roleList);
- return this.userRepository.save(user);
- }
- else
- {
- throw new RuntimeException("Role not found");
- }
-
-
- }
-
-
- public User saveUser3( User user ,List roleList)
- {
- user.setRoleList(roleList);
- return this.userRepository.save(user);
-
- }
-
-
-
- public Role findRoleById(int id)
- {
- return this.roleRepository.findById(id).get();
-
- }
-
- public List findAllRoles()
- {
- return this.roleRepository.findAll();
- }
-
-
- public List findAllUsers()
- {
- return this.userRepository.findAll();
- }
-
-
- public void deleteUserById(int id)
- {
- this.userRepository.deleteById(id);
- }
-
-
-
-
-}
diff --git a/src/main/java/com/example/demo/Controller/DepartmentController.java b/src/main/java/com/example/demo/Controller/DepartmentController.java
new file mode 100644
index 0000000..66f2769
--- /dev/null
+++ b/src/main/java/com/example/demo/Controller/DepartmentController.java
@@ -0,0 +1,83 @@
+package com.example.demo.Controller;
+
+import com.example.demo.Model.DAO.Department;
+import com.example.demo.Service.DepartmentService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/api/employee")
+public class DepartmentController {
+
+ @Autowired
+ private DepartmentService departmentService;
+
+ @PostMapping("/saveDepartment")
+ public Department saveDepartment(@RequestBody Department department) {
+ Department departmentAdded = this.departmentService.saveDepartment(department);
+ return departmentAdded;
+ }
+
+ @GetMapping("/getDepartmentById/{id}")
+ public ResponseEntity findDepartmentById(@PathVariable int id) {
+ HttpHeaders httpHeaders = new HttpHeaders();
+ httpHeaders.add("Response", "getDepartmentById");
+ return ResponseEntity.status(HttpStatus.OK).headers(httpHeaders).body(departmentService.findDepartmentById(id));
+ }
+
+ @PutMapping("/updateDepartment/{id}")
+ public Department updateDepartment(@RequestBody Department department, @PathVariable int id) {
+ System.out.println("Department was updated");
+ Department updateDepartment = null;
+ try {
+ updateDepartment = this.departmentService.updateDepartment(department, id);
+
+ } catch (RuntimeException e) {
+
+
+ System.out.println(e.getMessage());
+ }
+ return this.departmentService.updateDepartment(department, id);
+ }
+
+
+ @DeleteMapping("/deleteDepartment/{id}")
+ public boolean deleteDepartment(@PathVariable int id) {
+ System.out.println("Department was deleted");
+ return this.departmentService.deleteDepartment(id);
+ }
+
+ // @GetMapping("/findAllDepartments")
+// public ResponseEntity>getAllDepartments(){
+// List departmentList = null;
+// try {
+// departmentList = departmentService.findAllDepartments();
+// }catch (RuntimeException e) {
+// RuntimeException exception;
+// }
+// HttpHeaders httpHeaders = new HttpHeaders();
+// httpHeaders.add("Response","findAllDepartments");
+// return ResponseEntity.status(HttpStatus.OK).headers(httpHeaders).body(departmentList);
+// }
+// }
+ @GetMapping("/getAllDepartment")
+ public ResponseEntity> getAllDepartment() {
+
+
+ HttpHeaders httpHeaders = new HttpHeaders();
+ httpHeaders.add("Response", "findAllDepartments");
+
+ List departmentList = departmentService.findAllDepartments();
+ if (departmentList == null)
+ return ResponseEntity.status(HttpStatus.OK).headers(httpHeaders).body(departmentList);
+
+ departmentList = departmentService.findAllDepartments();
+ return ResponseEntity.status(HttpStatus.OK).headers(httpHeaders).body(departmentList);
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/example/demo/Controller/EmployeeController.java b/src/main/java/com/example/demo/Controller/EmployeeController.java
new file mode 100644
index 0000000..ab2dd38
--- /dev/null
+++ b/src/main/java/com/example/demo/Controller/EmployeeController.java
@@ -0,0 +1,153 @@
+package com.example.demo.Controller;
+
+import com.example.demo.Mapper.EmployeeMapper;
+import com.example.demo.Model.DAO.Employee;
+import com.example.demo.Model.DTO.EmployeeDTO;
+import com.example.demo.Service.EmployeeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+
+@RestController
+@RequestMapping("/api/employee")
+public class EmployeeController {
+
+ @Autowired
+ private EmployeeService employeeService;
+ @Autowired
+ private EmployeeMapper employeeMapper;
+
+ @PostMapping("/saveEmployee")
+ public Employee saveEmployee(@RequestBody Employee employee) {
+ Employee employeeAdded = null;
+ try {
+ employeeAdded = this.employeeService.saveEmployee(employee);
+ } catch (RuntimeException e) {
+ System.out.println(e.getMessage());
+ }
+ return employeeAdded;
+ }
+
+
+ // public ResponseEntityuserUpdate(@RequestBody Employee employee, @PathVariable int id){
+// Employee employeeToUpdate = employeeService.findEmployeeById(id);
+//
+// employeeToUpdate.setId(employee.getId());
+// HttpHeaders httpHeaders = new HttpHeaders();
+// httpHeaders.add("Responded","Update successfully");
+// return ResponseEntity.status(HttpStatus.OK).headers(httpHeaders).body(employeeToUpdate);
+//
+// }
+ @PutMapping("/updateEmployee/{id}")
+ public Employee updateEmployee(@RequestBody Employee employee, @PathVariable int id) {
+ System.out.println("Employee was updated");
+ Employee updateEmployee = null;
+ try {
+ updateEmployee = this.employeeService.updateEmployee(employee, id);
+ } catch (RuntimeException e) {
+
+
+ System.out.println(e.getMessage());
+ }
+ return this.employeeService.updateEmployee(employee, id);
+ }
+
+
+ @DeleteMapping("/deleteEmployee/{id}")
+ public Employee deleteEmployee(@PathVariable int id) {
+ System.out.println("Employee was deleted");
+ Employee deleteEmployee = null;
+ try {
+ deleteEmployee = this.employeeService.deleteEmployee(id);
+ } catch (RuntimeException e) {
+
+
+ System.out.println(e.getMessage());
+ }
+ return deleteEmployee;
+ }
+
+
+ @GetMapping("/getAllEmployee")
+ public ResponseEntity> getAllEmployee() {
+ HttpHeaders httpHeaders = new HttpHeaders();
+ httpHeaders.add("Response", "Successfully");
+ List employeeList = employeeService.findAllEmployee();
+ if (employeeList == null)
+ return ResponseEntity.status(HttpStatus.OK).headers(httpHeaders).body(employeeList);
+// try {
+// employeeList = employeeService.findAllEmployee();
+// }catch (RuntimeException e) {
+// RuntimeException exception;
+// }
+
+
+ employeeList = employeeService.findAllEmployee();
+ return ResponseEntity.status(HttpStatus.OK).headers(httpHeaders).body(employeeList);
+
+
+ }
+
+ // @GetMapping("/getByDepartment/{id}")
+// public List getEmployeeByDepartmentId(int departmentId){
+// return this.employeeService.getEmployeeByDepartmentId(departmentId);
+// }
+ @GetMapping("/getEmployeeById/{id}")
+ public ResponseEntity findEmployeeById(@PathVariable int id) {
+ HttpHeaders httpHeaders = new HttpHeaders();
+ httpHeaders.add("Response", "Successfully");
+ return ResponseEntity.status(HttpStatus.OK).headers(httpHeaders).body(employeeService.getEmployeeById(id));
+ }
+
+
+ @GetMapping("/getEmployeeByDep/{departmentId}")
+ public ResponseEntity> getEmployeeByDepartmentId(@PathVariable int departmentId) {
+ HttpHeaders httpHeaders = new HttpHeaders();
+ httpHeaders.add("Response", "getEmployeeByDep");
+ return ResponseEntity.status(HttpStatus.OK).headers(httpHeaders).body(employeeService.getEmployeeByDepartmentId(departmentId));
+ }
+
+ @GetMapping("/getEmployeeByJob/{jobCategoryId}")
+ public ResponseEntity> getEmployeeByJobCategoryId(@PathVariable int jobCategoryId) {
+ HttpHeaders httpHeaders = new HttpHeaders();
+ httpHeaders.add("Response", "getEmployeeByJob");
+ return ResponseEntity.status(HttpStatus.OK).headers(httpHeaders).body(employeeService.getEmployeeByJobCategoryId(jobCategoryId));
+ }
+
+ @GetMapping("/getEmployeeByDepAndJob/{departmentId}/{jobCategoryId}")
+ public ResponseEntity> getEmployeeByDepAndJob(@PathVariable int departmentId, @PathVariable int jobCategoryId) {
+ HttpHeaders httpHeaders = new HttpHeaders();
+ httpHeaders.add("Response", "getEmployeeByDepAndJob");
+ return ResponseEntity.status(HttpStatus.OK).headers(httpHeaders).body(employeeService.getEmployeeByDepAndJob(departmentId, jobCategoryId));
+ }
+
+ @GetMapping("/getEmployeeDtoById/{id}")
+ public EmployeeDTO getEmployeeDtoById(@PathVariable int id) {
+ Employee employee = this.employeeService.getEmployeeById(id);
+
+ EmployeeDTO getEmployeeDtoById = null;
+ try {
+ getEmployeeDtoById = this.employeeMapper.convertToEmployeeDTO(employee);
+ } catch (RuntimeException e) {
+
+
+ System.out.println(e.getMessage());
+ }
+ return getEmployeeDtoById;
+ }
+
+
+ @GetMapping("/getAllEmployeeDto")
+ public List getAllEmployeeDto() {
+ List employees = this.employeeService.findAllEmployee();
+ List employeeDTOS = employees.stream().map(e -> this.employeeMapper.convertToEmployeeDTO(e)).collect(Collectors.toList());
+ return employeeDTOS;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/example/demo/Controller/JobCategoryController.java b/src/main/java/com/example/demo/Controller/JobCategoryController.java
new file mode 100644
index 0000000..4d56df3
--- /dev/null
+++ b/src/main/java/com/example/demo/Controller/JobCategoryController.java
@@ -0,0 +1,84 @@
+package com.example.demo.Controller;
+
+import com.example.demo.Model.DAO.JobCategory;
+import com.example.demo.Service.JobCategoryService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+
+@RestController
+@RequestMapping("/api/employee")
+public class JobCategoryController {
+
+ @Autowired
+ private JobCategoryService jobCategoryService;
+
+ @PostMapping("/saveJobCategory")
+ public JobCategory saveJobCategory(@RequestBody JobCategory jobCategory) {
+
+ JobCategory JobCategoryAdded = this.jobCategoryService.saveJobCategory(jobCategory);
+ return JobCategoryAdded;
+ }
+
+ @GetMapping("/getJobCategoryById/{id}")
+ public ResponseEntity findJobCategoryById(@PathVariable int id) {
+ HttpHeaders httpHeaders = new HttpHeaders();
+ httpHeaders.add("Response", "getDepartmentById");
+ return ResponseEntity.status(HttpStatus.OK).headers(httpHeaders).body(jobCategoryService.findJobCategoryById(id));
+ }
+
+
+ @PutMapping("/updateJobCategory/{id}")
+ public JobCategory updateJobCategory(@RequestBody JobCategory jobCategory, @PathVariable int id) {
+ System.out.println("JobCategory was updated");
+// return this.jobCategoryService.updateJobCategory(jobCategory,id);
+ JobCategory updateJobCategory = null;
+ try {
+ updateJobCategory = this.jobCategoryService.updateJobCategory(jobCategory, id);
+ } catch (RuntimeException e) {
+
+
+ System.out.println(e.getMessage());
+ }
+ return this.jobCategoryService.updateJobCategory(jobCategory, id);
+ }
+
+
+ @DeleteMapping("/deleteJobCategory/{id}")
+ public boolean deleteJobCategory(@PathVariable int id) {
+// System.out.println("JobCategory was deleted");
+ return this.jobCategoryService.deleteJobCategory(id);
+
+ }
+
+
+ // public ResponseEntity> getAllJobCategory(){
+//
+// HttpHeaders httpHeaders = new HttpHeaders();
+// httpHeaders.add("Response","findAllDepartments");
+//
+// List jobCategoryList;
+//
+// jobCategoryList = jobCategoryService.findAllJobCategory();
+// return ResponseEntity.status(HttpStatus.OK).headers(httpHeaders).body(jobCategoryList);
+// }
+ @GetMapping("/getAllJobCategory")
+ public ResponseEntity> getAllJobCategory() {
+
+
+ HttpHeaders httpHeaders = new HttpHeaders();
+ httpHeaders.add("Response", "findAllJobCategory");
+
+ List jobCategoryList = jobCategoryService.findAllJobCategory();
+ if (jobCategoryList == null)
+ return ResponseEntity.status(HttpStatus.OK).headers(httpHeaders).body(jobCategoryList);
+
+ jobCategoryList = jobCategoryService.findAllJobCategory();
+ return ResponseEntity.status(HttpStatus.OK).headers(httpHeaders).body(jobCategoryList);
+ }
+}
diff --git a/src/main/java/com/example/demo/Error/ApiError.java b/src/main/java/com/example/demo/Error/ApiError.java
new file mode 100644
index 0000000..cfe0365
--- /dev/null
+++ b/src/main/java/com/example/demo/Error/ApiError.java
@@ -0,0 +1,56 @@
+package com.example.demo.Error;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.http.HttpStatus;
+
+import java.time.LocalDateTime;
+
+public class ApiError { // clasa ApiError
+ private HttpStatus httpStatus;
+
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy HH:mm:ss")
+ private LocalDateTime timestamp;
+ private String message;
+
+ private ApiError() {
+ this.timestamp = LocalDateTime.now();
+ }
+
+ public ApiError(HttpStatus httpStatus) {
+ this(); // call private constructor!
+ this.httpStatus = httpStatus;
+ }
+
+ public ApiError(HttpStatus httpStatus, String message, Throwable exception) {
+ this();
+ this.httpStatus = httpStatus;
+ this.message = message;
+ }
+
+ public HttpStatus getHttpStatus() {
+ return httpStatus;
+ }
+
+ public void setHttpStatus(HttpStatus httpStatus) {
+ this.httpStatus = httpStatus;
+ }
+
+ public LocalDateTime getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(LocalDateTime timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+
+}
+
diff --git a/src/main/java/com/example/demo/Error/RestExceptionHandler.java b/src/main/java/com/example/demo/Error/RestExceptionHandler.java
new file mode 100644
index 0000000..ac9f375
--- /dev/null
+++ b/src/main/java/com/example/demo/Error/RestExceptionHandler.java
@@ -0,0 +1,51 @@
+package com.example.demo.Error;
+
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.HttpRequestMethodNotSupportedException;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.context.request.WebRequest;
+import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
+
+import javax.servlet.http.HttpServletResponse;
+
+@ControllerAdvice // Adnotarea @ControllerAdvice vă permite să gestionați excepții în întreaga aplicație, nu doar la un controller individual. Vă puteți gândi la acesta ca la un interceptor al excepțiilor aruncate prin metode adnotate cu @RequestMapping(GET, PUT, POST, DELETE)
+public class RestExceptionHandler extends ResponseEntityExceptionHandler {
+
+
+
+
+// @ExceptionHandler(Exception.class) // Definim un handler pentru o excepție generică
+// public ResponseEntity