⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ordercontroller.java

📁 我做的ssd9 exercise6 的答案。分享
💻 JAVA
字号:
import java.util.*;
/**
 * OrderController is used to get History Order of make order for user.
 */ 

public class OrderController {
	/**
	 * Read all Orders made by one user in database for that user.
	 * <p>
	 * Algorithm:
	 * <p>
	 * Firstly, we needn't worry about whether the user has login or not. 
	 * Whether the user has login or not will be judged in the form view.
	 * Only user has login, this method can be invoked. Otherwise, not.
	 * This method will get access to database (Orders table and Orders_Product table) and read all the histroy orders for the user.
	 * For each record in the ResultSet. this method will create an Order object for it.
	 * And For each product in the order, this method will create an product object for it and add it to the Collection class products of that order object. 
	 * 
	 * And then add the order object to an vector.
	 * At last return the vector. So we get all the history order of that user.
	 * 
	 * <p>
	 * Internal data structures:
	 * <p>
	 * An vector used to store the objects of products.
	 * Product
	 * Order
	 * @see Product
	 * @see Order
	 * 
	 * @param name  the user who want to check his/her order history.
	 * @return a vector object that contains all the histroy orders of the user.
	 */
	public Vector getAllOrders(String name){
		Vector allorders=new Vector();
		//body
		return allorders;
	}
	/**
	 * This method is used to submit.
	 * <p>
	 * Algorithm:
	 * <p>
	 * Firstly, we needn't worry about whether the user has login or not. 
	 * Whether the user has login or not will be judged in the form view.
	 * Only user has login, this method can be invoked. Otherwise, not.
	 * This method just need to insert some records to the database(Orders table and Orders_product table).
	 * All the information need for field in both table contains in the param object.
	 * If the database update success return true. Otherwise, return false. 
	 * <p>
	 * Internal data structures:
	 * <p>
	 * Order.
	 * @see Order
	 * 
	 * @param order  the order object which contains all the information we need to make an order
	 * @return If the database update success which means the order make success, return true. Otherwise return false.
	 */
	public boolean submit(Order order){
		//body
		return true;
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -