📄 listsubcategoryorproductaction.java
字号:
package com.sush.webstore.store.web.struts;
import java.util.Set;
import com.sush.webstore.store.domain.ICategory;
import com.sush.webstore.store.domain.IProduct;
import com.sush.webstore.store.domain.IWebStoreFacade;
import com.sush.webstore.store.domain.facade.WebStorePOJO;
public class ListSubCategoryOrProductAction {
private IWebStoreFacade webStore = new WebStorePOJO();
private Set<ICategory> categories;
private Set<IProduct> products;
private long id;
public String execute() {
ICategory category = webStore.getCategory(id);
if (category == null)
return "error";
if (webStore.hasSubCategories(category)) {
categories = webStore.getSubCategories(category);
return (categories == null) ? "error" : "category";
}
else if (webStore.hasProducts(category)) {
products = webStore.getProducts(category);
return (products == null) ? "error" : "product";
}
else {
return "error";
}
}
/**
* @return the id
*/
public long getId() {
return id;
}
/**
* @param id
* the id to set
*/
public void setId(long id) {
this.id = id;
}
/**
* @return the webStore
*/
public IWebStoreFacade getWebStore() {
return webStore;
}
/**
* @param webStore
* the webStore to set
*/
public void setWebStore(IWebStoreFacade webStore) {
this.webStore = webStore;
}
/**
* @return the categories
*/
public Set<ICategory> getCategories() {
return categories;
}
/**
* @param categories
* the categories to set
*/
public void setCategories(Set<ICategory> categories) {
this.categories = categories;
}
/**
* @return the products
*/
public Set<IProduct> getProducts() {
return products;
}
/**
* @param products
* the products to set
*/
public void setProducts(Set<IProduct> products) {
this.products = products;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -