public class InventoryClientImpl extends Object implements InventoryClient
Modifier and Type | Field and Description |
---|---|
private URI |
appURI
Defines the HTTP URL for the WAR that hosts the JAX-RS resources.
|
private org.apache.http.client.HttpClient |
client |
private static org.apache.commons.logging.Log |
log |
Constructor and Description |
---|
InventoryClientImpl() |
Modifier and Type | Method and Description |
---|---|
protected <T> UriBuilder |
buildURI(Class<T> resourceClass,
String method)
Helper method that returns a URIBuilder fully initialized to point
to the URI that will reach the specified method within the inventory
resource classes.
|
Product |
createProduct(Product product,
String categoryName)
This method uses HTML FORM mechanism to POST a new product in the
inventory.
|
boolean |
deleteCategory(int id) |
boolean |
deleteProduct(int id) |
Categories |
findCategoryByName(String name,
int offset,
int limit) |
Products |
findProductsByName(String name,
int offset,
int limit) |
Category |
getCategory(int id) |
Product |
getProduct(int id) |
void |
setAppURI(URI appURI) |
void |
setHttpClient(org.apache.http.client.HttpClient client) |
Product |
updateProduct(Product product) |
private static final org.apache.commons.logging.Log log
private org.apache.http.client.HttpClient client
private URI appURI
public void setHttpClient(org.apache.http.client.HttpClient client)
public void setAppURI(URI appURI)
protected <T> UriBuilder buildURI(Class<T> resourceClass, String method)
resourceClass
- method
- public Categories findCategoryByName(String name, int offset, int limit) throws Exception
findCategoryByName
in interface InventoryClient
Exception
public Category getCategory(int id) throws Exception
getCategory
in interface InventoryClient
Exception
public boolean deleteCategory(int id) throws Exception
deleteCategory
in interface InventoryClient
Exception
public Product createProduct(Product product, String categoryName) throws Exception
createProduct
in interface InventoryClient
Exception
public Products findProductsByName(String name, int offset, int limit) throws Exception
findProductsByName
in interface InventoryClient
Exception
public Product getProduct(int id) throws Exception
getProduct
in interface InventoryClient
Exception
public Product updateProduct(Product product) throws Exception
updateProduct
in interface InventoryClient
Exception
public boolean deleteProduct(int id) throws Exception
deleteProduct
in interface InventoryClient
Exception
Copyright © 2015 John's Hopkins University, Engineering Programs for Professionals. All rights reserved.