public interface Catalog extends Pagination
A Catalog is the front end object interface for a back end peristance layer for storing product references and metadata. Classes implementing this interface implement methods to retrieve and store product references and metadata from a particular backend repository.
| Modifier and Type | Field and Description |
|---|---|
static String |
X_POINT_ID |
| Modifier and Type | Method and Description |
|---|---|
void |
addMetadata(Metadata m,
Product product)
Ingests
Metadata into the metadata store, and associates it with
the given productId. |
void |
addProduct(Product product)
Adds a Product to the Catalog.
|
void |
addProductReferences(Product product)
|
Metadata |
getMetadata(Product product)
Gets the Metadata for a given Product.
|
int |
getNumProducts(ProductType type) |
Product |
getProductById(String productId)
Gets a
Product, with the specified productId. |
Product |
getProductByName(String productName)
Gets a
Product with the specified productName. |
List |
getProductReferences(Product product)
Gets the
References associated with this Product. |
List<Product> |
getProducts()
|
List<Product> |
getProductsByProductType(ProductType type)
|
Metadata |
getReducedMetadata(Product product,
List<String> elements)
Gets a reduced set of metadata for a give Product.
|
List<Product> |
getTopNProducts(int n)
Gets the top
N most recent products that have been
cataloged. |
List<Product> |
getTopNProducts(int n,
ProductType type)
Gets the top
N most recent products that have been
cataloged for the given ProductType. |
ValidationLayer |
getValidationLayer() |
void |
modifyProduct(Product product)
Modifies an existing Product within the Catalog.
|
ProductPage |
pagedQuery(Query query,
ProductType type,
int pageNum)
Performs a query against the underlying
Catalog, and then
properly formulates a page of results to send back to the user. |
List<String> |
query(Query query,
ProductType type)
Queries the Catalog with the specified
Query |
void |
removeMetadata(Metadata m,
Product product)
Removes
Metadata from the metadata store, and disassociates it
from the given productId. |
void |
removeProduct(Product product)
Removes a
Product from the Catalog. |
void |
setProductTransferStatus(Product product)
Persists the
transferStatus attribute of the given
Product to the Catalog. |
getFirstPage, getLastProductPage, getNextPage, getPrevPagestatic final String X_POINT_ID
void addMetadata(Metadata m, Product product) throws CatalogException
Ingests Metadata into the metadata store, and associates it with
the given productId.
m - The Metadata to ingest.product - The product to add the metadata for.CatalogException - If any general error occurs.void removeMetadata(Metadata m, Product product) throws CatalogException
Removes Metadata from the metadata store, and disassociates it
from the given productId.
m - The Metadata to remove.product - The product for which the metadata is to be removed.CatalogException - If any general error occurs.void addProduct(Product product) throws CatalogException
Adds a Product to the Catalog.
product - The Product to add.CatalogException - If any error occurs during the add.void modifyProduct(Product product) throws CatalogException
Modifies an existing Product within the Catalog.
product - The new Product information to modify the existing
Product with.CatalogException - If any error occurs.void removeProduct(Product product) throws CatalogException
Removes a Product from the Catalog.
product - The product to remove.CatalogException - If any error occurs.void setProductTransferStatus(Product product) throws CatalogException
Persists the transferStatus attribute of the given
Product to the Catalog.
product - The Product whose transfer status will be persisted. The
caller should make sure that the product ID field is set.CatalogExceptionvoid addProductReferences(Product product) throws CatalogException
Adds the specified List of References to the
Catalog, and associates them with this Product specified
by its productId.
product - The product to add references for. The references are read
from the Products list of References.CatalogException - If anything goes wrong.Product getProductById(String productId) throws CatalogException
Gets a Product, with the specified productId.
productId - The unique ID of the Product to retrieve.Product, with the given ID. The implementer of this
method should ensure that the product References are
populated as well.CatalogException - If any error occurs.Product getProductByName(String productName) throws CatalogException
Gets a Product with the specified productName.
productName - The name of the Product to retrieve.Product with the given name. The implementer of this
method should ensure that the product References are
populated as well.CatalogExceptionList getProductReferences(Product product) throws CatalogException
Gets the References associated with this Product.
product - The Product to obtain the References for.List of References, associated with the
specified Product.CatalogExceptionList<Product> getProducts() throws CatalogException
List of Products in the Catalog.CatalogException - If any error occurs.List<Product> getProductsByProductType(ProductType type) throws CatalogException
type - The ProductType to obtain the Products for.List of Products that are associated with the
specified productType in the Catalog.CatalogException - If any error occurs.Metadata getMetadata(Product product) throws CatalogException
Gets the Metadata for a given Product.
product - The Product to obtain the Metadata for.Metadata for the given productId.
CatalogException - If any error occurs.Metadata getReducedMetadata(Product product, List<String> elements) throws CatalogException
Gets a reduced set of metadata for a give Product.
product - The Product to obtain the Metadata for.elements - The set of metadata elements of interest.Metadata for the given productId.CatalogException - If any error occurs.List<String> query(Query query, ProductType type) throws CatalogException
Queries the Catalog with the specified Query
query - The set of criteria by which to query the Catalog.type - The ProductType that should be queried.List of String product IDs that can be used to retrieve
products that match the query.CatalogException - If any error occurs.ProductPage pagedQuery(Query query, ProductType type, int pageNum) throws CatalogException
Performs a query against the underlying Catalog, and then
properly formulates a page of results to send back to the user. This
method is useful when you would like to conserve memory and not send back
the entire list of results, nor load them into memory. Of course, this
method assumes that queries are deterministic, i.e., the same query
issued 2x within a paginating session will produce the same set of
results to paginate.
query - The query to perform against the underlying Catalog.type - The ProductType that you are querying for.pageNum - The number of the ProductPage to return back to the
user.ProductPage of results.CatalogException - If any error occurs.List<Product> getTopNProducts(int n) throws CatalogException
Gets the top N most recent products that have been
cataloged.
n - The amount of recent products to return.List of Products that have been cataloged
recently.CatalogException - If any error occurs.List<Product> getTopNProducts(int n, ProductType type) throws CatalogException
Gets the top N most recent products that have been
cataloged for the given ProductType.
n - The amount of recent products to return.type - The ProductType to limit the query to.List of Products that have been cataloged
recently.CatalogException - If any error occurs.ValidationLayer getValidationLayer()
ValidationLayer that is used by this Catalog.CatalogException - If any error occurs (e.g., the layer isn't initialized).int getNumProducts(ProductType type) throws CatalogException
type - The ProductType to count the number of products for.Products for the
specified ProductType.CatalogException - If any error occurs.Copyright © 1999–2017 Apache OODT. All rights reserved.