diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/Library-Management-Systemm.iml b/.idea/Library-Management-Systemm.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/Library-Management-Systemm.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..d24d1ce --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000..210a811 --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,12 @@ + + + + + mysql.8 + true + com.mysql.cj.jdbc.Driver + jdbc:mysql://localhost:3306/Library + $ProjectFileDir$ + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..868c3fa --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..066633d --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..712ab9d --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_apiguardian_apiguardian_api_1_1_2.xml b/.idea/libraries/Maven__org_apiguardian_apiguardian_api_1_1_2.xml new file mode 100644 index 0000000..6ac1c42 --- /dev/null +++ b/.idea/libraries/Maven__org_apiguardian_apiguardian_api_1_1_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_8_2.xml b/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_8_2.xml new file mode 100644 index 0000000..8e50783 --- /dev/null +++ b/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_8_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_engine_5_8_2.xml b/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_engine_5_8_2.xml new file mode 100644 index 0000000..fc8291b --- /dev/null +++ b/.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_engine_5_8_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_8_2.xml b/.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_8_2.xml new file mode 100644 index 0000000..181d095 --- /dev/null +++ b/.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_8_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_junit_platform_junit_platform_engine_1_8_2.xml b/.idea/libraries/Maven__org_junit_platform_junit_platform_engine_1_8_2.xml new file mode 100644 index 0000000..5f3aebe --- /dev/null +++ b/.idea/libraries/Maven__org_junit_platform_junit_platform_engine_1_8_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_openjfx_javafx_base_17_0_2.xml b/.idea/libraries/Maven__org_openjfx_javafx_base_17_0_2.xml new file mode 100644 index 0000000..49c76b8 --- /dev/null +++ b/.idea/libraries/Maven__org_openjfx_javafx_base_17_0_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_openjfx_javafx_base_win_17_0_2.xml b/.idea/libraries/Maven__org_openjfx_javafx_base_win_17_0_2.xml new file mode 100644 index 0000000..583877e --- /dev/null +++ b/.idea/libraries/Maven__org_openjfx_javafx_base_win_17_0_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_openjfx_javafx_controls_17_0_2.xml b/.idea/libraries/Maven__org_openjfx_javafx_controls_17_0_2.xml new file mode 100644 index 0000000..25b943a --- /dev/null +++ b/.idea/libraries/Maven__org_openjfx_javafx_controls_17_0_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_openjfx_javafx_controls_win_17_0_2.xml b/.idea/libraries/Maven__org_openjfx_javafx_controls_win_17_0_2.xml new file mode 100644 index 0000000..359c1a3 --- /dev/null +++ b/.idea/libraries/Maven__org_openjfx_javafx_controls_win_17_0_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_openjfx_javafx_fxml_17_0_2.xml b/.idea/libraries/Maven__org_openjfx_javafx_fxml_17_0_2.xml new file mode 100644 index 0000000..48e1695 --- /dev/null +++ b/.idea/libraries/Maven__org_openjfx_javafx_fxml_17_0_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_openjfx_javafx_fxml_win_17_0_2.xml b/.idea/libraries/Maven__org_openjfx_javafx_fxml_win_17_0_2.xml new file mode 100644 index 0000000..5762fb4 --- /dev/null +++ b/.idea/libraries/Maven__org_openjfx_javafx_fxml_win_17_0_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_openjfx_javafx_graphics_17_0_2.xml b/.idea/libraries/Maven__org_openjfx_javafx_graphics_17_0_2.xml new file mode 100644 index 0000000..77cc3b9 --- /dev/null +++ b/.idea/libraries/Maven__org_openjfx_javafx_graphics_17_0_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_openjfx_javafx_graphics_win_17_0_2.xml b/.idea/libraries/Maven__org_openjfx_javafx_graphics_win_17_0_2.xml new file mode 100644 index 0000000..157c740 --- /dev/null +++ b/.idea/libraries/Maven__org_openjfx_javafx_graphics_win_17_0_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_opentest4j_opentest4j_1_2_0.xml b/.idea/libraries/Maven__org_opentest4j_opentest4j_1_2_0.xml new file mode 100644 index 0000000..fbc1b16 --- /dev/null +++ b/.idea/libraries/Maven__org_opentest4j_opentest4j_1_2_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..adac5af --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,13 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..e43fad5 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/lib/.gitignore b/lib/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/lib/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/lib/.mvn/wrapper/maven-wrapper.jar b/lib/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..c1dd12f Binary files /dev/null and b/lib/.mvn/wrapper/maven-wrapper.jar differ diff --git a/lib/.mvn/wrapper/maven-wrapper.properties b/lib/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..40ca015 --- /dev/null +++ b/lib/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.5/apache-maven-3.8.5-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar \ No newline at end of file diff --git a/lib/mvnw b/lib/mvnw new file mode 100644 index 0000000..8a8fb22 --- /dev/null +++ b/lib/mvnw @@ -0,0 +1,316 @@ +#!/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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# 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 + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -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 "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; 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; \\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 + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# 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/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# 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. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +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 "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -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 + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/lib/mvnw.cmd b/lib/mvnw.cmd new file mode 100644 index 0000000..1d8ab01 --- /dev/null +++ b/lib/mvnw.cmd @@ -0,0 +1,188 @@ +@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 Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@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 DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_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 DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_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('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@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% diff --git a/lib/pom.xml b/lib/pom.xml new file mode 100644 index 0000000..6977c74 --- /dev/null +++ b/lib/pom.xml @@ -0,0 +1,76 @@ + + + 4.0.0 + + com.example + lib + 1.0-SNAPSHOT + lib + + + UTF-8 + 5.8.2 + + + + + org.openjfx + javafx-controls + 17.0.2 + + + org.openjfx + javafx-fxml + 17.0.2 + + + + org.junit.jupiter + junit-jupiter-api + ${junit.version} + test + + + org.junit.jupiter + junit-jupiter-engine + ${junit.version} + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.10.1 + + 12 + 12 + + + + org.openjfx + javafx-maven-plugin + 0.0.8 + + + + default-cli + + com.example.lib/com.example.lib.firstPage + app + app + app + true + true + true + + + + + + + \ No newline at end of file diff --git a/lib/src/main/java/Console/Ui.java b/lib/src/main/java/Console/Ui.java new file mode 100644 index 0000000..5a66552 --- /dev/null +++ b/lib/src/main/java/Console/Ui.java @@ -0,0 +1,113 @@ +package Console; + +import com.example.lib.*; + +import java.sql.SQLException; +import java.util.Objects; +import java.util.Scanner; +import java.util.jar.JarException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class Ui { + Library lib=new Library(); + final String regex1="\\d{11}"; + final String regex2="((?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,15})"; + + public Ui() throws SQLException { + } + + public static void main(String[] args) throws SQLException { +Ui x=new Ui(); + x.mainPage(); + } + public void mainPage() throws SQLException { + String username=""; + boolean Admin=false; + String Description=""; + + Scanner input=new Scanner(System.in); + System.out.println("lib add book <author> <description>"); + System.out.println("lib get hrs"); + System.out.println("lib rent <bookName> <author>"); + System.out.println("lib get available books"); + System.out.println("lib remove member <user-name> <phone_number>"); + System.out.println("lib return <bookName> <author>"); + System.out.println("lib remove book <title> <author>\n"); + while(true){ + if(Objects.equals(username,"")){ + System.out.println("enter your command:"); + } + else{ + System.out.println("<"+username+"> "+"enter your command:"); + } + + String command; + command=input.nextLine(); + try{ + String split[]=command.split(" "); + Pattern pattern1=Pattern.compile(regex1); + Pattern pattern2=Pattern.compile(regex2); + switch (split[0]+split[1]){ + case "signup": + Matcher match1=pattern1.matcher(split[4]); + Matcher match2=pattern2.matcher(split[4]); + if(match1.find()){ + normalUser user=new normalUser(split[2]+" "+split[3],split[4],split[5]); + lib.addMember(user.getName(),user.getNumber(),user.getId(),split[5]); + break; + } + else{ + System.out.println("please enter a valid phone number!"); + break; + } + case "signin": + if(lib.checkUserexistence(split[2]+" "+split[3],split[4])){ + username=split[2]; + System.out.println("Welcome "+split[2]+"!"); + } + else{ + System.out.println("Wrong password try again"); + } + break; + case "addbook": + Description=""; + for(int i=4;i<split.length;i++) + Description+=split[i]+" "; + Book book=new Book(split[2],split[3],Description); + lib.addBook(book); + break; + case "getavailable": + if(Objects.equals(split[2],"books")){ + lib.getbooks(username); + } + break; + case "removemember": + lib.rmUser(split[2], Admin); + break; + case "gethrs": + System.out.println(lib.getOperatingHours()); + + + } + if(Objects.equals(split[0],"return")){ + lib.returnBook(split[1],username); + + } + if(Objects.equals(split[0],"rent")){ + if(split.length==2) + lib.rentBook(split[1]); + if(split.length==4){ + lib.rentUser(split[1],split[2],Admin); + } + } + + } + catch (Exception e){ + System.out.println("please enter your command correctly"); + } + + + } + } +} diff --git a/lib/src/main/java/com/example/lib/Admin.java b/lib/src/main/java/com/example/lib/Admin.java new file mode 100644 index 0000000..0148415 --- /dev/null +++ b/lib/src/main/java/com/example/lib/Admin.java @@ -0,0 +1,18 @@ +package com.example.lib; + +public class Admin extends User{ + public String getPassword() { + return Password; + } + private String Password; + Admin(String name,String number,String Password){ + super(name,number); + super.setId(String.valueOf(rand.nextInt(99999))); + this.Password=Password; + } + Admin(String name,String number,String Password,String Id){ + super(name,number); + super.setId(Id); + this.Password=Password; + } +} diff --git a/lib/src/main/java/com/example/lib/Book.java b/lib/src/main/java/com/example/lib/Book.java new file mode 100644 index 0000000..c690f0b --- /dev/null +++ b/lib/src/main/java/com/example/lib/Book.java @@ -0,0 +1,56 @@ +package com.example.lib; + +import java.util.Random; + +public class Book { + Random rand=new Random(); + public String getTitle() { + return Title; + } + + public void setTitle(String title) { + Title = title; + } + + public String getAuthor() { + return Author; + } + + public void setAuthor(String author) { + Author = author; + } + + public String getBookId() { + return bookId; + } + + public void setBookId(String bookId) { + this.bookId = bookId; + } + + public String getDescription() { + return Description; + } + + public void setDescription(String description) { + Description = description; + } + + public boolean isAvailabilityStatus() { + return AvailabilityStatus; + } + + public Book(String title, String author, String description) { + Title = title; + Author = author; + this.bookId= String.valueOf(rand.nextInt(9999)); + Description = description; + } + + private String Title; + private String Author; + private String bookId; + private String Description; + private boolean AvailabilityStatus=true; + +} diff --git a/lib/src/main/java/com/example/lib/Library.java b/lib/src/main/java/com/example/lib/Library.java new file mode 100644 index 0000000..7b30697 --- /dev/null +++ b/lib/src/main/java/com/example/lib/Library.java @@ -0,0 +1,183 @@ +package com.example.lib; +import com.mysql.cj.protocol.Resultset; + +import java.sql.*; +import java.util.Objects; +import java.util.Scanner; + +public class Library { + private String libraryName; + private int Capacity=1000; + + public String getOperatingHours() { + return operatingHours; + } + + private String operatingHours="6Am-9Pm"; + Connection connection; + Statement statement; + + public Library() throws SQLException { + connection= DriverManager.getConnection("jdbc:mysql://localhost:3306/library"); + statement= connection.createStatement(); + + } + + public void addMember(String name,String phoneNumber,String Id,String Password) throws SQLException { + statement.executeUpdate("INSERT INTO user (Name,PhoneNumber,Id,Password) VALUES ('"+name+"','"+phoneNumber+"','"+Id+"','"+Password+"')"); + } + public boolean checkUserexistence(String name,String Password) throws SQLException { + ResultSet resultSet1=statement.executeQuery("SELECT * FROM user WHERE Password='"+Password+"'"); + boolean a=resultSet1.next(); + + resultSet1=statement.executeQuery("SELECT * FROM user WHERE Name='"+name+"'"); + boolean b=resultSet1.next(); + if(a && b){ + return true; + } + else + return false; + } + public boolean checkUserexistence2(String Id) throws SQLException { + ResultSet resultSet1=statement.executeQuery("SELECT * FROM user WHERE Id='"+Id+"'"); + if(resultSet1.next()){ + return true; + } + else + return false; + } + public void rmUser(String Id, boolean admin) throws SQLException { + if(!admin){ + System.out.println("you're not admin."); + return; + } + if(checkUserexistence2(Id)){ + statement.executeUpdate("DELETE FROM user WHERE Id='"+Id+"'"); + System.out.println("Done."); + } + else{ + System.out.println("user not found"); + return; + } + } + public void rentBook(String name) throws SQLException { + ResultSet resultSet1=statement.executeQuery("SELECT * FROM book WHERE Title='"+name+"' AND Availabilitystatus='true'"); + if(!resultSet1.next()){ + System.out.println("book is rented or not found"); + return; + } + int tedad=0; + while(resultSet1.next()){ + tedad++; + } + if(tedad>1){ + Scanner input=new Scanner(System.in); + System.out.println("please enter author name: "); + String author=input.nextLine(); + resultSet1=statement.executeQuery("SELECT * FROM book WHERE Title='"+name+"' AND Author='"+author+"'"); + if(resultSet1.next()){ + statement.executeUpdate("UPDATE book SET Availabilitystatus='false' WHERE Title='"+name+"' AND Author='"+author+"'" ); + } + } + else{ + statement.executeUpdate("UPDATE book SET Availabilitystatus='false' WHERE Title='"+name+"'" ); + System.out.println("DONE."); + } + + } + + + + public void addAdmin(String name,String PhoneNumber,String Password,String Id) throws SQLException { + statement.executeUpdate("INSERT INTO admin (Name,PhoneNumber,Password,Id) VALUES ('"+name+"','"+PhoneNumber+"','"+Password+"','"+Id+"')"); + } + + public void rmAdmin(String Id) throws SQLException { + statement.executeUpdate("DELETE FROM admin WHERE Id='"+Id+"'"); + System.out.println("Done."); + } + public void addBook(Book book) throws SQLException { + statement.executeUpdate("INSERT INTO book (Title,Author,Id,Description,Availabilitystatus) VALUES ('"+book.getTitle()+"','"+book.getAuthor()+"','"+book.getBookId()+"','"+book.getDescription()+"','"+String.valueOf(book.isAvailabilityStatus())+"')"); + } + public void getbooks(String username) throws SQLException { + if(Objects.equals(username,"")){ + System.out.println("please sign in to use this command."); + return; + } + ResultSet resultSet1=statement.executeQuery("SELECT * FROM book WHERE Availabilitystatus='true'"); + while(resultSet1.next()){ + System.out.println("Title: "+resultSet1.getString("Title")); + System.out.println("Author: "+resultSet1.getString("Author")); + System.out.println("Description: "+resultSet1.getString("Description")); + System.out.println("*****************************"); + + } + } + public void returnBook(String name, String username) throws SQLException { + if(Objects.equals(username,"")){ + System.out.println("please sign in to use this command"); + return; + } + ResultSet resultSet1=statement.executeQuery("SELECT * FROM book WHERE Title='"+name+"' AND Availabilitystatus='false'"); + if(!resultSet1.next()){ + System.out.println("book is not rented or doesnt exist"); + return; + } + int tedad=0; + while(resultSet1.next()){ + tedad++; + } + if(tedad>1){ + Scanner input=new Scanner(System.in); + System.out.println("please enter author name: "); + String author=input.nextLine(); + resultSet1=statement.executeQuery("SELECT * FROM book WHERE Title='"+name+"' AND Author='"+author+"'"); + if(resultSet1.next()){ + statement.executeUpdate("UPDATE book SET Availabilitystatus='true' WHERE Title='"+name+"' AND Author='"+author+"'" ); + } + } + else{ + statement.executeUpdate("UPDATE book SET Availabilitystatus='true' WHERE Title='"+name+"'" ); + System.out.println("DONE."); + } + + } + public User getUserbyId(String id,boolean admin) throws SQLException { + if(admin){ + ResultSet resultSet1=statement.executeQuery("SELECT * FROM admin WHERE Id='"+id+"'"); + Admin admin1=new Admin(resultSet1.getString("Name"),resultSet1.getString("PhoneNumber"),resultSet1.getString("Password"),resultSet1.getString("Id")); + return admin1; + } + else{ + ResultSet resultSet1=statement.executeQuery("SELECT * FROM user WHERE Id='"+id+"'"); + normalUser user=new normalUser(resultSet1.getString("Name"),resultSet1.getString("PhoneNumber"),resultSet1.getString("Password"),resultSet1.getString("Id")); + return user; + } + + } + public String getBookIdbyName(String name) throws SQLException { + + ResultSet resultSet1=statement.executeQuery("SELECT * FROM book WHERE Title='"+name+"'"); + String Id=resultSet1.getString("Id"); + resultSet1.close(); + return Id; + + + } + + + + public void rentUser(String bookName,String userId,boolean admin) throws SQLException { + Rent rent =new Rent(); + + statement.executeUpdate("INSERT INTO rent (Id,userId,bookId,Datee) VALUES ('"+rent.getRentId()+"','"+userId+"','"+bookName+"','"+rent.getRentDate().toString()+"')"); + try{ + statement.executeUpdate("UPDATE book SET Availabilitystatus='false' WHERE Title='"+bookName+"'" ); + + } +catch (Exception e){ + System.out.println("book not found"); +} + System.out.println("DONE."); + } +} diff --git a/lib/src/main/java/com/example/lib/Rent.java b/lib/src/main/java/com/example/lib/Rent.java new file mode 100644 index 0000000..7755664 --- /dev/null +++ b/lib/src/main/java/com/example/lib/Rent.java @@ -0,0 +1,56 @@ +package com.example.lib; + +import java.time.LocalDate; +import java.util.Random; + +public class Rent { + Random rand=new Random(); + public String getRentId() { + return rentId; + } + + public void setRentId(String rentId) { + this.rentId = rentId; + } + + public Book getBook() { + return book; + } + + public void setBook(Book book) { + this.book = book; + } + + public User getUser() { + return user; + } + + public void setUser(normalUser user) { + this.user = user; + } + + public LocalDate getRentDate() { + return rentDate; + } + + public void setRentDate(LocalDate rentDate) { + this.rentDate = rentDate; + } + + private String rentId; + private Book book; + private User user; + private LocalDate rentDate ; + public Rent(Book book,User user){ + this.rentId= String.valueOf(rand.nextInt(9999)); + this.book=book; + this.user=user; + rentDate=LocalDate.now(); + } + public Rent(){ + this.rentId= String.valueOf(rand.nextInt(9999)); + rentDate=LocalDate.now(); + + } + +} diff --git a/lib/src/main/java/com/example/lib/User.java b/lib/src/main/java/com/example/lib/User.java new file mode 100644 index 0000000..f65a4fa --- /dev/null +++ b/lib/src/main/java/com/example/lib/User.java @@ -0,0 +1,38 @@ +package com.example.lib; + +import java.util.Random; + +public class User { + Random rand=new Random(); + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getNumber() { + return number; + } + + public void setNumber(String number) { + this.number = number; + } + + public String getId() { + return Id; + } + + public void setId(String id) { + Id = id; + } + + private String name; + private String number; + private String Id; + User(String name,String Number){ + this.name=name; + this.number=number; + } +} diff --git a/lib/src/main/java/com/example/lib/firstPage.java b/lib/src/main/java/com/example/lib/firstPage.java new file mode 100644 index 0000000..db7e342 --- /dev/null +++ b/lib/src/main/java/com/example/lib/firstPage.java @@ -0,0 +1,23 @@ +package com.example.lib; + +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.scene.Scene; +import javafx.stage.Stage; + +import java.io.IOException; + +public class firstPage extends Application { + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws IOException { + FXMLLoader fxmlloader = new FXMLLoader(firstPage.class.getResource("v.fxml")); + Scene scene = new Scene(fxmlloader.load(), 500, 200); + primaryStage.setScene(scene); + primaryStage.show(); + } +} diff --git a/lib/src/main/java/com/example/lib/loginForm.java b/lib/src/main/java/com/example/lib/loginForm.java new file mode 100644 index 0000000..68d3679 --- /dev/null +++ b/lib/src/main/java/com/example/lib/loginForm.java @@ -0,0 +1,29 @@ +package com.example.lib; + +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.control.PasswordField; +import javafx.scene.control.TextField; +import javafx.scene.layout.VBox; +import javafx.stage.Stage; + +import java.io.IOException; +import java.util.Objects; + +public class loginForm extends Application { + + public static void main(String[] args) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws IOException { + FXMLLoader fxmlloader = new FXMLLoader(loginForm.class.getResource("loginForm.fxml")); + Scene scene = new Scene(fxmlloader.load(), 1080, 820); + primaryStage.setScene(scene); + primaryStage.show(); + } +} diff --git a/lib/src/main/java/com/example/lib/normalUser.java b/lib/src/main/java/com/example/lib/normalUser.java new file mode 100644 index 0000000..ddc65cc --- /dev/null +++ b/lib/src/main/java/com/example/lib/normalUser.java @@ -0,0 +1,32 @@ +package com.example.lib; + +import java.time.LocalDate; +import java.util.Random; + +public class normalUser extends User{ + private LocalDate registration; + + public String getPassword() { + return Password; + } + + public void setPassword(String password) { + Password = password; + } + + private String Password; + + + public normalUser(String name, String phoneNumber,String Password){ + super(name,phoneNumber); + super.setNumber(phoneNumber); + super.setId(String.valueOf(rand.nextInt(999999))); + this.Password=Password; + } + normalUser(String name, String phoneNumber,String Password,String Id){ + super(name,phoneNumber); + super.setNumber(phoneNumber); + super.setId(Id); + this.Password=Password; + } +} diff --git a/lib/src/main/java/controler/LoginPage.java b/lib/src/main/java/controler/LoginPage.java new file mode 100644 index 0000000..244e7b1 --- /dev/null +++ b/lib/src/main/java/controler/LoginPage.java @@ -0,0 +1,88 @@ +package controler; + +import com.example.lib.Library; +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.scene.control.Button; +import javafx.scene.control.PasswordField; +import javafx.scene.control.RadioButton; +import javafx.scene.control.TextField; +import javafx.stage.Stage; + +import java.sql.SQLException; + + +public class LoginPage { + + @FXML + private RadioButton btnAdmin; + + @FXML + private RadioButton btnNormal; + + @FXML + private Button btnSign; + + @FXML + private Button btnSignUp; + + @FXML + private PasswordField txtPassword; + + @FXML + private TextField txtUsername; + + @FXML + void pressSignUp(ActionEvent event) { + + } + + @FXML + void pressSignin(ActionEvent event) throws SQLException { + Library lib=new Library(); + Stage stage=(Stage) btnSign.getScene().getWindow(); + stage.close(); + if(btnAdmin.isSelected()){ + if( lib.checkUserexistence(txtUsername.getText(),txtPassword.getText())){ + System.out.println("khosh amadid"); + + } + else{ + System.out.println("user not found"); + } + } + else if(btnNormal.isSelected()){ + if( lib.checkUserexistence(txtUsername.getText(),txtPassword.getText())){ + System.out.println("khosh amadid"); + + } + else{ + System.out.println("user not found"); + } + } + else{ + System.out.println("yeki ra entekhab konid"); + } + } + + public void pressRadioNormal(ActionEvent event) { + if(btnNormal.isSelected()==true){ + btnAdmin.setDisable(true); + } + else{ + btnAdmin.setDisable(false); + } + + } + + public void pressRadioAdmin(ActionEvent event) { + if(btnAdmin.isSelected()==true){ + btnNormal.setDisable(true); + } + else{ + btnNormal.setDisable(false); + } + } +} + + diff --git a/lib/src/main/java/module-info.java b/lib/src/main/java/module-info.java new file mode 100644 index 0000000..06a077d --- /dev/null +++ b/lib/src/main/java/module-info.java @@ -0,0 +1,12 @@ +module com.example.lib { + requires javafx.controls; + requires javafx.fxml; + requires mysql.connector.j; + requires java.sql; + opens com.example.lib to mysql.connector.j, javafx.fxml; + opens controler to javafx.fxml; + + exports controler; + exports com.example.lib; + +} \ No newline at end of file diff --git a/lib/src/main/resources/com/example/lib/hello-view.fxml b/lib/src/main/resources/com/example/lib/hello-view.fxml new file mode 100644 index 0000000..53878af --- /dev/null +++ b/lib/src/main/resources/com/example/lib/hello-view.fxml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.geometry.Insets?> +<?import javafx.scene.control.Label?> +<?import javafx.scene.layout.VBox?> + +<?import javafx.scene.control.Button?> +<VBox alignment="CENTER" spacing="20.0" xmlns:fx="http://javafx.com/fxml" + stylesheets="@style.css" > + <padding> + <Insets bottom="20.0" left="20.0" right="20.0" top="20.0"/> + </padding> + + <Label fx:id="welcomeText"/> + <Button text="Hello!" /> +</VBox> diff --git a/lib/src/main/resources/com/example/lib/images/book.jpg b/lib/src/main/resources/com/example/lib/images/book.jpg new file mode 100644 index 0000000..db7f5f6 Binary files /dev/null and b/lib/src/main/resources/com/example/lib/images/book.jpg differ diff --git a/lib/src/main/resources/com/example/lib/images/book.png b/lib/src/main/resources/com/example/lib/images/book.png new file mode 100644 index 0000000..60defa2 Binary files /dev/null and b/lib/src/main/resources/com/example/lib/images/book.png differ diff --git a/lib/src/main/resources/com/example/lib/images/loginlogo.png b/lib/src/main/resources/com/example/lib/images/loginlogo.png new file mode 100644 index 0000000..77e81d3 Binary files /dev/null and b/lib/src/main/resources/com/example/lib/images/loginlogo.png differ diff --git a/lib/src/main/resources/com/example/lib/loginForm.fxml b/lib/src/main/resources/com/example/lib/loginForm.fxml new file mode 100644 index 0000000..d00c22a --- /dev/null +++ b/lib/src/main/resources/com/example/lib/loginForm.fxml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.control.Button?> +<?import javafx.scene.control.Label?> +<?import javafx.scene.control.PasswordField?> +<?import javafx.scene.control.RadioButton?> +<?import javafx.scene.control.TextField?> +<?import javafx.scene.image.Image?> +<?import javafx.scene.image.ImageView?> +<?import javafx.scene.layout.AnchorPane?> +<?import javafx.scene.text.Font?> + +<AnchorPane prefHeight="818.0" prefWidth="1122.0" style="-fx-background-color: #202871;" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controler.LoginPage"> + <children> + <Label layoutX="308.0" prefHeight="106.0" prefWidth="576.0" text="Library Management System" textFill="WHITE"> + <font> + <Font name="System Bold" size="36.0" /> + </font> + </Label> + <ImageView fitHeight="299.0" fitWidth="353.0" layoutX="412.0" layoutY="14.0" pickOnBounds="true" preserveRatio="true"> + <image> + <Image url="@images/book.png" /> + </image> + </ImageView> + <AnchorPane layoutX="308.0" layoutY="245.0" prefHeight="559.0" prefWidth="506.0" style="-fx-background-color: #656FC9;"> + <children> + <Label layoutX="23.0" layoutY="481.0" text="Dont have an account?" textFill="WHITE"> + <font> + <Font name="System Bold" size="19.0" /> + </font> + </Label> + <Label layoutX="195.0" layoutY="26.0" text="Sign In" textFill="WHITE"> + <font> + <Font name="System Bold Italic" size="36.0" /> + </font></Label> + <RadioButton fx:id="btnAdmin" layoutX="37.0" layoutY="79.0" mnemonicParsing="false" onAction="#pressRadioAdmin" text="Admin" textFill="WHITE"> + <font> + <Font name="System Bold Italic" size="24.0" /> + </font></RadioButton> + <RadioButton fx:id="btnNormal" layoutX="37.0" layoutY="119.0" mnemonicParsing="false" onAction="#pressRadioNormal" text="normal user" textFill="WHITE"> + <font> + <Font name="System Bold Italic" size="24.0" /> + </font></RadioButton> + <PasswordField fx:id="txtPassword" layoutX="127.0" layoutY="280.0" prefHeight="60.0" prefWidth="256.0" promptText="Password"> + <font> + <Font name="System Bold Italic" size="12.0" /> + </font></PasswordField> + <TextField fx:id="txtUsername" layoutX="125.0" layoutY="192.0" prefHeight="60.0" prefWidth="256.0" promptText="Username" /> + <Button fx:id="btnSign" layoutX="189.0" layoutY="377.0" mnemonicParsing="false" onAction="#pressSignin" prefHeight="53.0" prefWidth="149.0" text="Sign in"> + <font> + <Font name="System Bold Italic" size="22.0" /> + </font></Button> + <Button fx:id="btnSignUp" layoutX="336.0" layoutY="475.0" mnemonicParsing="false" onAction="#pressSignUp" prefHeight="28.0" prefWidth="93.0" text="Sign up"> + <font> + <Font name="System Bold Italic" size="18.0" /> + </font> + </Button> + </children></AnchorPane> + </children> +</AnchorPane> diff --git a/lib/src/main/resources/com/example/lib/style.css b/lib/src/main/resources/com/example/lib/style.css new file mode 100644 index 0000000..651027e --- /dev/null +++ b/lib/src/main/resources/com/example/lib/style.css @@ -0,0 +1,3 @@ +.Button{ + +} \ No newline at end of file