📄 itemform.java
字号:
/*
* @author : Sujatha
* @Version : 1.0
*
* Development Environment : Oracle9i JDeveloper
* Name of the File : ItemForm.java
* Creation/Modification History :
*
* Sujatha 17-March-2003 Created
*
*/
package oracle.otnsamples.vsm.actions.forms;
// Java utility class
import java.util.Map;
// Value object corresponding to Item
import oracle.otnsamples.vsm.services.data.Item;
// Struts API
import org.apache.struts.action.ActionForm;
import org.apache.struts.upload.FormFile;
/**
* The class is a Struts action form encapsulating item data. The class has
* getters and setters for item related information like name, description,
* attributes, shopID etc.
*
* @author Sujatha
* @version 1.0
*/
public class ItemForm extends ActionForm {
private FormFile image; // Image of the item
private Map attributes; // Item Attributes
private String desc; // Item Description
private String id; // Item id
private String langID; // Language in which item information is maintained
private String name; // Item name
private String quantity; // Quantity of item available in inventory
private String reorderLevel; // Reorder level for the item.
private String reorderQty; // Quantity of item to be reordered
private String shopID; // Shop id which manages the item
private String subCatID; // SubCategory to which item belongs
private String unitPrice; // Unit Price of the item
/**
* Default Constructor - takes no parameter
*/
public ItemForm() {
}
/**
* 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>image</b> Path of the item image
* @param <b>langID</b> Language in which the item information is specified
* @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
*/
public ItemForm(
String itemID, String itemName, String desc, String subCatID,
String shopID, String unitPrice, FormFile image, String langID,
String quantity, String reorderLevel, String reorderQty) {
this.id = itemID;
this.name = itemName;
this.desc = desc;
this.subCatID = subCatID;
this.shopID = shopID;
this.unitPrice = unitPrice;
this.image = image;
this.langID = langID;
this.quantity = quantity;
this.reorderLevel = reorderLevel;
this.reorderQty = reorderQty;
}
/**
* Constructor which takes an Item value object and copies the values from
* the object
*
* @param <b>item</b> Item object
*/
public ItemForm(Item item) {
this.id = item.getID();
this.name = item.getName();
this.desc = item.getDesc();
this.subCatID = item.getSubCatID();
this.shopID = item.getShopID();
this.unitPrice = Double.toString(item.getUnitPrice());
this.langID = item.getLangID();
this.quantity = Integer.toString(item.getQuantity());
this.reorderLevel = Integer.toString(item.getReorderLevel());
this.reorderQty = Integer.toString(item.getReorderQty());
this.attributes = item.getAttributes();
}
/**
* 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 String getUnitPrice() {
return unitPrice;
}
/**
* Sets the unit price of the item
*
* @param <b>newUnitPrice</b> unit price of the item
*/
public void setUnitPrice(String newUnitPrice) {
this.unitPrice = newUnitPrice;
}
/**
* Gets the item image
*
* @return <b>FormFile</b> image of the item
*/
public FormFile getImage() {
return image;
}
/**
* Sets the item image
*
* @param <b>newImage</b> image of the item
*/
public void setImage(FormFile newImage) {
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
*/
public Map getAttributes() {
return attributes;
}
/**
* Sets the item attributes as a table of labels v/s values
*
* @return <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 label specified
*/
public String getAttribute(String label) {
return (String) attributes.get(label);
}
/**
* Gets the item quantity
*
* @return <b>String</b> Quantity in the inventory
*/
public String getQuantity() {
return quantity;
}
/**
* Sets the item quantity in inventory
*
* @return <b>qty</b> Quantity
*/
public void setQuantity(String qty) {
quantity = qty;
}
/**
* Gets the item reorder level in inventory
*
* @return <b>String</b> Reorder Level
*/
public String getReorderLevel() {
return reorderLevel;
}
/**
* Sets the item reorder in inventory
*
* @return <b>reOrdLevel</b> Reorder Level
*/
public void setReorderLevel(String reOrdLevel) {
reorderLevel = reOrdLevel;
}
/**
* Gets the item reorder quantity
*
* @return <b>int</b> Reorder Quantity in the inventory
*/
public String getReorderQty() {
return reorderQty;
}
/**
* Sets the item reorder in inventory
*
* @return <b>reOrdQty</b> Reorder Level
*/
public void setReorderQty(String reOrdQty) {
reorderQty = reOrdQty;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -