├── README.md ├── _config.yml └── online-shopping ├── .DS_Store ├── .gitignore ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── mvnw ├── mvnw.cmd ├── pom.xml └── src ├── .DS_Store ├── main ├── .DS_Store ├── java │ ├── .DS_Store │ └── com │ │ ├── .DS_Store │ │ └── isolutions4u │ │ ├── .DS_Store │ │ └── onlineshopping │ │ ├── .DS_Store │ │ ├── OnlineShoppingApplication.java │ │ ├── ServletInitializer.java │ │ ├── configurations │ │ ├── ProjectConfiguration.java │ │ ├── WebFlowConfig.java │ │ └── WebSecurityConfig.java │ │ ├── controllers │ │ ├── CartController.java │ │ ├── GlobalController.java │ │ ├── GlobalDefaultExceptionHandler.java │ │ ├── IndexController.java │ │ ├── JsonDataController.java │ │ ├── ManagementController.java │ │ └── ProductNotFoundExceptoion.java │ │ ├── handler │ │ └── RegisterHandler.java │ │ ├── model │ │ ├── Address.java │ │ ├── Cart.java │ │ ├── CartLine.java │ │ ├── Category.java │ │ ├── Product.java │ │ ├── RegisterModel.java │ │ ├── User.java │ │ └── UserModel.java │ │ ├── repository │ │ ├── AddressRepository.java │ │ ├── CartLineRepository.java │ │ ├── CartRepository.java │ │ ├── CategoryRepository.java │ │ ├── ProductRepository.java │ │ └── UserRepository.java │ │ ├── service │ │ ├── AddressService.java │ │ ├── AddressServiceImpl.java │ │ ├── CartLineService.java │ │ ├── CartLineServiceImpl.java │ │ ├── CartService.java │ │ ├── CartServiceImpl.java │ │ ├── CategoryService.java │ │ ├── CategoryServiceImpl.java │ │ ├── ProductService.java │ │ ├── ProductServiceImpl.java │ │ ├── UserService.java │ │ └── UserServiceImpl.java │ │ └── validator │ │ └── ProductValidator.java ├── resources │ ├── .DS_Store │ └── application.properties └── webapp │ ├── .DS_Store │ ├── WEB-INF │ ├── .DS_Store │ └── views │ │ ├── 404.jsp │ │ ├── about.jsp │ │ ├── cart.jsp │ │ ├── contact.jsp │ │ ├── flows │ │ ├── register │ │ │ ├── signup-billing.jsp │ │ │ ├── signup-confirm.jsp │ │ │ ├── signup-flow.xml │ │ │ ├── signup-personal.jsp │ │ │ └── signup-success.jsp │ │ └── shared │ │ │ ├── flows-footer.jsp │ │ │ ├── flows-header.jsp │ │ │ └── flows-navbar.jsp │ │ ├── home.jsp │ │ ├── listProducts.jsp │ │ ├── login.jsp │ │ ├── manageProduct.jsp │ │ ├── page.jsp │ │ ├── share │ │ ├── footer.jsp │ │ ├── navbar.jsp │ │ └── sidebar.jsp │ │ └── singleProduct.jsp │ └── static │ ├── .DS_Store │ ├── css │ ├── bootstrap-readable-theme.css │ ├── bootstrap-theme.css │ ├── bootstrap-theme.css.map │ ├── bootstrap-theme.min.css │ ├── bootstrap-theme.min.css.map │ ├── bootstrap.css │ ├── bootstrap.css.map │ ├── bootstrap.min.css │ ├── bootstrap.min.css.map │ ├── dataTables.bootstrap.css │ └── myapp.css │ ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 │ ├── images │ ├── PRD3707BEDE5B.jpg │ ├── PRD5372385A25.jpg │ ├── PRD6CC820B96D.jpg │ ├── PRDABC123DEFX.jpg │ ├── PRDABCXYZDEFX.jpg │ ├── PRDCF1E6B7BE1.jpg │ ├── PRDDEF123DEFX.jpg │ ├── PRDMNO123PQRX.jpg │ ├── PRDPQR123WGTX.jpg │ ├── PRO6532CAF4A5.jpg │ ├── PRO762AF8DA76.jpg │ ├── PRO7C4403B8DB.jpg │ ├── PRO84B37BEB32.jpg │ ├── PRO8E42B8DC7C.jpg │ ├── PROBC409D9452.jpg │ ├── PROC67489CF18.jpg │ ├── PROF02EB40085.jpg │ ├── PROFAFCC5BE84.jpg │ ├── banner1.jpg │ ├── banner2.jpg │ ├── banner3.jpg │ ├── banner4.jpg │ └── pre-loader.gif │ └── js │ ├── angular.js │ ├── bootbox.min.js │ ├── bootstrap.js │ ├── bootstrap.min.js │ ├── dataTables.bootstrap.js │ ├── jquery.dataTables.js │ ├── jquery.js │ ├── jquery.validate.js │ ├── jquery.validate.min.js │ ├── myapp.js │ ├── npm.js │ └── productsController.js └── test └── java └── com └── isolutions4u └── onlineshopping ├── OnlineShoppingApplicationTests.java └── test └── CategoryTestCase.java /README.md: -------------------------------------------------------------------------------- 1 | # online-shopping 2 | 3 | [![Build Status](https://travis-ci.org/codecentric/springboot-sample-app.svg?branch=master)](http://www.pyarts.org) 4 | [![Coverage Status](https://coveralls.io/repos/github/codecentric/springboot-sample-app/badge.svg?branch=master)](http://www.pyarts.org) 5 | [![License](http://img.shields.io/:license-apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html) 6 | 7 | Minimal [Spring Boot](https://sushildangi.github.io/online-shopping/) online-shopping. 8 | 9 | This is an online shopping project using Spring Boot,Spring web-flow, Spring Rest Services and Hibernate. In this project we also used Spring Security with java and annotation configuration 10 | 11 | ## Requirements 12 | 13 | For building and running the application you need: 14 | 15 | - [JDK 1.8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) 16 | - [Maven 3](https://maven.apache.org) 17 | 18 | # Runnig this project 19 | 20 | 1. Clone this project https://github.com/sushildangi/online-shopping.git change default branch "Upgrade-spring-boot" if default branch is "master" 21 | 2. create databases schema in mysql - **online_shopping_db** 22 | 3. edit **username** and **password** in **applicaton.properties** file 23 | 4. Run Project One time using Spring boot command - **mvn spring-boot:run** or using eclipse IDE run as Java Application 24 | 5. Run this Query in mysql 25 | 26 | ```sql 27 | insert into online_shopping_db.user_detail(contact_number,email,enabled,first_name,last_name,password,role) values ('9876543210','admin@gmail.com',true,'admin','admin','$2a$10$6UVHQoHhpoYZxBB.k9r.deSLTT0RD1Yk8GdggRywGw0Snr8syRDtG','ADMIN') 28 | ``` 29 | 30 | **Password = 123456(in encoded Form)** 31 | 32 | 6. Then Again run project using boot 33 | 7. create user by signup 34 | 35 | ### Guides 36 | 37 | The https://spring.io/[spring.io] site contains several guides that show how to use Spring 38 | Boot step-by-step: 39 | 40 | - https://spring.io/guides/gs/spring-boot/ [Building an Application with Spring Boot] is a 41 | very basic guide that shows you how to create a simple application, run it and add some 42 | management services. 43 | - https://spring.io/guides/gs/actuator-service/ [Building a RESTful Web Service with Spring 44 | Boot Actuator] is a guide to creating a REST web service and also shows how the server 45 | can be configured. 46 | - https://spring.io/guides/gs/convert-jar-to-war/ [Converting a Spring Boot JAR Application 47 | to a WAR] shows you how to run applications in a web server as a WAR file. 48 | 49 | enjoy my friends 50 | 51 | ### Useful Links 52 | 53 | - Find out more about me 54 | - LinkedIn : https://www.linkedin.com/in/sushil-dangi 55 | - Facebook : https://www.facebook.com/dangi.sushil5 56 | - Instagram : https://www.instagram.com/smiley_s_d/ 57 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /online-shopping/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/.DS_Store -------------------------------------------------------------------------------- /online-shopping/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | 12 | ### IntelliJ IDEA ### 13 | .idea 14 | *.iws 15 | *.iml 16 | *.ipr 17 | 18 | ### NetBeans ### 19 | nbproject/private/ 20 | build/ 21 | nbbuild/ 22 | dist/ 23 | nbdist/ 24 | .nb-gradle/ -------------------------------------------------------------------------------- /online-shopping/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /online-shopping/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip 2 | -------------------------------------------------------------------------------- /online-shopping/mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven2 Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ]; then 38 | 39 | if [ -f /etc/mavenrc ]; then 40 | . /etc/mavenrc 41 | fi 42 | 43 | if [ -f "$HOME/.mavenrc" ]; then 44 | . "$HOME/.mavenrc" 45 | fi 46 | 47 | fi 48 | 49 | # OS specific support. $var _must_ be set to either true or false. 50 | cygwin=false 51 | darwin=false 52 | mingw=false 53 | case "$(uname)" in 54 | CYGWIN*) cygwin=true ;; 55 | MINGW*) mingw=true ;; 56 | Darwin*) 57 | darwin=true 58 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 59 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 60 | if [ -z "$JAVA_HOME" ]; then 61 | if [ -x "/usr/libexec/java_home" ]; then 62 | export JAVA_HOME="$(/usr/libexec/java_home)" 63 | else 64 | export JAVA_HOME="/Library/Java/Home" 65 | fi 66 | fi 67 | ;; 68 | esac 69 | 70 | if [ -z "$JAVA_HOME" ]; then 71 | if [ -r /etc/gentoo-release ]; then 72 | JAVA_HOME=$(java-config --jre-home) 73 | fi 74 | fi 75 | 76 | if [ -z "$M2_HOME" ]; then 77 | ## resolve links - $0 may be a link to maven's home 78 | PRG="$0" 79 | 80 | # need this for relative symlinks 81 | while [ -h "$PRG" ]; do 82 | ls=$(ls -ld "$PRG") 83 | link=$(expr "$ls" : '.*-> \(.*\)$') 84 | if expr "$link" : '/.*' >/dev/null; then 85 | PRG="$link" 86 | else 87 | PRG="$(dirname "$PRG")/$link" 88 | fi 89 | done 90 | 91 | saveddir=$(pwd) 92 | 93 | M2_HOME=$(dirname "$PRG")/.. 94 | 95 | # make it fully qualified 96 | M2_HOME=$(cd "$M2_HOME" && pwd) 97 | 98 | cd "$saveddir" 99 | # echo Using m2 at $M2_HOME 100 | fi 101 | 102 | # For Cygwin, ensure paths are in UNIX format before anything is touched 103 | if $cygwin; then 104 | [ -n "$M2_HOME" ] && 105 | M2_HOME=$(cygpath --unix "$M2_HOME") 106 | [ -n "$JAVA_HOME" ] && 107 | JAVA_HOME=$(cygpath --unix "$JAVA_HOME") 108 | [ -n "$CLASSPATH" ] && 109 | CLASSPATH=$(cygpath --path --unix "$CLASSPATH") 110 | fi 111 | 112 | # For Migwn, ensure paths are in UNIX format before anything is touched 113 | if $mingw; then 114 | [ -n "$M2_HOME" ] && 115 | M2_HOME="$( ( 116 | cd "$M2_HOME" 117 | pwd 118 | ))" 119 | [ -n "$JAVA_HOME" ] && 120 | JAVA_HOME="$( ( 121 | cd "$JAVA_HOME" 122 | pwd 123 | ))" 124 | # TODO classpath? 125 | fi 126 | 127 | if [ -z "$JAVA_HOME" ]; then 128 | javaExecutable="$(which javac)" 129 | if [ -n "$javaExecutable" ] && ! [ "$(expr \"$javaExecutable\" : '\([^ ]*\)')" = "no" ]; then 130 | # readlink(1) is not available as standard on Solaris 10. 131 | readLink=$(which readlink) 132 | if [ ! $(expr "$readLink" : '\([^ ]*\)') = "no" ]; then 133 | if $darwin; then 134 | javaHome="$(dirname \"$javaExecutable\")" 135 | javaExecutable="$(cd \"$javaHome\" && pwd -P)/javac" 136 | else 137 | javaExecutable="$(readlink -f \"$javaExecutable\")" 138 | fi 139 | javaHome="$(dirname \"$javaExecutable\")" 140 | javaHome=$(expr "$javaHome" : '\(.*\)/bin') 141 | JAVA_HOME="$javaHome" 142 | export JAVA_HOME 143 | fi 144 | fi 145 | fi 146 | 147 | if [ -z "$JAVACMD" ]; then 148 | if [ -n "$JAVA_HOME" ]; then 149 | if [ -x "$JAVA_HOME/jre/sh/java" ]; then 150 | # IBM's JDK on AIX uses strange locations for the executables 151 | JAVACMD="$JAVA_HOME/jre/sh/java" 152 | else 153 | JAVACMD="$JAVA_HOME/bin/java" 154 | fi 155 | else 156 | JAVACMD="$(which java)" 157 | fi 158 | fi 159 | 160 | if [ ! -x "$JAVACMD" ]; then 161 | echo "Error: JAVA_HOME is not defined correctly." >&2 162 | echo " We cannot execute $JAVACMD" >&2 163 | exit 1 164 | fi 165 | 166 | if [ -z "$JAVA_HOME" ]; then 167 | echo "Warning: JAVA_HOME environment variable is not set." 168 | fi 169 | 170 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 171 | 172 | # traverses directory structure from process work directory to filesystem root 173 | # first directory with .mvn subdirectory is considered project base directory 174 | find_maven_basedir() { 175 | 176 | if [ -z "$1" ]; then 177 | echo "Path not specified to find_maven_basedir" 178 | return 1 179 | fi 180 | 181 | basedir="$1" 182 | wdir="$1" 183 | while [ "$wdir" != '/' ]; do 184 | if [ -d "$wdir"/.mvn ]; then 185 | basedir=$wdir 186 | break 187 | fi 188 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 189 | if [ -d "${wdir}" ]; then 190 | wdir=$( 191 | cd "$wdir/.." 192 | pwd 193 | ) 194 | fi 195 | # end of workaround 196 | done 197 | echo "${basedir}" 198 | } 199 | 200 | # concatenates all lines of a file 201 | concat_lines() { 202 | if [ -f "$1" ]; then 203 | echo "$(tr -s '\n' ' ' <"$1")" 204 | fi 205 | } 206 | 207 | BASE_DIR=$(find_maven_basedir "$(pwd)") 208 | if [ -z "$BASE_DIR" ]; then 209 | exit 1 210 | fi 211 | 212 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 213 | echo $MAVEN_PROJECTBASEDIR 214 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 215 | 216 | # For Cygwin, switch paths to Windows format before running java 217 | if $cygwin; then 218 | [ -n "$M2_HOME" ] && 219 | M2_HOME=$(cygpath --path --windows "$M2_HOME") 220 | [ -n "$JAVA_HOME" ] && 221 | JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") 222 | [ -n "$CLASSPATH" ] && 223 | CLASSPATH=$(cygpath --path --windows "$CLASSPATH") 224 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 225 | MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") 226 | fi 227 | 228 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 229 | 230 | exec "$JAVACMD" \ 231 | $MAVEN_OPTS \ 232 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 233 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 234 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 235 | -------------------------------------------------------------------------------- /online-shopping/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 39 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 40 | 41 | @REM set %HOME% to equivalent of $HOME 42 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 43 | 44 | @REM Execute a user defined script before this one 45 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 46 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 47 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 48 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 49 | :skipRcPre 50 | 51 | @setlocal 52 | 53 | set ERROR_CODE=0 54 | 55 | @REM To isolate internal variables from possible post scripts, we use another setlocal 56 | @setlocal 57 | 58 | @REM ==== START VALIDATION ==== 59 | if not "%JAVA_HOME%" == "" goto OkJHome 60 | 61 | echo. 62 | echo Error: JAVA_HOME not found in your environment. >&2 63 | echo Please set the JAVA_HOME variable in your environment to match the >&2 64 | echo location of your Java installation. >&2 65 | echo. 66 | goto error 67 | 68 | :OkJHome 69 | if exist "%JAVA_HOME%\bin\java.exe" goto init 70 | 71 | echo. 72 | echo Error: JAVA_HOME is set to an invalid directory. >&2 73 | echo JAVA_HOME = "%JAVA_HOME%" >&2 74 | echo Please set the JAVA_HOME variable in your environment to match the >&2 75 | echo location of your Java installation. >&2 76 | echo. 77 | goto error 78 | 79 | @REM ==== END VALIDATION ==== 80 | 81 | :init 82 | 83 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 84 | @REM Fallback to current working directory if not found. 85 | 86 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 87 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 88 | 89 | set EXEC_DIR=%CD% 90 | set WDIR=%EXEC_DIR% 91 | :findBaseDir 92 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 93 | cd .. 94 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 95 | set WDIR=%CD% 96 | goto findBaseDir 97 | 98 | :baseDirFound 99 | set MAVEN_PROJECTBASEDIR=%WDIR% 100 | cd "%EXEC_DIR%" 101 | goto endDetectBaseDir 102 | 103 | :baseDirNotFound 104 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 105 | cd "%EXEC_DIR%" 106 | 107 | :endDetectBaseDir 108 | 109 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 110 | 111 | @setlocal EnableExtensions EnableDelayedExpansion 112 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 113 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 114 | 115 | :endReadAdditionalConfig 116 | 117 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 118 | 119 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 120 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 121 | 122 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 123 | if ERRORLEVEL 1 goto error 124 | goto end 125 | 126 | :error 127 | set ERROR_CODE=1 128 | 129 | :end 130 | @endlocal & set ERROR_CODE=%ERROR_CODE% 131 | 132 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 133 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 134 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 135 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 136 | :skipRcPost 137 | 138 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 139 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 140 | 141 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 142 | 143 | exit /B %ERROR_CODE% 144 | -------------------------------------------------------------------------------- /online-shopping/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | org.springframework.boot 6 | spring-boot-starter-parent 7 | 2.4.1 8 | 9 | 10 | com.isolutions4u 11 | online-shopping 12 | 0.0.2-SNAPSHOT 13 | war 14 | 15 | online-shopping 16 | Demo project for Spring Boot 17 | 18 | 19 | 1.8 20 | 21 | 22 | 23 | 24 | org.springframework.boot 25 | spring-boot-starter-data-jpa 26 | 27 | 28 | org.springframework.boot 29 | spring-boot-starter-security 30 | 31 | 32 | org.springframework.boot 33 | spring-boot-starter-web 34 | 35 | 36 | mysql 37 | mysql-connector-java 38 | runtime 39 | 40 | 41 | org.hibernate 42 | hibernate-validator 43 | 6.0.23.Final 44 | 45 | 46 | org.springframework.boot 47 | spring-boot-starter-test 48 | test 49 | 50 | 51 | org.springframework.security 52 | spring-security-test 53 | test 54 | 55 | 56 | 57 | org.springframework.boot 58 | spring-boot-starter-tomcat 59 | provided 60 | 61 | 62 | 63 | org.apache.tomcat.embed 64 | tomcat-embed-jasper 65 | provided 66 | 67 | 68 | javax.servlet 69 | jstl 70 | 71 | 72 | javax.validation 73 | validation-api 74 | 75 | 76 | 77 | org.hibernate 78 | hibernate-validator 79 | 6.0.23.Final 80 | 81 | 82 | log4j 83 | log4j 84 | 1.2.17 85 | 86 | 87 | org.springframework.webflow 88 | spring-webflow 89 | 2.5.1.RELEASE 90 | 91 | 92 | org.springframework.security 93 | spring-security-taglibs 94 | 95 | 96 | 97 | 98 | 99 | 100 | org.springframework.boot 101 | spring-boot-maven-plugin 102 | 103 | 104 | 105 | org.projectlombok 106 | lombok 107 | 108 | 109 | 110 | 111 | 112 | org.apache.maven.plugins 113 | maven-release-plugin 114 | 115 | install 116 | true 117 | 118 | 119 | 120 | 121 | 122 | scm:git:git@github.com:sushildangi/online-shopping.git 123 | HEAD 124 | 125 | 126 | -------------------------------------------------------------------------------- /online-shopping/src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/.DS_Store -------------------------------------------------------------------------------- /online-shopping/src/main/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/.DS_Store -------------------------------------------------------------------------------- /online-shopping/src/main/java/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/java/.DS_Store -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/java/com/.DS_Store -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/java/com/isolutions4u/.DS_Store -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/java/com/isolutions4u/onlineshopping/.DS_Store -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/OnlineShoppingApplication.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | 7 | @SpringBootApplication 8 | public class OnlineShoppingApplication { 9 | 10 | public static void main(String[] args) { 11 | SpringApplication.run(OnlineShoppingApplication.class, args); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/ServletInitializer.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping; 2 | 3 | import org.springframework.boot.builder.SpringApplicationBuilder; 4 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 5 | 6 | public class ServletInitializer extends SpringBootServletInitializer { 7 | 8 | @Override 9 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 10 | return application.sources(OnlineShoppingApplication.class); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/configurations/ProjectConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.configurations; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.context.MessageSource; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.ComponentScan; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.context.annotation.EnableAspectJAutoProxy; 9 | import org.springframework.context.support.ResourceBundleMessageSource; 10 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 11 | import org.springframework.web.multipart.support.StandardServletMultipartResolver; 12 | import org.springframework.web.servlet.ViewResolver; 13 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; 14 | import org.springframework.web.servlet.config.annotation.ViewResolverRegistry; 15 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; 16 | import org.springframework.web.servlet.view.InternalResourceViewResolver; 17 | import org.springframework.web.servlet.view.JstlView; 18 | import org.springframework.webflow.mvc.servlet.FlowHandlerAdapter; 19 | import org.springframework.webflow.mvc.servlet.FlowHandlerMapping; 20 | 21 | @Configuration 22 | @EnableAspectJAutoProxy 23 | @ComponentScan(basePackages = "com.isolutions4u.onlineshopping") 24 | public class ProjectConfiguration extends WebMvcConfigurerAdapter { 25 | 26 | @Autowired 27 | private WebFlowConfig webFlowConfig; 28 | 29 | @Override 30 | public void configureViewResolvers(ViewResolverRegistry registry) { 31 | 32 | registry.viewResolver(getViewResolver()); 33 | } 34 | 35 | @Bean 36 | public ViewResolver getViewResolver() { 37 | InternalResourceViewResolver resolver = new InternalResourceViewResolver(); 38 | resolver.setPrefix("/WEB-INF/views/"); 39 | resolver.setSuffix(".jsp"); 40 | resolver.setViewClass(JstlView.class); 41 | return resolver; 42 | } 43 | 44 | @Bean 45 | public MessageSource messageSource() { 46 | ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource(); 47 | messageSource.setBasename("messages"); 48 | return messageSource; 49 | } 50 | 51 | @Bean(name = "multipartResolver") 52 | public StandardServletMultipartResolver resolver() { 53 | return new StandardServletMultipartResolver(); 54 | } 55 | 56 | @Override 57 | public void addResourceHandlers(ResourceHandlerRegistry registry) { 58 | registry.addResourceHandler("/static/**").addResourceLocations("/static/"); 59 | } 60 | 61 | @Bean 62 | public FlowHandlerMapping flowHandlerMapping() { 63 | FlowHandlerMapping handlerMapping = new FlowHandlerMapping(); 64 | handlerMapping.setOrder(-1); 65 | handlerMapping.setFlowRegistry(this.webFlowConfig.flowRegistry()); 66 | return handlerMapping; 67 | } 68 | 69 | @Bean 70 | public FlowHandlerAdapter flowHandlerAdapter() { 71 | FlowHandlerAdapter handlerAdapter = new FlowHandlerAdapter(); 72 | handlerAdapter.setFlowExecutor(this.webFlowConfig.flowExecutor()); 73 | handlerAdapter.setSaveOutputToFlashScopeOnRedirect(true); 74 | return handlerAdapter; 75 | } 76 | 77 | @Bean 78 | public BCryptPasswordEncoder passwordEncoder() { 79 | BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder(); 80 | return bCryptPasswordEncoder; 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/configurations/WebFlowConfig.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.configurations; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; 7 | import org.springframework.web.servlet.ViewResolver; 8 | import org.springframework.webflow.config.AbstractFlowConfiguration; 9 | import org.springframework.webflow.definition.registry.FlowDefinitionRegistry; 10 | import org.springframework.webflow.engine.builder.support.FlowBuilderServices; 11 | import org.springframework.webflow.executor.FlowExecutor; 12 | import org.springframework.webflow.mvc.builder.MvcViewFactoryCreator; 13 | 14 | import java.util.Arrays; 15 | 16 | 17 | @Configuration 18 | public class WebFlowConfig extends AbstractFlowConfiguration { 19 | 20 | 21 | @Autowired 22 | private ProjectConfiguration projectConfiguration; 23 | 24 | @Bean 25 | public FlowExecutor flowExecutor() { 26 | return getFlowExecutorBuilder(flowRegistry()) 27 | //.addFlowExecutionListener(new SecurityFlowExecutionListener(), "*") 28 | .build(); 29 | } 30 | 31 | @Bean 32 | public FlowDefinitionRegistry flowRegistry() { 33 | return getFlowDefinitionRegistryBuilder(flowBuilderServices()) 34 | .setBasePath("/WEB-INF/views/flows") 35 | .addFlowLocationPattern("/**/*-flow.xml").build(); 36 | } 37 | 38 | @Bean 39 | public FlowBuilderServices flowBuilderServices() { 40 | return getFlowBuilderServicesBuilder() 41 | .setViewFactoryCreator(mvcViewFactoryCreator()) 42 | .setValidator(validator()) 43 | .setDevelopmentMode(true) 44 | .build(); 45 | } 46 | 47 | @Bean 48 | public MvcViewFactoryCreator mvcViewFactoryCreator() { 49 | MvcViewFactoryCreator factoryCreator = new MvcViewFactoryCreator(); 50 | factoryCreator.setViewResolvers(Arrays.asList(this.projectConfiguration.getViewResolver())); 51 | factoryCreator.setUseSpringBeanBinding(true); 52 | return factoryCreator; 53 | } 54 | 55 | @Bean 56 | public LocalValidatorFactoryBean validator() { 57 | return new LocalValidatorFactoryBean(); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/configurations/WebSecurityConfig.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.configurations; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.beans.factory.annotation.Value; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; 7 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 8 | import org.springframework.security.config.annotation.web.builders.WebSecurity; 9 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 10 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 11 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 12 | 13 | import javax.sql.DataSource; 14 | 15 | 16 | @Configuration 17 | @EnableWebSecurity 18 | public class WebSecurityConfig extends WebSecurityConfigurerAdapter { 19 | 20 | 21 | @Autowired 22 | private BCryptPasswordEncoder bCryptPasswordEncoder; 23 | 24 | @Autowired 25 | private DataSource dataSource; 26 | 27 | @Value("${spring.queries.users-query}") 28 | private String usersQuery; 29 | 30 | @Value("${spring.queries.roles-query}") 31 | private String rolesQuery; 32 | 33 | @Override 34 | protected void configure(AuthenticationManagerBuilder auth) 35 | throws Exception { 36 | auth. 37 | jdbcAuthentication() 38 | .usersByUsernameQuery(usersQuery) 39 | .authoritiesByUsernameQuery(rolesQuery) 40 | .dataSource(dataSource) 41 | .passwordEncoder(bCryptPasswordEncoder); 42 | ; 43 | } 44 | 45 | 46 | protected void configure(HttpSecurity http) throws Exception { 47 | 48 | http. 49 | authorizeRequests() 50 | .antMatchers("/manage/**").hasAuthority("ADMIN") 51 | .antMatchers("/cart/**").hasAuthority("USER") 52 | .antMatchers("/**").permitAll() 53 | .anyRequest() 54 | .authenticated().and().formLogin() 55 | .loginPage("/login") 56 | .failureUrl("/login?error=true") 57 | .defaultSuccessUrl("/") 58 | .usernameParameter("username") 59 | .passwordParameter("password") 60 | .and().exceptionHandling() 61 | .accessDeniedPage("/access-denied"); 62 | } 63 | 64 | 65 | @Override 66 | public void configure(WebSecurity web) throws Exception { 67 | web 68 | .ignoring() 69 | .antMatchers("/resources/**", "/static/**", "/css/**", "/js/**", "/images/**"); 70 | } 71 | } -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/controllers/CartController.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.controllers; 2 | 3 | import com.isolutions4u.onlineshopping.model.Cart; 4 | import com.isolutions4u.onlineshopping.model.CartLine; 5 | import com.isolutions4u.onlineshopping.model.Product; 6 | import com.isolutions4u.onlineshopping.service.CartLineService; 7 | import com.isolutions4u.onlineshopping.service.CartService; 8 | import com.isolutions4u.onlineshopping.service.ProductService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.beans.factory.annotation.Qualifier; 11 | import org.springframework.stereotype.Controller; 12 | import org.springframework.web.bind.annotation.GetMapping; 13 | import org.springframework.web.bind.annotation.PathVariable; 14 | import org.springframework.web.bind.annotation.RequestMapping; 15 | import org.springframework.web.bind.annotation.RequestParam; 16 | import org.springframework.web.servlet.ModelAndView; 17 | 18 | @Controller 19 | @RequestMapping("/cart") 20 | public class CartController { 21 | 22 | @Autowired 23 | @Qualifier("cartLineService") 24 | private CartLineService cartLineService; 25 | 26 | @Autowired 27 | @Qualifier("productService") 28 | private ProductService productService; 29 | 30 | @Autowired 31 | @Qualifier("cartService") 32 | private CartService cartService; 33 | 34 | @GetMapping("/show") 35 | public ModelAndView showCart(@RequestParam(name = "result", required = false) String result) { 36 | ModelAndView modelAndView = new ModelAndView("page"); 37 | 38 | if (result != null) { 39 | switch (result) { 40 | case "updated": 41 | modelAndView.addObject("message", "CartLine has been updated sucessfully"); 42 | break; 43 | 44 | case "error": 45 | modelAndView.addObject("message", "Something went wrong!!"); 46 | break; 47 | 48 | case "added": 49 | modelAndView.addObject("message", "Cartline has been added sucessfully!"); 50 | break; 51 | 52 | case "deleted": 53 | modelAndView.addObject("message", "Cart has been removed sucessfully"); 54 | break; 55 | default: 56 | break; 57 | } 58 | } 59 | 60 | modelAndView.addObject("title", "User Cart"); 61 | modelAndView.addObject("userClickShowCart", true); 62 | modelAndView.addObject("cartLines", cartLineService.findCartLines()); 63 | return modelAndView; 64 | } 65 | 66 | @GetMapping("/{id}/update") 67 | public String updateCart(@PathVariable int id, @RequestParam int count) { 68 | CartLine cartLine = cartLineService.findCartLineById(id); 69 | if (cartLine != null) { 70 | Product product = cartLine.getProduct(); 71 | double oldTotal = cartLine.getTotal(); 72 | if (product.getQuantity() <= count) { 73 | count = product.getQuantity(); 74 | } 75 | cartLine.setProductCount(count); 76 | cartLine.setBuyingPrice(product.getUnitPrice()); 77 | cartLine.setTotal(product.getUnitPrice() * count); 78 | String response = cartLineService.updateCartLine(cartLine) + ""; 79 | Cart cart = cartService.findCart(); 80 | cart.setGrandTotal(cart.getGrandTotal() - oldTotal + cartLine.getTotal()); 81 | cartService.updateCart(cart); 82 | return "redirect:/cart/show?result=updated"; 83 | } else { 84 | return "redirect:/cart/show?result=error"; 85 | } 86 | } 87 | 88 | @GetMapping("/{id}/delete") 89 | public String deleteCart(@PathVariable int id) { 90 | // TODO : fetch the cartLine 91 | CartLine cartLine = cartLineService.findCartLineById(id); 92 | if (cartLine != null) { 93 | Cart cart = cartService.findCart(); 94 | cart.setGrandTotal(cart.getGrandTotal() - cartLine.getTotal()); 95 | cart.setCartLines(cart.getCartLines() - 1); 96 | cartService.updateCart(cart); 97 | // TODO : remove the cartLine 98 | cartLineService.deleteCartLine(cartLine); 99 | return "redirect:/cart/show?result=deleted"; 100 | } else { 101 | return "redirect:/cart/show?result=error"; 102 | } 103 | } 104 | 105 | @GetMapping("/add/{id}/product") 106 | public String addCart(@PathVariable int id) { 107 | // TODO : fetch the cart 108 | Cart cart = cartService.findCart(); 109 | CartLine cartLine = cartLineService.findCartLineByCartIdAndProductId(cart.getId(), id); 110 | if (cartLine != null) { 111 | 112 | /*cart.setGrandTotal(cart.getGrandTotal() - cartLine.getTotal()); 113 | cart.setCartLines(cart.getCartLines() - 1); 114 | cartService.updateCart(cart); 115 | // TODO : remove the cartLine 116 | cartLineService.deleteCartLine(cartLine); 117 | return "redirect:/cart/show?result=deleted";*/ 118 | return ""; 119 | } else { 120 | cartLine = new CartLine(); 121 | 122 | Product product = productService.findProductById(id); 123 | cartLine.setCartId(cart.getId()); 124 | cartLine.setProduct(product); 125 | cartLine.setBuyingPrice(product.getUnitPrice()); 126 | cartLine.setProductCount(1); 127 | cartLine.setTotal(product.getUnitPrice()); 128 | cartLine.setAvailable(true); 129 | cartLineService.saveCartLine(cartLine); 130 | cart.setCartLines(cart.getCartLines() + 1); 131 | cart.setGrandTotal(cart.getGrandTotal() + cartLine.getTotal()); 132 | cartService.saveCart(cart); 133 | return "redirect:/cart/show?result=added"; 134 | } 135 | } 136 | 137 | } 138 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/controllers/GlobalController.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.controllers; 2 | 3 | import com.isolutions4u.onlineshopping.model.User; 4 | import com.isolutions4u.onlineshopping.model.UserModel; 5 | import com.isolutions4u.onlineshopping.service.UserService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.security.core.Authentication; 8 | import org.springframework.security.core.context.SecurityContextHolder; 9 | import org.springframework.web.bind.annotation.ControllerAdvice; 10 | import org.springframework.web.bind.annotation.ModelAttribute; 11 | 12 | import javax.servlet.http.HttpSession; 13 | 14 | @ControllerAdvice 15 | public class GlobalController { 16 | 17 | @Autowired 18 | private HttpSession httpSession; 19 | 20 | @Autowired 21 | private UserService userService; 22 | 23 | private UserModel userModel = null; 24 | 25 | @ModelAttribute("userModel") 26 | public UserModel getUserModel() { 27 | 28 | if (httpSession.getAttribute("userModel") == null) { 29 | // add the user model 30 | 31 | Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); 32 | User user = userService.findUserByEmail(authentication.getName()); 33 | if (user != null) { 34 | userModel = new UserModel(); 35 | userModel.setId(user.getId()); 36 | userModel.setEmail(user.getEmail()); 37 | userModel.setRole(user.getRole()); 38 | userModel.setFullName(user.getFirstName() + " " + user.getLastName()); 39 | 40 | if (userModel.getRole().equalsIgnoreCase("USER")) { 41 | // set the cart only if user is a buyer 42 | 43 | userModel.setCart(user.getCart()); 44 | } 45 | httpSession.setAttribute("userModel", userModel); 46 | } 47 | 48 | } 49 | 50 | return (UserModel) httpSession.getAttribute("userModel"); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/controllers/GlobalDefaultExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.controllers; 2 | 3 | import org.springframework.boot.web.servlet.error.ErrorController; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.ControllerAdvice; 6 | import org.springframework.web.bind.annotation.ExceptionHandler; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.multipart.MultipartException; 9 | import org.springframework.web.servlet.ModelAndView; 10 | import org.springframework.web.servlet.NoHandlerFoundException; 11 | import org.springframework.web.servlet.mvc.support.RedirectAttributes; 12 | 13 | @Controller 14 | @ControllerAdvice 15 | public class GlobalDefaultExceptionHandler implements ErrorController { 16 | 17 | private static final String PATH = "/error"; 18 | 19 | @RequestMapping(value = PATH) 20 | @ExceptionHandler(NoHandlerFoundException.class) 21 | public ModelAndView error() { 22 | ModelAndView modelAndView = new ModelAndView("404"); 23 | modelAndView.addObject("errorTitle", "This page is not constructed!"); 24 | modelAndView.addObject("errorDescription", "The Page you are looking for is not available now!"); 25 | modelAndView.addObject("title", "404 Error Page"); 26 | return modelAndView; 27 | } 28 | 29 | @Override 30 | public String getErrorPath() { 31 | // TODO Auto-generated method stub 32 | return PATH; 33 | } 34 | 35 | @ExceptionHandler(ProductNotFoundExceptoion.class) 36 | public ModelAndView errorProductNotfound() { 37 | ModelAndView modelAndView = new ModelAndView("404"); 38 | modelAndView.addObject("errorTitle", "This Product Not Available"); 39 | modelAndView.addObject("errorDescription", "The Product you looking for is not available right Now!"); 40 | modelAndView.addObject("title", "Product Unavailable"); 41 | return modelAndView; 42 | } 43 | 44 | @ExceptionHandler(MultipartException.class) 45 | public String handleError1(MultipartException e, RedirectAttributes redirectAttributes) { 46 | redirectAttributes.addFlashAttribute("message", e.getCause().getMessage()); 47 | return "/redirect:/manage/products"; 48 | 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/controllers/IndexController.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.controllers; 2 | 3 | import com.isolutions4u.onlineshopping.model.Category; 4 | import com.isolutions4u.onlineshopping.model.Product; 5 | import com.isolutions4u.onlineshopping.service.CategoryService; 6 | import com.isolutions4u.onlineshopping.service.ProductService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.beans.factory.annotation.Qualifier; 9 | import org.springframework.security.core.Authentication; 10 | import org.springframework.security.core.context.SecurityContextHolder; 11 | import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler; 12 | import org.springframework.stereotype.Controller; 13 | import org.springframework.web.bind.annotation.GetMapping; 14 | import org.springframework.web.bind.annotation.PathVariable; 15 | import org.springframework.web.bind.annotation.RequestParam; 16 | import org.springframework.web.servlet.ModelAndView; 17 | 18 | import javax.servlet.http.HttpServletRequest; 19 | import javax.servlet.http.HttpServletResponse; 20 | 21 | @Controller 22 | public class IndexController { 23 | 24 | @Autowired 25 | @Qualifier("categoryService") 26 | private CategoryService categoryService; 27 | 28 | @Autowired 29 | @Qualifier("productService") 30 | private ProductService productService; 31 | 32 | @GetMapping(value = {"/", "/home"}) 33 | public ModelAndView home() { 34 | ModelAndView modelAndView = new ModelAndView("page"); 35 | modelAndView.addObject("userClickHome", true); 36 | modelAndView.addObject("title", "Home"); 37 | 38 | modelAndView.addObject("categories", categoryService.findAllCategories()); 39 | 40 | return modelAndView; 41 | } 42 | 43 | @GetMapping("/contact") 44 | public ModelAndView contact() { 45 | ModelAndView modelAndView = new ModelAndView("page"); 46 | modelAndView.addObject("userClickContact", true); 47 | modelAndView.addObject("title", "Contact Us"); 48 | 49 | return modelAndView; 50 | } 51 | 52 | @GetMapping("/about") 53 | public ModelAndView about() { 54 | ModelAndView modelAndView = new ModelAndView("page"); 55 | modelAndView.addObject("userClickAbout", true); 56 | modelAndView.addObject("title", "About Us"); 57 | 58 | return modelAndView; 59 | } 60 | 61 | /* 62 | * Creating Custom Login Controller 63 | * 64 | * 65 | */ 66 | 67 | @GetMapping("/login") 68 | public ModelAndView login(@RequestParam(name = "error", required = false) String error, 69 | @RequestParam(name = "logout", required = false) String logout) { 70 | ModelAndView modelAndView = new ModelAndView("login"); 71 | if (error != null) { 72 | modelAndView.addObject("message", "Invalid User Name or Password!"); 73 | } 74 | if (logout != null) { 75 | modelAndView.addObject("logout", "User has Successfully Logged out!"); 76 | } 77 | modelAndView.addObject("title", "Login"); 78 | 79 | return modelAndView; 80 | } 81 | 82 | /* 83 | * Methods to load all the products and based on category 84 | * 85 | */ 86 | 87 | @GetMapping("/show/all/products") 88 | public ModelAndView showAllProducts() { 89 | ModelAndView modelAndView = new ModelAndView("page"); 90 | modelAndView.addObject("userClickAllProducts", true); 91 | modelAndView.addObject("title", "All Products"); 92 | 93 | // passing the list of categories 94 | 95 | modelAndView.addObject("categories", categoryService.findAllCategories()); 96 | 97 | return modelAndView; 98 | } 99 | 100 | @GetMapping("/show/category/{id}/products") 101 | public ModelAndView showCategoryProducts(@PathVariable("id") int id) { 102 | ModelAndView modelAndView = new ModelAndView("page"); 103 | 104 | Category category = null; 105 | category = categoryService.findCategoryById(id); 106 | 107 | modelAndView.addObject("userClickCategoryProducts", true); 108 | modelAndView.addObject("title", category.getName()); 109 | 110 | // passing the list of categories 111 | 112 | modelAndView.addObject("categories", categoryService.findAllCategories()); 113 | 114 | // passing the single category object 115 | modelAndView.addObject("category", category); 116 | 117 | return modelAndView; 118 | } 119 | 120 | /* 121 | * Viewing a single product 122 | */ 123 | 124 | @GetMapping("/show/{id}/product") 125 | public ModelAndView showSingleProduct(@PathVariable("id") int id) throws ProductNotFoundExceptoion { 126 | 127 | ModelAndView modelAndView = new ModelAndView("page"); 128 | 129 | Product product = productService.findProductById(id); 130 | 131 | if (product == null) 132 | throw new ProductNotFoundExceptoion(); 133 | 134 | product.setViews(product.getViews() + 1); 135 | productService.updateProduct(product); 136 | modelAndView.addObject("title", product.getName()); 137 | modelAndView.addObject("product", product); 138 | modelAndView.addObject("userClickShowProduct", true); 139 | 140 | return modelAndView; 141 | 142 | } 143 | 144 | /* 145 | * Access denied Page 146 | */ 147 | @GetMapping("/access-denied") 148 | public ModelAndView accessDenied() { 149 | ModelAndView modelAndView = new ModelAndView("404"); 150 | modelAndView.addObject("title", "403 - Access Denied"); 151 | modelAndView.addObject("errorTitle", "Aha! Caught You"); 152 | modelAndView.addObject("errorDescription", "You Are not authorized to Access this Page"); 153 | return modelAndView; 154 | } 155 | 156 | /* 157 | * Logout 158 | */ 159 | @GetMapping("/logout") 160 | public String logout(HttpServletRequest request, HttpServletResponse response) { 161 | 162 | // first we are going to fetch the authentication 163 | Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); 164 | if (authentication != null) { 165 | new SecurityContextLogoutHandler().logout(request, response, authentication); 166 | } 167 | 168 | return "redirect:/login?logout"; 169 | } 170 | 171 | } 172 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/controllers/JsonDataController.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.controllers; 2 | 3 | import com.isolutions4u.onlineshopping.model.Product; 4 | import com.isolutions4u.onlineshopping.service.ProductService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.beans.factory.annotation.Qualifier; 7 | import org.springframework.web.bind.annotation.GetMapping; 8 | import org.springframework.web.bind.annotation.PathVariable; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | import java.util.List; 13 | 14 | @RestController 15 | @RequestMapping("/json/data") 16 | public class JsonDataController { 17 | 18 | @Autowired 19 | @Qualifier("productService") 20 | private ProductService productService; 21 | 22 | @GetMapping("/all/products") 23 | public List getAllProducts() { 24 | List products = productService.findAllProducts(); 25 | return products; 26 | 27 | } 28 | 29 | @GetMapping("/admin/all/products") 30 | public List getAllProductsForAdmin() { 31 | List products = productService.findAllProductsForAdmin(); 32 | return products; 33 | 34 | } 35 | 36 | @GetMapping("/category/{categoryId}/products") 37 | public List getProductsByCategory(@PathVariable("categoryId") int categoryId) { 38 | List products = productService.findProductByCategoryId(categoryId); 39 | return products; 40 | 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/controllers/ManagementController.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.controllers; 2 | 3 | import com.isolutions4u.onlineshopping.model.Category; 4 | import com.isolutions4u.onlineshopping.model.Product; 5 | import com.isolutions4u.onlineshopping.service.CategoryService; 6 | import com.isolutions4u.onlineshopping.service.ProductService; 7 | import com.isolutions4u.onlineshopping.validator.ProductValidator; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.beans.factory.annotation.Qualifier; 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.ui.Model; 12 | import org.springframework.validation.BindingResult; 13 | import org.springframework.web.bind.annotation.*; 14 | import org.springframework.web.multipart.MultipartFile; 15 | import org.springframework.web.servlet.ModelAndView; 16 | 17 | import javax.servlet.http.HttpServletRequest; 18 | import javax.validation.Valid; 19 | import java.io.IOException; 20 | import java.nio.file.Files; 21 | import java.nio.file.Path; 22 | import java.nio.file.Paths; 23 | import java.util.List; 24 | 25 | @Controller 26 | @RequestMapping("/manage") 27 | public class ManagementController { 28 | 29 | @Qualifier("categoryService") 30 | @Autowired 31 | private CategoryService categoryService; 32 | 33 | @Qualifier("productService") 34 | @Autowired 35 | private ProductService productService; 36 | 37 | @GetMapping(value = "/products") 38 | public ModelAndView showManageProducts(@RequestParam(name = "operation", required = false) String operation) { 39 | 40 | ModelAndView modelAndView = new ModelAndView("page"); 41 | 42 | modelAndView.addObject("userClickManageProducts", true); 43 | modelAndView.addObject("title", "Manage Products"); 44 | 45 | Product nProduct = new Product(); 46 | nProduct.setSupplierId(1); 47 | nProduct.setActive(true); 48 | modelAndView.addObject("product", nProduct); 49 | if (operation != null && operation.equals("product")) { 50 | modelAndView.addObject("message", "Product Added Sucessfully!"); 51 | } else if (operation != null && operation.equals("category")) { 52 | modelAndView.addObject("message", "Category Added Sucessfully!"); 53 | } else if (operation != null && operation.equals("updated")) { 54 | modelAndView.addObject("message", "Product Updated Sucessfully!"); 55 | } 56 | 57 | return modelAndView; 58 | } 59 | 60 | // handling product submission 61 | @PostMapping(value = "/products") 62 | public String handleProductSubmission(@Valid @ModelAttribute("product") Product mProduct, 63 | BindingResult bindingResult, Model model, @RequestParam("file") MultipartFile file, 64 | HttpServletRequest request) { 65 | 66 | // check if there are any error 67 | 68 | if (mProduct.getId() == 0) { 69 | 70 | new ProductValidator().validate(mProduct, bindingResult); 71 | 72 | if (bindingResult.hasErrors()) { 73 | model.addAttribute("userClickManageProducts", true); 74 | model.addAttribute("title", "Manage Products"); 75 | model.addAttribute("message", "Validation failed for Product Submission!"); 76 | return "page"; 77 | } 78 | 79 | try { 80 | 81 | // Get the file and save it somewhere 82 | fileSaveInFolder(mProduct, file, request); 83 | productService.saveProduct(mProduct); 84 | return "redirect:/manage/products?operation=product"; 85 | } catch (IOException e) { 86 | e.printStackTrace(); 87 | model.addAttribute("userClickManageProducts", true); 88 | model.addAttribute("title", "Manage Products"); 89 | model.addAttribute("message", e.getMessage()); 90 | return "page"; 91 | } 92 | } else { 93 | if (!mProduct.getFile().getOriginalFilename().equals("")) { 94 | new ProductValidator().validate(mProduct, bindingResult); 95 | if (bindingResult.hasErrors()) { 96 | model.addAttribute("userClickManageProducts", true); 97 | model.addAttribute("title", "Manage Products"); 98 | model.addAttribute("message", "Validation failed for Product Submission!"); 99 | return "page"; 100 | } 101 | 102 | try { 103 | 104 | fileSaveInFolder(mProduct, file, request); 105 | productService.updateProduct(mProduct); 106 | return "redirect:/manage/products?operation=updated"; 107 | } catch (IOException e) { 108 | // TODO Auto-generated catch block 109 | e.printStackTrace(); 110 | model.addAttribute("userClickManageProducts", true); 111 | model.addAttribute("title", "Manage Products"); 112 | model.addAttribute("message", e.getMessage()); 113 | return "page"; 114 | } 115 | 116 | } else { 117 | productService.updateProduct(mProduct); 118 | return "redirect:/manage/products?operation=updated"; 119 | } 120 | } 121 | } 122 | 123 | private void fileSaveInFolder(Product mProduct, MultipartFile file, HttpServletRequest request) throws IOException { 124 | byte[] bytes = file.getBytes(); 125 | String p = request.getSession().getServletContext().getRealPath("/static/images/"); 126 | System.out.println(p); 127 | Path path = Paths.get(p + mProduct.getCode() + ".jpg"); 128 | Files.write(path, bytes); 129 | } 130 | 131 | // Activating Deactivating Products 132 | 133 | @PostMapping("/product/{id}/activation") 134 | @ResponseBody 135 | public String handleProductActivation(@PathVariable("id") int id) { 136 | 137 | Product product = productService.findProductByIdForAdmin(id); 138 | boolean isActive = product.isActive(); 139 | 140 | product.setActive(!isActive); 141 | 142 | productService.updateProduct(product); 143 | 144 | return (isActive) ? "You have Successfully deactivated the Product with Id : " + product.getId() 145 | : "You have Successfully activated the Product with Id : " + product.getId(); 146 | } 147 | 148 | @GetMapping("{id}/product") 149 | public ModelAndView showEditProducts(@PathVariable("id") int id) { 150 | 151 | ModelAndView modelAndView = new ModelAndView("page"); 152 | 153 | modelAndView.addObject("userClickManageProducts", true); 154 | modelAndView.addObject("title", "Manage Products"); 155 | 156 | // Fetching the product form database 157 | 158 | Product nProduct = productService.findProductByIdForAdmin(id); 159 | 160 | modelAndView.addObject("product", nProduct); 161 | 162 | return modelAndView; 163 | } 164 | 165 | @PostMapping("/category") 166 | public String handleCategorySubmission(@ModelAttribute("category") Category category) { 167 | 168 | categoryService.saveCategory(category); 169 | 170 | return "redirect:/manage/products?operation=category"; 171 | } 172 | 173 | @ModelAttribute("categories") 174 | public List getCategories() { 175 | List categories = categoryService.findAllCategories(); 176 | return categories; 177 | } 178 | 179 | @ModelAttribute("category") 180 | public Category getCategory() { 181 | return new Category(); 182 | } 183 | 184 | } 185 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/controllers/ProductNotFoundExceptoion.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.controllers; 2 | 3 | import java.io.Serializable; 4 | 5 | public class ProductNotFoundExceptoion extends Exception implements Serializable { 6 | 7 | private static final long serialVersionUID = 1L; 8 | 9 | private String message; 10 | 11 | public ProductNotFoundExceptoion(String message) { 12 | this.message = System.currentTimeMillis() + " : " + message; 13 | } 14 | 15 | public ProductNotFoundExceptoion() { 16 | this("Product Not Available!"); 17 | } 18 | 19 | public String getMessage() { 20 | return message; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/handler/RegisterHandler.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.handler; 2 | 3 | import com.isolutions4u.onlineshopping.model.Address; 4 | import com.isolutions4u.onlineshopping.model.Cart; 5 | import com.isolutions4u.onlineshopping.model.RegisterModel; 6 | import com.isolutions4u.onlineshopping.model.User; 7 | import com.isolutions4u.onlineshopping.service.AddressService; 8 | import com.isolutions4u.onlineshopping.service.UserService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.beans.factory.annotation.Qualifier; 11 | import org.springframework.binding.message.MessageBuilder; 12 | import org.springframework.binding.message.MessageContext; 13 | import org.springframework.stereotype.Component; 14 | 15 | @Component 16 | public class RegisterHandler { 17 | 18 | @Qualifier("userService") 19 | @Autowired 20 | private UserService userService; 21 | 22 | @Qualifier("addressService") 23 | @Autowired 24 | private AddressService addressService; 25 | 26 | public RegisterModel init() { 27 | 28 | return new RegisterModel(); 29 | 30 | } 31 | 32 | public void addUser(RegisterModel registerModel, User user) { 33 | registerModel.setUser(user); 34 | } 35 | 36 | public void addBilling(RegisterModel registerModel, Address billing) { 37 | registerModel.setBilling(billing); 38 | } 39 | 40 | public String saveAll(RegisterModel registerModel) { 41 | String transitionValue = "success"; 42 | 43 | // Getting User 44 | 45 | User user = registerModel.getUser(); 46 | if (user.getRole().equalsIgnoreCase("USER")) { 47 | Cart cart = new Cart(); 48 | cart.setUser(user); 49 | user.setCart(cart); 50 | } 51 | // save User 52 | userService.saveUser(user); 53 | 54 | // Getting Address 55 | 56 | Address billing = registerModel.getBilling(); 57 | 58 | billing.setUser(user); 59 | billing.setBilling(true); 60 | addressService.saveAddress(billing); 61 | 62 | return transitionValue; 63 | } 64 | 65 | public String validateUser(User user, MessageContext messageContext) { 66 | 67 | String transitionValue = "success"; 68 | if (!(user.getPassword().equals(user.getConfirmPassword()))) { 69 | messageContext.addMessage(new MessageBuilder().error().source("confirmPassword") 70 | .defaultText("Password does not match the confirm Password").build()); 71 | transitionValue = "failure"; 72 | } 73 | 74 | if (userService.findUserByEmail(user.getEmail()) != null) { 75 | messageContext.addMessage( 76 | new MessageBuilder().error().source("email").defaultText("Email is already in use").build()); 77 | transitionValue = "failure"; 78 | } 79 | 80 | return transitionValue; 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/model/Address.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.model; 2 | 3 | import org.hibernate.validator.constraints.NotBlank; 4 | 5 | import javax.persistence.*; 6 | import java.io.Serializable; 7 | 8 | @Entity 9 | @Table(name = "address") 10 | public class Address implements Serializable { 11 | 12 | /** 13 | * 14 | */ 15 | private static final long serialVersionUID = 1L; 16 | 17 | @Id 18 | @GeneratedValue(strategy = GenerationType.IDENTITY) 19 | @Column(name = "id") 20 | private int id; 21 | 22 | /////////////// add many to one relation ship 23 | @ManyToOne 24 | private User user; 25 | /*----------------------*/ 26 | @Column(name = "address_line_one") 27 | @NotBlank(message = "Please Enter Address Line One!") 28 | private String addressLineOne; 29 | 30 | @Column(name = "address_line_two") 31 | @NotBlank(message = "Please Enter Address Line Two!") 32 | private String addressLineTwo; 33 | 34 | @Column(name = "city") 35 | @NotBlank(message = "Please Enter City!") 36 | private String city; 37 | 38 | @Column(name = "state") 39 | @NotBlank(message = "Please Enter City!") 40 | private String state; 41 | 42 | @Column(name = "country") 43 | @NotBlank(message = "Please Enter Country!") 44 | private String country; 45 | 46 | @Column(name = "postal_code") 47 | @NotBlank(message = "Please Enter Postal Code!") 48 | private String postalCode; 49 | 50 | @Column(name = "shipping") 51 | private boolean shipping; 52 | 53 | @Column(name = "billing") 54 | private boolean billing; 55 | 56 | public int getId() { 57 | return id; 58 | } 59 | 60 | public void setId(int id) { 61 | this.id = id; 62 | } 63 | 64 | public String getAddressLineOne() { 65 | return addressLineOne; 66 | } 67 | 68 | public void setAddressLineOne(String addressLineOne) { 69 | this.addressLineOne = addressLineOne; 70 | } 71 | 72 | public String getAddressLineTwo() { 73 | return addressLineTwo; 74 | } 75 | 76 | public void setAddressLineTwo(String addressLineTwo) { 77 | this.addressLineTwo = addressLineTwo; 78 | } 79 | 80 | public String getCity() { 81 | return city; 82 | } 83 | 84 | public void setCity(String city) { 85 | this.city = city; 86 | } 87 | 88 | public String getState() { 89 | return state; 90 | } 91 | 92 | public void setState(String state) { 93 | this.state = state; 94 | } 95 | 96 | public String getCountry() { 97 | return country; 98 | } 99 | 100 | public void setCountry(String country) { 101 | this.country = country; 102 | } 103 | 104 | public String getPostalCode() { 105 | return postalCode; 106 | } 107 | 108 | public void setPostalCode(String postalCode) { 109 | this.postalCode = postalCode; 110 | } 111 | 112 | public boolean isShipping() { 113 | return shipping; 114 | } 115 | 116 | public void setShipping(boolean shipping) { 117 | this.shipping = shipping; 118 | } 119 | 120 | public boolean isBilling() { 121 | return billing; 122 | } 123 | 124 | public void setBilling(boolean billing) { 125 | this.billing = billing; 126 | } 127 | 128 | public User getUser() { 129 | return user; 130 | } 131 | 132 | public void setUser(User user) { 133 | this.user = user; 134 | } 135 | 136 | @Override 137 | public String toString() { 138 | return "Address [id=" + id + ", addressLineOne=" + addressLineOne + ", addressLineTwo=" + addressLineTwo 139 | + ", city=" + city + ", state=" + state + ", country=" + country + ", postalCode=" + postalCode 140 | + ", shipping=" + shipping + ", billing=" + billing + "]"; 141 | } 142 | 143 | } 144 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/model/Cart.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.model; 2 | 3 | import javax.persistence.*; 4 | import java.io.Serializable; 5 | 6 | @Entity 7 | @Table(name = "cart") 8 | public class Cart implements Serializable { 9 | 10 | /** 11 | * 12 | */ 13 | private static final long serialVersionUID = 1L; 14 | 15 | @Id 16 | @GeneratedValue(strategy = GenerationType.IDENTITY) 17 | @Column(name = "id") 18 | private int id; 19 | 20 | // creating one to one relationship 21 | 22 | @OneToOne 23 | private User user; 24 | 25 | @Column(name = "grand_total") 26 | private double grandTotal; 27 | 28 | @Column(name = "cart_lines") 29 | private int cartLines; 30 | 31 | public int getId() { 32 | return id; 33 | } 34 | 35 | public void setId(int id) { 36 | this.id = id; 37 | } 38 | 39 | public double getGrandTotal() { 40 | return grandTotal; 41 | } 42 | 43 | public void setGrandTotal(double grandTotal) { 44 | this.grandTotal = grandTotal; 45 | } 46 | 47 | public int getCartLines() { 48 | return cartLines; 49 | } 50 | 51 | public void setCartLines(int cartLines) { 52 | this.cartLines = cartLines; 53 | } 54 | 55 | public User getUser() { 56 | return user; 57 | } 58 | 59 | public void setUser(User user) { 60 | this.user = user; 61 | } 62 | 63 | @Override 64 | public String toString() { 65 | return "Cart [id=" + id + ", grandTotal=" + grandTotal + ", cartLines=" + cartLines + "]"; 66 | } 67 | 68 | 69 | } 70 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/model/CartLine.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.model; 2 | 3 | import javax.persistence.*; 4 | import java.io.Serializable; 5 | 6 | @Entity 7 | @Table(name = "cart_line") 8 | public class CartLine implements Serializable { 9 | 10 | /** 11 | * 12 | */ 13 | private static final long serialVersionUID = 1L; 14 | 15 | @Id 16 | @GeneratedValue(strategy = GenerationType.IDENTITY) 17 | @Column(name = "id") 18 | private int id; 19 | 20 | @OneToOne 21 | private Product product; 22 | 23 | @Column(name = "cart_id") 24 | private int cartId; 25 | 26 | @Column(name = "total") 27 | private double total; 28 | 29 | @Column(name = "product_count") 30 | private int productCount; 31 | 32 | @Column(name = "buying_price") 33 | private double buyingPrice; 34 | 35 | @Column(name = "is_available") 36 | private boolean isAvailable; 37 | 38 | public int getId() { 39 | return id; 40 | } 41 | 42 | public void setId(int id) { 43 | this.id = id; 44 | } 45 | 46 | public int getCartId() { 47 | return cartId; 48 | } 49 | 50 | public void setCartId(int cartId) { 51 | this.cartId = cartId; 52 | } 53 | 54 | public double getTotal() { 55 | return total; 56 | } 57 | 58 | public void setTotal(double total) { 59 | this.total = total; 60 | } 61 | 62 | public int getProductCount() { 63 | return productCount; 64 | } 65 | 66 | public void setProductCount(int productCount) { 67 | this.productCount = productCount; 68 | } 69 | 70 | public double getBuyingPrice() { 71 | return buyingPrice; 72 | } 73 | 74 | public void setBuyingPrice(double buyingPrice) { 75 | this.buyingPrice = buyingPrice; 76 | } 77 | 78 | public boolean isAvailable() { 79 | return isAvailable; 80 | } 81 | 82 | public void setAvailable(boolean isAvailable) { 83 | this.isAvailable = isAvailable; 84 | } 85 | 86 | 87 | public Product getProduct() { 88 | return product; 89 | } 90 | 91 | public void setProduct(Product product) { 92 | this.product = product; 93 | } 94 | 95 | @Override 96 | public String toString() { 97 | return "CartLine [id=" + id + ", cartId=" + cartId + ", total=" + total + ", productCount=" + productCount 98 | + ", buyingPrice=" + buyingPrice + ", isAvailable=" + isAvailable + "]"; 99 | } 100 | 101 | 102 | } 103 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/model/Category.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.model; 2 | 3 | import javax.persistence.*; 4 | 5 | @Entity 6 | @Table(name = "category") 7 | public class Category { 8 | 9 | // private fields 10 | 11 | @Id 12 | @GeneratedValue(strategy = GenerationType.IDENTITY) 13 | @Column(name = "id") 14 | private int id; 15 | 16 | @Column(name = "name") 17 | private String name; 18 | 19 | @Column(name = "description") 20 | private String description; 21 | 22 | @Column(name = "image_url") 23 | private String imageUrl; 24 | 25 | @Column(name = "is_active") 26 | private boolean active; 27 | 28 | public int getId() { 29 | return id; 30 | } 31 | 32 | public void setId(int id) { 33 | this.id = id; 34 | } 35 | 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name; 42 | } 43 | 44 | public String getDescription() { 45 | return description; 46 | } 47 | 48 | public void setDescription(String description) { 49 | this.description = description; 50 | } 51 | 52 | public String getImageUrl() { 53 | return imageUrl; 54 | } 55 | 56 | public void setImageUrl(String imageUrl) { 57 | this.imageUrl = imageUrl; 58 | } 59 | 60 | public boolean isActive() { 61 | return active; 62 | } 63 | 64 | public void setActive(boolean active) { 65 | this.active = active; 66 | } 67 | 68 | @Override 69 | public String toString() { 70 | return "Category [id=" + id + ", name=" + name + ", description=" + description + ", imageUrl=" + imageUrl 71 | + ", active=" + active + "]"; 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/model/Product.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | import org.hibernate.validator.constraints.NotBlank; 5 | import org.springframework.web.multipart.MultipartFile; 6 | 7 | import javax.persistence.*; 8 | import javax.validation.constraints.Min; 9 | import java.util.UUID; 10 | 11 | @Entity 12 | @Table(name = "product") 13 | public class Product { 14 | 15 | @Id 16 | @GeneratedValue(strategy = GenerationType.IDENTITY) 17 | @Column(name = "id") 18 | private int id; 19 | 20 | @Column(name = "code") 21 | private String code; 22 | 23 | @Column(name = "name") 24 | @NotBlank(message = "Please Enter the Product Name") 25 | private String name; 26 | 27 | @Column(name = "brand") 28 | @NotBlank(message = "Please Enter the Brand Name") 29 | private String brand; 30 | 31 | @Column(name = "description") 32 | @JsonIgnore 33 | @NotBlank(message = "Please Enter the Product Description") 34 | private String description; 35 | 36 | @Column(name = "unit_price") 37 | @Min(value = 1, message = "Unit Price atleast one (1)") 38 | private double unitPrice; 39 | 40 | @Column(name = "quantity") 41 | private int quantity; 42 | 43 | @Column(name = "is_active") 44 | private boolean active; 45 | 46 | @Column(name = "category_id") 47 | @JsonIgnore 48 | private int categoryId; 49 | 50 | @Column(name = "supplier_id") 51 | @JsonIgnore 52 | private int supplierId; 53 | 54 | @Column(name = "purchases") 55 | private int purchases; 56 | 57 | @Column(name = "views") 58 | private int views; 59 | 60 | @Transient 61 | private MultipartFile file; 62 | 63 | // default constructor 64 | public Product() { 65 | this.code = "PRO" + UUID.randomUUID().toString().substring(26).toUpperCase(); 66 | } 67 | 68 | public int getId() { 69 | return id; 70 | } 71 | 72 | public void setId(int id) { 73 | this.id = id; 74 | } 75 | 76 | public String getCode() { 77 | return code; 78 | } 79 | 80 | public void setCode(String code) { 81 | this.code = code; 82 | } 83 | 84 | public String getName() { 85 | return name; 86 | } 87 | 88 | public void setName(String name) { 89 | this.name = name; 90 | } 91 | 92 | public String getBrand() { 93 | return brand; 94 | } 95 | 96 | public void setBrand(String brand) { 97 | this.brand = brand; 98 | } 99 | 100 | public String getDescription() { 101 | return description; 102 | } 103 | 104 | public void setDescription(String description) { 105 | this.description = description; 106 | } 107 | 108 | public double getUnitPrice() { 109 | return unitPrice; 110 | } 111 | 112 | public void setUnitPrice(double unitPrice) { 113 | this.unitPrice = unitPrice; 114 | } 115 | 116 | public int getQuantity() { 117 | return quantity; 118 | } 119 | 120 | public void setQuantity(int quantity) { 121 | this.quantity = quantity; 122 | } 123 | 124 | public boolean isActive() { 125 | return active; 126 | } 127 | 128 | public void setActive(boolean active) { 129 | this.active = active; 130 | } 131 | 132 | public int getCategoryId() { 133 | return categoryId; 134 | } 135 | 136 | public void setCategoryId(int categoryId) { 137 | this.categoryId = categoryId; 138 | } 139 | 140 | public int getSupplierId() { 141 | return supplierId; 142 | } 143 | 144 | public void setSupplierId(int supplierId) { 145 | this.supplierId = supplierId; 146 | } 147 | 148 | public int getPurchases() { 149 | return purchases; 150 | } 151 | 152 | public void setPurchases(int purchases) { 153 | this.purchases = purchases; 154 | } 155 | 156 | public int getViews() { 157 | return views; 158 | } 159 | 160 | public void setViews(int views) { 161 | this.views = views; 162 | } 163 | 164 | public MultipartFile getFile() { 165 | return file; 166 | } 167 | 168 | public void setFile(MultipartFile file) { 169 | this.file = file; 170 | } 171 | 172 | @Override 173 | public String toString() { 174 | return "Product [id=" + id + ", code=" + code + ", name=" + name + ", brand=" + brand + ", description=" 175 | + description + ", unitPrice=" + unitPrice + ", quantity=" + quantity + ", active=" + active 176 | + ", categoryId=" + categoryId + ", supplierId=" + supplierId + ", purchases=" + purchases + ", views=" 177 | + views + "]"; 178 | } 179 | 180 | } 181 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/model/RegisterModel.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.model; 2 | 3 | import java.io.Serializable; 4 | 5 | public class RegisterModel implements Serializable { 6 | 7 | /** 8 | * 9 | */ 10 | private static final long serialVersionUID = 1L; 11 | 12 | 13 | private User user; 14 | private Address billing; 15 | 16 | public User getUser() { 17 | return user; 18 | } 19 | 20 | public void setUser(User user) { 21 | this.user = user; 22 | } 23 | 24 | public Address getBilling() { 25 | return billing; 26 | } 27 | 28 | public void setBilling(Address billing) { 29 | this.billing = billing; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/model/User.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.model; 2 | 3 | import org.hibernate.validator.constraints.NotBlank; 4 | 5 | import javax.persistence.*; 6 | import java.io.Serializable; 7 | 8 | @Entity 9 | @Table(name = "user_detail") 10 | public class User implements Serializable { 11 | 12 | /** 13 | * 14 | */ 15 | private static final long serialVersionUID = 1L; 16 | 17 | @Id 18 | @GeneratedValue(strategy = GenerationType.IDENTITY) 19 | @Column(name = "id") 20 | private int id; 21 | 22 | @Column(name = "first_name") 23 | @NotBlank(message = "Please Enter First Name!") 24 | private String firstName; 25 | 26 | @Column(name = "last_name") 27 | @NotBlank(message = "Please Enter Last Name!") 28 | private String lastName; 29 | 30 | @Column(name = "email", unique = true) 31 | private String email; 32 | 33 | @Column(name = "contact_number") 34 | @NotBlank(message = "Please Enter Contact number!") 35 | private String contactNumber; 36 | 37 | @Column(name = "role") 38 | private String role; 39 | 40 | @Column(name = "password") 41 | @NotBlank(message = "Please Enter Password for Login!") 42 | private String password; 43 | 44 | //confirm password transient field 45 | @Transient 46 | private String confirmPassword; 47 | 48 | @Column(name = "enabled") 49 | private boolean enabled = true; 50 | 51 | @OneToOne(mappedBy = "user", cascade = CascadeType.ALL) 52 | private Cart cart; 53 | 54 | public int getId() { 55 | return id; 56 | } 57 | 58 | public void setId(int id) { 59 | this.id = id; 60 | } 61 | 62 | public String getFirstName() { 63 | return firstName; 64 | } 65 | 66 | public void setFirstName(String firstName) { 67 | this.firstName = firstName; 68 | } 69 | 70 | public String getLastName() { 71 | return lastName; 72 | } 73 | 74 | public void setLastName(String lastName) { 75 | this.lastName = lastName; 76 | } 77 | 78 | public String getEmail() { 79 | return email; 80 | } 81 | 82 | public void setEmail(String email) { 83 | this.email = email; 84 | } 85 | 86 | public String getContactNumber() { 87 | return contactNumber; 88 | } 89 | 90 | public void setContactNumber(String contactNumber) { 91 | this.contactNumber = contactNumber; 92 | } 93 | 94 | public String getRole() { 95 | return role; 96 | } 97 | 98 | public void setRole(String role) { 99 | this.role = role; 100 | } 101 | 102 | public String getPassword() { 103 | return password; 104 | } 105 | 106 | public void setPassword(String password) { 107 | this.password = password; 108 | } 109 | 110 | public boolean isEnabled() { 111 | return enabled; 112 | } 113 | 114 | public void setEnabled(boolean enabled) { 115 | this.enabled = enabled; 116 | } 117 | 118 | public Cart getCart() { 119 | return cart; 120 | } 121 | 122 | public void setCart(Cart cart) { 123 | this.cart = cart; 124 | } 125 | 126 | public String getConfirmPassword() { 127 | return confirmPassword; 128 | } 129 | 130 | public void setConfirmPassword(String confirmPassword) { 131 | this.confirmPassword = confirmPassword; 132 | } 133 | 134 | @Override 135 | public String toString() { 136 | return "User [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", email=" + email 137 | + ", contactNumber=" + contactNumber + ", role=" + role + ", password=" + password + ", enabled=" 138 | + enabled + "]"; 139 | } 140 | 141 | } 142 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/model/UserModel.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.model; 2 | 3 | import java.io.Serializable; 4 | 5 | public class UserModel implements Serializable { 6 | 7 | /** 8 | * 9 | */ 10 | private static final long serialVersionUID = 1L; 11 | 12 | private int id; 13 | private String fullName; 14 | private String email; 15 | private String role; 16 | private Cart cart; 17 | 18 | public int getId() { 19 | return id; 20 | } 21 | 22 | public void setId(int id) { 23 | this.id = id; 24 | } 25 | 26 | public String getFullName() { 27 | return fullName; 28 | } 29 | 30 | public void setFullName(String fullName) { 31 | this.fullName = fullName; 32 | } 33 | 34 | public String getEmail() { 35 | return email; 36 | } 37 | 38 | public void setEmail(String email) { 39 | this.email = email; 40 | } 41 | 42 | public String getRole() { 43 | return role; 44 | } 45 | 46 | public void setRole(String role) { 47 | this.role = role; 48 | } 49 | 50 | public Cart getCart() { 51 | return cart; 52 | } 53 | 54 | public void setCart(Cart cart) { 55 | this.cart = cart; 56 | } 57 | 58 | @Override 59 | public String toString() { 60 | return "UserModel [id=" + id + ", fullName=" + fullName + ", email=" + email + ", role=" + role + "]"; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/repository/AddressRepository.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.repository; 2 | 3 | import com.isolutions4u.onlineshopping.model.Address; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | @Repository("addressRepository") 8 | public interface AddressRepository extends JpaRepository { 9 | 10 | Address findAddressByBilling(boolean billing); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/repository/CartLineRepository.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.repository; 2 | 3 | import com.isolutions4u.onlineshopping.model.CartLine; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | @Repository("cartLineRepository") 10 | public interface CartLineRepository extends JpaRepository { 11 | 12 | List findCartLineByCartId(int cartId); 13 | 14 | CartLine findCartLineByCartIdAndProductId(int cartId, int id); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/repository/CartRepository.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.repository; 2 | 3 | import com.isolutions4u.onlineshopping.model.Cart; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | @Repository("cartRepository") 8 | public interface CartRepository extends JpaRepository { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/repository/CategoryRepository.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.repository; 2 | 3 | import com.isolutions4u.onlineshopping.model.Category; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | ; 8 | 9 | @Repository("categoryRepository") 10 | public interface CategoryRepository extends JpaRepository { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/repository/ProductRepository.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.repository; 2 | 3 | import com.isolutions4u.onlineshopping.model.Product; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | @Repository("productRepository") 10 | public interface ProductRepository extends JpaRepository { 11 | 12 | List findProductByCategoryId(Integer categoryId); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/repository/UserRepository.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.repository; 2 | 3 | import com.isolutions4u.onlineshopping.model.User; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | @Repository("userRepository") 8 | public interface UserRepository extends JpaRepository { 9 | 10 | User findUserByEmail(String email); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/service/AddressService.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.service; 2 | 3 | import com.isolutions4u.onlineshopping.model.Address; 4 | 5 | public interface AddressService { 6 | 7 | boolean saveAddress(Address address); 8 | 9 | Address findAddressByBilling(boolean billing); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/service/AddressServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.service; 2 | 3 | import com.isolutions4u.onlineshopping.model.Address; 4 | import com.isolutions4u.onlineshopping.repository.AddressRepository; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.beans.factory.annotation.Qualifier; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service("addressService") 10 | public class AddressServiceImpl implements AddressService { 11 | 12 | @Qualifier("addressRepository") 13 | @Autowired 14 | private AddressRepository addressRepository; 15 | 16 | @Override 17 | public boolean saveAddress(Address address) { 18 | // TODO Auto-generated method stub 19 | addressRepository.saveAndFlush(address); 20 | return true; 21 | } 22 | 23 | @Override 24 | public Address findAddressByBilling(boolean billing) { 25 | // TODO Auto-generated method stub 26 | return addressRepository.findAddressByBilling(billing); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/service/CartLineService.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.service; 2 | 3 | import com.isolutions4u.onlineshopping.model.CartLine; 4 | 5 | import java.util.List; 6 | 7 | public interface CartLineService { 8 | 9 | public CartLine findCartLineById(int id); 10 | 11 | public boolean saveCartLine(CartLine cartLine); 12 | 13 | public boolean updateCartLine(CartLine cartLine); 14 | 15 | public boolean deleteCartLine(CartLine cartLine); 16 | 17 | public List findAllCartLine(int cartId); 18 | 19 | public List findCartLines(); 20 | 21 | CartLine findCartLineByCartIdAndProductId(int cartId, int id); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/service/CartLineServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.service; 2 | 3 | import com.isolutions4u.onlineshopping.model.Cart; 4 | import com.isolutions4u.onlineshopping.model.CartLine; 5 | import com.isolutions4u.onlineshopping.repository.CartLineRepository; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | @Service("cartLineService") 12 | public class CartLineServiceImpl implements CartLineService { 13 | 14 | @Autowired 15 | private CartService cartService; 16 | 17 | @Autowired 18 | private CartLineRepository cartLineRepository; 19 | 20 | @Override 21 | public CartLine findCartLineById(int id) { 22 | // TODO Auto-generated method stub 23 | return cartLineRepository.getOne(id); 24 | } 25 | 26 | @Override 27 | public boolean saveCartLine(CartLine cartLine) { 28 | // TODO Auto-generated method stub 29 | cartLineRepository.saveAndFlush(cartLine); 30 | return true; 31 | } 32 | 33 | @Override 34 | public boolean updateCartLine(CartLine cartLine) { 35 | // TODO Auto-generated method stub 36 | cartLineRepository.saveAndFlush(cartLine); 37 | return true; 38 | } 39 | 40 | @Override 41 | public boolean deleteCartLine(CartLine cartLine) { 42 | // TODO Auto-generated method stub 43 | cartLineRepository.delete(cartLine); 44 | return false; 45 | } 46 | 47 | @Override 48 | public List findAllCartLine(int cartId) { 49 | // TODO Auto-generated method stub 50 | return cartLineRepository.findAll(); 51 | } 52 | 53 | @Override 54 | public List findCartLines() { 55 | Cart cart = cartService.findCart(); 56 | return cartLineRepository.findCartLineByCartId(cart.getId()); 57 | } 58 | 59 | @Override 60 | public CartLine findCartLineByCartIdAndProductId(int cartId, int id) { 61 | // TODO Auto-generated method stub 62 | return cartLineRepository.findCartLineByCartIdAndProductId(cartId, id); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/service/CartService.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.service; 2 | 3 | import com.isolutions4u.onlineshopping.model.Cart; 4 | 5 | public interface CartService { 6 | 7 | boolean saveCart(Cart cart); 8 | 9 | boolean updateCart(Cart cart); 10 | 11 | Cart findCart(); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/service/CartServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.service; 2 | 3 | import com.isolutions4u.onlineshopping.model.Cart; 4 | import com.isolutions4u.onlineshopping.model.UserModel; 5 | import com.isolutions4u.onlineshopping.repository.CartRepository; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.beans.factory.annotation.Qualifier; 8 | import org.springframework.stereotype.Service; 9 | 10 | import javax.servlet.http.HttpSession; 11 | 12 | @Service("cartService") 13 | public class CartServiceImpl implements CartService { 14 | 15 | @Qualifier("cartRepository") 16 | @Autowired 17 | private CartRepository cartRepository; 18 | 19 | @Autowired 20 | private HttpSession httpSession; 21 | 22 | @Override 23 | public boolean saveCart(Cart cart) { 24 | // TODO Auto-generated method stub 25 | cartRepository.saveAndFlush(cart); 26 | return true; 27 | } 28 | 29 | @Override 30 | public boolean updateCart(Cart cart) { 31 | // TODO Auto-generated method stub 32 | cartRepository.saveAndFlush(cart); 33 | return true; 34 | } 35 | 36 | @Override 37 | public Cart findCart() { 38 | // TODO Auto-generated method stub 39 | return ((UserModel) httpSession.getAttribute("userModel")).getCart(); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/service/CategoryService.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.service; 2 | 3 | import com.isolutions4u.onlineshopping.model.Category; 4 | 5 | import java.util.List; 6 | 7 | public interface CategoryService { 8 | 9 | String saveCategory(Category category); 10 | 11 | List findAllCategories(); 12 | 13 | Category findCategoryById(Integer id); 14 | 15 | String deleteCategory(Integer id); 16 | 17 | String updateCategory(Category branch); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/service/CategoryServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.service; 2 | 3 | import com.isolutions4u.onlineshopping.model.Category; 4 | import com.isolutions4u.onlineshopping.repository.CategoryRepository; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.beans.factory.annotation.Qualifier; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | @Service("categoryService") 13 | public class CategoryServiceImpl implements CategoryService { 14 | 15 | @Qualifier("categoryRepository") 16 | @Autowired 17 | private CategoryRepository categoryRepository; 18 | 19 | @Override 20 | public String saveCategory(Category category) { 21 | // TODO Auto-generated method stub 22 | category.setActive(true); 23 | categoryRepository.saveAndFlush(category); 24 | return "Save Sucessfully"; 25 | } 26 | 27 | @Override 28 | public List findAllCategories() { 29 | // TODO Auto-generated method stub 30 | 31 | List categories = new ArrayList<>(); 32 | List categoriesCopy = new ArrayList<>(); 33 | categoryRepository.findAll().forEach(categories::add); 34 | categoriesCopy.addAll(categories); 35 | for (Category c : categories) { 36 | System.out.println(c); 37 | if (!c.isActive()) { 38 | categoriesCopy.remove(c); 39 | } 40 | } 41 | return categoriesCopy; 42 | 43 | } 44 | 45 | @Override 46 | public Category findCategoryById(Integer id) { 47 | // TODO Auto-generated method stub 48 | Category category = categoryRepository.getOne(id); 49 | if (!category.isActive()) { 50 | category = null; 51 | } 52 | return category; 53 | } 54 | 55 | @Override 56 | public String deleteCategory(Integer id) { 57 | // TODO Auto-generated method stub 58 | Category c = categoryRepository.getOne(id); 59 | c.setActive(false); 60 | categoryRepository.saveAndFlush(c); 61 | return "Deleted Successfully"; 62 | } 63 | 64 | @Override 65 | public String updateCategory(Category category) { 66 | // TODO Auto-generated method stub 67 | categoryRepository.saveAndFlush(category); 68 | return "Updated Successfully"; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/service/ProductService.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.service; 2 | 3 | import com.isolutions4u.onlineshopping.model.Product; 4 | 5 | import java.util.List; 6 | 7 | public interface ProductService { 8 | 9 | String saveProduct(Product product); 10 | 11 | List findAllProducts(); 12 | 13 | List findAllProductsForAdmin(); 14 | 15 | Product findProductById(Integer id); 16 | 17 | String deleteProduct(Integer id); 18 | 19 | String updateProduct(Product product); 20 | 21 | List findProductByCategoryId(Integer categoryId); 22 | 23 | Product findProductByIdForAdmin(int id); 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/service/ProductServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.service; 2 | 3 | import com.isolutions4u.onlineshopping.model.Product; 4 | import com.isolutions4u.onlineshopping.repository.ProductRepository; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.beans.factory.annotation.Qualifier; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | @Service("productService") 13 | public class ProductServiceImpl implements ProductService { 14 | 15 | @Qualifier("productRepository") 16 | @Autowired 17 | private ProductRepository productRepository; 18 | 19 | @Override 20 | public String saveProduct(Product product) { 21 | // TODO Auto-generated method stub 22 | productRepository.saveAndFlush(product); 23 | return "Product Added Sucessfully"; 24 | } 25 | 26 | @Override 27 | public List findAllProducts() { 28 | try { 29 | List products = new ArrayList<>(); 30 | List productsCopy = new ArrayList<>(); 31 | productRepository.findAll().forEach(products::add); 32 | productsCopy.addAll(products); 33 | for (Product p : products) { 34 | if (!p.isActive()) { 35 | productsCopy.remove(p); 36 | } 37 | } 38 | return productsCopy; 39 | } catch (Exception e) { 40 | e.printStackTrace(); 41 | return null; 42 | } 43 | 44 | } 45 | 46 | @Override 47 | public Product findProductById(Integer id) { 48 | // TODO Auto-generated method stub 49 | Product product = productRepository.getOne(id); 50 | if (!product.isActive()) 51 | product = null; 52 | 53 | return product; 54 | } 55 | 56 | @Override 57 | public String deleteProduct(Integer id) { 58 | 59 | Product product = productRepository.getOne(id); 60 | 61 | product.setActive(false); 62 | productRepository.saveAndFlush(product); 63 | 64 | return "Product Deleted Sucessfully"; 65 | } 66 | 67 | @Override 68 | public String updateProduct(Product product) { 69 | // TODO Auto-generated method stub 70 | productRepository.saveAndFlush(product); 71 | return "Product Updated Sucessfully"; 72 | } 73 | 74 | @Override 75 | public List findProductByCategoryId(Integer categoryId) { 76 | // TODO Auto-generated method stub 77 | List products = new ArrayList<>(); 78 | List productsCopy = new ArrayList<>(); 79 | productRepository.findProductByCategoryId(categoryId).forEach(products::add); 80 | productsCopy.addAll(products); 81 | for (Product p : products) { 82 | if (!p.isActive()) { 83 | productsCopy.remove(p); 84 | } 85 | } 86 | return productsCopy; 87 | } 88 | 89 | @Override 90 | public List findAllProductsForAdmin() { 91 | List products = new ArrayList<>(); 92 | productRepository.findAll().forEach(products::add); 93 | return products; 94 | } 95 | 96 | @Override 97 | public Product findProductByIdForAdmin(int id) { 98 | // TODO Auto-generated method stub 99 | Product product = productRepository.getOne(id); 100 | return product; 101 | } 102 | 103 | } 104 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.service; 2 | 3 | import com.isolutions4u.onlineshopping.model.User; 4 | 5 | public interface UserService { 6 | 7 | boolean saveUser(User user); 8 | 9 | User findUserByEmail(String email); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/service/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.service; 2 | 3 | import com.isolutions4u.onlineshopping.model.User; 4 | import com.isolutions4u.onlineshopping.repository.UserRepository; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.beans.factory.annotation.Qualifier; 7 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 8 | import org.springframework.stereotype.Service; 9 | 10 | @Service("userService") 11 | public class UserServiceImpl implements UserService { 12 | 13 | @Qualifier("userRepository") 14 | @Autowired 15 | private UserRepository userRepository; 16 | 17 | @Autowired 18 | private BCryptPasswordEncoder bCryptPasswordEncoder; 19 | 20 | @Override 21 | public boolean saveUser(User user) { 22 | // TODO Auto-generated method stub 23 | user.setPassword(bCryptPasswordEncoder.encode(user.getPassword())); 24 | userRepository.saveAndFlush(user); 25 | return true; 26 | } 27 | 28 | @Override 29 | public User findUserByEmail(String email) { 30 | // TODO Auto-generated method stub 31 | return userRepository.findUserByEmail(email); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /online-shopping/src/main/java/com/isolutions4u/onlineshopping/validator/ProductValidator.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.validator; 2 | 3 | import com.isolutions4u.onlineshopping.model.Product; 4 | import org.springframework.validation.Errors; 5 | import org.springframework.validation.Validator; 6 | 7 | public class ProductValidator implements Validator { 8 | 9 | @Override 10 | public boolean supports(Class clazz) { 11 | // TODO Auto-generated method stub 12 | return Product.class.equals(clazz); 13 | } 14 | 15 | @Override 16 | public void validate(Object target, Errors errors) { 17 | // TODO Auto-generated method stub 18 | Product product = (Product) target; 19 | 20 | // whether file has been selected or not 21 | if (product.getFile() == null || product.getFile().getOriginalFilename().equals("")) { 22 | errors.rejectValue("file", null, "Please select an image file to upload!"); 23 | return; 24 | } 25 | if (!(product.getFile().getContentType().equals("image/jpeg") 26 | || product.getFile().getContentType().equals("image/png"))) { 27 | errors.rejectValue("file", null, "Please use only an image file to upload!"); 28 | return; 29 | 30 | } 31 | 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /online-shopping/src/main/resources/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/resources/.DS_Store -------------------------------------------------------------------------------- /online-shopping/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # =============================== 2 | # = DATA SOURCE 3 | # =============================== 4 | spring.datasource.url=jdbc:mysql://localhost:3306/online_shopping_db?useSSL=false 5 | spring.datasource.username=root 6 | spring.datasource.password=Hello@123 7 | spring.datasource.testWhileIdle=true 8 | spring.datasource.validationQuery=SELECT 1 9 | # =============================== 10 | # = JPA / HIBERNATE 11 | # =============================== 12 | spring.jpa.show-sql=true 13 | spring.jpa.hibernate.ddl-auto=update 14 | spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy 15 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect 16 | #========================================= 17 | # = File Uploading 18 | #========================================= 19 | spring.http.multipart.max-file-size=10MB 20 | spring.http.multipart.max-request-size=10MB 21 | spring.http.multipart.file-size-threshold=1MB 22 | # ============================================================== 23 | # = Spring Security / Queries for AuthenticationManagerBuilder 24 | # ============================================================== 25 | spring.queries.users-query=select email, password, enabled from user_detail where email=? 26 | spring.queries.roles-query=select email, role from user_detail where email=? -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/.DS_Store -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/WEB-INF/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/WEB-INF/.DS_Store -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/WEB-INF/views/404.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" %> 3 | <%@taglib prefix="spring" uri="http://www.springframework.org/tags" %> 4 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Online Shopping - ${title } 13 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 | 39 | 40 | 41 | 50 | 51 | 52 | 53 |
54 |
55 |
56 |
57 |
58 |

${errorTitle }

59 |
60 |
${errorDescription }
61 |
62 |
63 |
64 | 65 |
66 | 67 |
68 | 69 | 70 | 71 | 72 | <%@include file="share/footer.jsp" %> 73 |
74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/WEB-INF/views/about.jsp: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 |

About Us

6 |
7 |

This is an about us page

8 | 9 |
10 | 11 | 12 |
-------------------------------------------------------------------------------- /online-shopping/src/main/webapp/WEB-INF/views/cart.jsp: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 |
5 |

${message }

6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 47 | 48 | 51 | 53 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 74 | 75 | 76 | 79 | 80 | 82 | 85 | 86 | 87 | 88 |
ProductPriceQuantitySubtotal
28 |
29 | 35 |
36 |

${cartLine.product.name } 37 | 38 | (Not Available) 39 | 40 | 41 |

42 |

Brand - ${cartLine.product.brand }

43 |

Description - ${cartLine.product.description }

44 |
45 |
46 |
₹ ${cartLine.buyingPrice }₹ 52 | ${cartLine.total } 54 | 58 | 59 | 60 | 61 |
Total ₹ 73 | ${userModel.cart.grandTotal }
Continue 78 | ShoppingCheckout 83 | 84 |
89 |
90 | 91 |
92 |
93 |

Your cart is empty!

94 | 95 |
96 | 97 |
98 |
99 | 100 |
101 | 102 | 103 |
-------------------------------------------------------------------------------- /online-shopping/src/main/webapp/WEB-INF/views/contact.jsp: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 |

Contact Us

6 |
7 |

This is an contact us page

8 | 9 |
10 | 11 | 12 |
-------------------------------------------------------------------------------- /online-shopping/src/main/webapp/WEB-INF/views/flows/register/signup-billing.jsp: -------------------------------------------------------------------------------- 1 | <%@taglib prefix="sf" uri="http://www.springframework.org/tags/form" %> 2 | <%@include file="../shared/flows-header.jsp" %> 3 | 4 |
5 |
6 |
7 |
8 |
9 |

Sign Up - Personal

10 |
11 |
12 | 14 |
15 | 17 |
18 | 20 | 22 |
23 |
24 | 25 |
26 | 28 |
29 | 31 | 33 |
34 |
35 | 36 |
37 | 38 |
39 | 41 | 42 |
43 |
44 |
45 | 47 |
48 | 50 | 51 |
52 |
53 | 54 | 55 |
56 | 57 |
58 | 60 | 61 |
62 |
63 | 64 |
65 | 66 |
67 | 69 | 70 |
71 |
72 | 73 |
74 |
75 | 76 | 80 | 81 | 85 | 86 |
87 | 88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | 96 | 97 | <%@ include file="../shared/flows-footer.jsp" %> -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/WEB-INF/views/flows/register/signup-confirm.jsp: -------------------------------------------------------------------------------- 1 | <%@include file="../shared/flows-header.jsp" %> 2 | 3 |
4 |
5 | 6 |
7 |
8 |
9 |

Personal Details

10 | 11 |
12 |
13 | 14 | 15 |
16 |

Name : ${registerModel.user.firstName } ${registerModel.user.firstName }

17 |
Email : ${registerModel.user.email }
18 |
Contact Number : ${registerModel.user.contactNumber }
19 |
Role : ${registerModel.user.role }
20 |
21 | 22 |
23 | 29 | 30 |
31 | 32 |
33 | 34 | 35 |
36 |
37 |
38 |

Address

39 | 40 |
41 |
42 | 43 | 44 |
45 |

${registerModel.billing.addressLineOne }

46 |

${registerModel.billing.addressLineTwo }

47 |

${registerModel.billing.city }-${registerModel.billing.postalCode }

48 |

${registerModel.billing.state }-${registerModel.billing.country }

49 |
50 | 51 |
52 | 57 | 58 |
59 | 60 |
61 |
62 | 63 |
64 |
65 |
66 | Confirm 68 | 69 |
70 |
71 |
72 |
73 | 74 | 75 | <%@ include file="../shared/flows-footer.jsp" %> -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/WEB-INF/views/flows/register/signup-flow.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 38 | 39 | 40 | 41 | 43 | 44 | 45 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/WEB-INF/views/flows/register/signup-personal.jsp: -------------------------------------------------------------------------------- 1 | <%@taglib prefix="sf" uri="http://www.springframework.org/tags/form" %> 2 | <%@include file="../shared/flows-header.jsp" %> 3 | 4 |
5 |
6 |
7 |
8 |
9 |

Sign Up - Personal

10 |
11 |
12 | 14 |
15 | 17 |
18 | 20 | 21 |
22 |
23 | 24 |
25 | 27 |
28 | 30 | 31 |
32 |
33 | 34 |
35 | 36 |
37 | 39 | 40 |
41 |
42 | 43 |
44 | 46 |
47 | 49 | 51 |
52 |
53 | 54 |
55 | 56 |
57 | 59 | 60 |
61 |
62 | 63 |
64 | 66 |
67 | 69 | 71 |
72 |
73 | 74 | 75 | 76 |
77 | 79 |
80 | 85 |
86 |
87 | 88 |
89 |
90 | 91 | 95 | 96 |
97 | 98 |
99 | 100 |
101 | 102 |
103 |
104 | 105 |
106 |
107 |
108 | 109 | <%@ include file="../shared/flows-footer.jsp" %> -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/WEB-INF/views/flows/register/signup-success.jsp: -------------------------------------------------------------------------------- 1 | <%@include file="../shared/flows-header.jsp" %> 2 | 3 | 4 |
5 | 6 |
7 |
8 |
9 |

Welcome!

10 |

http://www.isolutions4u.com

11 |
You can use your email address as username to login!
12 |
13 | Login 14 | Here 15 |
16 |
17 | 18 |
19 | 20 |
21 | 22 | 23 |
24 | 25 | 26 | <%@ include file="../shared/flows-footer.jsp" %> -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/WEB-INF/views/flows/shared/flows-footer.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | <%@include file="../../share/footer.jsp" %> 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/WEB-INF/views/flows/shared/flows-header.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" %> 3 | <%@taglib prefix="spring" uri="http://www.springframework.org/tags" %> 4 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 5 | 6 | 7 | 8 | 9 | 10 | 11 | Online Shopping - ${title } 12 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 27 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
40 | 41 | 42 | <%@include file="flows-navbar.jsp" %> 43 | 44 | 45 |
-------------------------------------------------------------------------------- /online-shopping/src/main/webapp/WEB-INF/views/flows/shared/flows-navbar.jsp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/WEB-INF/views/home.jsp: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 |
6 | <%@include file="./share/sidebar.jsp" %> 7 |
8 | 9 |
10 | 11 | 53 | 54 |
55 |
56 |

Our Most Viewed Products

57 |
58 |
59 |
60 | 61 |
62 | 63 |
64 |
65 | 66 |
{{product.name}}
67 |
68 |
69 |

70 |

71 | View 72 |
73 |
74 | 75 |
76 | 77 |
78 |

Checkout more products!

79 |
80 | More Products 81 |
82 | 83 |
84 | 85 |
86 |
87 |

Our Most Purchased Products

88 |
89 |
90 |
91 |
92 | 93 |
94 |
95 | {{product.name}} 96 |
97 |
98 |
99 |

100 |

101 | View 102 |
103 |
104 |
105 | 106 |
107 |

Checkout more products!

108 |
109 | More Products 110 |
111 | 112 |
113 | 114 |
115 | 116 |
117 | 118 |
119 | -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/WEB-INF/views/listProducts.jsp: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 | 6 | 7 |
8 | <%@include file="share/sidebar.jsp" %> 9 | 10 |
11 | 12 | 13 |
14 | 15 | 16 |
17 | 18 |
19 | 20 | 23 | 24 | 28 | 29 | 30 | 31 | 32 | 33 | 36 | 42 | 43 |
44 |
45 | 46 | 47 |
48 | 49 |
50 |
51 |
52 | 53 | 54 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 |
NameBrandPriceQty. Available
NameBrandPriceQty. Available
82 |
83 |
84 |
85 |
86 |
87 | 88 |
89 |
90 | -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/WEB-INF/views/login.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" %> 3 | <%@taglib prefix="spring" uri="http://www.springframework.org/tags" %> 4 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 5 | 6 | 7 | 8 | 9 | 10 | 11 | Online Shopping - ${title } 12 | 16 | 17 | 18 | 20 | 21 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
34 | 35 | 36 | 45 | 46 | 47 |
48 |
49 | 50 | 51 |
52 |
53 |
${message }
54 |
55 |
56 | 57 |
58 | 59 | 60 |
61 |
62 |
${logout }
63 |
64 |
65 | 66 |
67 | 68 |
69 |
70 |
71 |
72 |

Login

73 |
74 |
75 |
77 |
78 | 80 |
81 | 82 |
83 |
84 | 85 |
86 | 88 |
89 | 90 |
91 |
92 | 93 |
94 |
95 | 96 | 98 |
99 |
100 | 101 |
102 |
103 | 108 |
109 |
110 |
111 |
112 |
113 | 114 | 115 | <%@include file="share/footer.jsp" %> 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 |
129 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/WEB-INF/views/manageProduct.jsp: -------------------------------------------------------------------------------- 1 | <%@taglib prefix="sf" uri="http://www.springframework.org/tags/form" %> 2 | 3 |
4 |
5 | 6 |
7 |
8 | 9 | ${message } 10 |
11 |
12 |
13 | 14 |
15 |
16 |
17 |

Product Management

18 |
19 |
20 | 21 | 24 |
25 | 27 |
28 | 30 | 31 |
32 |
33 | 34 |
35 | 37 | 38 |
39 | 41 | 42 |
43 |
44 | 45 |
46 | 48 | 49 |
50 | 53 | 54 |
55 |
56 | 57 |
58 | 60 | 61 |
62 | 64 | 65 | 66 |
67 |
68 | 69 | 70 |
71 | 73 | 74 |
75 | 77 | 78 |
79 |
80 | 81 | 82 |
83 | 85 | 86 |
87 | 88 | 89 |
90 |
91 | 92 | 93 |
94 | 96 | 97 |
98 | 101 | 102 | 103 |
104 |
105 | 109 |
110 |
111 | 112 |
113 |
114 | 115 |
116 |
117 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 |
127 |
128 | 129 |
130 | 131 |
132 |
133 |
134 |
135 | 136 | 137 |
138 |
139 |

Available Products

140 |
141 |
142 |
143 |
144 |
145 | 146 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 |
Id NameBrandQuantityUnit PriceActiveEdit
Id NameBrandQuantityUnit PriceActiveEdit
174 |
175 |
176 |
177 |
178 | 179 | 180 | 232 | 233 | 234 |
-------------------------------------------------------------------------------- /online-shopping/src/main/webapp/WEB-INF/views/page.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" %> 3 | <%@taglib prefix="spring" uri="http://www.springframework.org/tags" %> 4 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Online Shopping - ${title } 17 | 21 | 22 | 23 | 25 | 26 | 27 | 29 | 30 | 31 | 32 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |
45 | 46 | 47 | <%@include file="share/navbar.jsp" %> 48 | 49 | 50 |
51 | 52 | 53 | <%@include file="home.jsp" %> 54 | 55 | 56 | 57 | <%@include file="about.jsp" %> 58 | 59 | 60 | 61 | <%@include file="contact.jsp" %> 62 | 63 | 64 | 65 | 67 | <%@include file="listProducts.jsp" %> 68 | 69 | 70 | 71 | 72 | 73 | <%@include file="singleProduct.jsp" %> 74 | 75 | 76 | 77 | 78 | <%@include file="manageProduct.jsp" %> 79 | 80 | 81 | 82 | 83 | <%@include file="cart.jsp" %> 84 | 85 | 86 | 87 |
88 | 89 | 90 | 91 | 92 | <%@include file="share/footer.jsp" %> 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 |
115 | 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/WEB-INF/views/share/footer.jsp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/WEB-INF/views/share/navbar.jsp: -------------------------------------------------------------------------------- 1 | <%@taglib prefix="security" 2 | uri="http://www.springframework.org/security/tags" %> 3 | 4 | 65 | 66 | 67 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/WEB-INF/views/share/sidebar.jsp: -------------------------------------------------------------------------------- 1 |

Shop Name

2 | 3 |
4 | 5 | ${category.name } 7 | 8 |
-------------------------------------------------------------------------------- /online-shopping/src/main/webapp/WEB-INF/views/singleProduct.jsp: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |
5 | 10 |
11 | 12 |
13 | 14 |
15 | 16 |
17 |
18 | 20 |
21 |
22 | 23 | 24 |
25 |

${product.name }

26 |
27 |

${product.description }

28 |
29 |

30 | Price : ₹ ${product.unitPrice } /- 31 |

32 |
33 | 34 | 35 | 36 | 37 |
38 | Qty. Available : Out of Stock 39 |
40 |
41 | 42 |
Qty. Available : ${product.quantity }
43 | 44 |
45 | 46 |
47 | 48 | 49 | 50 | 51 | Add to Cart 53 | 54 | 55 | Add to Cart 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | Edit 67 | 68 | 69 | 70 | Back 71 | 72 |
73 |
74 |
-------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/.DS_Store -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/css/dataTables.bootstrap.css: -------------------------------------------------------------------------------- 1 | table.dataTable { 2 | clear: both; 3 | margin-top: 6px !important; 4 | margin-bottom: 6px !important; 5 | max-width: none !important; 6 | border-collapse: separate !important; 7 | } 8 | 9 | table.dataTable td, 10 | table.dataTable th { 11 | -webkit-box-sizing: content-box; 12 | box-sizing: content-box; 13 | } 14 | 15 | table.dataTable td.dataTables_empty, 16 | table.dataTable th.dataTables_empty { 17 | text-align: center; 18 | } 19 | 20 | table.dataTable.nowrap th, 21 | table.dataTable.nowrap td { 22 | white-space: nowrap; 23 | } 24 | 25 | div.dataTables_wrapper div.dataTables_length label { 26 | font-weight: normal; 27 | text-align: left; 28 | white-space: nowrap; 29 | } 30 | 31 | div.dataTables_wrapper div.dataTables_length select { 32 | width: 75px; 33 | display: inline-block; 34 | } 35 | 36 | div.dataTables_wrapper div.dataTables_filter { 37 | text-align: right; 38 | } 39 | 40 | div.dataTables_wrapper div.dataTables_filter label { 41 | font-weight: normal; 42 | white-space: nowrap; 43 | text-align: left; 44 | } 45 | 46 | div.dataTables_wrapper div.dataTables_filter input { 47 | margin-left: 0.5em; 48 | display: inline-block; 49 | width: auto; 50 | } 51 | 52 | div.dataTables_wrapper div.dataTables_info { 53 | padding-top: 8px; 54 | white-space: nowrap; 55 | } 56 | 57 | div.dataTables_wrapper div.dataTables_paginate { 58 | margin: 0; 59 | white-space: nowrap; 60 | text-align: right; 61 | } 62 | 63 | div.dataTables_wrapper div.dataTables_paginate ul.pagination { 64 | margin: 2px 0; 65 | white-space: nowrap; 66 | } 67 | 68 | div.dataTables_wrapper div.dataTables_processing { 69 | position: absolute; 70 | top: 50%; 71 | left: 50%; 72 | width: 200px; 73 | margin-left: -100px; 74 | margin-top: -26px; 75 | text-align: center; 76 | padding: 1em 0; 77 | } 78 | 79 | table.dataTable thead > tr > th.sorting_asc, table.dataTable thead > tr > th.sorting_desc, table.dataTable thead > tr > th.sorting, 80 | table.dataTable thead > tr > td.sorting_asc, 81 | table.dataTable thead > tr > td.sorting_desc, 82 | table.dataTable thead > tr > td.sorting { 83 | padding-right: 30px; 84 | } 85 | 86 | table.dataTable thead > tr > th:active, 87 | table.dataTable thead > tr > td:active { 88 | outline: none; 89 | } 90 | 91 | table.dataTable thead .sorting, 92 | table.dataTable thead .sorting_asc, 93 | table.dataTable thead .sorting_desc, 94 | table.dataTable thead .sorting_asc_disabled, 95 | table.dataTable thead .sorting_desc_disabled { 96 | cursor: pointer; 97 | position: relative; 98 | } 99 | 100 | table.dataTable thead .sorting:after, 101 | table.dataTable thead .sorting_asc:after, 102 | table.dataTable thead .sorting_desc:after, 103 | table.dataTable thead .sorting_asc_disabled:after, 104 | table.dataTable thead .sorting_desc_disabled:after { 105 | position: absolute; 106 | bottom: 8px; 107 | right: 8px; 108 | display: block; 109 | font-family: 'Glyphicons Halflings'; 110 | opacity: 0.5; 111 | } 112 | 113 | table.dataTable thead .sorting:after { 114 | opacity: 0.2; 115 | content: "\e150"; 116 | /* sort */ 117 | } 118 | 119 | table.dataTable thead .sorting_asc:after { 120 | content: "\e155"; 121 | /* sort-by-attributes */ 122 | } 123 | 124 | table.dataTable thead .sorting_desc:after { 125 | content: "\e156"; 126 | /* sort-by-attributes-alt */ 127 | } 128 | 129 | table.dataTable thead .sorting_asc_disabled:after, 130 | table.dataTable thead .sorting_desc_disabled:after { 131 | color: #eee; 132 | } 133 | 134 | div.dataTables_scrollHead table.dataTable { 135 | margin-bottom: 0 !important; 136 | } 137 | 138 | div.dataTables_scrollBody table { 139 | border-top: none; 140 | margin-top: 0 !important; 141 | margin-bottom: 0 !important; 142 | } 143 | 144 | div.dataTables_scrollBody table thead .sorting:after, 145 | div.dataTables_scrollBody table thead .sorting_asc:after, 146 | div.dataTables_scrollBody table thead .sorting_desc:after { 147 | display: none; 148 | } 149 | 150 | div.dataTables_scrollBody table tbody tr:first-child th, 151 | div.dataTables_scrollBody table tbody tr:first-child td { 152 | border-top: none; 153 | } 154 | 155 | div.dataTables_scrollFoot table { 156 | margin-top: 0 !important; 157 | border-top: none; 158 | } 159 | 160 | @media screen and (max-width: 767px) { 161 | div.dataTables_wrapper div.dataTables_length, 162 | div.dataTables_wrapper div.dataTables_filter, 163 | div.dataTables_wrapper div.dataTables_info, 164 | div.dataTables_wrapper div.dataTables_paginate { 165 | text-align: center; 166 | } 167 | } 168 | 169 | table.dataTable.table-condensed > thead > tr > th { 170 | padding-right: 20px; 171 | } 172 | 173 | table.dataTable.table-condensed .sorting:after, 174 | table.dataTable.table-condensed .sorting_asc:after, 175 | table.dataTable.table-condensed .sorting_desc:after { 176 | top: 6px; 177 | right: 6px; 178 | } 179 | 180 | table.table-bordered.dataTable th, 181 | table.table-bordered.dataTable td { 182 | border-left-width: 0; 183 | } 184 | 185 | table.table-bordered.dataTable th:last-child, table.table-bordered.dataTable th:last-child, 186 | table.table-bordered.dataTable td:last-child, 187 | table.table-bordered.dataTable td:last-child { 188 | border-right-width: 0; 189 | } 190 | 191 | table.table-bordered.dataTable tbody th, 192 | table.table-bordered.dataTable tbody td { 193 | border-bottom-width: 0; 194 | } 195 | 196 | div.dataTables_scrollHead table.table-bordered { 197 | border-bottom-width: 0; 198 | } 199 | 200 | div.table-responsive > div.dataTables_wrapper > div.row { 201 | margin: 0; 202 | } 203 | 204 | div.table-responsive > div.dataTables_wrapper > div.row > div[class^="col-"]:first-child { 205 | padding-left: 0; 206 | } 207 | 208 | div.table-responsive > div.dataTables_wrapper > div.row > div[class^="col-"]:last-child { 209 | padding-right: 0; 210 | } 211 | -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/css/myapp.css: -------------------------------------------------------------------------------- 1 | html { 2 | height: 100%; 3 | } 4 | 5 | body { 6 | padding-top: 70px; 7 | height: 100%; 8 | } 9 | 10 | .slide-image { 11 | width: 100%; 12 | } 13 | 14 | .carousel-holder { 15 | margin-bottom: 30px; 16 | } 17 | 18 | .carousel-control, .item { 19 | border-radius: 4px; 20 | } 21 | 22 | .caption { 23 | height: 130px; 24 | overflow: hidden; 25 | } 26 | 27 | .caption h4 { 28 | white-space: nowrap; 29 | } 30 | 31 | .thumbnail img { 32 | width: 100%; 33 | } 34 | 35 | .ratings { 36 | padding-right: 10px; 37 | padding-left: 10px; 38 | color: #d17581; 39 | } 40 | 41 | .thumbnail { 42 | padding: 0; 43 | } 44 | 45 | .thumbnail .caption-full { 46 | padding: 9px; 47 | color: #333; 48 | } 49 | 50 | footer { 51 | margin: 0; 52 | } 53 | 54 | /* 55 | custom styling 56 | */ 57 | .wrapper { 58 | min-height: 100%; 59 | position: relative; 60 | } 61 | 62 | .content { 63 | padding-bottom: 60px; /*height of the footer*/ 64 | } 65 | 66 | .footer { 67 | width: 100%; 68 | position: absolute; 69 | bottom: 20px; 70 | height: 60px; 71 | } 72 | 73 | .dataTableImg { 74 | width: 100px; 75 | height: 100px; 76 | } 77 | 78 | .has-success { 79 | color: #4582ec; 80 | } 81 | 82 | .help-block { 83 | color: #FF0000; 84 | } 85 | 86 | .adminDataTableImg { 87 | height: 50px; 88 | width: 50px; 89 | } 90 | 91 | /*Toggle Switch code*/ 92 | 93 | /* The switch - the box around the slider */ 94 | .switch { 95 | width: 50px; 96 | height: 30px; 97 | position: relative; 98 | display: inline-block; 99 | } 100 | 101 | /* Hide default HTML checkbox */ 102 | .switch input { 103 | display: none; 104 | } 105 | 106 | /* The slider */ 107 | .slider { 108 | position: absolute; 109 | cursor: pointer; 110 | top: 0; 111 | left: 0; 112 | right: 0; 113 | bottom: 0; 114 | background-color: #ccc; 115 | border-radius: 30px; 116 | transition: .5s; 117 | } 118 | 119 | .slider:before { 120 | position: absolute; 121 | content: ""; 122 | height: 20px; 123 | width: 20px; 124 | left: 5px; 125 | bottom: 5px; 126 | background-color: #fff; 127 | border-radius: 50%; 128 | transition: .5s; 129 | } 130 | 131 | input:checked + .slider { 132 | background-color: #1863E6; 133 | } 134 | 135 | input:focus + .slider { 136 | box-shadow: 0 0 1px #2196F3; 137 | } 138 | 139 | input:checked + .slider:before { 140 | transform: translateX(20px); 141 | } 142 | 143 | .table-responsive { 144 | overflow-x: inherit; 145 | } 146 | 147 | /* Cart CSS */ 148 | .table > tbody > tr > td, .table > tfoot > tr > td { 149 | vertical-align: middle; 150 | } 151 | 152 | @media screen and (max-width: 600px) { 153 | table#cart tbody td .form-control { 154 | width: 20%; 155 | display: inline !important; 156 | } 157 | 158 | .actions .btn { 159 | width: 36%; 160 | margin: 1.5em 0; 161 | } 162 | 163 | .actions .btn-info { 164 | float: left; 165 | } 166 | 167 | .actions .btn-danger { 168 | float: right; 169 | } 170 | 171 | table#cart thead { 172 | display: none; 173 | } 174 | 175 | table#cart tbody td { 176 | display: block; 177 | padding: .6rem; 178 | min-width: 320px; 179 | } 180 | 181 | table#cart tbody tr td:first-child { 182 | background: #333; 183 | color: #fff; 184 | } 185 | 186 | table#cart tbody td:before { 187 | content: attr(data-th); 188 | font-weight: bold; 189 | display: inline-block; 190 | width: 8rem; 191 | } 192 | 193 | table#cart tfoot td { 194 | display: block; 195 | } 196 | 197 | table#cart tfoot td .btn { 198 | display: block; 199 | } 200 | } 201 | 202 | .cartImg { 203 | width: 100px; 204 | height: 100px; 205 | } 206 | 207 | .unavailable { 208 | color: red; 209 | } -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/images/PRD3707BEDE5B.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/images/PRD3707BEDE5B.jpg -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/images/PRD5372385A25.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/images/PRD5372385A25.jpg -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/images/PRD6CC820B96D.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/images/PRD6CC820B96D.jpg -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/images/PRDABC123DEFX.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/images/PRDABC123DEFX.jpg -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/images/PRDABCXYZDEFX.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/images/PRDABCXYZDEFX.jpg -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/images/PRDCF1E6B7BE1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/images/PRDCF1E6B7BE1.jpg -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/images/PRDDEF123DEFX.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/images/PRDDEF123DEFX.jpg -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/images/PRDMNO123PQRX.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/images/PRDMNO123PQRX.jpg -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/images/PRDPQR123WGTX.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/images/PRDPQR123WGTX.jpg -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/images/PRO6532CAF4A5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/images/PRO6532CAF4A5.jpg -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/images/PRO762AF8DA76.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/images/PRO762AF8DA76.jpg -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/images/PRO7C4403B8DB.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/images/PRO7C4403B8DB.jpg -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/images/PRO84B37BEB32.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/images/PRO84B37BEB32.jpg -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/images/PRO8E42B8DC7C.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/images/PRO8E42B8DC7C.jpg -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/images/PROBC409D9452.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/images/PROBC409D9452.jpg -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/images/PROC67489CF18.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/images/PROC67489CF18.jpg -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/images/PROF02EB40085.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/images/PROF02EB40085.jpg -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/images/PROFAFCC5BE84.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/images/PROFAFCC5BE84.jpg -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/images/banner1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/images/banner1.jpg -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/images/banner2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/images/banner2.jpg -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/images/banner3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/images/banner3.jpg -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/images/banner4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/images/banner4.jpg -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/images/pre-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dangi-ai/online-shopping/fce8873144071880f0da4482c8a37f3241c1c2da/online-shopping/src/main/webapp/static/images/pre-loader.gif -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/js/bootbox.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * bootbox.js v4.4.0 3 | * 4 | * http://bootboxjs.com/license.txt 5 | */ 6 | !function(a,b){"use strict";"function"==typeof define&&define.amd?define(["jquery"],b):"object"==typeof exports?module.exports=b(require("jquery")):a.bootbox=b(a.jQuery)}(this,function a(b,c){"use strict";function d(a){var b=q[o.locale];return b?b[a]:q.en[a]}function e(a,c,d){a.stopPropagation(),a.preventDefault();var e=b.isFunction(d)&&d.call(c,a)===!1;e||c.modal("hide")}function f(a){var b,c=0;for(b in a)c++;return c}function g(a,c){var d=0;b.each(a,function(a,b){c(a,b,d++)})}function h(a){var c,d;if("object"!=typeof a)throw new Error("Please supply an object of options");if(!a.message)throw new Error("Please specify a message");return a=b.extend({},o,a),a.buttons||(a.buttons={}),c=a.buttons,d=f(c),g(c,function(a,e,f){if(b.isFunction(e)&&(e=c[a]={callback:e}),"object"!==b.type(e))throw new Error("button with key "+a+" must be an object");e.label||(e.label=a),e.className||(e.className=2>=d&&f===d-1?"btn-primary":"btn-default")}),a}function i(a,b){var c=a.length,d={};if(1>c||c>2)throw new Error("Invalid argument length");return 2===c||"string"==typeof a[0]?(d[b[0]]=a[0],d[b[1]]=a[1]):d=a[0],d}function j(a,c,d){return b.extend(!0,{},a,i(c,d))}function k(a,b,c,d){var e={className:"bootbox-"+a,buttons:l.apply(null,b)};return m(j(e,d,c),b)}function l(){for(var a={},b=0,c=arguments.length;c>b;b++){var e=arguments[b],f=e.toLowerCase(),g=e.toUpperCase();a[f]={label:d(g)}}return a}function m(a,b){var d={};return g(b,function(a,b){d[b]=!0}),g(a.buttons,function(a){if(d[a]===c)throw new Error("button key "+a+" is not allowed (options are "+b.join("\n")+")")}),a}var n={dialog:"",header:"",footer:"",closeButton:"",form:"
",inputs:{text:"",textarea:"",email:"",select:"",checkbox:"
",date:"",time:"",number:"",password:""}},o={locale:"en",backdrop:"static",animate:!0,className:null,closeButton:!0,show:!0,container:"body"},p={};p.alert=function(){var a;if(a=k("alert",["ok"],["message","callback"],arguments),a.callback&&!b.isFunction(a.callback))throw new Error("alert requires callback property to be a function when provided");return a.buttons.ok.callback=a.onEscape=function(){return b.isFunction(a.callback)?a.callback.call(this):!0},p.dialog(a)},p.confirm=function(){var a;if(a=k("confirm",["cancel","confirm"],["message","callback"],arguments),a.buttons.cancel.callback=a.onEscape=function(){return a.callback.call(this,!1)},a.buttons.confirm.callback=function(){return a.callback.call(this,!0)},!b.isFunction(a.callback))throw new Error("confirm requires a callback");return p.dialog(a)},p.prompt=function(){var a,d,e,f,h,i,k;if(f=b(n.form),d={className:"bootbox-prompt",buttons:l("cancel","confirm"),value:"",inputType:"text"},a=m(j(d,arguments,["title","callback"]),["cancel","confirm"]),i=a.show===c?!0:a.show,a.message=f,a.buttons.cancel.callback=a.onEscape=function(){return a.callback.call(this,null)},a.buttons.confirm.callback=function(){var c;switch(a.inputType){case"text":case"textarea":case"email":case"select":case"date":case"time":case"number":case"password":c=h.val();break;case"checkbox":var d=h.find("input:checked");c=[],g(d,function(a,d){c.push(b(d).val())})}return a.callback.call(this,c)},a.show=!1,!a.title)throw new Error("prompt requires a title");if(!b.isFunction(a.callback))throw new Error("prompt requires a callback");if(!n.inputs[a.inputType])throw new Error("invalid prompt type");switch(h=b(n.inputs[a.inputType]),a.inputType){case"text":case"textarea":case"email":case"date":case"time":case"number":case"password":h.val(a.value);break;case"select":var o={};if(k=a.inputOptions||[],!b.isArray(k))throw new Error("Please pass an array of input options");if(!k.length)throw new Error("prompt with select requires options");g(k,function(a,d){var e=h;if(d.value===c||d.text===c)throw new Error("given options in wrong format");d.group&&(o[d.group]||(o[d.group]=b("").attr("label",d.group)),e=o[d.group]),e.append("")}),g(o,function(a,b){h.append(b)}),h.val(a.value);break;case"checkbox":var q=b.isArray(a.value)?a.value:[a.value];if(k=a.inputOptions||[],!k.length)throw new Error("prompt with checkbox requires options");if(!k[0].value||!k[0].text)throw new Error("given options in wrong format");h=b("
"),g(k,function(c,d){var e=b(n.inputs[a.inputType]);e.find("input").attr("value",d.value),e.find("label").append(d.text),g(q,function(a,b){b===d.value&&e.find("input").prop("checked",!0)}),h.append(e)})}return a.placeholder&&h.attr("placeholder",a.placeholder),a.pattern&&h.attr("pattern",a.pattern),a.maxlength&&h.attr("maxlength",a.maxlength),f.append(h),f.on("submit",function(a){a.preventDefault(),a.stopPropagation(),e.find(".btn-primary").click()}),e=p.dialog(a),e.off("shown.bs.modal"),e.on("shown.bs.modal",function(){h.focus()}),i===!0&&e.modal("show"),e},p.dialog=function(a){a=h(a);var d=b(n.dialog),f=d.find(".modal-dialog"),i=d.find(".modal-body"),j=a.buttons,k="",l={onEscape:a.onEscape};if(b.fn.modal===c)throw new Error("$.fn.modal is not defined; please double check you have included the Bootstrap JavaScript library. See http://getbootstrap.com/javascript/ for more details.");if(g(j,function(a,b){k+="",l[a]=b.callback}),i.find(".bootbox-body").html(a.message),a.animate===!0&&d.addClass("fade"),a.className&&d.addClass(a.className),"large"===a.size?f.addClass("modal-lg"):"small"===a.size&&f.addClass("modal-sm"),a.title&&i.before(n.header),a.closeButton){var m=b(n.closeButton);a.title?d.find(".modal-header").prepend(m):m.css("margin-top","-10px").prependTo(i)}return a.title&&d.find(".modal-title").html(a.title),k.length&&(i.after(n.footer),d.find(".modal-footer").html(k)),d.on("hidden.bs.modal",function(a){a.target===this&&d.remove()}),d.on("shown.bs.modal",function(){d.find(".btn-primary:first").focus()}),"static"!==a.backdrop&&d.on("click.dismiss.bs.modal",function(a){d.children(".modal-backdrop").length&&(a.currentTarget=d.children(".modal-backdrop").get(0)),a.target===a.currentTarget&&d.trigger("escape.close.bb")}),d.on("escape.close.bb",function(a){l.onEscape&&e(a,d,l.onEscape)}),d.on("click",".modal-footer button",function(a){var c=b(this).data("bb-handler");e(a,d,l[c])}),d.on("click",".bootbox-close-button",function(a){e(a,d,l.onEscape)}),d.on("keyup",function(a){27===a.which&&d.trigger("escape.close.bb")}),b(a.container).append(d),d.modal({backdrop:a.backdrop?"static":!1,keyboard:!1,show:!1}),a.show&&d.modal("show"),d},p.setDefaults=function(){var a={};2===arguments.length?a[arguments[0]]=arguments[1]:a=arguments[0],b.extend(o,a)},p.hideAll=function(){return b(".bootbox").modal("hide"),p};var q={bg_BG:{OK:"Ок",CANCEL:"Отказ",CONFIRM:"Потвърждавам"},br:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Sim"},cs:{OK:"OK",CANCEL:"Zrušit",CONFIRM:"Potvrdit"},da:{OK:"OK",CANCEL:"Annuller",CONFIRM:"Accepter"},de:{OK:"OK",CANCEL:"Abbrechen",CONFIRM:"Akzeptieren"},el:{OK:"Εντάξει",CANCEL:"Ακύρωση",CONFIRM:"Επιβεβαίωση"},en:{OK:"OK",CANCEL:"Cancel",CONFIRM:"OK"},es:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Aceptar"},et:{OK:"OK",CANCEL:"Katkesta",CONFIRM:"OK"},fa:{OK:"قبول",CANCEL:"لغو",CONFIRM:"تایید"},fi:{OK:"OK",CANCEL:"Peruuta",CONFIRM:"OK"},fr:{OK:"OK",CANCEL:"Annuler",CONFIRM:"D'accord"},he:{OK:"אישור",CANCEL:"ביטול",CONFIRM:"אישור"},hu:{OK:"OK",CANCEL:"Mégsem",CONFIRM:"Megerősít"},hr:{OK:"OK",CANCEL:"Odustani",CONFIRM:"Potvrdi"},id:{OK:"OK",CANCEL:"Batal",CONFIRM:"OK"},it:{OK:"OK",CANCEL:"Annulla",CONFIRM:"Conferma"},ja:{OK:"OK",CANCEL:"キャンセル",CONFIRM:"確認"},lt:{OK:"Gerai",CANCEL:"Atšaukti",CONFIRM:"Patvirtinti"},lv:{OK:"Labi",CANCEL:"Atcelt",CONFIRM:"Apstiprināt"},nl:{OK:"OK",CANCEL:"Annuleren",CONFIRM:"Accepteren"},no:{OK:"OK",CANCEL:"Avbryt",CONFIRM:"OK"},pl:{OK:"OK",CANCEL:"Anuluj",CONFIRM:"Potwierdź"},pt:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Confirmar"},ru:{OK:"OK",CANCEL:"Отмена",CONFIRM:"Применить"},sq:{OK:"OK",CANCEL:"Anulo",CONFIRM:"Prano"},sv:{OK:"OK",CANCEL:"Avbryt",CONFIRM:"OK"},th:{OK:"ตกลง",CANCEL:"ยกเลิก",CONFIRM:"ยืนยัน"},tr:{OK:"Tamam",CANCEL:"İptal",CONFIRM:"Onayla"},zh_CN:{OK:"OK",CANCEL:"取消",CONFIRM:"确认"},zh_TW:{OK:"OK",CANCEL:"取消",CONFIRM:"確認"}};return p.addLocale=function(a,c){return b.each(["OK","CANCEL","CONFIRM"],function(a,b){if(!c[b])throw new Error("Please supply a translation for '"+b+"'")}),q[a]={OK:c.OK,CANCEL:c.CANCEL,CONFIRM:c.CONFIRM},p},p.removeLocale=function(a){return delete q[a],p},p.setLocale=function(a){return p.setDefaults("locale",a)},p.init=function(c){return a(c||b)},p}); -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/js/dataTables.bootstrap.js: -------------------------------------------------------------------------------- 1 | /*! DataTables Bootstrap 3 integration 2 | * ©2011-2015 SpryMedia Ltd - datatables.net/license 3 | */ 4 | 5 | /** 6 | * DataTables integration for Bootstrap 3. This requires Bootstrap 3 and 7 | * DataTables 1.10 or newer. 8 | * 9 | * This file sets the defaults and adds options to DataTables to style its 10 | * controls using Bootstrap. See http://datatables.net/manual/styling/bootstrap 11 | * for further information. 12 | */ 13 | (function (factory) { 14 | if (typeof define === 'function' && define.amd) { 15 | // AMD 16 | define(['jquery', 'datatables.net'], function ($) { 17 | return factory($, window, document); 18 | }); 19 | } else if (typeof exports === 'object') { 20 | // CommonJS 21 | module.exports = function (root, $) { 22 | if (!root) { 23 | root = window; 24 | } 25 | 26 | if (!$ || !$.fn.dataTable) { 27 | // Require DataTables, which attaches to jQuery, including 28 | // jQuery if needed and have a $ property so we can access the 29 | // jQuery object that is used 30 | $ = require('datatables.net')(root, $).$; 31 | } 32 | 33 | return factory($, root, root.document); 34 | }; 35 | } else { 36 | // Browser 37 | factory(jQuery, window, document); 38 | } 39 | }(function ($, window, document, undefined) { 40 | 'use strict'; 41 | var DataTable = $.fn.dataTable; 42 | 43 | 44 | /* Set the defaults for DataTables initialisation */ 45 | $.extend(true, DataTable.defaults, { 46 | dom: 47 | "<'row'<'col-sm-6'l><'col-sm-6'f>>" + 48 | "<'row'<'col-sm-12'tr>>" + 49 | "<'row'<'col-sm-5'i><'col-sm-7'p>>", 50 | renderer: 'bootstrap' 51 | }); 52 | 53 | 54 | /* Default class modification */ 55 | $.extend(DataTable.ext.classes, { 56 | sWrapper: "dataTables_wrapper form-inline dt-bootstrap", 57 | sFilterInput: "form-control input-sm", 58 | sLengthSelect: "form-control input-sm", 59 | sProcessing: "dataTables_processing panel panel-default" 60 | }); 61 | 62 | 63 | /* Bootstrap paging button renderer */ 64 | DataTable.ext.renderer.pageButton.bootstrap = function (settings, host, idx, buttons, page, pages) { 65 | var api = new DataTable.Api(settings); 66 | var classes = settings.oClasses; 67 | var lang = settings.oLanguage.oPaginate; 68 | var aria = settings.oLanguage.oAria.paginate || {}; 69 | var btnDisplay, btnClass, counter = 0; 70 | 71 | var attach = function (container, buttons) { 72 | var i, ien, node, button; 73 | var clickHandler = function (e) { 74 | e.preventDefault(); 75 | if (!$(e.currentTarget).hasClass('disabled') && api.page() != e.data.action) { 76 | api.page(e.data.action).draw('page'); 77 | } 78 | }; 79 | 80 | for (i = 0, ien = buttons.length; i < ien; i++) { 81 | button = buttons[i]; 82 | 83 | if ($.isArray(button)) { 84 | attach(container, button); 85 | } else { 86 | btnDisplay = ''; 87 | btnClass = ''; 88 | 89 | switch (button) { 90 | case 'ellipsis': 91 | btnDisplay = '…'; 92 | btnClass = 'disabled'; 93 | break; 94 | 95 | case 'first': 96 | btnDisplay = lang.sFirst; 97 | btnClass = button + (page > 0 ? 98 | '' : ' disabled'); 99 | break; 100 | 101 | case 'previous': 102 | btnDisplay = lang.sPrevious; 103 | btnClass = button + (page > 0 ? 104 | '' : ' disabled'); 105 | break; 106 | 107 | case 'next': 108 | btnDisplay = lang.sNext; 109 | btnClass = button + (page < pages - 1 ? 110 | '' : ' disabled'); 111 | break; 112 | 113 | case 'last': 114 | btnDisplay = lang.sLast; 115 | btnClass = button + (page < pages - 1 ? 116 | '' : ' disabled'); 117 | break; 118 | 119 | default: 120 | btnDisplay = button + 1; 121 | btnClass = page === button ? 122 | 'active' : ''; 123 | break; 124 | } 125 | 126 | if (btnDisplay) { 127 | node = $('
  • ', { 128 | 'class': classes.sPageButton + ' ' + btnClass, 129 | 'id': idx === 0 && typeof button === 'string' ? 130 | settings.sTableId + '_' + button : 131 | null 132 | }) 133 | .append($('', { 134 | 'href': '#', 135 | 'aria-controls': settings.sTableId, 136 | 'aria-label': aria[button], 137 | 'data-dt-idx': counter, 138 | 'tabindex': settings.iTabIndex 139 | }) 140 | .html(btnDisplay) 141 | ) 142 | .appendTo(container); 143 | 144 | settings.oApi._fnBindAction( 145 | node, {action: button}, clickHandler 146 | ); 147 | 148 | counter++; 149 | } 150 | } 151 | } 152 | }; 153 | 154 | // IE9 throws an 'unknown error' if document.activeElement is used 155 | // inside an iframe or frame. 156 | var activeEl; 157 | 158 | try { 159 | // Because this approach is destroying and recreating the paging 160 | // elements, focus is lost on the select button which is bad for 161 | // accessibility. So we want to restore focus once the draw has 162 | // completed 163 | activeEl = $(host).find(document.activeElement).data('dt-idx'); 164 | } catch (e) { 165 | } 166 | 167 | attach( 168 | $(host).empty().html('
      ').children('ul'), 169 | buttons 170 | ); 171 | 172 | if (activeEl !== undefined) { 173 | $(host).find('[data-dt-idx=' + activeEl + ']').focus(); 174 | } 175 | }; 176 | 177 | 178 | return DataTable; 179 | })); 180 | -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /online-shopping/src/main/webapp/static/js/productsController.js: -------------------------------------------------------------------------------- 1 | var app = angular.module('ShoppingApp', []); 2 | 3 | app.controller('ProductController', function ($http) { 4 | 5 | var me = this; 6 | 7 | me.mvProducts = []; 8 | me.mpProducts = []; 9 | 10 | me.fetchProducts = function () { 11 | 12 | 13 | $http.get('/onlineshopping/json/data/mv/products') 14 | .then(function (response) { 15 | me.mvProducts = response.data; 16 | }); 17 | 18 | 19 | $http.get('/onlineshopping/json/data/mp/products') 20 | .then(function (response) { 21 | me.mpProducts = response.data; 22 | }); 23 | 24 | } 25 | 26 | }); -------------------------------------------------------------------------------- /online-shopping/src/test/java/com/isolutions4u/onlineshopping/OnlineShoppingApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | public class OnlineShoppingApplicationTests { 8 | 9 | @Test 10 | public void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /online-shopping/src/test/java/com/isolutions4u/onlineshopping/test/CategoryTestCase.java: -------------------------------------------------------------------------------- 1 | package com.isolutions4u.onlineshopping.test; 2 | 3 | public class CategoryTestCase { 4 | 5 | /*private static AnnotationConfigApplicationContext context; 6 | 7 | private static CategoryDAO categoryDAO; 8 | private static Category category; 9 | 10 | @BeforeClass 11 | public static void init() { 12 | context = new AnnotationConfigApplicationContext(); 13 | context.scan("com.isolutions4u.onlineshopping"); 14 | context.refresh(); 15 | 16 | categoryDAO = (CategoryDAO) context.getBean("categoryDAO"); 17 | } 18 | 19 | @Test 20 | public void testAddCategory() { 21 | category = new Category(); 22 | 23 | category.setName("Television"); 24 | category.setDescription("This is some description for television"); 25 | category.setImageUrl("cat_1.png"); 26 | category.setActive(true); 27 | 28 | assertEquals("Successfully added a category inside the table!", true, categoryDAO.add(category)); 29 | }*/ 30 | 31 | } 32 | --------------------------------------------------------------------------------