├── .classpath
├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.yml
│ └── feature_request.yml
└── pull_request_template.md
├── .gitignore
├── .project
├── .settings
├── .jsdtscope
├── org.eclipse.jdt.core.prefs
├── org.eclipse.m2e.core.prefs
├── org.eclipse.wst.common.component
├── org.eclipse.wst.common.project.facet.core.xml
├── org.eclipse.wst.jsdt.ui.superType.container
├── org.eclipse.wst.jsdt.ui.superType.name
└── org.eclipse.wst.validation.prefs
├── 1.sh
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Dummy_Database.md
├── Jenkinsfile
├── Procfile
├── README.md
├── WebContent
├── CustomerHome.html
├── CustomerLogin.html
├── CustomerRegister.html
├── META-INF
│ └── MANIFEST.MF
├── Photo.jpg
├── SellerHome.html
├── SellerLogin.html
├── WEB-INF
│ └── web.xml
├── favicons
│ ├── android-chrome-192x192.png
│ ├── android-chrome-512x512.png
│ ├── apple-touch-icon.png
│ ├── favicon-16x16.png
│ ├── favicon-32x32.png
│ ├── favicon.ico
│ └── site.webmanifest
├── index.html
├── loader.gif
├── login.html
├── logo.png
├── payment.html
└── styles.css
├── appspec.yaml
├── buildspec.yaml
├── pom.xml
├── scripts
├── start_server.sh
└── stop_server.sh
├── setup
└── CreateDatastore.sql
└── src
└── main
├── java
├── com
│ └── bittercode
│ │ ├── constant
│ │ ├── BookStoreConstants.java
│ │ ├── ResponseCode.java
│ │ └── db
│ │ │ ├── BooksDBConstants.java
│ │ │ └── UsersDBConstants.java
│ │ ├── model
│ │ ├── Address.java
│ │ ├── Book.java
│ │ ├── Cart.java
│ │ ├── StoreException.java
│ │ ├── User.java
│ │ ├── UserRole.java
│ │ └── package-info.java
│ │ ├── service
│ │ ├── BookService.java
│ │ ├── UserService.java
│ │ └── impl
│ │ │ ├── BookServiceImpl.java
│ │ │ └── UserServiceImpl.java
│ │ └── util
│ │ ├── DBUtil.java
│ │ ├── DatabaseConfig.java
│ │ └── StoreUtil.java
└── servlets
│ ├── AboutServlet.java
│ ├── AddBookServlet.java
│ ├── BuyBooksServlet.java
│ ├── CartServlet.java
│ ├── CheckoutServlet.java
│ ├── CustomerLoginServlet.java
│ ├── CustomerRegisterServlet.java
│ ├── ErrorHandlerServlet.java
│ ├── LogoutServlet.java
│ ├── ProcessPaymentServlet.java
│ ├── ReceiptServlet.java
│ ├── RemoveBookServlet.java
│ ├── SellerLoginServlet.java
│ ├── StoreBookServlet.java
│ ├── UpdateBookServlet.java
│ └── ViewBookServlet.java
└── resources
└── application.properties
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
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 |
34 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.yml:
--------------------------------------------------------------------------------
1 | name: Bug report
2 | description: Create a report to help us improve. Report bugs found while using the project
3 | title: "[BUG]"
4 | labels: [bug]
5 | body:
6 | - type: markdown
7 | attributes:
8 | value: "Provide a general summary of the issue in the Title above"
9 | - type: textarea
10 | id: description
11 | attributes:
12 | label: Description
13 | description: Provide a general summary of the issue in the Title above
14 | validations:
15 | required: true
16 | - type: input
17 | id: expectedbhv
18 | attributes:
19 | label: Expected behavior
20 | description: Tell us what should happen
21 | validations:
22 | required: true
23 | - type: input
24 | id: actualbhv
25 | attributes:
26 | label: Actual behavior
27 | description: Tell us what happens instead
28 | validations:
29 | required: true
30 | - type: input
31 | id: possiblefix
32 | attributes:
33 | label: Possible fix
34 | description: Not obligatory, but suggest a fix or reason for the bug
35 | validations:
36 | required: false
37 | - type: textarea
38 | id: steps
39 | attributes:
40 | label: Steps to reproduce
41 | description: |
42 | Provide a link to a live example, or an unambiguous set of steps to
43 | reproduce this bug. Include code to reproduce, if relevant
44 | placeholder: |
45 | 1.
46 | 2.
47 | 3.
48 | 4.
49 | validations:
50 | required: true
51 | - type: textarea
52 | id: context
53 | attributes:
54 | label: Context
55 | description: How has this bug affected you? What were you trying to accomplish?
56 | validations:
57 | required: true
58 | - type: textarea
59 | id: extrainformation
60 | attributes:
61 | label: Additional information
62 | description: Is there anything else we should know about this bug?
63 | validations:
64 | required: false
65 |
66 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.yml:
--------------------------------------------------------------------------------
1 | name: Feature request
2 | description: Suggest features, propose improvements, discuss new ideas.
3 | title: "[FEATURE]"
4 | labels: [enhancement]
5 | body:
6 | - type: markdown
7 | attributes:
8 | value: Provide a general summary of the issue in the Title above
9 | - type: textarea
10 | id: description
11 | attributes:
12 | label: Detailed description
13 | description: Provide a detailed description of the change or addition you are proposing
14 | validations:
15 | required: true
16 | - type: textarea
17 | id: context
18 | attributes:
19 | label: Context
20 | description: |
21 | Why is this change important to you? How would you use it?
22 | How can it benefit other users?
23 | validations:
24 | required: true
25 | - type: textarea
26 | id: possibleimpl
27 | attributes:
28 | label: Possible implementation
29 | description: Not obligatory, but suggest an idea for implementing addition or change
30 | validations:
31 | required: false
32 | - type: textarea
33 | id: extrainformation
34 | attributes:
35 | label: Additional information
36 | description: Is there anything else we should know about this feature?
37 | validations:
38 | required: false
39 |
--------------------------------------------------------------------------------
/.github/pull_request_template.md:
--------------------------------------------------------------------------------
1 | #### Description of Change
2 |
3 |
9 |
10 | #### References
11 |
12 |
13 | ## Type of change
14 |
15 |
16 | - [ ] Bug fix (non-breaking change which fixes an issue)
17 | - [ ] New feature (non-breaking change which adds functionality)
18 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
19 | - [ ] This change requires a documentation update
20 |
21 | #### Checklist
22 |
23 |
24 | - [ ] Added description of change
25 | - [ ] Relevant documentation/comments is changed or added
26 | - [ ] Search previous suggestions before making a new one, as yours may be a duplicate.
27 | - [ ] I have performed a self-review of my own code by running the project in local
28 | - [ ] I acknowledge that all my contributions will be made under the project's license.
29 |
30 | Notes:
31 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | /build/
3 | .classpath
4 | .settings
5 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | onlinebookstore
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.wst.common.project.facet.core.builder
15 |
16 |
17 |
18 |
19 | org.eclipse.wst.validation.validationbuilder
20 |
21 |
22 |
23 |
24 | org.eclipse.m2e.core.maven2Builder
25 |
26 |
27 |
28 |
29 |
30 | org.eclipse.m2e.core.maven2Nature
31 | org.eclipse.jem.workbench.JavaEMFNature
32 | org.eclipse.wst.common.modulecore.ModuleCoreNature
33 | org.eclipse.wst.common.project.facet.core.nature
34 | org.eclipse.jdt.core.javanature
35 | org.eclipse.wst.jsdt.core.jsNature
36 |
37 |
38 |
39 | 1665573956898
40 |
41 | 30
42 |
43 | org.eclipse.core.resources.regexFilterMatcher
44 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/.settings/.jsdtscope:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.wst.common.component:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
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 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.wst.common.project.facet.core.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.wst.jsdt.ui.superType.container:
--------------------------------------------------------------------------------
1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary
--------------------------------------------------------------------------------
/.settings/org.eclipse.wst.jsdt.ui.superType.name:
--------------------------------------------------------------------------------
1 | Window
--------------------------------------------------------------------------------
/.settings/org.eclipse.wst.validation.prefs:
--------------------------------------------------------------------------------
1 | disabled=06target
2 | eclipse.preferences.version=1
3 |
--------------------------------------------------------------------------------
/1.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #
4 | # Change the Git history of a repository
5 | #
6 | # Note: Running this script rewrites history for all repository collaborators.
7 | # After completing these steps, any person with forks or clones must fetch
8 | # the rewritten history and rebase any local changes into the rewritten history.
9 | #
10 |
11 | VERSION="v2.4.1"
12 |
13 | # Set Defaults
14 | SHOW_HELP=0
15 | SHOW_VERSION=0
16 | REPOSITORY_VERIFIED=0 # Set global REPOSITORY_VERIFIED function to false so user must confirm
17 | SHOULD_EXECUTE=0 # Set global SHOULD_EXECUTE function to false so user must confirm
18 | REMOTE_REPOSITORY=
19 | USER_OLD_EMAIL=
20 | USER_NEW_EMAIL=
21 | USER_NEW_NAME=
22 | USER_GIT_DIR=
23 | USER_WORK_TREE=
24 | UPDATE_REMOTE=
25 | DEFAULT_REMOTE="origin"
26 | USER_REMOTE=
27 |
28 | # Set Colors
29 | COLOR_RED=$'\e[31m'
30 | COLOR_CYAN=$'\e[36m'
31 | COLOR_YELLOW=$'\e[93m'
32 | COLOR_GREEN=$'\e[32m'
33 | COLOR_RESET=$'\e[0m'
34 |
35 | PARAMS=""
36 |
37 | # Loop through arguments and process them
38 | while (("$#")); do
39 |
40 | # Debug: Show flag being evaulated
41 | # echo " ${COLOR_CYAN}$1${COLOR_RESET}"
42 |
43 | case "$1" in
44 | -h | -\? | --help)
45 | SHOW_HELP=1
46 | ;;
47 | -v | -V | --version)
48 | SHOW_VERSION=1
49 | ;;
50 | -f | --force)
51 | REPOSITORY_VERIFIED=1
52 | SHOULD_EXECUTE=1
53 | ;;
54 | # USER_OLD_EMAIL
55 | -o | --old-email)
56 | if [ "$2" ]; then
57 | USER_OLD_EMAIL=$(echo "$2" | awk "{print tolower(\$0)}")
58 | shift # Remove argument name from processing
59 | else
60 | echo "${COLOR_RED}ERROR: Value for $1 is required."${COLOR_RESET} >&2
61 | exit 1
62 | fi
63 | ;;
64 | -o=*? | --old-email=*?)
65 | USER_OLD_EMAIL=$(echo "${1#*=}" | awk "{print tolower(\$0)}")
66 | ;;
67 | # USER_NEW_EMAIL
68 | -e | --new-email)
69 | if [ "$2" ]; then
70 | USER_NEW_EMAIL="$2"
71 | shift # Remove argument name from processing
72 | else
73 | echo "${COLOR_RED}ERROR: Value for $1 is required."${COLOR_RESET} >&2
74 | exit 1
75 | fi
76 | ;;
77 | -e=*? | --new-email=*?)
78 | USER_NEW_EMAIL="${1#*=}"
79 | ;;
80 | # USER_NEW_NAME
81 | -n | --new-name)
82 | if [ "$2" ]; then
83 | USER_NEW_NAME="$2"
84 | shift # Remove argument name from processing
85 | else
86 | echo "${COLOR_RED}ERROR: Value for $1 is required."${COLOR_RESET} >&2
87 | exit 1
88 | fi
89 | ;;
90 | -n=*? | --new-name=*?)
91 | USER_NEW_NAME="${1#*=}"
92 | ;;
93 | # USER_REMOTE
94 | -r | --remote)
95 | if [ "$2" ]; then
96 | USER_REMOTE="$2"
97 | # Automatically set UPDATE_REMOTE to true
98 | UPDATE_REMOTE=1
99 | shift # Remove argument name from processing
100 | else
101 | echo "${COLOR_RED}ERROR: Value for $1 is required."${COLOR_RESET} >&2
102 | exit 1
103 | fi
104 | ;;
105 | -r=*? | --remote=*?)
106 | USER_REMOTE="${1#*=}"
107 | # Automatically set UPDATE_REMOTE to true
108 | UPDATE_REMOTE=1
109 | ;;
110 | # USER_GIT_DIR
111 | -d | --git-dir)
112 | if [ "$2" ]; then
113 | USER_GIT_DIR="--git-dir=$2"
114 | shift # Remove argument name from processing
115 | else
116 | echo "${COLOR_RED}ERROR: Value for $1 is required."${COLOR_RESET} >&2
117 | exit 1
118 | fi
119 | ;;
120 | -d=*? | --git-dir=*?)
121 | USER_GIT_DIR="--git-dir=${1#*=}"
122 | ;;
123 | # USER_WORK_TREE
124 | -w | --work-tree)
125 | if [ "$2" ]; then
126 | USER_WORK_TREE="--work-tree=$2"
127 | shift # Remove argument name from processing
128 | else
129 | echo "${COLOR_RED}ERROR: Value for $1 is required."${COLOR_RESET} >&2
130 | exit 1
131 | fi
132 | ;;
133 | -w=*? | --work-tree=*?)
134 | USER_WORK_TREE="--work-tree=${1#*=}"
135 | ;;
136 | # End of all options
137 | -* | --*=) # unsupported flags
138 | echo "${COLOR_RED}ERROR: Flag $1 is not a supported option."${COLOR_RESET} >&2
139 | exit 1
140 | ;;
141 | # preserve positional arguments
142 | *)
143 | PARAMS="${PARAMS} $1"
144 | shift
145 | ;;
146 | esac
147 | shift
148 | done
149 |
150 | # Set positional arguments in their proper place
151 | eval set -- "$PARAMS"
152 |
153 | # Version
154 | showVersion() {
155 | echo ""
156 | echo "${COLOR_YELLOW}changeauthor $VERSION${COLOR_RESET}"
157 | footerInfo
158 | }
159 |
160 | footerInfo() {
161 | echo ""
162 | echo "For updates and more information:"
163 | echo " https://github.com/adamdehaven/change-git-author"
164 | echo ""
165 | echo "Created by Adam DeHaven"
166 | echo " @adamdehaven or https://www.adamdehaven.com/"
167 | echo ""
168 | }
169 |
170 | # Help text
171 | showHelp() {
172 | echo ""
173 | echo "Description:"
174 | echo " A bash script to update (change) a git repository's commit author history for a given author email address."
175 | echo ""
176 | echo "Usage:"
177 | echo " 1. Set execute permissions for the script:"
178 | echo " ${COLOR_CYAN}chmod +x ./changeauthor.sh${COLOR_RESET}"
179 | echo " 2. Navigate into the repository with the incorrect commit history:"
180 | echo " ${COLOR_CYAN}cd path/to/git/repository${COLOR_RESET}"
181 | echo ""
182 | echo " Alternatively, you can run from anywhere by passing the ${COLOR_CYAN}--git-dir${COLOR_RESET} and ${COLOR_CYAN}--work-tree${COLOR_RESET} flags."
183 | echo ""
184 | echo " 3. Enter the following to run the script (with or without options):"
185 | echo " ${COLOR_CYAN}./changeauthor.sh [OPTIONS]...${COLOR_RESET}"
186 | echo ""
187 | echo " Alternatively, you may execute with either of the following:"
188 | echo " a) ${COLOR_CYAN}sh ./changeauthor.sh [OPTIONS]...${COLOR_RESET}"
189 | echo " b) ${COLOR_CYAN}bash ./changeauthor.sh [OPTIONS]...${COLOR_RESET}"
190 | echo ""
191 | echo " ${COLOR_YELLOW}Note: The script will run in interactive mode if no options are passed.${COLOR_RESET}"
192 | echo ""
193 | echo "Options:"
194 | echo ""
195 | echo " -o, --old-email The old/incorrect email address of the author you would like to "
196 | echo " replace in the commit history."
197 | echo " Example: ${COLOR_CYAN}emmett.brown@example.com${COLOR_RESET}"
198 | echo ""
199 | echo " -e, --new-email The new/corrected email address to replace in commits matching"
200 | echo " the old email."
201 | echo " Example: ${COLOR_CYAN}marty.mcfly@example.com${COLOR_RESET}"
202 | echo ""
203 | echo " -n, --new-name The new/corrected name for the new commit author info."
204 | echo " ${COLOR_YELLOW}Be sure to enclose the name in quotes if passing as a flag${COLOR_RESET}"
205 | echo " Example: ${COLOR_CYAN}Marty McFly${COLOR_RESET}"
206 | echo ""
207 | echo " -r, --remote The name of the repository remote you would like to alter."
208 | echo " Default: ${COLOR_YELLOW}origin${COLOR_RESET}"
209 | echo " Example: ${COLOR_CYAN}github${COLOR_RESET}"
210 | echo ""
211 | echo " -f, --force Allows the script to run successfully in a non-interactive"
212 | echo " shell (assuming all required flags are set), bypassing "
213 | echo " the confirmation prompt."
214 | echo " ${COLOR_YELLOW}WARNING: By passing the --force flag (along with all other${COLOR_RESET}"
215 | echo " ${COLOR_YELLOW}required flags), there is no turning back. Once you start${COLOR_RESET}"
216 | echo " ${COLOR_YELLOW}the script, the process will start and can severely${COLOR_RESET}"
217 | echo " ${COLOR_YELLOW}damage your repository if used incorrectly.${COLOR_RESET}"
218 | echo ""
219 | echo " -d, --git-dir Set the path to the repository (\".git\" directory) if it"
220 | echo " differs from the current directory. It can be an absolute path or"
221 | echo " relative path to current working directory."
222 | echo " ${COLOR_YELLOW}This option should be used in conjunction with${COLOR_RESET}"
223 | echo " ${COLOR_YELLOW}the --work-tree flag.${COLOR_RESET}"
224 | echo ""
225 | echo " -w, --work-tree Set the path to the working tree. It can be an absolute"
226 | echo " path or a path relative to the current working directory."
227 | echo ""
228 | echo " -v, -V, --version Show version info."
229 | echo ""
230 | echo " -h, -?, --help Show this help message."
231 | echo ""
232 | echo "--------------------------------------------"
233 | footerInfo
234 | }
235 |
236 | # If user passed help flag
237 | if [ "$SHOW_HELP" == 1 ]; then
238 | showHelp
239 | exit
240 | # If user passed version flag
241 | elif [ "$SHOW_VERSION" == 1 ]; then
242 | showVersion
243 | exit
244 | fi
245 |
246 | # Check if --git-dir is inside git repository, if not, exit
247 | INSIDE_GIT_REPO="$(git ${USER_GIT_DIR} ${USER_WORK_TREE} rev-parse --is-inside-work-tree 2>/dev/null)"
248 | if [ ! "$INSIDE_GIT_REPO" ]; then
249 | echo ""
250 | echo "${COLOR_RED}ERROR: This is not a git repository.${COLOR_RESET}"
251 | echo ""
252 | echo "${COLOR_YELLOW}You must run the script from within a git repository or utilize${COLOR_RESET}"
253 | echo "${COLOR_YELLOW}the --git-dir and --work-tree flags to set the path to the${COLOR_RESET}"
254 | echo "${COLOR_YELLOW}repository and working tree. Run with --help for more info.${COLOR_RESET}"
255 | exit
256 | fi
257 |
258 | # USER_OLD_EMAIL
259 | if [ -z "$USER_OLD_EMAIL" ] && [ "$SHOULD_EXECUTE" == 0 ]; then
260 | echo ""
261 | echo "# ---------------------------------- #"
262 | echo "# Change Author for Existing Commits #"
263 | echo "# ---------------------------------- #"
264 | # Prompt user for email to replace ( USER_OLD_EMAIL )
265 | echo ""
266 | echo "Commit Authors:"
267 | echo "--------------------------------------------"
268 | echo "$(git ${USER_GIT_DIR} ${USER_WORK_TREE} log --pretty=format:"${COLOR_CYAN}%an - %ae${COLOR_RESET}" | sort -u)"
269 | echo "--------------------------------------------"
270 | echo ""
271 | echo "Enter the email address of the author you "
272 | echo "would like to replace in the commit history."
273 | echo "--------------------------------------------"
274 | read -p "Email to Replace: ${COLOR_CYAN}" USER_OLD_EMAIL
275 | echo "${COLOR_RESET}"
276 | elif [ -z "$USER_OLD_EMAIL" ] && [ "$SHOULD_EXECUTE" == 1 ]; then
277 | echo "${COLOR_RED}ERROR: --old-email is required.${COLOR_RESET}"
278 | echo "${COLOR_RED}Try again by passing a valid old email address or removing the --force flag."${COLOR_RESET} >&2
279 | exit 1
280 | fi
281 |
282 | if [ -z "$USER_OLD_EMAIL" ]; then
283 | echo "${COLOR_RED}ERROR: Email to Replace is required.${COLOR_RESET}"
284 | echo "${COLOR_RED}Try again and be sure to provide a valid email address to replace."${COLOR_RESET} >&2
285 | exit 1
286 | else
287 | # Set USER_OLD_EMAIL and transform to lowercase
288 | USER_OLD_EMAIL=$(echo "$USER_OLD_EMAIL" | awk "{print tolower(\$0)}")
289 | fi
290 |
291 | # Check if USER_OLD_EMAIL exists in log
292 | USER_OLD_EMAIL_EXISTS="$(git ${USER_GIT_DIR} ${USER_WORK_TREE} log --pretty=format:"%ae" | grep -wxi ${USER_OLD_EMAIL})"
293 |
294 | # If USER_OLD_EMAIL does NOT exist in log
295 | if [ -z "$USER_OLD_EMAIL_EXISTS" ]; then
296 | # USER_OLD_EMAIL does not exist in log
297 | echo "${COLOR_YELLOW}The email '${USER_OLD_EMAIL}' does not exist in the commit history for ${COLOR_RESET}"
298 | echo "${COLOR_YELLOW}this repository. Please check your spelling and try again.${COLOR_RESET}"
299 | exit 1
300 | fi
301 |
302 | # USER_NEW_EMAIL
303 | if [ -z "$USER_NEW_EMAIL" ] && [ "$SHOULD_EXECUTE" == 0 ]; then
304 | # Prompt user for correct email ( USER_NEW_EMAIL )
305 | echo ""
306 | echo "Enter a new/corrected email for this user."
307 | echo "------------------------------------------"
308 | read -p "New Email: ${COLOR_CYAN}" USER_NEW_EMAIL
309 | echo "${COLOR_RESET}"
310 | elif [ -z "$USER_NEW_EMAIL" ] && [ "$SHOULD_EXECUTE" == 1 ]; then
311 | echo "${COLOR_RED}ERROR: --new-email is required.${COLOR_RESET}"
312 | echo "${COLOR_RED}A new email address is required. Please try again.${COLOR_RESET}"
313 | exit 1
314 | fi
315 |
316 | if [ -z "$USER_NEW_EMAIL" ]; then
317 | echo "${COLOR_RED}ERROR: New Email is required.${COLOR_RESET}"
318 | echo "${COLOR_RED}Try again and be sure to provide a valid new email address."${COLOR_RESET} >&2
319 | exit 1
320 | else
321 | # Set USER_NEW_EMAIL and transform to lowercase
322 | USER_NEW_EMAIL="${USER_NEW_EMAIL}"
323 | fi
324 |
325 | # If old email address matches new email address
326 | if [ "$USER_OLD_EMAIL" == "$USER_NEW_EMAIL" ] && [ "$SHOULD_EXECUTE" == 0 ]; then
327 | # Check if user would like to update a remote repository
328 | while true; do
329 | echo "${COLOR_YELLOW}The old email address, '${USER_OLD_EMAIL}' matches the${COLOR_RESET}"
330 | echo "${COLOR_YELLOW}new email address you provided, '${USER_NEW_EMAIL}'.${COLOR_RESET}"
331 | echo "${COLOR_YELLOW}If you continue, you will only be updating the name.${COLOR_RESET}"
332 | echo ""
333 | read -p "${COLOR_YELLOW}Continue to updating the name only? [y/n]: ${COLOR_CYAN}" UPDATE_NAME
334 | echo "${COLOR_RESET}"
335 | case $UPDATE_NAME in
336 | [Yy]*)
337 | UPDATE_NAME=1
338 | break
339 | ;;
340 | [Nn]*)
341 | UPDATE_NAME=0
342 | break
343 | ;;
344 | *)
345 | echo ""
346 | echo " ${COLOR_YELLOW}You must enter 'y' or 'n' to signal if you would like to update just the name.${COLOR_RESET}"
347 | echo ""
348 | ;;
349 | esac
350 | done
351 | else
352 | UPDATE_NAME=1
353 | fi
354 |
355 | if [ "$UPDATE_NAME" == 0 ]; then
356 | echo ""
357 | echo "${COLOR_YELLOW}No changes are necessary.${COLOR_RESET}"
358 | SHOULD_EXECUTE=0
359 | exit 1
360 | fi
361 |
362 | # USER_NEW_NAME
363 | if [ -z "$USER_NEW_NAME" ] && [ "$SHOULD_EXECUTE" == 0 ]; then
364 | # Prompt user for correct name ( USER_NEW_NAME )
365 | echo ""
366 | echo "Enter the new/corrected first and last name for this user."
367 | echo "----------------------------------------------------------"
368 | read -p "New Name: ${COLOR_CYAN}" USER_NEW_NAME
369 | echo "${COLOR_RESET}"
370 | elif [ -z "$USER_NEW_NAME" ] && [ "$SHOULD_EXECUTE" == 1 ]; then
371 | echo "${COLOR_RED}ERROR: --new-name is required.${COLOR_RESET}"
372 | echo "${COLOR_RED}Try again by passing a valid first and last name or removing the --force flag."${COLOR_RESET} >&2
373 | exit 1
374 | fi
375 |
376 | if [ -z "$USER_NEW_NAME" ]; then
377 | echo "${COLOR_RED}ERROR: New Name is required.${COLOR_RESET}"
378 | echo "${COLOR_RED}Try again and be sure to provide a valid first and last name."${COLOR_RESET} >&2
379 | exit 1
380 | else
381 | USER_NEW_NAME="${USER_NEW_NAME}"
382 | fi
383 |
384 | # Get a list of remote repositories, if they exist
385 | ALL_REMOTE_REPOSITORIES=$(git ${USER_GIT_DIR} ${USER_WORK_TREE} remote show)
386 |
387 | # If user wants to update remote and remote repositories exist, and user did not force
388 | if [ -z "$UPDATE_REMOTE" ] && [ -n "$ALL_REMOTE_REPOSITORIES" ] && [ "$SHOULD_EXECUTE" == 0 ]; then
389 | # Check if user would like to update a remote repository
390 | while true; do
391 | read -p "Would you like to update a remote repository? [y/n]: ${COLOR_CYAN}" UPDATE_REMOTE
392 | echo "${COLOR_RESET}"
393 | case $UPDATE_REMOTE in
394 | [Yy]*)
395 | UPDATE_REMOTE=1
396 | break
397 | ;;
398 | [Nn]*)
399 | UPDATE_REMOTE=0
400 | break
401 | ;;
402 | *)
403 | echo ""
404 | echo " ${COLOR_YELLOW}You must enter 'y' or 'n' to signal if you would like to update a remote repository.${COLOR_RESET}"
405 | echo ""
406 | ;;
407 | esac
408 | done
409 | elif [ "$SHOULD_EXECUTE" == 1 ] && [ -n "$ALL_REMOTE_REPOSITORIES" ]; then
410 | # User forced, and remote repositories exist, so set flag
411 | UPDATE_REMOTE=1
412 | elif [ -z "$ALL_REMOTE_REPOSITORIES" ]; then
413 | # Remote repositories do not exist, so set flag
414 | UPDATE_REMOTE=0
415 | fi
416 |
417 | # USER_REMOTE
418 | if [ "$UPDATE_REMOTE" == 1 ] && [ -z "$USER_REMOTE" ] && [ "$SHOULD_EXECUTE" == 0 ]; then
419 | # Prompt user for remote (Default: 'origin' )
420 | echo ""
421 | echo "Existing Remote Repositories:"
422 | echo "--------------------------------------------"
423 | echo "${COLOR_CYAN}$(git ${USER_GIT_DIR} ${USER_WORK_TREE} remote show)${COLOR_RESET}"
424 | echo "--------------------------------------------"
425 | echo ""
426 | echo "Enter the name of the remote you would like to alter."
427 | echo "Default: ${COLOR_YELLOW}${DEFAULT_REMOTE}${COLOR_RESET}"
428 | echo "--------------------------------------------------------"
429 | read -p "Remote Name [Press enter to use ${COLOR_YELLOW}${DEFAULT_REMOTE}${COLOR_RESET}]: ${COLOR_CYAN}" USER_REMOTE
430 | USER_REMOTE=${USER_REMOTE:-"$DEFAULT_REMOTE"}
431 | echo "${COLOR_RESET}"
432 | elif [ -z "$USER_REMOTE" ] && [ "$SHOULD_EXECUTE" == 1 ]; then
433 | # Running non-interactive, so set to default
434 | USER_REMOTE="$DEFAULT_REMOTE"
435 | echo ""
436 | echo "${COLOR_YELLOW}--remote flag not present... proceeding with default remote '${USER_REMOTE}'.${COLOR_RESET}"
437 | fi
438 |
439 | # Double-check that USER_REMOTE is set
440 | if [ -z "$USER_REMOTE" ]; then
441 | USER_REMOTE="${DEFAULT_REMOTE}"
442 | else
443 | USER_REMOTE="${USER_REMOTE}"
444 | fi
445 |
446 | if [ "$UPDATE_REMOTE" == 1 ]; then
447 | # Check if USER_REMOTE exists
448 | USER_REMOTE_EXISTS="$(git ${USER_GIT_DIR} ${USER_WORK_TREE} remote show | grep -wxi ${USER_REMOTE})"
449 | # Get the remote repository URL, if there is one
450 | REMOTE_REPOSITORY=$(git ${USER_GIT_DIR} ${USER_WORK_TREE} config --get remote.${USER_REMOTE}.url)
451 |
452 | # If USER_REMOTE does NOT exist
453 | if [ -z "$USER_REMOTE_EXISTS" ] || [ -z "$REMOTE_REPOSITORY" ]; then
454 | echo ""
455 | echo "${COLOR_YELLOW}The remote '${USER_REMOTE}' does not exist in this repository. ${COLOR_RESET}"
456 | echo "${COLOR_YELLOW}You may run 'git remote show' to view available remotes, and then try again.${COLOR_RESET}"
457 | echo ""
458 | SHOULD_EXECUTE=0
459 | exit 1
460 | fi
461 | fi
462 |
463 | # Have user verify repository
464 | if [ "$UPDATE_REMOTE" == 1 ] && [ -n "$USER_REMOTE_EXISTS" ] && [ -n "$REMOTE_REPOSITORY" ] && [ "$REPOSITORY_VERIFIED" == 0 ]; then
465 | while true; do
466 | echo ""
467 | echo "Please verify that the remote repository shown below is correct:"
468 | echo "Remote URL: ${COLOR_YELLOW}${REMOTE_REPOSITORY}${COLOR_RESET}"
469 | echo "--------------------------------------------------------"
470 | read -p "${COLOR_RED}Is this the correct repository? [y/n]: ${COLOR_CYAN}" USER_CONFIRM
471 | echo "${COLOR_RESET}"
472 | case $USER_CONFIRM in
473 | [Yy]*)
474 | REPOSITORY_VERIFIED=1
475 | break
476 | ;;
477 | [Nn]*)
478 | REPOSITORY_VERIFIED=0
479 | break
480 | ;;
481 | *)
482 | echo ""
483 | echo " ${COLOR_YELLOW}You must enter 'y' to verify the repository, or 'n' to cancel${COLOR_RESET}"
484 | echo ""
485 | ;;
486 | esac
487 | done
488 | fi
489 |
490 | # Have the user confirm before executing (if they didn't already cancel)
491 | if [ "$SHOULD_EXECUTE" == 0 ] && { [ "$REPOSITORY_VERIFIED" == 1 ] || [ "$UPDATE_REMOTE" == 0 ]; }; then
492 | while true; do
493 | echo ""
494 | echo "Are you sure you want to rewrite the entire"
495 | echo "history of this Git repository?"
496 | echo "-------------------------------------------"
497 | echo "Old email: ${COLOR_CYAN}${USER_OLD_EMAIL}${COLOR_RESET}"
498 | echo "New email: ${COLOR_CYAN}${USER_NEW_EMAIL}${COLOR_RESET}"
499 | echo "New name: ${COLOR_CYAN}${USER_NEW_NAME}${COLOR_RESET}"
500 | if [ "$UPDATE_REMOTE" == 1 ] && [ -n "$USER_REMOTE" ] && [ -n "$REMOTE_REPOSITORY" ]; then
501 | echo "Remote: ${COLOR_CYAN}${USER_REMOTE}${COLOR_RESET}"
502 | echo "Remote URL: ${COLOR_CYAN}${REMOTE_REPOSITORY}${COLOR_RESET}"
503 | fi
504 | echo ""
505 | echo "${COLOR_YELLOW}Note: Running this script rewrites history for all${COLOR_RESET}"
506 | echo "${COLOR_YELLOW}repository collaborators. Any person with forks ${COLOR_RESET}"
507 | echo "${COLOR_YELLOW}or clones must fetch the rewritten history and${COLOR_RESET}"
508 | echo "${COLOR_YELLOW}rebase any local changes into the rewritten history.${COLOR_RESET}"
509 | echo ""
510 | read -p "${COLOR_RED}Continue? [y/n]: ${COLOR_CYAN}" USER_CONFIRM
511 | echo "${COLOR_RESET}"
512 | case $USER_CONFIRM in
513 | [Yy]*)
514 | SHOULD_EXECUTE=1
515 | break
516 | ;;
517 | [Nn]*)
518 | SHOULD_EXECUTE=0
519 | break
520 | ;;
521 | *)
522 | echo ""
523 | echo " ${COLOR_YELLOW}You must enter 'y' to confirm, or 'n' to cancel${COLOR_RESET}"
524 | echo ""
525 | ;;
526 | esac
527 | done
528 | fi
529 |
530 | echo ""
531 |
532 | # If SHOULD_EXECUTE is true, and REPOSITORY_VERIFIED is true, rewrite repo history, otherwise, exit
533 | if [ "$SHOULD_EXECUTE" == 1 ]; then
534 | # Alter commits and rewrite history
535 | git ${USER_GIT_DIR:+-$USER_GIT_DIR} ${USER_WORK_TREE:+-$USER_WORK_TREE} filter-branch -f --env-filter '
536 | if [ "$(echo "$GIT_COMMITTER_EMAIL" | awk "{print tolower(\$0)}")" = "'"$USER_OLD_EMAIL"'" ]
537 | then
538 | export GIT_COMMITTER_NAME="'"$USER_NEW_NAME"'"
539 | export GIT_COMMITTER_EMAIL="'"$USER_NEW_EMAIL"'"
540 | fi
541 | if [ "$(echo "$GIT_AUTHOR_EMAIL" | awk "{print tolower(\$0)}")" = "'"$USER_OLD_EMAIL"'" ]
542 | then
543 | export GIT_AUTHOR_NAME="'"$USER_NEW_NAME"'"
544 | export GIT_AUTHOR_EMAIL="'"$USER_NEW_EMAIL"'"
545 | fi
546 | ' --tag-name-filter cat -- --branches --tags
547 |
548 | # Show Success Message
549 | echo ""
550 | echo "${COLOR_GREEN}Successfully updated local commit author info.${COLOR_RESET}"
551 |
552 | # If user wants to update remote and the remote is verified
553 | if [ "$UPDATE_REMOTE" == 1 ] && [ -n "$REPOSITORY_VERIFIED" ]; then
554 | echo ""
555 | echo "Preparing to push to remote '${USER_REMOTE}'..."
556 | echo ""
557 | echo "${COLOR_YELLOW}You have 5 seconds to cancel (Ctrl + C)${COLOR_RESET}"
558 | echo ""
559 | # Sleep to let user cancel
560 | sleep 5
561 |
562 | # Update Remote
563 | git ${USER_GIT_DIR:+-$USER_GIT_DIR} ${USER_WORK_TREE:+-$USER_WORK_TREE} push --force --tags "$USER_REMOTE" 'refs/heads/*'
564 |
565 | echo ""
566 | echo "${COLOR_GREEN}Successfully updated remote commit author info.${COLOR_RESET}"
567 | echo ""
568 | echo "The commits linked to '${COLOR_CYAN}${USER_OLD_EMAIL}${COLOR_RESET}' have"
569 | echo "been updated to '${COLOR_CYAN}${USER_NEW_NAME} <${USER_NEW_EMAIL}>${COLOR_RESET}' and"
570 | echo "the changes have been pushed to remote '${COLOR_CYAN}${USER_REMOTE}${COLOR_RESET}'."
571 | fi
572 | else
573 | # User Cancelled
574 | echo "${COLOR_YELLOW}Changes Cancelled.${COLOR_RESET}"
575 | echo "${COLOR_YELLOW}No changes were pushed to remote '${USER_REMOTE}'.${COLOR_RESET}"
576 | fi
577 |
578 | # Reset global vars
579 | REPOSITORY_VERIFIED=0
580 | SHOULD_EXECUTE=0
581 | UPDATE_REMOTE=0
582 | # Reset git environment variables
583 | USER_GIT_DIR=
584 | USER_WORK_TREE=
585 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6 |
7 | ## Our Standards
8 |
9 | Examples of behavior that contributes to creating a positive environment include:
10 |
11 | * Using welcoming and inclusive language
12 | * Being respectful of differing viewpoints and experiences
13 | * Gracefully accepting constructive criticism
14 | * Focusing on what is best for the community
15 | * Showing empathy towards other community members
16 |
17 | Examples of unacceptable behavior by participants include:
18 |
19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances
20 | * Trolling, insulting/derogatory comments, and personal or political attacks
21 | * Public or private harassment
22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission
23 | * Other conduct which could reasonably be considered inappropriate in a professional setting
24 |
25 | ## Our Responsibilities
26 |
27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28 |
29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30 |
31 | ## Scope
32 |
33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34 |
35 | ## Enforcement
36 |
37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [Contact Email Address](https://flowcv.me/shashirajraja). The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38 |
39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40 |
41 | ## Attribution
42 |
43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44 |
45 | [homepage]: http://contributor-covenant.org
46 | [version]: http://contributor-covenant.org/version/1/4/
47 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | ## Contributing
2 |
3 | [pr]: https://github.com/raise-dev/hacktoberfest/compare
4 | [style]: https://github.com/bbatsov/ruby-style-guide
5 |
6 | Hi there! We're thrilled that you'd like to contribute to Hacktoberfest. Your help is essential for keeping it great.
7 |
8 | Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license](LICENSE).
9 |
10 | ## Opening an issue
11 |
12 | Thank you for taking the time to open an issue, your feedback helps make Hacktoberfest better.
13 | Before opening an issue, please be sure that your issue hasn't already been asked by using [GitHub search](https://help.github.com/articles/searching-issues/)
14 |
15 | Here are a few things that will help us help resolve your issues:
16 |
17 | - A descriptive title that gives an idea of what your issue refers to
18 | - A thorough description of the issue, (one word descriptions are very hard to understand)
19 | - Screenshots (if appropriate)
20 | - Links (if appropriate)
21 |
22 | ## Submitting a pull request
23 |
24 | 0. Clone the repository
25 | 0. Configure and install the dependencies: (See the [README](README.md) for more details)
26 | 0. Make sure the tests pass on your machine: `script/test`
27 | 0. Create a new branch: `git checkout -b my-branch-name`
28 | 0. Make your change, add tests, and make sure the tests still pass
29 | 0. Push to your branch and [submit a pull request][pr]
30 | 0. Wait for your pull request to be reviewed and merged!
31 |
32 | Here are a few things you can do that will increase the likelihood of your pull request being accepted:
33 |
34 | - Follow the [style guide][style].
35 | - Write tests.
36 | - Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
37 | - Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
38 |
39 | ## Resources
40 |
41 | - [Contributing to Open Source on GitHub](https://guides.github.com/activities/contributing-to-open-source/)
42 | - [Using Pull Requests](https://help.github.com/articles/using-pull-requests/)
43 | - [GitHub Help](https://help.github.com)
44 |
--------------------------------------------------------------------------------
/Dummy_Database.md:
--------------------------------------------------------------------------------
1 | ### Copy and Paste the following MYSQL commands to make a dummy database for this Project :
2 |
3 |
4 | create database if not exists onlinebookstore;
5 |
6 | use onlinebookstore;
7 |
8 | create table if not exists books(barcode varchar(100) primary key, name varchar(100), author varchar(100), price int, quantity int);
9 |
10 | create table if not exists users(username varchar(100) primary key,password varchar(100), firstname varchar(100),lastname varchar(100),address text, phone varchar(100),mailid varchar(100),usertype int);
11 |
12 |
13 | insert into books values('9780134190563','The Go Programming Language','Alan A. A. Donovan and Brian W. Kernighan',400,8);
14 |
15 | insert into books values('9780133053036','C++ Primer','Stanley Lippman and Josée Lajoie and Barbara Moo',976,13);
16 |
17 | insert into books values('9781718500457','The Rust Programming Language','Steve Klabnik and Carol Nichols',560,12);
18 |
19 | insert into books values('9781491910740','Head First Java','Kathy Sierra and Bert Bates and Trisha Gee',754,23);
20 |
21 | insert into books values('9781492056300','Fluent Python','Luciano Ramalho',1014,5);
22 |
23 | insert into books values('9781720043997','The Road to Learn React','Robin Wieruch',239,18);
24 |
25 | insert into books values('9780132350884','Clean Code: A Handbook of Agile Software Craftsmanship','Robert C Martin',288,3);
26 |
27 | insert into books values('9780132181273','Domain-Driven Design','Eric Evans',560,28);
28 |
29 | insert into books values('9781951204006','A Programmers Guide to Computer Science','William Springer',188,4);
30 |
31 | insert into books values('9780316204552','The Soul of a New Machine','Tracy Kidder',293,30);
32 |
33 | insert into books values('9780132778046','Effective Java','Joshua Bloch',368,21);
34 |
35 | insert into books values('9781484255995','Practical Rust Projects','Shing Lyu',257,15);
36 |
37 | insert into users values('demo','demo','Demo','User','Demo Home','42502216225','demo@gmail.com',2);
38 |
39 | insert into users values('Admin','Admin','Mr.','Admin','Haldia WB','9584552224521','admin@gmail.com',1);
40 |
41 | insert into users values('shashi','shashi','Shashi','Raj','Bihar','1236547089','shashi@gmail.com',2);
42 |
43 | commit;
44 |
--------------------------------------------------------------------------------
/Jenkinsfile:
--------------------------------------------------------------------------------
1 | pipeline {
2 | agent any
3 | stages {
4 | stage("git_checkout") {
5 | steps {
6 | echo "cloning repository"
7 | echo "repo cloned successfully"
8 | }
9 | }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | web: java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # OnlineBookStore
2 | - A Java Web Developement Project
3 | - **Youtube VIDEO** for step by step Local Setup Guide : https://youtu.be/mLFPodZO8Iw
4 | - **Youtube VIDEO** for local setup of tender management project: https://www.youtube.com/watch?v=7CE3aY4e644
5 |
6 | - User Login Credentials: (shashi/shashi)
7 | - Admin Login Credentials: (Admin/Admin)
8 |
9 |
10 | ### About
11 |
12 | A user-friendly Online Bookstore project in which users can log in or register, view the available books, select books along with their quantity, and buy them. Users can also get payment receipts after successful payment. The project can also be used by the administrator, who can add new books, remove books, increase and decrease the quantity of books, change the price of the books as well as maintain the selling history of books.
13 |
14 | 
15 |
16 | **This Website is built for following purpose:-**
17 | - For Selling books online.
18 | - Maintaining books selling history.
19 | - Adding and managing books.
20 | - User Friendly.
21 | - For Implementation of Http Servlets in Java.
22 | - This is a Mini-project developed using Java, Jdbc, And Servlets.
23 |
24 | **Admin Have Following Access for this online store site:-**
25 | - Add New Books.
26 | - View Books Available.
27 | - Remove Books.
28 | - Increase Books Amount.
29 |
30 | **Users Have Following Access for this online store site:-**
31 | - Create New Account or Register.
32 | - Login.
33 | - View Available Books.
34 | - Select Books to Buy.
35 | - Select Books Quantity.
36 | - Buy Books.
37 | - Get Payment Receipt.
38 |
39 | ### Technologies used:-
40 | 1. Front-End Development:
41 | - HTML
42 | - CSS
43 | - Javascript
44 | - BootStrap
45 |
46 | 2. Back-End Development:
47 | - Java [JDK 8+]
48 | - JDBC
49 | - Servlet
50 |
51 | 3. Database:
52 | - MySql
53 |
54 | ### ================ Software And Tools Required ================
55 | - : Git [https://www.youtube.com/watch?v=gv7VPQ4LZ7g]
56 | - : Java JDK 8+ [https://www.youtube.com/watch?v=O9PWH9SeTTE]
57 | - : Eclipse EE (Enterprise Edition) [https://www.youtube.com/watch?v=8aDsEV7txXE]
58 | - : Apache Maven [https://www.youtube.com/watch?v=jd2zx3dLjuw]
59 | - : Tomcat v8.0+ [https://youtu.be/mLFPodZO8Iw?t=903]
60 | - : MySQL Server [https://www.youtube.com/watch?v=Ydh5jYA6Frs]
61 | - : MySQL Workbench (optional) [https://www.youtube.com/watch?v=t79oCeTXHwg]
62 |
63 | ### ================= Dummy Database Initialization =================
64 |
65 | STEP 1: Open MySQL Command Prompt or MySQL Workbench
66 |
67 | STEP 2: Login to the administrator user as : ```mysql -u -p``` (Enter Password if asked)
68 |
69 | STEP 3: Copy paste the following MySql Commands-
70 | ```MySQL
71 | create database if not exists onlinebookstore;
72 |
73 | use onlinebookstore;
74 |
75 | create table if not exists books(barcode varchar(100) primary key, name varchar(100), author varchar(100), price int, quantity int);
76 |
77 | create table if not exists users(username varchar(100) primary key,password varchar(100), firstname varchar(100),
78 | lastname varchar(100),address text, phone varchar(100),mailid varchar(100),usertype int);
79 |
80 | insert into books values('9780134190563','The Go Programming Language','Alan A. A. Donovan and Brian W. Kernighan',400,8);
81 | insert into books values('9780133053036','C++ Primer','Stanley Lippman and Josée Lajoie and Barbara Moo',976,13);
82 | insert into books values('9781718500457','The Rust Programming Language','Steve Klabnik and Carol Nichols',560,12);
83 | insert into books values('9781491910740','Head First Java','Kathy Sierra and Bert Bates and Trisha Gee',754,23);
84 | insert into books values('9781492056300','Fluent Python','Luciano Ramalho',1014,5);
85 | insert into books values('9781720043997','The Road to Learn React','Robin Wieruch',239,18);
86 | insert into books values('9780132350884','Clean Code: A Handbook of Agile Software Craftsmanship','Robert C Martin',288,3);
87 | insert into books values('9780132181273','Domain-Driven Design','Eric Evans',560,28);
88 | insert into books values('9781951204006','A Programmers Guide to Computer Science','William Springer',188,4);
89 | insert into books values('9780316204552','The Soul of a New Machine','Tracy Kidder',293,30);
90 | insert into books values('9780132778046','Effective Java','Joshua Bloch',368,21);
91 | insert into books values('9781484255995','Practical Rust Projects','Shing Lyu',257,15);
92 | insert into users values('demo','demo','Demo','User','Demo Home','42502216225','demo@gmail.com',2);
93 | insert into users values('Admin','Admin','Mr.','Admin','Haldia WB','9584552224521','admin@gmail.com',1);
94 | insert into users values('shashi','shashi','Shashi','Raj','Bihar','1236547089','shashi@gmail.com',2);
95 |
96 | commit;
97 |
98 | ```
99 |
100 | ### ========== Importing and Running The Project Through Eclipse EE ==========
101 |
102 | Step 0: Open Eclipse Enterprise Edition. [Install, if not already installed.]
103 |
104 | Step 1: Click On File > Import > Git > Projects From Git > Clone Uri > Paste The Repository Url as: ```https://github.com/shashirajraja/onlinebookstore.git```> Select master Branch > Next > Next > Finish.
105 |
106 | Step 2. a: Go inside ```src/main/resources > application.properties``` and update the value of database details as per your usage, like db.driver, db.host, db.username and db.password according to your installed mysql/postgresql admin user credentials.
107 |
108 | Step 2.b: Right Click on Project > Run as > Maven Build > In the goals field enter "clean install" > apply > run
109 |
110 | Step 2.c: Right Click On Project > Build Path > Configure Build Path > Libraries > Remove and Update Any Libraries if Red Mark Exists > Finish.
111 |
112 | Step 3: [Only If Tomcat Server is not configured in Eclipse] : Right Click On Project > Run As > Run On Server > Select Tomcat V8.0 > (Select Tomcat V8.0 Installation Location If Asked) Next > Add onlinebookstore > Finish.
113 |
114 | Step 4: In The Server Tab > Double Click On Tomcat Server > Ports > Change The Port Number For Http/1.1 To 8083 > Close And Save.
115 |
116 | Step 5: Right Click On Project > Run As > Run On Server > Select Tomcat v8.0 > Next > Add All> Done.
117 |
118 | Step 6: Check Running The Site At http://localhost:8083/onlinebookstore/
119 |
120 | Step 7: Default Username And Password For Admin Is "Admin" And "Admin"
121 |
122 | Step 8: The default Username And Password For User Is "shashi" And "shashi"
123 |
124 | ## FAQ
125 | **Question:1** Unable to Connect to Database?
126 |
127 | **Answer:** Please check you have installed the mysql correctly and have updated the correct db details in application.properties file. Also you can try doing maven clean install and force update the project and restart.
128 |
129 |
130 | Note:- Considering this as a Sample Project, we have not much considered of web security.
131 |
132 | #### "Suggestions and project improvement ideas are welcomed!"
133 |
134 | Thanks a lot,
135 | Project Leader
136 | Roger Rodriguez
137 |
--------------------------------------------------------------------------------
/WebContent/CustomerHome.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Book Store
5 |
7 |
9 |
11 |
12 |
14 |
15 |
16 |
18 |
22 |
26 |
29 |
30 |
31 |
32 |
63 |
64 |
65 |
66 |
67 |
69 |
71 |
74 |
75 |
--------------------------------------------------------------------------------
/WebContent/CustomerLogin.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Book Store
5 |
7 |
9 |
11 |
12 |
14 |
15 |
69 |
70 |
71 |
72 |
95 |
96 |
97 |
");
33 | return;
34 | }
35 | try {
36 |
37 | // Add/Remove Item from the cart if requested
38 | // store the comma separated bookIds of cart in the session
39 | // StoreUtil.updateCartItems(req);
40 |
41 | RequestDispatcher rd = req.getRequestDispatcher("SellerHome.html");
42 | rd.include(req, res);
43 | pw.println("
");
44 | // Set the active tab as cart
45 | StoreUtil.setActiveTab(pw, "storebooks");
46 |
47 | // Read the books from the database with the respective bookIds
48 | List books = bookService.getAllBooks();
49 | pw.println("
");
34 | return;
35 | }
36 | try {
37 |
38 | // Read All available books from the database
39 | List books = bookService.getAllBooks();
40 |
41 | // Default Page to load data into
42 | RequestDispatcher rd = req.getRequestDispatcher("CustomerHome.html");
43 | rd.include(req, res);
44 |
45 | // Set Available Books tab as active
46 | StoreUtil.setActiveTab(pw, "books");
47 |
48 | // Show the heading for the page
49 | pw.println("
Available Books"
50 | + "
"
51 | + "
"
52 | + "
");
53 | pw.println("
\r\n"
54 | + "
");
55 |
56 | // Add or Remove items from the cart, if requested
57 | StoreUtil.updateCartItems(req);
58 |
59 | HttpSession session = req.getSession();
60 | for (Book book : books) {
61 |
62 | // Add each book to display as a card
63 | pw.println(this.addBookToCard(session, book));
64 |
65 | }
66 |
67 | // Checkout Button
68 | pw.println("
"
69 | + "
"
70 | + "
"
71 | + "
");
72 |
73 | } catch (Exception e) {
74 | e.printStackTrace();
75 | }
76 | }
77 |
78 | public String addBookToCard(HttpSession session, Book book) {
79 | String bCode = book.getBarcode();
80 | int bQty = book.getQuantity();
81 |
82 | // Quantity of the current book added to the cart
83 | int cartItemQty = 0;
84 | if (session.getAttribute("qty_" + bCode) != null) {
85 | // Quantity of each book in the cart will be added in the session prefixed with
86 | // 'qty_' following with bookId
87 | cartItemQty = (int) session.getAttribute("qty_" + bCode);
88 | }
89 |
90 | // Button To Add/Remove item from the cart
91 | String button = "";
92 | if (bQty > 0) {
93 | // If no items in the cart, show add to cart button
94 | // If items is added to the cart, then show +, - button to add/remove more items
95 | button = "