/*
* @author : Neelesh
* @Version : 1.0
*
* Development Environment : Oracle9i JDeveloper
* Name of the File : Shop.java
* Creation/Modification History :
*
* Neelesh 03-Oct-2002 Created
*
*/
package oracle.otnsamples.vsm.services.data;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* The class is a value object for Shop, and has getters and setters for
* username,id, shopname,description,rating,registrationdate and category id .
*
* @author Neelesh
* @version 1.0
*/
public class Shop implements java.io.Serializable {
private Date regDate; // date of shop registration
private List shopDetails;
private String categoryId; // id of shop category
private String id; // shop's unique id
private String status; // shop status
private String userName; // user name of shop owner
//P-pending,R-Rejected, A-Approved,D-discontinued
//private Customer owner;
// private Category category;
/**
* constructor
*/
public Shop(
String userName, String catID, Date regDate, String id,
String status, List details) {
this.userName = userName;
this.categoryId = catID;
this.regDate = regDate;
this.id = id;
this.status = status;
this.shopDetails = details;
}
/**
* Default constructor
*/
public Shop() {
}
/**
* Gets the category of the shop
*
* @return String category id
*/
public String getCategoryId() {
return categoryId;
}
/**
* Gets the date of shop registration
*
* @return Date date of registration
*/
public Date getRegDate() {
return regDate;
}
/**
* Gets the status of the shop
*
* @return String status of the shop P-pending,R-Rejected,
* A-Approved,D-discontinued
*/
public String getStatus() {
return status;
}
/**
* Sets the owner's userName
*
* @param newUserName username of shopowner
*/
public void setUserName(String newUserName) {
userName = newUserName;
}
/**
* Gets the owner's userName
*
* @return String username of shopowner
*/
public String getUserName() {
return userName;
}
/**
* Sets the category of the shop
*
* @param newCategoryId new category id
*/
public void setCategoryId(String newCategoryId) {
categoryId = newCategoryId;
}
/**
* Gets the id of the shop
*/
public String getId() {
return id;
}
/**
* Sets the date of shop registration
*
* @param newRegDate date of registration
*/
public void setRegDate(Date newRegDate) {
regDate = newRegDate;
}
/**
* Sets the id of the shop
*
* @return newId id
*/
public void setId(String newId) {
id = newId;
}
/**
* Sets the status of the shop
*
* @param newStatus new status of the shop P-pending,R-Rejected,
* A-Approved,D-Discontinued
*/
public void setStatus(String newStatus) {
status = newStatus;
}
/**
* Returns a list of shop details in different languages
*
* @return List list of ShopDetail objects
*/
public List getShopDetails() {
return shopDetails;
}
/**
* Sets a list of shop details in different languages
*
* @param details list of ShopDetail objects
*/
public void setShopDetails(List details) {
shopDetails = details;
}
/**
* Gets a shop detail at the provided index in the list of details
*
* @param i index
*
* @return ShopDetail ShopDetail object, null if its not there
*/
public ShopDetail getShopDetail(int i) {
if(shopDetails == null) {
return null;
}
return (ShopDetail) shopDetails.get(i);
}
/**
* Removes a shop detail at the provided index, from the list of details
*
* @param i index
*/
public void removeShopDetail(int i) {
if(shopDetails == null) {
return;
}
shopDetails.remove(i);
}
/**
* Adds a shop detail to the list of details
*
* @param detail ShopDetail object
*/
public void addShopDetail(ShopDetail detail) {
if(shopDetails == null) {
shopDetails = new ArrayList();
}
shopDetails.add(detail);
}
/**
* Gets the shop detail for a given language from the list of details
*
* @param langID language id
*
* @return ShopDetail ShopDetail object, null if its not present
*/
public ShopDetail getShopDetail(String langID) {
if(shopDetails == null) {
return null;
}
for(int i = 0; i < shopDetails.size(); i++) {
if(langID.equals(((ShopDetail) shopDetails.get(i)).getLangId())) {
return (ShopDetail) shopDetails.get(i);
}
}
return null;
}
}