1. Trang chủ
  2. » Luận Văn - Báo Cáo

spring store software design specification mentor quách luyl đa

92 0 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề SPRING_STORE Software Design Specification
Tác giả Trần Trọng Nguyễn, Hồng Bảo Bảo, Đoàn Quốc Kiệt
Người hướng dẫn Quách Luyl Đa
Thể loại Software Design Specification
Năm xuất bản 2022
Thành phố CanTho
Định dạng
Số trang 92
Dung lượng 4,17 MB

Cấu trúc

  • I. Overview (8)
    • 1. Code Packages (8)
    • 2. Database Design (9)
  • II. Code Designs (11)
    • 1. Login for user (11)
    • 2. Login for staff (14)
    • 4. Update Product By Staff (18)
    • 5. Add An Order (22)
    • 10. Log out (0)
    • 11. Register for user (0)
    • 12. View user profile (0)
    • 14. Update Product By Staff (0)
    • 15. List staff management (0)
    • 25. Delete product by staff ................................................................................................................ a. Class diagram b. Class specification (68)
  • C. Sequence Diagram(s) d. Database queries 28. Order Approval a. Class diagram b. Class Specification (13)
    • 33. Add product into cart from product details (90)

Nội dung

Table Description01 Admin Stores information about administrators in the system.- Primary keys: adminID- Foreign keys: None02 User Stores information about registered users.- Primary key

Overview

Code Packages

01 View This package include font-end source with: jsp page, css, javascript, images, icon, font, bootstrap and jquery library

02 Models This package contains entities(classes) Product, Cart, Order, User,

Staff, etc that can be accessed and used by other classes DAO.

03 DAOs Includes class ProductDAO, CartDAO, OrderDAO, UserDAO, and etc with detailed functions that can interact directly with the database for data processing to which the Controller can load data for the user.

04 Controller Includes Servlets with a responsibility to process, transfer the data collected by user on web page(view) to DAO and Model in the database to JSP pages.

05 DBContext This package helps connect database.

06 Ultis This package contains Helper class with functions for sending

Database Design

01 Admin Stores information about administrators in the system.

02 User Stores information about registered users.

03 Staff Stores information about staff members.

04 Product Stores information about products available in the system.

05 Comment Stores user comments on products.

- Foreign keys: productID (references Product), userID (references User)

06 Cart Stores information about user shopping carts.

- Foreign keys: userID (references User), productID (references Product)

07 Order Stores information about user orders.

- Foreign keys: userID (references User)

08 OrderDetail Stores detailed information about products in each order.

09 Size Stores information about product sizes.

10 Import Stores information about product imports.

Code Designs

Login for user

01 doPost() After the user presses the "login" button and submits the necessary information to log in, this function processes and forwards the request from the user First, it checks if the person logging in has the

"user" role, and if so, it calls the login() function in UserDAO to verify the username and password against the stored data.

01 login() First, Establish a connection to the database.

Second, it sends the email address and password to select an account in the database If the account is returned, it displays successful login information or incorrect login information.

+ Input: email(String), password(String): verified data. query(string): to select data from the database.

+ Output: acc(Account) or null.

02 getUser() After login into the system successfully, save user session information.

01 User () We must add the data to an Account entity with each attribute by progressively supplying arguments to the constructor after loading the data to a result table so that it can be added to the list collection.

+Input: userID(int), userEmail(String), userPassword(String), userName(String), userDOB(date), userPhone(String), userAddress(String).

Figure 1 Sequence diagram login for user d Database Queries

String query: Select * from [User] where userEmail = ? and userPassword=?

Login for staff

01 doPost() After the user presses the "login" button and submits the necessary information to log in, this function processes and forwards the request from the user First, it checks if the person logging in has the

"staff" role, and if so, it calls the login() function in StaffDAO to

Second, it sends the email address and password to select an account in the database If the account is returned, it displays successful login information or incorrect login information.

+ Input: email(String), password(String): verified data. query(string): to select data from the database.

+ Output: acc(Account) or null.

02 getStaff() After login into the system successfully, save user session information.

01 Staff () We must add the data to an Account entity with each attribute by progressively supplying arguments to the constructor after loading the data to a result table so that it can be added to the list collection.

+Input: staffID(int), staffEmail(String), staffsPassword(String), staffName(String), staffDOB(date), staffPhone(String), staffAddress(String).

01 getConnection() Create a connection using a few of the provided parameters Next, establish a database connection to begin processing data

+ Input: dbPrefix(String), dbPort(String), dbName(String), instance(String), user(String), and password(String)—passed data is formatted for validation.

+ Output: Conn (connection), which connects to the database. c Sequence Diagram(s)

Figure 1 Sequence diagram login for staff d Database Queries

String query: Select * from [Staff] where staffEmail = ? and staffPassword=?

3 Add Product By Staff a.Class Diagram b.Class Specifications

1 doPost Get parameter in form add product then pass into addProduct() in ProductDAO class

01 addProduct(in product:Product):void

Add new product + Input: name(String),Price(string), description(String), Quantity(String),img(string), category(string).

HTTPServlet: Extends the GenericServlet class and implements Serializable interface It provides http specific methods such as doGet, doPost, doHead, doTrace This class provide by Java Servlet framework. c.Sequence Diagram(s)

Update Product By Staff

01 doGet() Call getProductByID() in ProductDAO then load on web

02 doPost Get parameter in form update product then pass into updateProduct() in ProductDAO class

Method that take sanintegerproduct Idasaparameter Inside themethod,youwouldtypicallyhavecodeto locateand updatetheproductinyourdatastore,such as a database.

+ Update product by parameter+productId(int),productName(String),productPrice(double),productQuantity(int),productImg(string),productCategory(string),productDis(string).

After loading data to a result table to have the data for adding to list collection we need to add them into a Product entity with each attribute by passing parameters to the constructor sequentially + Input:productId(int), productName(String),productPrice(double),productQuantity(int),productImg(strin g),productCategory(string),productDis(string)

- passed data is validated format.

+ Output: None c Sequence Diagram(s) d.Database queries

+ "LEFT JOIN [Size] S OSN P.productID = S.productID "

List staff management

Figure 1 Sequence diagram login for user d Database Queries

String query: Select * from [User] where userEmail = ? and userPassword=?

2 Login for staff a Class Diagram b Class Specifications

01 doPost() After the user presses the "login" button and submits the necessary information to log in, this function processes and forwards the request from the user First, it checks if the person logging in has the

"staff" role, and if so, it calls the login() function in StaffDAO to

Second, it sends the email address and password to select an account in the database If the account is returned, it displays successful login information or incorrect login information.

+ Input: email(String), password(String): verified data. query(string): to select data from the database.

+ Output: acc(Account) or null.

02 getStaff() After login into the system successfully, save user session information.

01 Staff () We must add the data to an Account entity with each attribute by progressively supplying arguments to the constructor after loading the data to a result table so that it can be added to the list collection.

+Input: staffID(int), staffEmail(String), staffsPassword(String), staffName(String), staffDOB(date), staffPhone(String), staffAddress(String).

01 getConnection() Create a connection using a few of the provided parameters Next, establish a database connection to begin processing data

+ Input: dbPrefix(String), dbPort(String), dbName(String), instance(String), user(String), and password(String)—passed data is formatted for validation.

+ Output: Conn (connection), which connects to the database. c Sequence Diagram(s)

Figure 1 Sequence diagram login for staff d Database Queries

String query: Select * from [Staff] where staffEmail = ? and staffPassword=?

3 Add Product By Staff a.Class Diagram b.Class Specifications

1 doPost Get parameter in form add product then pass into addProduct() in ProductDAO class

01 addProduct(in product:Product):void

Add new product + Input: name(String),Price(string), description(String), Quantity(String),img(string), category(string).

HTTPServlet: Extends the GenericServlet class and implements Serializable interface It provides http specific methods such as doGet, doPost, doHead, doTrace This class provide by Java Servlet framework. c.Sequence Diagram(s)

4 Update Product By Staff a.Class Diagram b.Class Specifications

01 doGet() Call getProductByID() in ProductDAO then load on web

02 doPost Get parameter in form update product then pass into updateProduct() in ProductDAO class

Method that take sanintegerproduct Idasaparameter Inside themethod,youwouldtypicallyhavecodeto locateand updatetheproductinyourdatastore,such as a database.

+ Update product by parameter+productId(int),productName(String),productPrice(double),productQuantity(int),productImg(string),productCategory(string),productDis(string).

After loading data to a result table to have the data for adding to list collection we need to add them into a Product entity with each attribute by passing parameters to the constructor sequentially + Input:productId(int), productName(String),productPrice(double),productQuantity(int),productImg(strin g),productCategory(string),productDis(string)

- passed data is validated format.

+ Output: None c Sequence Diagram(s) d.Database queries

+ "LEFT JOIN [Size] S OSN P.productID = S.productID "

5 Add An Order a Class Diagram b Class Specifications

Second, it checks to see if the email account already exists If so, it will return to the registration interface and display a message indicating that the email already exists.

03 addNew(user) Firstly, this method calls the class DBcontext to create a connection with the database

Secondly, add new user account to database.

+Input:email(String),password(String),name(String), phone(String), address(String)

01 Order() We must add the data to an Account entity with each attribute by progressively supplying arguments to the constructor after loading the data to a result table so that it can be added to the list collection.

+ Input: orderId(int), userID(int), PurchaseDate(String), productName(String), totalPrice(float)

01 getConnection() Create a connection using a few of the provided parameters Next, establish a database connection to begin processing data

+ Input: dbPrefix(String), dbPort(String), dbName(String), instance(String), user(String), and password(String)—passed data is formatted for validation.

+ Output: Conn (connection), which connects to the database. c Sequence Diagram(s)

Figure 1 Sequence diagram register for user d Database Queries

String query: INSERT INTO ORDER VALUES (UserID,TotalPrice,purchaseDate);

6 List Product category by Users

1 doGet Get parameter in form getproduct() in ProductDAO class

Get product + Input: name(String),Price(string), description(String), Quantity(String),img(string), category(string).

HTTPServlet: Extends the GenericServlet class and implements Serializable interface It provides http specific methods such as doGet, doPost, doHead, doTrace This class provide by Java Servlet framework c Sequence Diagram(s) d Database queries select * from [Product] p where p.productName like ? and [productCategory] like ?

This method extends HttpServlet with responsibility to handle and transfer requests from users It gets txtSearch entered by the user in jsp page then call function in ProductDAO to process data and respond to the result to home page lists products matched with keywords and messages not found otherwise.

01 searchProduct(in keyword:String): List

This function is responsible for searching for information about a product based on the provided product ID The The search process can be related to queries in gadatabaseor The system stores product data and returns details information about the respective product product code This information may include the product name, price, description, images and other related details.

01 Product() After loading data to a result table to have the data for adding to the list collection we need to add them into a Product entity with each attribute by passing parameter to constructor sequentially.

+ Input:productId(int), productName(String),product

Price(double),productQuantity(int),productImg(string),productCategory(string),pro ductDis(string).passed data is validated format.

Database queries select * from Product where userId like '%?%'

8.Delete list product in cart a.Class Diagram b.Class Specifications

01 +DelateProductFormCart() +Delete product by ID of product

- After loading data to a result table to have the data for adding to list collection we need to add them into a

Product entity with each attribute by passing parameters to the constructor sequentially

No Method Description getconnection() getconnection so that when adding a product it will be put into the dboCart field c.Sequence Diagram(s)

