package data;
public class DataBasketConditionImpl extends Object implements DataBasketCondition {
protected DataBasketEntrySource m_dbesSource;
protected DataBasketEntryDestination m_dbedDest;
protected String m_sMainKey;
protected String m_sSecondaryKey;
protected Object m_oValue;
public DataBasketConditionImpl (String sMainKey,
String sSecondaryKey,
DataBasketEntrySource dbesSource,
DataBasketEntryDestination dbedDest,
Object oValue) {
super();
m_sMainKey = sMainKey;
m_sSecondaryKey = sSecondaryKey;
m_dbesSource = dbesSource;
m_dbedDest = dbedDest;
m_oValue = oValue;
}
public DataBasketEntrySource getSource() {
return m_dbesSource;
}
public DataBasketEntryDestination getDestination() {
return m_dbedDest;
}
public Object getValue() {
return m_oValue;
}
public String getMainKey() {
return m_sMainKey;
}
public String getSecondaryKey() {
return m_sSecondaryKey;
}
public boolean match (DataBasketEntry dbe) {
return true;
}
public final static DataBasketCondition ALL_ENTRIES = new DataBasketConditionImpl (null,
null,
null,
null,
null);
public final static DataBasketCondition ALL_STOCK_ITEMS = new DataBasketConditionImpl (STOCK_ITEM_MAIN_KEY,
null,
null,
null,
null);
public final static DataBasketCondition ALL_CATALOG_ITEMS = new DataBasketConditionImpl (CATALOG_ITEM_MAIN_KEY,
null,
null,
null,
null);
public static final DataBasketCondition allStockItemsWithSource (Stock stSource) {
return new DataBasketConditionImpl (STOCK_ITEM_MAIN_KEY,
null,
stSource,
null,
null);
}
public static final DataBasketCondition allStockItemsWithDest (Stock stDest) {
return new DataBasketConditionImpl (STOCK_ITEM_MAIN_KEY,
null,
null,
stDest,
null);
}
public static final DataBasketCondition allCatalogItemsWithSource (Catalog cSource) {
return new DataBasketConditionImpl (CATALOG_ITEM_MAIN_KEY,
null,
cSource,
null,
null);
}
public static final DataBasketCondition allCatalogItemsWithDest (Catalog cDest) {
return new DataBasketConditionImpl (CATALOG_ITEM_MAIN_KEY,
null,
null,
cDest,
null);
}
public static final DataBasketCondition specificCatalogItem (CatalogItem ci) {
return new DataBasketConditionImpl (CATALOG_ITEM_MAIN_KEY,
ci.getName(),
null,
null,
ci);
}
public static final DataBasketCondition specificStockItem (StockItem si) {
return new DataBasketConditionImpl (STOCK_ITEM_MAIN_KEY,
si.getName(),
null,
null,
si);
}
}