Package

Source Code of AdminImpl

import item.AdminPOA;
import item.product;
import item.unknownId;



public class AdminImpl extends AdminPOA {
  private Items items;

  public AdminImpl() {
  }

  public AdminImpl(Items items) {
    this.items = items;
  }

  @Override
  public String addProduct(String id, double price, String description,
      String location) {
    try {
      product p=new product(id, price, description,
          location);
       items.addProduct(p);
       return p.id;
    } catch (Exception e) {
      e.printStackTrace(System.err);
    }
    return null;
  }

  @Override
  public void deleteProduct(String id) throws unknownId {
    items.deleteProduct(id);
  }

  @Override
  public String searchProductByName(String description) {
    return items.searchProductByName(description);
  }

  @Override
  public product getProductWithId(String id) {
    return items.getProductWithId(id);
  }

  @Override
  public void changeProductPrice(String id, double price) throws unknownId {
    try {
      items.changePrice(id, price);
    } catch (Exception e) {
      e.printStackTrace(System.err);
    }
  }

  @Override
  public void changeProductDescription(String id, String description)
      throws unknownId {
    try {
      items.changeDescription(id, description);
    } catch (Exception e) {
      e.printStackTrace(System.err);
    }
  }

  @Override
  public void changeProductLocation(String id, String location)
      throws unknownId {
    try {
      items.changeLocation(id, location);
    } catch (Exception e) {
      e.printStackTrace(System.err);
    }
  }

  @Override
  public product[] getProducts() {
    return items.getProducts();
  }

}
TOP

Related Classes of AdminImpl

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.