01 Staff() After loading data to a result table to have the data for adding to the list collection we need to add them into a staff entity with each attribute by passing parameters to the constructor sequentially

+ Input: staffID(int), staffEmail(String), staffPassword(String), staffName(String), staffDOB(date), staffPhone(String), staffAddress(String) – validated data + Output: none

01 getconnection() Create a connection with some of the passed parameters as below Then create a connection with database for data processing + Input: dbPrefix(String), dbPort(String), dbName(String), instance(String), user(String), and password(String) - passed data is validated format

+ Output: conn(Connection) - to connect with database. c.Sequence Diagram(s) d.Database queries

22.Add new staff a.Class Diagram b Class Specifications

01 doPost() +Call addStaff() and getStaff() in StaffDAO class then upload to web

01 addStaff() +Add a new staff member to the database

02 getStaff() +Check to see if the imported email already exists in the database. the list collection we need to add them into an Staff entity with each attribute by passing parameters to the constructor sequentially

+ Input: id (int), email(String), password(String), staffID(int), staffName(String), staffPhone(String),staffAddress(String)

01 getConnection() Create a connection with some of the passed parameters as below Then create a connection with database for data processing + Input: dbPrefix(String), dbPort(String), dbName(String), instance(String), user(String), and password(String) - passed data is validated format

+ Output: conn(Connection) - to connect with database. c.Sequence Diagram(s) d.Database queries

String query: INSERT INTO [dbo].[Staff]"

SELECT * from Staff where staffEmail=?

23.Change user password a Class Diagram

01 doPost() + Get parameter of form update user profile then pass Update() in UserDAO class.

01 User() After loading data to a result table to have the data for adding to the list collection we need to add them into an Account entity with each attribute by passing parameters to the constructor sequentially

+ Input: userID (int), userEmail(String), userName(String), userPassword(String), userDOB(Date), userPhone(String), userAddress(String) + Output: None

01 User() After loading data to a result table to have the data for adding to the list collection we need to add them into an Account entity with each attribute by passing parameters to the constructor sequentially

+ Input: id (int), userEmail(String), userPassword(String), userID(int), userName(String), userDateOfBirth(date), userPhone(String), userAddress(String) + Output: none

01 getConnection() Create a connection with some of the passed parameters as below Then create a connection with database for data processing

+ Input: dbPrefix(String), dbPort(String), dbName(String), instance(String), user(String), and password(String) - passed data is validated format

+ Output: conn(Connection) - to connect with database. c.Sequence Diagram(s) d.Database queries

- String query: update [User] set userPassword=? where userID=?

24.Show Detail Product a.Class Diagram b Class Specifications

01 doGet() + doGet()is a method within the ClassSpecifications of the Product Controller,used to handle HTTP GET requests from clients or web browsers This method is primarily associated with displaying detailed information abou ta specific product and relies on the GetProducbytId method from the Product DAO to access and retrieve product details from the database.

01 GetProductbyId It employs the productId parameter to invoke the method of the Product DAO, facilitating access to the database and the retriev a lof comprehensive product information.

01 Product() After load data to a result table to have the data for adding to list collection we need to add them into a

Product entity with each attribute by passing parameters to the constructor sequentially

+ Input:productId(int), productName(String),product

Price(double),productQuantity(int),productImg(string),productCatego ry(string),productDis(string).passed data is validated format

+ Output: None c Sequence Diagram(s) d Database queries

+ "LEFT JOIN [Size] S ON P.productID = S.productID

Sequence Diagram(s) d Database queries 28 Order Approval a Class diagram b Class Specification

Add product into cart from product details

This function will retrieve the information in the product to put into thecart database, it will be cartID, userID, ProductID, size and quantity

01 getConnection() getConnection so that when adding a product it will be put into the dboCart field c.Sequence Diagram(s) d.Database queries

- String query: INSERT into Cart values(?,?,?,?)

Ngày đăng: 09/05/2024, 10:57

w