Migrate from Bucket
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
# Getting Started
|
||||
|
||||
### Reference Documentation
|
||||
For further reference, please consider the following sections:
|
||||
|
||||
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
|
||||
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/3.3.0-SNAPSHOT/maven-plugin/reference/html/)
|
||||
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/3.3.0-SNAPSHOT/maven-plugin/reference/html/#build-image)
|
||||
|
||||
@@ -0,0 +1,308 @@
|
||||
#!/bin/sh
|
||||
# ----------------------------------------------------------------------------
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Apache Maven Wrapper startup batch script, version 3.2.0
|
||||
#
|
||||
# Required ENV vars:
|
||||
# ------------------
|
||||
# JAVA_HOME - location of a JDK home dir
|
||||
#
|
||||
# Optional ENV vars
|
||||
# -----------------
|
||||
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
# e.g. to debug Maven itself, use
|
||||
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
||||
|
||||
if [ -f /usr/local/etc/mavenrc ] ; then
|
||||
. /usr/local/etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f /etc/mavenrc ] ; then
|
||||
. /etc/mavenrc
|
||||
fi
|
||||
|
||||
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;
|
||||
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
|
||||
JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME
|
||||
else
|
||||
JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
if [ -r /etc/gentoo-release ] ; then
|
||||
JAVA_HOME=$(java-config --jre-home)
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
|
||||
fi
|
||||
|
||||
# For Mingw, ensure paths are in UNIX format before anything is touched
|
||||
if $mingw ; then
|
||||
[ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] &&
|
||||
JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)"
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ]; 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"
|
||||
else
|
||||
javaExecutable="$(readlink -f "\"$javaExecutable\"")"
|
||||
fi
|
||||
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
|
||||
# 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="$(\unset -f command 2>/dev/null; \command -v java)"
|
||||
fi
|
||||
fi
|
||||
|
||||
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
|
||||
echo "Warning: JAVA_HOME environment variable is not set."
|
||||
fi
|
||||
|
||||
# traverses directory structure from process work directory to filesystem root
|
||||
# first directory with .mvn subdirectory is considered project base directory
|
||||
find_maven_basedir() {
|
||||
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
|
||||
basedir=$wdir
|
||||
break
|
||||
fi
|
||||
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
||||
if [ -d "${wdir}" ]; then
|
||||
wdir=$(cd "$wdir/.." || exit 1; pwd)
|
||||
fi
|
||||
# end of workaround
|
||||
done
|
||||
printf '%s' "$(cd "$basedir" || exit 1; pwd)"
|
||||
}
|
||||
|
||||
# concatenates all lines of a file
|
||||
concat_lines() {
|
||||
if [ -f "$1" ]; then
|
||||
# Remove \r in case we run on Windows within Git Bash
|
||||
# and check out the repository with auto CRLF management
|
||||
# enabled. Otherwise, we may read lines that are delimited with
|
||||
# \r\n and produce $'-Xarg\r' rather than -Xarg due to word
|
||||
# splitting rules.
|
||||
tr -s '\r\n' ' ' < "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
log() {
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
printf '%s\n' "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
BASE_DIR=$(find_maven_basedir "$(dirname "$0")")
|
||||
if [ -z "$BASE_DIR" ]; then
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
|
||||
log "$MAVEN_PROJECTBASEDIR"
|
||||
|
||||
##########################################################################################
|
||||
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||
##########################################################################################
|
||||
wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar"
|
||||
if [ -r "$wrapperJarPath" ]; then
|
||||
log "Found $wrapperJarPath"
|
||||
else
|
||||
log "Couldn't find $wrapperJarPath, downloading it ..."
|
||||
|
||||
if [ -n "$MVNW_REPOURL" ]; then
|
||||
wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
else
|
||||
wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
fi
|
||||
while IFS="=" read -r key value; do
|
||||
# Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' )
|
||||
safeValue=$(echo "$value" | tr -d '\r')
|
||||
case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;;
|
||||
esac
|
||||
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
|
||||
log "Downloading from: $wrapperUrl"
|
||||
|
||||
if $cygwin; then
|
||||
wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
|
||||
fi
|
||||
|
||||
if command -v wget > /dev/null; then
|
||||
log "Found wget ... using wget"
|
||||
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet"
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||
else
|
||||
wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||
fi
|
||||
elif command -v curl > /dev/null; then
|
||||
log "Found curl ... using curl"
|
||||
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent"
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
|
||||
else
|
||||
curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
|
||||
fi
|
||||
else
|
||||
log "Falling back to using Java to download"
|
||||
javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
||||
javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class"
|
||||
# For Cygwin, switch paths to Windows format before running javac
|
||||
if $cygwin; then
|
||||
javaSource=$(cygpath --path --windows "$javaSource")
|
||||
javaClass=$(cygpath --path --windows "$javaClass")
|
||||
fi
|
||||
if [ -e "$javaSource" ]; then
|
||||
if [ ! -e "$javaClass" ]; then
|
||||
log " - Compiling MavenWrapperDownloader.java ..."
|
||||
("$JAVA_HOME/bin/javac" "$javaSource")
|
||||
fi
|
||||
if [ -e "$javaClass" ]; then
|
||||
log " - Running MavenWrapperDownloader.java ..."
|
||||
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
##########################################################################################
|
||||
# End of extension
|
||||
##########################################################################################
|
||||
|
||||
# If specified, validate the SHA-256 sum of the Maven wrapper jar file
|
||||
wrapperSha256Sum=""
|
||||
while IFS="=" read -r key value; do
|
||||
case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;;
|
||||
esac
|
||||
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
|
||||
if [ -n "$wrapperSha256Sum" ]; then
|
||||
wrapperSha256Result=false
|
||||
if command -v sha256sum > /dev/null; then
|
||||
if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then
|
||||
wrapperSha256Result=true
|
||||
fi
|
||||
elif command -v shasum > /dev/null; then
|
||||
if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then
|
||||
wrapperSha256Result=true
|
||||
fi
|
||||
else
|
||||
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available."
|
||||
echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties."
|
||||
exit 1
|
||||
fi
|
||||
if [ $wrapperSha256Result = false ]; then
|
||||
echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2
|
||||
echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2
|
||||
echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
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 "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
|
||||
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
||||
MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
|
||||
fi
|
||||
|
||||
# Provide a "standardized" way to retrieve the CLI args that will
|
||||
# work with both Windows and non-Windows executions.
|
||||
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*"
|
||||
export MAVEN_CMD_LINE_ARGS
|
||||
|
||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
# shellcheck disable=SC2086 # safe args
|
||||
exec "$JAVACMD" \
|
||||
$MAVEN_OPTS \
|
||||
$MAVEN_DEBUG_OPTS \
|
||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
||||
@@ -0,0 +1,205 @@
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||
@REM or more contributor license agreements. See the NOTICE file
|
||||
@REM distributed with this work for additional information
|
||||
@REM regarding copyright ownership. The ASF licenses this file
|
||||
@REM to you under the Apache License, Version 2.0 (the
|
||||
@REM "License"); you may not use this file except in compliance
|
||||
@REM with the License. You may obtain a copy of the License at
|
||||
@REM
|
||||
@REM https://www.apache.org/licenses/LICENSE-2.0
|
||||
@REM
|
||||
@REM Unless required by applicable law or agreed to in writing,
|
||||
@REM software distributed under the License is distributed on an
|
||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@REM KIND, either express or implied. See the License for the
|
||||
@REM specific language governing permissions and limitations
|
||||
@REM under the License.
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Apache Maven Wrapper startup batch script, version 3.2.0
|
||||
@REM
|
||||
@REM Required ENV vars:
|
||||
@REM JAVA_HOME - location of a JDK home dir
|
||||
@REM
|
||||
@REM Optional ENV vars
|
||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
|
||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
@REM e.g. to debug Maven itself, use
|
||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
||||
@echo off
|
||||
@REM set title of command window
|
||||
title %0
|
||||
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
|
||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||
|
||||
@REM set %HOME% to equivalent of $HOME
|
||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||
|
||||
@REM Execute a user defined script before this one
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
|
||||
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
|
||||
:skipRcPre
|
||||
|
||||
@setlocal
|
||||
|
||||
set ERROR_CODE=0
|
||||
|
||||
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
||||
@setlocal
|
||||
|
||||
@REM ==== START VALIDATION ====
|
||||
if not "%JAVA_HOME%" == "" goto OkJHome
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME not found in your environment. >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
:OkJHome
|
||||
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
||||
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
@REM ==== END VALIDATION ====
|
||||
|
||||
:init
|
||||
|
||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
||||
@REM Fallback to current working directory if not found.
|
||||
|
||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
||||
|
||||
set EXEC_DIR=%CD%
|
||||
set WDIR=%EXEC_DIR%
|
||||
:findBaseDir
|
||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
||||
cd ..
|
||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
||||
set WDIR=%CD%
|
||||
goto findBaseDir
|
||||
|
||||
:baseDirFound
|
||||
set MAVEN_PROJECTBASEDIR=%WDIR%
|
||||
cd "%EXEC_DIR%"
|
||||
goto endDetectBaseDir
|
||||
|
||||
:baseDirNotFound
|
||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
||||
cd "%EXEC_DIR%"
|
||||
|
||||
:endDetectBaseDir
|
||||
|
||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
||||
|
||||
@setlocal EnableExtensions EnableDelayedExpansion
|
||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
||||
|
||||
:endReadAdditionalConfig
|
||||
|
||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
||||
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
|
||||
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||
IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
|
||||
)
|
||||
|
||||
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||
if exist %WRAPPER_JAR% (
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Found %WRAPPER_JAR%
|
||||
)
|
||||
) else (
|
||||
if not "%MVNW_REPOURL%" == "" (
|
||||
SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
)
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||
echo Downloading from: %WRAPPER_URL%
|
||||
)
|
||||
|
||||
powershell -Command "&{"^
|
||||
"$webclient = new-object System.Net.WebClient;"^
|
||||
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
||||
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
||||
"}"^
|
||||
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
|
||||
"}"
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Finished downloading %WRAPPER_JAR%
|
||||
)
|
||||
)
|
||||
@REM End of extension
|
||||
|
||||
@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file
|
||||
SET WRAPPER_SHA_256_SUM=""
|
||||
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||
IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
|
||||
)
|
||||
IF NOT %WRAPPER_SHA_256_SUM%=="" (
|
||||
powershell -Command "&{"^
|
||||
"$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
|
||||
"If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
|
||||
" Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
|
||||
" Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
|
||||
" Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
|
||||
" exit 1;"^
|
||||
"}"^
|
||||
"}"
|
||||
if ERRORLEVEL 1 goto error
|
||||
)
|
||||
|
||||
@REM Provide a "standardized" way to retrieve the CLI args that will
|
||||
@REM work with both Windows and non-Windows executions.
|
||||
set MAVEN_CMD_LINE_ARGS=%*
|
||||
|
||||
%MAVEN_JAVA_EXE% ^
|
||||
%JVM_CONFIG_MAVEN_PROPS% ^
|
||||
%MAVEN_OPTS% ^
|
||||
%MAVEN_DEBUG_OPTS% ^
|
||||
-classpath %WRAPPER_JAR% ^
|
||||
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
|
||||
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
||||
if ERRORLEVEL 1 goto error
|
||||
goto end
|
||||
|
||||
:error
|
||||
set ERROR_CODE=1
|
||||
|
||||
:end
|
||||
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||
|
||||
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
|
||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
|
||||
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
|
||||
:skipRcPost
|
||||
|
||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
||||
if "%MAVEN_BATCH_PAUSE%"=="on" pause
|
||||
|
||||
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
|
||||
|
||||
cmd /C exit /B %ERROR_CODE%
|
||||
@@ -0,0 +1,187 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.3.0-SNAPSHOT</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.sms.backend</groupId>
|
||||
<artifactId>smsBackend</artifactId>
|
||||
<version>0.0.1</version>
|
||||
<name>SchoolManagementSystemBackend</name>
|
||||
<description>School Management System</description>
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-core</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/io.springfox/springfox-bean-validators -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-bean-validators</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-boot-starter</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.30</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Hibernate -->
|
||||
<dependency>
|
||||
<groupId>io.hypersistence</groupId>
|
||||
<artifactId>hypersistence-utils-hibernate-63</artifactId>
|
||||
<version>3.7.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.module</groupId>
|
||||
<artifactId>jackson-module-jakarta-xmlbind-annotations</artifactId>
|
||||
<version>2.17.0</version>
|
||||
</dependency>
|
||||
<!-- Hibernate -->
|
||||
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-api</artifactId>
|
||||
<version>0.11.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-impl</artifactId>
|
||||
<version>0.11.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-jackson</artifactId>
|
||||
<version>0.11.5</version>
|
||||
</dependency>
|
||||
|
||||
<!-- -- -->
|
||||
<!-- Spring Security -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Security-->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.17.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.validation</groupId>
|
||||
<artifactId>jakarta.validation-api</artifactId>
|
||||
<version>2.0.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.vaadin.external.google</groupId>
|
||||
<artifactId>android-json</artifactId>
|
||||
<version>0.0.20131108.vaadin1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-snapshots</id>
|
||||
<name>Spring Snapshots</name>
|
||||
<url>https://repo.spring.io/snapshot</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
<pluginRepository>
|
||||
<id>spring-snapshots</id>
|
||||
<name>Spring Snapshots</name>
|
||||
<url>https://repo.spring.io/snapshot</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.sms.backend.smsBackend;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
|
||||
|
||||
@SpringBootApplication(exclude = {
|
||||
// SecurityAutoConfiguration.class
|
||||
})
|
||||
public class SmsBackendApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SmsBackendApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.sms.backend.smsBackend.config;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class
|
||||
BeanUtil implements ApplicationContextAware {
|
||||
|
||||
private static ApplicationContext context;
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
context = applicationContext;
|
||||
}
|
||||
|
||||
public static <T> T getBean(Class<T> beanClass) {
|
||||
return context.getBean(beanClass);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
//package com.sms.backend.smsBackend.config;
|
||||
//
|
||||
//import org.hibernate.jpa.HibernatePersistenceProvider;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.context.annotation.PropertySource;
|
||||
//import org.springframework.core.env.Environment;
|
||||
//import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
//import org.springframework.orm.jpa.JpaTransactionManager;
|
||||
//import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||
//import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
||||
//import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
//
|
||||
//import javax.sql.DataSource;
|
||||
//import java.util.Properties;
|
||||
//
|
||||
//@Configuration
|
||||
//@EnableJpaRepositories(basePackages = "com.sms.*", transactionManagerRef = "jpaTransactionManager")
|
||||
//@PropertySource(value = {"classpath:application.properties"})
|
||||
//@EnableTransactionManagement
|
||||
//public class JpaConfig {
|
||||
//
|
||||
// private static final String[] ENTITYMANAGER_PACKAGES_TO_SCAN = {"com.saslpay.*"};
|
||||
//
|
||||
// @Autowired
|
||||
// private Environment env;
|
||||
//
|
||||
// String dialect;
|
||||
//
|
||||
// @Bean
|
||||
// public DataSource dataSource() {
|
||||
//
|
||||
// String username = env.getProperty("spring.datasource.username");
|
||||
// String password = env.getProperty("spring.datasource.password");
|
||||
//// String driverClass = env.getProperty("spring.datasource.driver");
|
||||
// String url = env.getProperty("spring.datasource.url");
|
||||
//// dialect = env.getProperty("spring.jpa.database-platform");
|
||||
// return DataSourceBuilder.create().username(username).password(password).url(url).build();
|
||||
// //driverClassName(driverClass).build();
|
||||
// }
|
||||
//
|
||||
// @Bean
|
||||
// public JpaTransactionManager jpaTransactionManager() {
|
||||
// JpaTransactionManager transactionManager = new JpaTransactionManager();
|
||||
// transactionManager.setEntityManagerFactory(entityManagerFactory().getObject());
|
||||
// return transactionManager;
|
||||
// }
|
||||
//
|
||||
// //adding for future use
|
||||
// private HibernateJpaVendorAdapter vendorAdaptor() {
|
||||
// return new HibernateJpaVendorAdapter();
|
||||
// }
|
||||
//
|
||||
// @Bean
|
||||
// public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
|
||||
// LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
|
||||
// entityManagerFactoryBean.setJpaVendorAdapter(vendorAdaptor());
|
||||
// entityManagerFactoryBean.setDataSource(dataSource());
|
||||
// entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistenceProvider.class);
|
||||
// entityManagerFactoryBean.setPackagesToScan(ENTITYMANAGER_PACKAGES_TO_SCAN);
|
||||
// entityManagerFactoryBean.setJpaProperties(addProperties());
|
||||
// return entityManagerFactoryBean;
|
||||
// }
|
||||
//
|
||||
// private Properties addProperties() {
|
||||
// Properties properties = new Properties();
|
||||
// properties.setProperty("hibernate.hbm2ddl.auto", "none");
|
||||
// // properties.setProperty("hibernate.dialect", dialect);
|
||||
// properties.setProperty("hibernate.show_sql", "false");
|
||||
// // we can add
|
||||
// return properties;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.sms.backend.smsBackend.config;
|
||||
|
||||
import com.sms.backend.smsBackend.service.JwtService;
|
||||
import com.sms.backend.smsBackend.service.UserService;
|
||||
import io.jsonwebtoken.ExpiredJwtException;
|
||||
import io.jsonwebtoken.MalformedJwtException;
|
||||
import jakarta.servlet.FilterChain;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
// This class helps us to validate the generated jwt token
|
||||
@Component
|
||||
public class JwtAuthFilter extends OncePerRequestFilter {
|
||||
|
||||
@Autowired
|
||||
private JwtService jwtService;
|
||||
|
||||
@Autowired
|
||||
private UserService userDetailsService;
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) {
|
||||
String authHeader = request.getHeader("Authorization");
|
||||
String token = null;
|
||||
String username = null;
|
||||
if (authHeader != null && authHeader.startsWith("Bearer ")) {
|
||||
token = authHeader.substring(7);
|
||||
try {
|
||||
username = jwtService.extractUsername(token);
|
||||
} catch (ExpiredJwtException | MalformedJwtException ex) {
|
||||
System.out.println(ex.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) {
|
||||
UserDetails userDetails = userDetailsService.loadUserByUsername(username);
|
||||
if (jwtService.validateToken(token, userDetails)) {
|
||||
UsernamePasswordAuthenticationToken authToken = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
|
||||
authToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
|
||||
SecurityContextHolder.getContext().setAuthentication(authToken);
|
||||
}
|
||||
}
|
||||
try {
|
||||
filterChain.doFilter(request, response);
|
||||
} catch (ServletException | IOException | UsernameNotFoundException ex) {
|
||||
System.out.println(ex.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.sms.backend.smsBackend.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
|
||||
@Component
|
||||
public class PasswordCustomEncoder{
|
||||
|
||||
@Bean
|
||||
public PasswordEncoder bCryptPasswordEncoder() {
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
//package com.sms.backend.smsBackend.config;
|
||||
//
|
||||
//import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
//import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
//import com.sms.backend.smsBackend.dto.ResultsDTO;
|
||||
//import jakarta.persistence.AttributeConverter;
|
||||
//
|
||||
//public class ResultsAttributeConverter implements AttributeConverter<ResultsDTO, String> {
|
||||
//
|
||||
// private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
//
|
||||
// @Override
|
||||
// public String convertToDatabaseColumn(ResultsDTO resultsDTO) {
|
||||
// try {
|
||||
// return objectMapper.writeValueAsString(resultsDTO);
|
||||
// } catch (JsonProcessingException jpe) {
|
||||
//// log.warn("Cannot convert Address into JSON");
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ResultsDTO convertToEntityAttribute(String value) {
|
||||
// try {
|
||||
// return objectMapper.readValue(value, ResultsDTO.class);
|
||||
// } catch (JsonProcessingException e) {
|
||||
// //log.warn("Cannot convert JSON into Address");
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.sms.backend.smsBackend.config;
|
||||
|
||||
|
||||
import com.sms.backend.smsBackend.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.AuthenticationProvider;
|
||||
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
|
||||
import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
|
||||
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
|
||||
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
@EnableMethodSecurity
|
||||
public class SecurityConfig {
|
||||
|
||||
@Autowired
|
||||
private PasswordCustomEncoder passwordEncoder;
|
||||
|
||||
@Autowired
|
||||
private JwtAuthFilter authFilter;
|
||||
|
||||
// User Creation
|
||||
private UserDetailsService userDetailsService() {
|
||||
return new UserService();
|
||||
}
|
||||
|
||||
// Configuring HttpSecurity
|
||||
@Bean
|
||||
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
||||
|
||||
return http
|
||||
.csrf(AbstractHttpConfigurer::disable)
|
||||
.authorizeHttpRequests((authorizeHttpRequests) -> authorizeHttpRequests
|
||||
.requestMatchers(
|
||||
"/auth/generateToken",
|
||||
"/swagger-ui/**",
|
||||
"/springfox/")
|
||||
.permitAll()
|
||||
)
|
||||
.authorizeHttpRequests((authorizeHttpRequests) -> authorizeHttpRequests
|
||||
.requestMatchers(
|
||||
"/user/**",
|
||||
"student/**",
|
||||
"/results/**",
|
||||
"/session/**",
|
||||
"/calender/**",
|
||||
"/modules/**")
|
||||
.authenticated()
|
||||
)
|
||||
.sessionManagement((sessionManagement) -> sessionManagement
|
||||
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
||||
)
|
||||
.authenticationProvider(authenticationProvider())
|
||||
.addFilterBefore(authFilter, UsernamePasswordAuthenticationFilter.class)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AuthenticationProvider authenticationProvider() {
|
||||
DaoAuthenticationProvider authenticationProvider = new DaoAuthenticationProvider();
|
||||
authenticationProvider.setUserDetailsService(userDetailsService());
|
||||
authenticationProvider.setPasswordEncoder(passwordEncoder.bCryptPasswordEncoder());
|
||||
return authenticationProvider;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public AuthenticationManager authenticationManager(AuthenticationConfiguration config) throws Exception {
|
||||
return config.getAuthenticationManager();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.sms.backend.smsBackend.controller;
|
||||
|
||||
import com.sms.backend.smsBackend.dto.UserDTO;
|
||||
import com.sms.backend.smsBackend.service.JwtService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.sql.Time;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@RestController
|
||||
@RequestMapping("/auth")
|
||||
public class AuthController {
|
||||
|
||||
@Value("${jwt.validity.seconds}")
|
||||
private int JWT_TOKEN_VALIDITY;
|
||||
|
||||
private final AuthenticationManager authenticationManager;
|
||||
private final JwtService jwtService;
|
||||
|
||||
public AuthController(AuthenticationManager authenticationManager, JwtService jwtService) {
|
||||
this.authenticationManager = authenticationManager;
|
||||
this.jwtService = jwtService;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/generateToken", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Tag(name = "Authorisation")
|
||||
public String authenticateAndGetToken(@RequestBody UserDTO userDTO) {
|
||||
|
||||
JSONObject object = new JSONObject();
|
||||
LocalDate localDate;
|
||||
LocalDateTime tokenInitTime;
|
||||
localDate = LocalDate.parse(new Date(System.currentTimeMillis()).toString(), DateTimeFormatter.ISO_LOCAL_DATE);
|
||||
|
||||
try {
|
||||
Authentication authentication = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(userDTO.getUsername(), userDTO.getPassword()));
|
||||
if (authentication.isAuthenticated()) {
|
||||
|
||||
tokenInitTime = localDate.atTime(new Time((System.currentTimeMillis())).toLocalTime());
|
||||
tokenInitTime = tokenInitTime.plusSeconds(JWT_TOKEN_VALIDITY/1000);
|
||||
|
||||
String token = jwtService.generateToken(userDTO.getUsername());
|
||||
|
||||
object.put("token", token);
|
||||
object.put("status", "successful");
|
||||
object.put("validUntil", tokenInitTime.toString());
|
||||
return object.toJSONString();
|
||||
}
|
||||
} catch (AuthenticationException ex) {
|
||||
|
||||
tokenInitTime = localDate.atTime(new Time((System.currentTimeMillis())).toLocalTime());
|
||||
tokenInitTime = tokenInitTime.plusSeconds(JWT_TOKEN_VALIDITY/1000);
|
||||
|
||||
object.put("message", ex.getLocalizedMessage());
|
||||
object.put("status", "failed");
|
||||
object.put("validUntil", "1900-01-01T12:00:00");
|
||||
return object.toJSONString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.sms.backend.smsBackend.controller;
|
||||
|
||||
import com.sms.backend.smsBackend.entity.CalendarEntity;
|
||||
import com.sms.backend.smsBackend.service.CalenderService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.http.HttpStatusCode;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@RestController
|
||||
@RequestMapping("/calender")
|
||||
|
||||
public class CalenderController {
|
||||
|
||||
private final CalenderService calenderService;
|
||||
|
||||
|
||||
|
||||
public CalenderController(CalenderService calenderService) {
|
||||
this.calenderService = calenderService;
|
||||
}
|
||||
|
||||
@GetMapping(value = "/getCalender/{calenderid}")
|
||||
@Tag(name = "Calender")
|
||||
public ResponseEntity<CalendarEntity> getCalender(@PathVariable String calenderid, @RequestParam String session, @RequestParam String semester) {
|
||||
|
||||
return ResponseEntity.status(HttpStatusCode.valueOf(200))
|
||||
.body(calenderService.getCalender(calenderid, session, semester));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/addCalender")
|
||||
@Tag(name = "Calender")
|
||||
public ResponseEntity<CalendarEntity> saveCalender(@RequestBody CalendarEntity calendarEntity) {
|
||||
|
||||
calendarEntity.setUuid(UUID.randomUUID());
|
||||
|
||||
return ResponseEntity.status(HttpStatusCode.valueOf(200))
|
||||
.body(calenderService.save(calendarEntity));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/getCalender/getAll")
|
||||
@Tag(name = "Calender")
|
||||
public ResponseEntity<List<CalendarEntity>> getAllCalender() {
|
||||
|
||||
return ResponseEntity.status(HttpStatusCode.valueOf(200))
|
||||
.body(calenderService.getAll());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.sms.backend.smsBackend.controller;
|
||||
|
||||
import com.sms.backend.smsBackend.entity.ModulesEntity;
|
||||
import com.sms.backend.smsBackend.service.ModulesService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.http.HttpStatusCode;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@RestController
|
||||
@RequestMapping("/modules")
|
||||
public class ModulesController {
|
||||
|
||||
final ModulesService modulesService;
|
||||
|
||||
public ModulesController(ModulesService modulesService) {
|
||||
this.modulesService = modulesService;
|
||||
}
|
||||
|
||||
@GetMapping(value = "/listall")
|
||||
@Tag(name = "Modules")
|
||||
public List<ModulesEntity> findAll(){
|
||||
|
||||
return modulesService.findAll();
|
||||
}
|
||||
|
||||
@GetMapping(value = "/{moduleid}")
|
||||
@Tag(name = "Modules")
|
||||
public Optional<ModulesEntity> findById(@PathVariable UUID moduleid){
|
||||
|
||||
return modulesService.findById(moduleid);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/addmodule")
|
||||
@Tag(name = "Modules")
|
||||
public ResponseEntity<ModulesEntity> create(@RequestBody ModulesEntity modulesEntity){
|
||||
|
||||
modulesEntity.setModuleid(UUID.randomUUID());
|
||||
|
||||
return ResponseEntity
|
||||
.status(HttpStatusCode.valueOf(200))
|
||||
.body(modulesService.save(modulesEntity));
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/deletemodule/{moduleid}")
|
||||
@Tag(name = "Modules")
|
||||
public ModulesEntity delete(UUID moduleid){
|
||||
|
||||
return modulesService.delete(moduleid);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.sms.backend.smsBackend.controller;
|
||||
|
||||
import com.sms.backend.smsBackend.entity.ResultsEntity;
|
||||
import com.sms.backend.smsBackend.service.ResultsService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.http.HttpStatusCode;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@RestController
|
||||
@RequestMapping("/results")
|
||||
public class ResultsController {
|
||||
|
||||
final ResultsService resultsService;
|
||||
|
||||
public ResultsController(ResultsService resultsService) {
|
||||
this.resultsService = resultsService;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/getSession/{studentid}")
|
||||
@Tag(name = "Results")
|
||||
public ResponseEntity<Map<String ,List<String>>> getStudentSession(@PathVariable String studentid){
|
||||
|
||||
return ResponseEntity
|
||||
.status(HttpStatusCode.valueOf(200))
|
||||
.body(resultsService.findDistintSession(studentid));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/getSemester/{studentid}")
|
||||
@Tag(name = "Results")
|
||||
public ResponseEntity<List<String>> getStudentSemester(@PathVariable String studentid, @RequestParam String session){
|
||||
|
||||
return ResponseEntity
|
||||
.status(HttpStatusCode.valueOf(200))
|
||||
.body(resultsService.findDistinctSemester(studentid,session));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/list/{studentid}")
|
||||
@Tag(name = "Results")
|
||||
public ResponseEntity<Optional<ResultsEntity>> getStudentResult(@PathVariable String studentid, @RequestParam String session, @RequestParam String semester){
|
||||
|
||||
return ResponseEntity
|
||||
.status(HttpStatusCode.valueOf(200))
|
||||
.body(resultsService.findByStudentResult(studentid,session, semester));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/addResult")
|
||||
@Tag(name = "Results")
|
||||
public ResponseEntity<String> addResult(@RequestBody ResultsEntity resultsEntity){
|
||||
|
||||
resultsEntity.setResultsid(UUID.randomUUID());
|
||||
resultsService.save(resultsEntity);
|
||||
|
||||
return ResponseEntity
|
||||
.status(HttpStatusCode.valueOf(200))
|
||||
.body("{\"status\":\"successful\"}");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.sms.backend.smsBackend.controller;
|
||||
|
||||
import com.sms.backend.smsBackend.entity.SessionEntity;
|
||||
import com.sms.backend.smsBackend.service.SessionService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.http.HttpStatusCode;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@RestController
|
||||
@RequestMapping(value = "/session")
|
||||
public class SessionController {
|
||||
|
||||
private final SessionService sessionService;
|
||||
|
||||
public SessionController(SessionService sessionService) {
|
||||
this.sessionService = sessionService;
|
||||
}
|
||||
|
||||
@GetMapping(value = "/getSessionsList")
|
||||
@Tag(name = "Session")
|
||||
public ResponseEntity<List<String>> getSessionsList(){
|
||||
|
||||
return ResponseEntity
|
||||
.status(HttpStatusCode.valueOf(200))
|
||||
.body(sessionService.getDistinctSession());
|
||||
}
|
||||
|
||||
@GetMapping(value = "/getCurrentSession")
|
||||
@Tag(name = "Session")
|
||||
public ResponseEntity<SessionEntity> getCurrenSession(){
|
||||
|
||||
return ResponseEntity
|
||||
.status(HttpStatusCode.valueOf(200))
|
||||
.body(sessionService.getCurrentSession());
|
||||
}
|
||||
|
||||
@GetMapping(value = "/getPreviousSessions")
|
||||
@Tag(name = "Session")
|
||||
public ResponseEntity<List<SessionEntity>> getPreviousSessions(){
|
||||
|
||||
return ResponseEntity
|
||||
.status(HttpStatusCode.valueOf(200))
|
||||
.body(sessionService.getPreviousSessions());
|
||||
}
|
||||
|
||||
@PostMapping(value = "/saveSession")
|
||||
@Tag(name = "Session")
|
||||
public ResponseEntity<SessionEntity> save(@RequestBody SessionEntity sessionEntity){
|
||||
|
||||
sessionEntity.setUuid(UUID.randomUUID());
|
||||
|
||||
return ResponseEntity
|
||||
.status(HttpStatusCode.valueOf(200))
|
||||
.body(sessionService.save(sessionEntity));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/getSession")
|
||||
@Tag(name = "Session")
|
||||
public ResponseEntity<List<SessionEntity>> getSession(@RequestParam String session){
|
||||
|
||||
return ResponseEntity
|
||||
.status(HttpStatusCode.valueOf(200))
|
||||
.body(sessionService.getSession(session));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.sms.backend.smsBackend.controller;
|
||||
|
||||
import com.sms.backend.smsBackend.entity.StudentDetailEntity;
|
||||
import com.sms.backend.smsBackend.entity.UserEntity;
|
||||
import com.sms.backend.smsBackend.service.StudentDetailService;
|
||||
import com.sms.backend.smsBackend.service.UserService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@RestController
|
||||
@RequestMapping("/student")
|
||||
public class StudentDetailController {
|
||||
|
||||
final StudentDetailService studentDetailService;
|
||||
final UserService userService;
|
||||
|
||||
public StudentDetailController(StudentDetailService studentDetailService, UserService userService) {
|
||||
this.studentDetailService = studentDetailService;
|
||||
this.userService = userService;
|
||||
}
|
||||
|
||||
@GetMapping(value = "/")
|
||||
@Tag(name = "Student Detail")
|
||||
public List<StudentDetailEntity> getAllUsers() {
|
||||
|
||||
return studentDetailService.findAll();
|
||||
}
|
||||
|
||||
@GetMapping("/{studentid}")
|
||||
@Tag(name = "Student Detail")
|
||||
public Optional<StudentDetailEntity> getSudentDetail(@PathVariable String studentid) {
|
||||
|
||||
return studentDetailService.findById(studentid);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/")
|
||||
@Tag(name = "Student Detail")
|
||||
public StudentDetailEntity createStudent(@RequestBody StudentDetailEntity studentDetailEntity) {
|
||||
|
||||
Optional<UserEntity> userDetail = userService.findById(studentDetailEntity.getStudentid());
|
||||
if (userDetail.isPresent()) {
|
||||
studentDetailEntity.setSchoolemail(userDetail.get().getEmail());
|
||||
studentDetailService.save(studentDetailEntity);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return studentDetailEntity;
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{studentid}")
|
||||
@Tag(name = "Student Detail")
|
||||
public StudentDetailEntity deleteStudent(@PathVariable String studentid) {
|
||||
return studentDetailService.delete(studentid);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.sms.backend.smsBackend.controller;
|
||||
|
||||
|
||||
import com.sms.backend.smsBackend.entity.UserEntity;
|
||||
import com.sms.backend.smsBackend.service.UserService;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
public class UserController {
|
||||
|
||||
private final UserService userService;
|
||||
|
||||
public UserController(UserService userService) {
|
||||
this.userService = userService;
|
||||
}
|
||||
|
||||
@GetMapping(value = "/getAll")
|
||||
@Tag(name = "User")
|
||||
public List<UserEntity> getAllUsers()
|
||||
{
|
||||
|
||||
return userService.findAll();
|
||||
}
|
||||
|
||||
@GetMapping(value = "/{userid}")
|
||||
@Tag(name = "User")
|
||||
public Optional<UserEntity> getUser(@PathVariable String userid) {
|
||||
return userService.findById(userid);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/addUser")
|
||||
@Tag(name = "User")
|
||||
public UserEntity createUser(@RequestBody UserEntity userEntity) {
|
||||
|
||||
userService.save(userEntity);
|
||||
return null;
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/deleteUser/{userid}")
|
||||
@Tag(name = "User")
|
||||
public UserEntity deleteUser(@PathVariable String userid){
|
||||
|
||||
return userService.delete(userid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.sms.backend.smsBackend.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@RestController
|
||||
@RequestMapping(value = "/swagger-ui")
|
||||
@Tag(name = "Welcome")
|
||||
public class WelcomeController {
|
||||
|
||||
//
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.sms.backend.smsBackend.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.sql.Time;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
public class CalendarDetails {
|
||||
|
||||
private String event;
|
||||
private Date startdate;
|
||||
private Date enddate;
|
||||
private Time starttime;
|
||||
private Time endtime;
|
||||
private Boolean allday;
|
||||
|
||||
// private String occurence;
|
||||
private String frequency;
|
||||
private String interval;
|
||||
private String dayofweek;
|
||||
//
|
||||
|
||||
private String note;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.sms.backend.smsBackend.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CourseDTO {
|
||||
|
||||
private String courseofstudy;
|
||||
private String coursetype;
|
||||
private String coursequalification;
|
||||
private String coursemode;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.sms.backend.smsBackend.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GuardianDTO {
|
||||
|
||||
private String guardianname;
|
||||
private String guardianrelationship;
|
||||
private String guardiancontact;
|
||||
private String guardianaddress;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.sms.backend.smsBackend.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MedicalDTO {
|
||||
|
||||
private String weight;
|
||||
private String height;
|
||||
private String genotype;
|
||||
private String bloodgroup;
|
||||
private String medicalcondition;
|
||||
private String allergies;
|
||||
private Boolean dnr;
|
||||
private String emergencycontactname;
|
||||
private String emergencycontactnumber;
|
||||
private String emergencycontractrelationship;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.sms.backend.smsBackend.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ModuleCodesDTO {
|
||||
private String modulecode;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.sms.backend.smsBackend.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ModuleDTO {
|
||||
|
||||
private String instructor;
|
||||
private String role;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.sms.backend.smsBackend.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ModuledetailDTO {
|
||||
|
||||
private String modulecode;
|
||||
private String modulename;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.sms.backend.smsBackend.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class NextOfKinDTO {
|
||||
|
||||
private String nextofkinname;
|
||||
private String nextofkinrelationship;
|
||||
private String nextofkincontact;
|
||||
private String nextofkinaddress;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.sms.backend.smsBackend.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ResultsDTO {
|
||||
|
||||
private String module;
|
||||
private double score;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.sms.backend.smsBackend.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class SessiondetailDTO {
|
||||
|
||||
Map<String, List<String>> session = new HashMap<>();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.sms.backend.smsBackend.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserDTO {
|
||||
|
||||
private final String username;
|
||||
private final String password;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.sms.backend.smsBackend.dto;
|
||||
|
||||
import com.sms.backend.smsBackend.entity.UserEntity;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
public class UserInfoDetails implements UserDetails {
|
||||
|
||||
private final String userId;
|
||||
private final String password;
|
||||
private final List<GrantedAuthority> authorities;
|
||||
|
||||
public UserInfoDetails(UserEntity userEntity) {
|
||||
userId = userEntity.getUserid();
|
||||
password = userEntity.getPassword();
|
||||
authorities = Arrays.stream(userEntity.getRole().split(","))
|
||||
.map(SimpleGrantedAuthority::new)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<? extends GrantedAuthority> getAuthorities() {
|
||||
return authorities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsername() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAccountNonExpired() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAccountNonLocked() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCredentialsNonExpired() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.sms.backend.smsBackend.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.sms.backend.smsBackend.dto.CalendarDetails;
|
||||
import io.hypersistence.utils.hibernate.type.json.JsonType;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "calender", schema = "public", catalog = "school_mgt_database")
|
||||
public class CalendarEntity {
|
||||
|
||||
@Id
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private UUID uuid;
|
||||
private String calenderid;
|
||||
private String session;
|
||||
private String semester;
|
||||
|
||||
// @JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
// private Timestamp timestamp;
|
||||
|
||||
@Type(JsonType.class)
|
||||
@Column(columnDefinition = "jsonb")
|
||||
private List<CalendarDetails> calenderrdetails;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.sms.backend.smsBackend.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "courses", schema = "public", catalog = "school_mgt_database")
|
||||
public class CoursesEntity {
|
||||
|
||||
@Id
|
||||
private String coursecode;
|
||||
private String coursename;
|
||||
private String department;
|
||||
private String award;
|
||||
private String coursetype;
|
||||
private String courseroute;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.sms.backend.smsBackend.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.sms.backend.smsBackend.dto.ModuleDTO;
|
||||
import io.hypersistence.utils.hibernate.type.json.JsonType;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "modules", schema = "public", catalog = "school_mgt_database")
|
||||
public class ModulesEntity {
|
||||
|
||||
@Id
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private UUID moduleid;
|
||||
private String modulecode;
|
||||
private String courseid;
|
||||
private String moduletitle;
|
||||
private Integer units;
|
||||
private String status;
|
||||
|
||||
@Type(JsonType.class)
|
||||
@Column(columnDefinition = "jsonb")
|
||||
private ModuleDTO[] moduledetails;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.sms.backend.smsBackend.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.sms.backend.smsBackend.dto.ResultsDTO;
|
||||
import io.hypersistence.utils.hibernate.type.json.JsonType;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.JdbcTypeCode;
|
||||
import org.hibernate.annotations.Type;
|
||||
import org.hibernate.type.SqlTypes;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "results", schema = "public", catalog = "school_mgt_database")
|
||||
public class ResultsEntity {
|
||||
|
||||
@Id
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private UUID resultsid;
|
||||
private String studentid;
|
||||
private String session;
|
||||
private String comments;
|
||||
private Boolean resit;
|
||||
private String semester;
|
||||
|
||||
@Type(JsonType.class)
|
||||
@Column(columnDefinition = "jsonb")
|
||||
private ResultsDTO[] scores;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.sms.backend.smsBackend.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "results_temp", schema = "public", catalog = "school_mgt_database")
|
||||
public class ResultsTempEntity {
|
||||
|
||||
@Id
|
||||
private UUID resitid;
|
||||
private String courseid;
|
||||
private String studentit;
|
||||
private String session;
|
||||
private Integer score;
|
||||
private Timestamp datetime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.sms.backend.smsBackend.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "session", schema = "public", catalog = "school_mgt_database")
|
||||
public class SessionEntity {
|
||||
|
||||
@Id
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private UUID uuid;
|
||||
private String session;
|
||||
private String semester;
|
||||
private Date startdate;
|
||||
private Date enddate;
|
||||
private String status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.sms.backend.smsBackend.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "staff_detail", schema = "public", catalog = "school_mgt_database")
|
||||
public class StaffDetailEntity {
|
||||
|
||||
@Id
|
||||
private String staffid;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.sms.backend.smsBackend.entity;
|
||||
|
||||
import com.sms.backend.smsBackend.dto.*;
|
||||
import io.hypersistence.utils.hibernate.type.json.JsonType;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import javax.validation.constraints.Email;
|
||||
import java.sql.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "student_detail", schema = "public", catalog = "school_mgt_database")
|
||||
public class StudentDetailEntity {
|
||||
|
||||
@Id
|
||||
private String studentid;
|
||||
private String title;
|
||||
private String firstname;
|
||||
private String lastname;
|
||||
private Date dateofbirth;
|
||||
private String currentyear;
|
||||
private String currentsession;
|
||||
|
||||
@Type(JsonType.class)
|
||||
@Column(columnDefinition = "jsonb")
|
||||
private CourseDTO[] coursedetails;
|
||||
|
||||
private String homeaddress;
|
||||
private String mobilenumber;
|
||||
|
||||
@Email
|
||||
private String emailaddress;
|
||||
|
||||
@Email
|
||||
private String schoolemail;
|
||||
|
||||
@Type(JsonType.class)
|
||||
@Column(columnDefinition = "jsonb")
|
||||
private NextOfKinDTO[] nextofkindetails;
|
||||
|
||||
@Type(JsonType.class)
|
||||
@Column(columnDefinition = "jsonb")
|
||||
private GuardianDTO[] guardiandetails;
|
||||
|
||||
@Type(JsonType.class)
|
||||
@Column(columnDefinition = "jsonb")
|
||||
private MedicalDTO[] medicaldetails;
|
||||
|
||||
private String gender;
|
||||
|
||||
@Type(JsonType.class)
|
||||
@Column(columnDefinition = "jsonb")
|
||||
private Map<String, ModuledetailDTO[]> moduledetails;
|
||||
|
||||
@Type(JsonType.class)
|
||||
@Column(columnDefinition = "jsonb")
|
||||
private Map<String, String[]> sessiondetails;
|
||||
|
||||
// @OneToOne(fetch = FetchType.LAZY)
|
||||
// @JoinColumn(name = "user_id", nullable = false)
|
||||
// private User user;
|
||||
|
||||
// @OneToOne(fetch = FetchType.LAZY,
|
||||
// cascade = CascadeType.ALL,
|
||||
// mappedBy = "user")
|
||||
// private UserProfile userProfile;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.sms.backend.smsBackend.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "user", schema = "public", catalog = "school_mgt_database")
|
||||
public class UserEntity {
|
||||
|
||||
@Id
|
||||
private String userid;
|
||||
private String role;
|
||||
private String email;
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String password;
|
||||
private String fullname;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.sms.backend.smsBackend.jobs;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HolidayCalender {
|
||||
|
||||
private String title;
|
||||
private String date;
|
||||
private String notes;
|
||||
private boolean bunting;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.sms.backend.smsBackend.jobs;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class HolidayCalenderApi {
|
||||
|
||||
HolidayCalender[] holidayCalender = new HolidayCalender[0];
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
public HolidayCalender[] ukHolidays() {
|
||||
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
|
||||
try {
|
||||
Request request = new Request.Builder()
|
||||
.url("https://www.gov.uk/bank-holidays.json")
|
||||
.get()
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
|
||||
if (response.isSuccessful()) {
|
||||
assert response.body() != null;
|
||||
|
||||
JSONObject jsonObject1 = new JSONObject(response.body().string());
|
||||
JSONObject jsonObject = new JSONObject(jsonObject1.get("england-and-wales").toString());
|
||||
|
||||
return mapper.readValue(jsonObject.get("events").toString(), HolidayCalender[].class);
|
||||
|
||||
} else {
|
||||
|
||||
return null;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
System.out.println(ex.getLocalizedMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.sms.backend.smsBackend.jobs;
|
||||
|
||||
import com.sms.backend.smsBackend.dto.CalendarDetails;
|
||||
import com.sms.backend.smsBackend.entity.CalendarEntity;
|
||||
import com.sms.backend.smsBackend.entity.SessionEntity;
|
||||
import com.sms.backend.smsBackend.service.CalenderService;
|
||||
import com.sms.backend.smsBackend.service.SessionService;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.sql.Time;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Configuration
|
||||
@EnableScheduling
|
||||
public class HolidayCalenderJob {
|
||||
|
||||
LocalDate localDate;
|
||||
private final CalenderService calenderService;
|
||||
private final SessionService sessionService;
|
||||
SessionEntity sessionEntity;
|
||||
|
||||
public HolidayCalenderJob(CalenderService calenderService, SessionService sessionService) {
|
||||
this.calenderService = calenderService;
|
||||
this.sessionService = sessionService;
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 */120 * * * ?")
|
||||
public void scheduleTaskUsingCronExpression() {
|
||||
|
||||
HolidayCalenderApi holidayCalenderApis = new HolidayCalenderApi();
|
||||
CalendarEntity calender = new CalendarEntity();
|
||||
List<CalendarDetails> calenderDetails = new ArrayList<>();
|
||||
|
||||
sessionEntity = sessionService.getCurrentSession();
|
||||
LocalDate startDate = sessionEntity.getStartdate().toLocalDate();
|
||||
LocalDate endDate = sessionEntity.getEnddate().toLocalDate();
|
||||
|
||||
calender.setUuid(UUID.randomUUID());
|
||||
calender.setCalenderid("HOLIDAY");
|
||||
calender.setSession(sessionEntity.getSession());
|
||||
calender.setSemester(sessionEntity.getSemester());
|
||||
|
||||
for (HolidayCalender holidayCalender : holidayCalenderApis.ukHolidays()) {
|
||||
|
||||
String[] args = holidayCalender.getDate().split("-");
|
||||
localDate = LocalDate.of(Integer.parseInt(args[0]),
|
||||
Integer.parseInt(args[1]),
|
||||
Integer.parseInt(args[2]));
|
||||
|
||||
if ((localDate.isEqual(startDate) || localDate.isAfter(startDate)) &&
|
||||
(localDate.isEqual(endDate) || localDate.isBefore(endDate))) {
|
||||
|
||||
calenderDetails.add(new CalendarDetails(
|
||||
holidayCalender.getTitle(),
|
||||
Date.valueOf(holidayCalender.getDate()),
|
||||
Date.valueOf(holidayCalender.getDate()),
|
||||
Time.valueOf("06:00:00"),
|
||||
Time.valueOf("07:00:00"),
|
||||
true,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
""));
|
||||
}
|
||||
}
|
||||
calender.setCalenderrdetails(calenderDetails);
|
||||
calenderService.save(calender);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.sms.backend.smsBackend.repository;
|
||||
|
||||
import com.sms.backend.smsBackend.entity.CalendarEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface CalenderRepository extends JpaRepository<CalendarEntity, UUID> {
|
||||
|
||||
List<CalendarEntity> findByCalenderidAndSessionAndSemester(String calenderid, String session, String semester);
|
||||
|
||||
void deleteAllByCalenderid(String calenderid);
|
||||
|
||||
@Query(value = "SELECT * from public.calender where " +
|
||||
"calenderid=:calenderid and session=:session and semester=:semester " +
|
||||
"order by timestamp desc limit 1", nativeQuery = true)
|
||||
CalendarEntity getCalender(@Param("calenderid") String calenderid,
|
||||
@Param("session") String session,
|
||||
@Param("semester") String semester);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.sms.backend.smsBackend.repository;
|
||||
|
||||
import com.sms.backend.smsBackend.entity.ModulesEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Repository
|
||||
public interface ModulesRepository extends JpaRepository<ModulesEntity, UUID> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.sms.backend.smsBackend.repository;
|
||||
|
||||
import com.sms.backend.smsBackend.entity.ResultsEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
@Repository
|
||||
public interface ResultsRepository extends JpaRepository<ResultsEntity, UUID> {
|
||||
|
||||
List<ResultsEntity> findDistinctBySessionAndStudentid(String session, String studentid);
|
||||
|
||||
Optional<ResultsEntity> findFirstByStudentidAndSessionAndSemester(String studentid, String session, String semester);
|
||||
|
||||
// List<ResultsEntity> findBySessionOrderByModuleid(String session);
|
||||
|
||||
// List<ResultsEntity> findByModuleid(String moduleid);
|
||||
|
||||
@Query(value = "select distinct session from public.results where studentid= :studentId order by session asc",nativeQuery = true)
|
||||
List<String> getStudentSession(@Param("studentId") String studentId);
|
||||
|
||||
@Query(value = "SELECT DISTINCT semester from public.results where studentid= :studentId and session= :session ", nativeQuery = true)
|
||||
List<String> getStudentSemester(@Param("studentId") String studentId, @Param("session") String session);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.sms.backend.smsBackend.repository;
|
||||
|
||||
import com.sms.backend.smsBackend.entity.SessionEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface SessionRepository extends JpaRepository<SessionEntity, UUID> {
|
||||
|
||||
@Query(value = "SELECT DISTINCT session FROM public.session ORDER BY session", nativeQuery = true)
|
||||
List<String> getAllDistinctSession();
|
||||
|
||||
@Query(value = "SELECT * FROM public.session where status='OPEN'", nativeQuery = true)
|
||||
SessionEntity getCurrentSession();
|
||||
|
||||
@Query(value = "SELECT * FROM public.session where status='CLOSE'", nativeQuery = true)
|
||||
List<SessionEntity> getPreviousSessions();
|
||||
|
||||
List<SessionEntity> findBySession(String session);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.sms.backend.smsBackend.repository;
|
||||
|
||||
import com.sms.backend.smsBackend.entity.StudentDetailEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface StudentDetailRepository extends JpaRepository<StudentDetailEntity, String> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.sms.backend.smsBackend.repository;
|
||||
|
||||
import com.sms.backend.smsBackend.entity.UserEntity;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
public interface UserRepository extends JpaRepository<UserEntity, String> {
|
||||
|
||||
List<UserEntity> findByEmail(String email);
|
||||
|
||||
List<UserEntity> findByRole(String role);
|
||||
|
||||
Optional<UserEntity> findByUserid(String userid);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.sms.backend.smsBackend.service;
|
||||
|
||||
import com.sms.backend.smsBackend.dto.CalendarDetails;
|
||||
import com.sms.backend.smsBackend.entity.CalendarEntity;
|
||||
import com.sms.backend.smsBackend.repository.CalenderRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
|
||||
@Service("CalenderService")
|
||||
@Transactional
|
||||
public class CalenderService {
|
||||
|
||||
private final CalenderRepository calenderRepository;
|
||||
|
||||
public CalenderService(CalenderRepository calenderRepository) {
|
||||
this.calenderRepository = calenderRepository;
|
||||
}
|
||||
|
||||
public CalendarEntity getCalender(String calenderid, String session, String semester) {
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
||||
CalendarEntity calendarEntity = calenderRepository.getCalender(calenderid, session, semester);
|
||||
|
||||
if (!calendarEntity.getCalenderid().equals("HOLIDAY")) {
|
||||
List<CalendarDetails> calenderDetails = calendarEntity.getCalenderrdetails();
|
||||
List<CalendarDetails> outCalenderDetails = new ArrayList<>();
|
||||
for (CalendarDetails calendarDetail : calenderDetails) {
|
||||
|
||||
String frequency = calendarDetail.getFrequency();
|
||||
int interval = Integer.parseInt(calendarDetail.getInterval());
|
||||
Date startDate = calendarDetail.getStartdate();
|
||||
Date endDate = calendarDetail.getEnddate();
|
||||
|
||||
calendar.setTime(startDate);
|
||||
while (!calendar.getTime().after(endDate)) {
|
||||
|
||||
java.sql.Date sqlDate = new java.sql.Date(calendar.getTime().getTime());
|
||||
|
||||
outCalenderDetails.add(new CalendarDetails(
|
||||
calendarDetail.getEvent(),
|
||||
sqlDate,
|
||||
sqlDate,
|
||||
calendarDetail.getStarttime(),
|
||||
calendarDetail.getEndtime(),
|
||||
calendarDetail.getAllday(),
|
||||
calendarDetail.getFrequency(),
|
||||
calendarDetail.getInterval(),
|
||||
calendarDetail.getDayofweek(),
|
||||
calendarDetail.getNote()
|
||||
));
|
||||
|
||||
switch (frequency) {
|
||||
case "WEEKLY":
|
||||
calendar.add(Calendar.WEEK_OF_YEAR, interval);
|
||||
break;
|
||||
|
||||
case "DAILY":
|
||||
calendar.add(Calendar.DATE, interval);
|
||||
break;
|
||||
|
||||
case "YEARLY":
|
||||
calendar.add(Calendar.YEAR, interval);
|
||||
break;
|
||||
|
||||
case "MONTHLY":
|
||||
calendar.add(Calendar.MONTH, interval);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
calendarEntity.setCalenderrdetails(outCalenderDetails);
|
||||
}
|
||||
return calendarEntity;
|
||||
}
|
||||
|
||||
|
||||
public CalendarEntity save(CalendarEntity calendarEntity) {
|
||||
return calenderRepository.save(calendarEntity);
|
||||
}
|
||||
|
||||
public void delete(String calenderid) {
|
||||
|
||||
calenderRepository.deleteAllByCalenderid(calenderid);
|
||||
}
|
||||
|
||||
public List<CalendarEntity> getAll() {
|
||||
return calenderRepository.findAll();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.sms.backend.smsBackend.service;
|
||||
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.SignatureAlgorithm;
|
||||
import io.jsonwebtoken.io.Decoders;
|
||||
import io.jsonwebtoken.security.Keys;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.security.Key;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Service("JwtService")
|
||||
public class JwtService {
|
||||
|
||||
@Value("${jwt.secret}")
|
||||
private String SECRET;
|
||||
|
||||
@Value("${jwt.validity.seconds}")
|
||||
private long JWT_TOKEN_VALIDITY;
|
||||
|
||||
public String generateToken(String userName) {
|
||||
Map<String, Object> claims = new HashMap<>();
|
||||
return createToken(claims, userName);
|
||||
}
|
||||
|
||||
private String createToken(Map<String, Object> claims, String userName) {
|
||||
return Jwts.builder()
|
||||
.setClaims(claims)
|
||||
.setSubject(userName)
|
||||
.setIssuedAt(new Date(System.currentTimeMillis()))
|
||||
.setExpiration(new Date(System.currentTimeMillis()+ JWT_TOKEN_VALIDITY))
|
||||
.signWith(getSignKey(), SignatureAlgorithm.HS256).compact();
|
||||
}
|
||||
|
||||
private Key getSignKey() {
|
||||
byte[] keyBytes= Decoders.BASE64.decode(SECRET);
|
||||
return Keys.hmacShaKeyFor(keyBytes);
|
||||
}
|
||||
|
||||
public String extractUsername(String token) {
|
||||
return extractClaim(token, Claims::getSubject);
|
||||
}
|
||||
|
||||
public Date extractExpiration(String token) {
|
||||
return extractClaim(token, Claims::getExpiration);
|
||||
}
|
||||
|
||||
public <T> T extractClaim(String token, Function<Claims, T> claimsResolver) {
|
||||
final Claims claims = extractAllClaims(token);
|
||||
return claimsResolver.apply(claims);
|
||||
}
|
||||
|
||||
private Claims extractAllClaims(String token) {
|
||||
return Jwts
|
||||
.parserBuilder()
|
||||
.setSigningKey(getSignKey())
|
||||
.build()
|
||||
.parseClaimsJws(token)
|
||||
.getBody();
|
||||
}
|
||||
|
||||
private Boolean isTokenExpired(String token) {
|
||||
return extractExpiration(token).before(new Date());
|
||||
}
|
||||
|
||||
public Boolean validateToken(String token, UserDetails userDetails) {
|
||||
final String username = extractUsername(token);
|
||||
return (username.equals(userDetails.getUsername()) && !isTokenExpired(token));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.sms.backend.smsBackend.service;
|
||||
|
||||
import com.sms.backend.smsBackend.entity.ModulesEntity;
|
||||
import com.sms.backend.smsBackend.repository.ModulesRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
@Service("ModulesService")
|
||||
@Transactional
|
||||
public class ModulesService {
|
||||
|
||||
final ModulesRepository modulesRepository;
|
||||
|
||||
public ModulesService(ModulesRepository modulesRepository) {
|
||||
this.modulesRepository = modulesRepository;
|
||||
}
|
||||
|
||||
|
||||
public Optional<ModulesEntity> findById(UUID moduleid){
|
||||
|
||||
return modulesRepository.findById(moduleid);
|
||||
}
|
||||
|
||||
public List<ModulesEntity> findAll(){
|
||||
|
||||
return modulesRepository.findAll();
|
||||
}
|
||||
|
||||
public ModulesEntity delete(UUID moduleid){
|
||||
|
||||
modulesRepository.deleteById(moduleid);
|
||||
return null;
|
||||
}
|
||||
|
||||
public ModulesEntity save(ModulesEntity modulesEntity){
|
||||
|
||||
modulesRepository.save(modulesEntity);
|
||||
return modulesEntity;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.sms.backend.smsBackend.service;
|
||||
|
||||
import com.sms.backend.smsBackend.entity.ResultsEntity;
|
||||
import com.sms.backend.smsBackend.repository.ResultsRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service("ResultsService")
|
||||
public class ResultsService {
|
||||
|
||||
final ResultsRepository resultsRepository;
|
||||
|
||||
public ResultsService(ResultsRepository resultsRepository) {
|
||||
this.resultsRepository = resultsRepository;
|
||||
}
|
||||
|
||||
|
||||
public List<ResultsEntity> findByStudentAndSession(String studentid, String session){
|
||||
|
||||
return resultsRepository.findDistinctBySessionAndStudentid(studentid,session);
|
||||
}
|
||||
|
||||
public Optional<ResultsEntity> findByStudentResult(String studentid, String session, String semester){
|
||||
|
||||
return resultsRepository.findFirstByStudentidAndSessionAndSemester(studentid,session,semester);
|
||||
}
|
||||
|
||||
public ResultsEntity save(ResultsEntity resultsEntity){
|
||||
|
||||
return resultsRepository.save(resultsEntity);
|
||||
}
|
||||
|
||||
public Map<String ,List<String>> findDistintSession(String studentId){
|
||||
Map<String ,List<String>> theMap = new HashMap<>();
|
||||
|
||||
List<String> sessions = resultsRepository.getStudentSession(studentId);
|
||||
for (String session : sessions) {
|
||||
List<String> semester = resultsRepository.getStudentSemester(studentId, session);
|
||||
|
||||
theMap.put(session, semester);
|
||||
}
|
||||
|
||||
return theMap;
|
||||
}
|
||||
|
||||
public List<String> findDistinctSemester(String studentId,String session){
|
||||
|
||||
return resultsRepository.getStudentSemester(studentId, session);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.sms.backend.smsBackend.service;
|
||||
|
||||
import com.sms.backend.smsBackend.entity.SessionEntity;
|
||||
import com.sms.backend.smsBackend.repository.SessionRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service("SessionService")
|
||||
public class SessionService {
|
||||
|
||||
private final SessionRepository sessionRepository;
|
||||
|
||||
|
||||
public SessionService(SessionRepository sessionRepository) {
|
||||
this.sessionRepository = sessionRepository;
|
||||
}
|
||||
|
||||
public List<String> getDistinctSession(){
|
||||
|
||||
return sessionRepository.getAllDistinctSession();
|
||||
}
|
||||
|
||||
public List<SessionEntity> getSession(String session){
|
||||
|
||||
return sessionRepository.findBySession(session);
|
||||
}
|
||||
|
||||
public SessionEntity save(SessionEntity sessionEntity){
|
||||
|
||||
return sessionRepository.save(sessionEntity);
|
||||
}
|
||||
|
||||
public SessionEntity getCurrentSession(){
|
||||
|
||||
return sessionRepository.getCurrentSession();
|
||||
}
|
||||
|
||||
public List<SessionEntity> getPreviousSessions(){
|
||||
|
||||
return sessionRepository.getPreviousSessions();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.sms.backend.smsBackend.service;
|
||||
|
||||
import com.sms.backend.smsBackend.entity.StudentDetailEntity;
|
||||
import com.sms.backend.smsBackend.repository.StudentDetailRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service("StudentDetailService")
|
||||
@Transactional
|
||||
public class StudentDetailService {
|
||||
|
||||
final StudentDetailRepository studentDetailRepository;
|
||||
|
||||
public StudentDetailService(StudentDetailRepository studentDetailRepository) {
|
||||
this.studentDetailRepository = studentDetailRepository;
|
||||
}
|
||||
|
||||
public Optional<StudentDetailEntity> findById(String studentid){
|
||||
|
||||
return studentDetailRepository.findById(studentid);
|
||||
}
|
||||
|
||||
public List<StudentDetailEntity> findAll(){
|
||||
|
||||
return studentDetailRepository.findAll();
|
||||
}
|
||||
|
||||
public StudentDetailEntity delete(String studentid){
|
||||
|
||||
studentDetailRepository.deleteById(studentid);
|
||||
return null;
|
||||
}
|
||||
|
||||
public void save(StudentDetailEntity studentDetailEntity){
|
||||
|
||||
if (!studentDetailRepository.existsById(studentDetailEntity.getStudentid())) {
|
||||
studentDetailRepository.save(studentDetailEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.sms.backend.smsBackend.service;
|
||||
|
||||
import com.sms.backend.smsBackend.config.BeanUtil;
|
||||
import com.sms.backend.smsBackend.config.PasswordCustomEncoder;
|
||||
import com.sms.backend.smsBackend.dto.UserInfoDetails;
|
||||
import com.sms.backend.smsBackend.entity.UserEntity;
|
||||
import com.sms.backend.smsBackend.repository.UserRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service("UserService")
|
||||
@Transactional
|
||||
public class UserService implements UserDetailsService {
|
||||
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Autowired
|
||||
private PasswordCustomEncoder passwordEncoder;
|
||||
|
||||
public List<UserEntity> findByEmail(String email) {
|
||||
return userRepository.findByEmail(email);
|
||||
}
|
||||
|
||||
public Optional<UserEntity> findById(String userid) {
|
||||
|
||||
return userRepository.findById(userid);
|
||||
}
|
||||
|
||||
public List<UserEntity> findAll() {
|
||||
|
||||
return userRepository.findAll();
|
||||
}
|
||||
|
||||
public void save(UserEntity userEntity) {
|
||||
|
||||
String email = "";
|
||||
switch (userEntity.getRole()) {
|
||||
|
||||
case "student":
|
||||
email = userEntity.getUserid() + "@live.school.ac.uk";
|
||||
break;
|
||||
case "staff", "admin":
|
||||
email = userEntity.getUserid() + "@school.ac.uk";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
userEntity.setEmail(email);
|
||||
userEntity.setPassword(passwordEncoder.bCryptPasswordEncoder().encode(userEntity.getPassword()));
|
||||
|
||||
if (!userRepository.existsById(userEntity.getUserid())) {
|
||||
userRepository.save(userEntity);
|
||||
}
|
||||
}
|
||||
|
||||
public UserEntity delete(String userid) {
|
||||
|
||||
userRepository.deleteById(userid);
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<UserEntity> findByRole(String role) {
|
||||
|
||||
return userRepository.findByRole(role);
|
||||
}
|
||||
|
||||
public UserDetails loadUserByUsername(String username) {
|
||||
|
||||
userRepository = BeanUtil.getBean(UserRepository.class);
|
||||
Optional<UserEntity> userDetail = userRepository.findByUserid(username);
|
||||
|
||||
return userDetail.map(UserInfoDetails::new)
|
||||
.orElseThrow(() -> new UsernameNotFoundException("USER NOT FOUND"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity-mappings xmlns="https://jakarta.ee/xml/ns/persistence/orm"
|
||||
version="3.0">
|
||||
|
||||
<entity class="com.sms.backend.smsBackend.entity.CalendarEntity">
|
||||
<table name="calender" schema="public" catalog="school_mgt_database"/>
|
||||
<attributes>
|
||||
<id name="uuid">
|
||||
<column name="uuid" precision="-1"/>
|
||||
</id>
|
||||
<basic name="event">
|
||||
<column name="event" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="eventdescription">
|
||||
<column name="eventdescription" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="startdate">
|
||||
<column name="startdate" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
<basic name="enddate">
|
||||
<column name="enddate" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
<basic name="starttime">
|
||||
<column name="starttime" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
<basic name="endtime">
|
||||
<column name="endtime" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
<basic name="allday">
|
||||
<column name="allday" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
<basic name="occurence">
|
||||
<column name="occurence" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="note">
|
||||
<column name="note" nullable="false"/>
|
||||
</basic>
|
||||
</attributes>
|
||||
</entity>
|
||||
</entity-mappings>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity-mappings xmlns="https://jakarta.ee/xml/ns/persistence/orm"
|
||||
version="3.0">
|
||||
|
||||
<entity class="com.sms.backend.smsBackend.entity.CoursesEntity">
|
||||
<table name="courses" schema="public" catalog="school_mgt_database"/>
|
||||
<attributes>
|
||||
<id name="coursecode">
|
||||
<column name="coursecode"/>
|
||||
</id>
|
||||
<basic name="coursename">
|
||||
<column name="coursename" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="department">
|
||||
<column name="department" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="award">
|
||||
<column name="award" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="coursetype">
|
||||
<column name="coursetype" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="courseroute">
|
||||
<column name="courseroute" nullable="false"/>
|
||||
</basic>
|
||||
</attributes>
|
||||
</entity>
|
||||
</entity-mappings>
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"properties": [
|
||||
{
|
||||
"name": "ip.address",
|
||||
"type": "java.lang.String",
|
||||
"description": "Description for ip.address."
|
||||
}
|
||||
] }
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity-mappings xmlns="https://jakarta.ee/xml/ns/persistence/orm"
|
||||
version="3.0">
|
||||
|
||||
<entity class="com.sms.backend.smsBackend.entity.ModulesEntity">
|
||||
<table name="modules" schema="public" catalog="school_mgt_database"/>
|
||||
<attributes>
|
||||
<id name="moduleid">
|
||||
<column name="moduleid"/>
|
||||
</id>
|
||||
<basic name="courseid">
|
||||
<column name="courseid" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="moduletitle">
|
||||
<column name="moduletitle" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="units">
|
||||
<column name="units" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
<many-to-one name="coursesByCourseid" optional="true"
|
||||
target-entity="com.sms.backend.smsBackend.entity.CoursesEntity">
|
||||
<join-column name="courseid" nullable="false" referenced-column-name="coursecode"/>
|
||||
</many-to-one>
|
||||
</attributes>
|
||||
</entity>
|
||||
</entity-mappings>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity-mappings xmlns="https://jakarta.ee/xml/ns/persistence/orm"
|
||||
version="3.0">
|
||||
|
||||
<entity class="com.sms.backend.smsBackend.entity.ResitsEntity">
|
||||
<table name="resits" schema="public" catalog="school_mgt_database"/>
|
||||
<attributes>
|
||||
<id name="resitid">
|
||||
<column name="resitid" precision="-1"/>
|
||||
</id>
|
||||
<basic name="courseid">
|
||||
<column name="courseid" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="studentit">
|
||||
<column name="studentit" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="session">
|
||||
<column name="session" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="score">
|
||||
<column name="score" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
<basic name="datetime">
|
||||
<column name="datetime" precision="-1"/>
|
||||
</basic>
|
||||
</attributes>
|
||||
</entity>
|
||||
</entity-mappings>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity-mappings xmlns="https://jakarta.ee/xml/ns/persistence/orm"
|
||||
version="3.0">
|
||||
|
||||
<entity class="com.sms.backend.smsBackend.entity.ResultsAEntity">
|
||||
<table name="resultsDTO" schema="public" catalog="school_mgt_database"/>
|
||||
<attributes>
|
||||
<basic name="scoresJsonb">
|
||||
<column name="scores_jsonb" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
</attributes>
|
||||
</entity>
|
||||
</entity-mappings>
|
||||
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity-mappings xmlns="https://jakarta.ee/xml/ns/persistence/orm"
|
||||
version="3.0">
|
||||
|
||||
<entity class="com.sms.backend.smsBackend.entity.ResultsBEntity">
|
||||
<table name="resultsDTO" schema="public" catalog="school_mgt_database"/>
|
||||
<attributes>
|
||||
<id name="resultsid">
|
||||
<column name="resultsid" precision="-1"/>
|
||||
</id>
|
||||
<basic name="studentid">
|
||||
<column name="studentid" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="moduleid">
|
||||
<column name="moduleid" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="session">
|
||||
<column name="session" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="score">
|
||||
<column name="score" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
<basic name="comments">
|
||||
<column name="comments" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="resit">
|
||||
<column name="resit" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
<basic name="semester">
|
||||
<column name="semester" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="scoresJsonb">
|
||||
<column name="scores_jsonb" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
<basic name="scoresJson">
|
||||
<column name="scores_json" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
</attributes>
|
||||
</entity>
|
||||
</entity-mappings>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity-mappings xmlns="https://jakarta.ee/xml/ns/persistence/orm"
|
||||
version="3.0">
|
||||
|
||||
</entity-mappings>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity-mappings xmlns="https://jakarta.ee/xml/ns/persistence/orm"
|
||||
version="3.0">
|
||||
|
||||
<entity class="com.sms.backend.smsBackend.entity.ResultsTempEntity">
|
||||
<table name="results_temp" schema="public" catalog="school_mgt_database"/>
|
||||
<attributes>
|
||||
<id name="resitid">
|
||||
<column name="resitid" precision="-1"/>
|
||||
</id>
|
||||
<basic name="courseid">
|
||||
<column name="courseid" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="studentit">
|
||||
<column name="studentit" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="session">
|
||||
<column name="session" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="score">
|
||||
<column name="score" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
<basic name="datetime">
|
||||
<column name="datetime" precision="-1"/>
|
||||
</basic>
|
||||
</attributes>
|
||||
</entity>
|
||||
</entity-mappings>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity-mappings xmlns="https://jakarta.ee/xml/ns/persistence/orm"
|
||||
version="3.0">
|
||||
|
||||
<entity class="com.sms.backend.smsBackend.entity.SessionEntity">
|
||||
<table name="session" schema="public" catalog="school_mgt_database"/>
|
||||
<attributes>
|
||||
<id name="uuid">
|
||||
<column name="uuid" precision="-1"/>
|
||||
</id>
|
||||
<basic name="session">
|
||||
<column name="session" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="semester">
|
||||
<column name="semester" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
<basic name="startdate">
|
||||
<column name="startdate" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
<basic name="enddate">
|
||||
<column name="enddate" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
</attributes>
|
||||
</entity>
|
||||
</entity-mappings>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity-mappings xmlns="https://jakarta.ee/xml/ns/persistence/orm"
|
||||
version="3.0">
|
||||
|
||||
<entity class="com.sms.backend.smsBackend.entity.StaffDetailEntity">
|
||||
<table name="staff_detail" schema="public" catalog="school_mgt_database"/>
|
||||
<attributes>
|
||||
<id name="staffid">
|
||||
<column name="staffid"/>
|
||||
</id>
|
||||
</attributes>
|
||||
</entity>
|
||||
</entity-mappings>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity-mappings xmlns="https://jakarta.ee/xml/ns/persistence/orm"
|
||||
version="3.0">
|
||||
|
||||
<entity class="com.sms.backend.smsBackend.entity.StudentDetailEntity">
|
||||
<table name="student_detail" schema="public" catalog="school_mgt_database"/>
|
||||
<attributes>
|
||||
<basic name="gender">
|
||||
<column name="gender" nullable="false"/>
|
||||
</basic>
|
||||
</attributes>
|
||||
</entity>
|
||||
<entity class="com.sms.backend.smsBackend.entity.ResultsEntity"/>
|
||||
</entity-mappings>
|
||||
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity-mappings xmlns="https://jakarta.ee/xml/ns/persistence/orm"
|
||||
version="3.0">
|
||||
|
||||
<entity class="com.sms.backend.smsBackend.entity.UsersEntity">
|
||||
<table name="user" schema="public" catalog="school_mgt_database"/>
|
||||
<attributes>
|
||||
<id name="userid">
|
||||
<column name="userid"/>
|
||||
</id>
|
||||
<basic name="role">
|
||||
<column name="role" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="email">
|
||||
<column name="email" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="password">
|
||||
<column name="password" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="fullname">
|
||||
<column name="fullname" nullable="false"/>
|
||||
</basic>
|
||||
</attributes>
|
||||
</entity>
|
||||
<entity class="com.sms.backend.smsBackend.entity.CalendarEntity">
|
||||
<table name="calender" schema="public" catalog="school_mgt_database"/>
|
||||
<attributes>
|
||||
<id name="uuid">
|
||||
<column name="uuid" precision="-1"/>
|
||||
</id>
|
||||
<basic name="event">
|
||||
<column name="event" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="eventdescription">
|
||||
<column name="eventdescription" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="startdate">
|
||||
<column name="startdate" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
<basic name="enddate">
|
||||
<column name="enddate" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
<basic name="starttime">
|
||||
<column name="starttime" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
<basic name="endtime">
|
||||
<column name="endtime" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
<basic name="allday">
|
||||
<column name="allday" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
<basic name="occurence">
|
||||
<column name="occurence" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="note">
|
||||
<column name="note" nullable="false"/>
|
||||
</basic>
|
||||
</attributes>
|
||||
</entity>
|
||||
<entity class="com.sms.backend.smsBackend.entity.StudentDetailEntity">
|
||||
<table name="student_detail" schema="public" catalog="school_mgt_database"/>
|
||||
<attributes>
|
||||
<basic name="gender">
|
||||
<column name="gender" nullable="false"/>
|
||||
</basic>
|
||||
</attributes>
|
||||
</entity>
|
||||
<entity class="com.sms.backend.smsBackend.entity.ResultsEntity">
|
||||
<table name="resultsDTO" schema="public" catalog="school_mgt_database"/>
|
||||
<attributes>
|
||||
<basic name="scoresJsonb">
|
||||
<column name="scores_jsonb" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
<basic name="scoresJson">
|
||||
<column name="scores_json" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
</attributes>
|
||||
</entity>
|
||||
<entity class="com.sms.backend.smsBackend.entity.ResultsAEntity">
|
||||
<table name="resultsDTO" schema="public" catalog="school_mgt_database"/>
|
||||
<attributes>
|
||||
<basic name="scoresJsonb">
|
||||
<column name="scores_jsonb" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
</attributes>
|
||||
</entity>
|
||||
<entity class="com.sms.backend.smsBackend.entity.ResultsEntity"/>
|
||||
<entity class="com.sms.backend.smsBackend.entity.ResultsEntity"/>
|
||||
<entity class="com.sms.backend.smsBackend.entity.ResultsEntity"/>
|
||||
<entity class="com.sms.backend.smsBackend.entity.ResultsEntity"/>
|
||||
<entity class="com.sms.backend.smsBackend.entity.ResultsBEntity">
|
||||
<table name="resultsDTO" schema="public" catalog="school_mgt_database"/>
|
||||
<attributes>
|
||||
<id name="resultsid">
|
||||
<column name="resultsid" precision="-1"/>
|
||||
</id>
|
||||
<basic name="studentid">
|
||||
<column name="studentid" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="moduleid">
|
||||
<column name="moduleid" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="session">
|
||||
<column name="session" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="score">
|
||||
<column name="score" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
<basic name="comments">
|
||||
<column name="comments" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="resit">
|
||||
<column name="resit" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
<basic name="semester">
|
||||
<column name="semester" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="scoresJsonb">
|
||||
<column name="scores_jsonb" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
<basic name="scoresJson">
|
||||
<column name="scores_json" nullable="false" precision="-1"/>
|
||||
</basic>
|
||||
</attributes>
|
||||
</entity>
|
||||
</entity-mappings>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity-mappings xmlns="https://jakarta.ee/xml/ns/persistence/orm"
|
||||
version="3.0">
|
||||
|
||||
<entity class="com.sms.backend.smsBackend.entity.UsersEntity">
|
||||
<table name="user" schema="public" catalog="school_mgt_database"/>
|
||||
<attributes>
|
||||
<id name="userid">
|
||||
<column name="userid"/>
|
||||
</id>
|
||||
<basic name="role">
|
||||
<column name="role" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="email">
|
||||
<column name="email" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="password">
|
||||
<column name="password" nullable="false"/>
|
||||
</basic>
|
||||
<basic name="fullname">
|
||||
<column name="fullname" nullable="false"/>
|
||||
</basic>
|
||||
</attributes>
|
||||
</entity>
|
||||
</entity-mappings>
|
||||
Binary file not shown.
Binary file not shown.
+13
@@ -0,0 +1,13 @@
|
||||
package com.sms.backend.smsBackend;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class SchoolManagementSystemBackendApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user