📄 inventorylogic.java~13~
字号:
package com.inv.logic;import com.inv.dao.HbmDAO;import com.inv.actionform.InventoryActionForm;import java.util.*;import com.inv.vo.Inventory;import com.inv.dao.DAOException;public class InventoryLogic { private HbmDAO dao; private InventoryActionForm form; public InventoryLogic() { dao = new HbmDAO(); dao.setAutoClose(false); } public void getInventorys() { String str = "from Inventory"; List inventorys = dao.list(str); form.setInventorys(inventorys); } public void addInventory() { Inventory inventory = new Inventory(); inventory.setInvName(""); inventory.setInvLocation(""); inventory.setInvUID(null); form.getInventorys().add(inventory); } public void saveInventory() { List inventorys = form.getInventorys(); for (Iterator iter = inventorys.iterator(); iter.hasNext(); ) { Inventory item = (Inventory)iter.next(); if(item.getInvUID().equals(new Long(0))) { item.setInvUID(null); } try { dao.store(item); } catch (DAOException ex) { ex.printStackTrace(); } } } public void deleteInventory() { Long uid = form.getDeleteUID(); try { dao.remove(Inventory.class, uid); } catch (DAOException ex) { ex.printStackTrace(); } } public void closeDAO() { dao.closeSession(); } public InventoryActionForm getForm() { return form; } public void setForm(InventoryActionForm form) { this.form = form; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -