📄 item.java
字号:
/*
* @author : Sujatha
* @Version : 1.0
*
* Development Environment : Oracle9i JDeveloper
* Name of the File : Item.java
* Creation/Modification History :
*
* Sujatha 10-Dec-2002 Created
*
*/
package oracle.otnsamples.vsm.services.data;
// Java utility class
import java.util.Map;
/**
* This class defines member variables which represent all the information of
* an item in the Shopping Mall. This class is used to pass Item related data
* to the clients from the services layer and vice versa.
*
* @author Sujatha
* @version 1.0
*/
public class Item implements java.io.Serializable {
private Map attributes; // Item Attributes
private String desc; // Item Description
private String id; // Item id
private String image; // Path of the image of the item
private String langID; // Language in which item information is maintained
private String name; // Item name
private String shopID; // Shop id which manages the item
private String subCatID; // SubCategory to which item belongs
private double unitPrice; // Unit Price of the item
private int quantity; // Quantity of item available in inventory
private int reorderLevel; // Reorder level for the item. If quantity goes below
// this, the item will be procured from supplier
private int reorderQty; // Quantity of item to be reordered
/**
* Default Constructor, takes no parameters
*/
public Item() {
}
/**
* Constructor. Stores the values passed as parameters into member variables
*
* @param <b>itemID</b> ID value of the Item
* @param <b>itemName</b> Name of the Item
* @param <b>desc</b> Item Description
* @param <b>subCatID</b> Sub category id to which the item belongs to
* @param <b>shopID</b> Shop id which manages the item
* @param <b>unitPrice</b> Unit Price of the item
* @param <b>quantity</b> Quantity of item available in inventory
* @param <b>reorderLevel</b> Reorder Level for this item
* @param <b>reorderQty</b> Quantity of item to be reordered
* @param <b>image</b> Path of the item image
* @param <b>langID</b> Language in which the item information is specified
* @param <b>attributes</b> Attributes of the item
*/
public Item(
String itemID, String itemName, String desc, String subCatID,
String shopID, double unitPrice, int quantity, int reorderLevel,
int reorderQty, String image, String langID, Map attributes) {
this.id = itemID;
this.name = itemName;
this.desc = desc;
this.subCatID = subCatID;
this.shopID = shopID;
this.unitPrice = unitPrice;
this.quantity = quantity;
this.reorderLevel = reorderLevel;
this.reorderQty = reorderQty;
this.image = image;
this.langID = langID;
this.attributes = attributes;
}
/**
* Gets the item id
*
* @return <b>String</b> id of the item
*/
public String getID() {
return id;
}
/**
* Sets the item id
*
* @param <b>newID</b> id of the item
*/
public void setID(String newID) {
this.id = newID;
}
/**
* Gets the item name
*
* @return <b>String</b> name of the item
*/
public String getName() {
return name;
}
/**
* Sets the item name
*
* @param <b>newName</b> name of the item
*/
public void setName(String newName) {
this.name = newName;
}
/**
* Gets the item description
*
* @return <b>String</b> description of the item
*/
public String getDesc() {
return desc;
}
/**
* Sets the item description
*
* @param <b>newDesc</b> description of the item
*/
public void setDesc(String newDesc) {
this.desc = newDesc;
}
/**
* Gets the item sub category id
*
* @return <b>String</b> subcategory id of the item
*/
public String getSubCatID() {
return subCatID;
}
/**
* Sets the item subcategory id
*
* @param <b>newSubCatID</b> subcategory id of the item
*/
public void setSubCatID(String newSubCatID) {
this.subCatID = newSubCatID;
}
/**
* Gets the item shop id
*
* @return <b>String</b> Shop id of the item
*/
public String getShopID() {
return shopID;
}
/**
* Sets the item shop id
*
* @param <b>newShopID</b> Shop id of the item
*/
public void setShopID(String newShopID) {
this.shopID = newShopID;
}
/**
* Gets the unit price of the item
*
* @return <b>String</b> unit price of the item
*/
public double getUnitPrice() {
return unitPrice;
}
/**
* Sets the unit price of the item
*
* @param <b>newId</b> unit price of the item
*/
public void setUnitPrice(double newUnitPrice) {
this.unitPrice = newUnitPrice;
}
/**
* Gets the item image path
*
* @return <b>String</b> image path of the item
*/
public String getImage() {
return image;
}
/**
* Sets the item image path
*
* @param <b>newImage</b> image path of the item
*/
public void setImage(String newImage) {
this.image = newImage;
}
/**
* Gets the item language
*
* @return <b>String</b> language of the item information
*/
public String getLangID() {
return langID;
}
/**
* Sets the item language
*
* @param <b>newLangID</b> language of the item information
*/
public void setLangID(String newLangID) {
this.langID = newLangID;
}
/**
* Gets the item attributes as a table of labels v/s values
*
* @return <b>Map</b> attributes for the item
*/
public Map getAttributes() {
return attributes;
}
/**
* Sets the item attributes as a table of labels v/s values
*
* @param <b>attributes</b> attributes for the item
*/
public void setAttributes(Map attributes) {
this.attributes = attributes;
}
/**
* Gets an item attribute identified by a label
*
* @param <b>label</b> label for the attribute
*
* @return <b>String</b> attribute value for the specified label
*/
public String getAttribute(String label) {
return (String) attributes.get(label);
}
/**
* Gets the item quantity
*
* @return <b>int</b> Quantity in the inventory
*/
public int getQuantity() {
return quantity;
}
/**
* Sets the item quantity in inventory
*
* @param <b>qty</b> Quantity
*/
public void setQuantity(int qty) {
quantity = qty;
}
/**
* Gets the item reorder level in inventory
*
* @return <b>int</b> Reorder Level
*/
public int getReorderLevel() {
return reorderLevel;
}
/**
* Sets the item reorder in inventory
*
* @param <b>reOrdLevel</b> Reorder Level
*/
public void setReorderLevel(int reOrdLevel) {
reorderLevel = reOrdLevel;
}
/**
* Gets the item reorder quantity
*
* @return <b>int</b> Reorder Quantity in the inventory
*/
public int getReorderQty() {
return reorderQty;
}
/**
* Sets the item reorder quantity in inventory
*
* @param <b>qty</b> Reorder Quantity
*/
public void setReorderQty(int qty) {
reorderQty = qty;
}
/**
* This method returns the values of the member variables
*
* @return <b>String</b> Name/ Value pair of the member variables
*/
public String toString() {
StringBuffer buf = new StringBuffer("SubCategory=");
buf.append(subCatID);
buf.append(",ItemName=");
buf.append(name);
buf.append(",Description=");
buf.append(desc);
buf.append(",ShopId=");
buf.append(shopID);
buf.append(",Price=");
buf.append(unitPrice);
buf.append(",ImageLoc=");
buf.append(image);
return buf.toString();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -