Package com.emc.plants.persistence

Examples of com.emc.plants.persistence.Supplier


   * @param url
   */
  public void createSupplier(String supplierID, String name, String street, String city, String state, String zip, String phone, String url) {
    try {
      Util.debug("SuppliersBean.createSupplier() - Entered");
      Supplier supplier = null;
      /*
       try {
       // Create a new Supplier if there is NOT an existing Supplier.
        supplier = getSupplierLocalHome().findByPrimaryKey(new SupplierKey(supplierID));
        } catch (FinderException e) {
        */
      supplier = em.find(Supplier.class, supplierID);
      if (supplier == null) {
        Util.debug("SuppliersBean.createSupplier() - supplier doesn't exist.");
        Util.debug("SuppliersBean.createSupplier() - Creating Supplier for SupplierID: " + supplierID);
        //supplier = getSupplierLocalHome().create(supplierID, name, street, city, state, zip, phone, url);
        supplier = new Supplier(supplierID, name, street, city, state, zip, phone, url);
        em.persist(supplier);
      }
    } catch (Exception e) {
      Util.debug("SuppliersBean.createSupplier() - Exception: " + e);
    }
View Full Code Here


  @Transactional
  public SupplierInfo updateSupplier(String supplierID, String name, String street, String city, String state, String zip, String phone, String url) {
    SupplierInfo supplierInfo = null;
    try {
      Util.debug("SuppliersBean.updateSupplier() - Entered");
      Supplier supplier = null;
      /*
       try { */
      supplier = em.find(Supplier.class, supplierID);
      if (supplier != null) {
        // Create a new Supplier if there is NOT an existing Supplier.
        // supplier = getSupplierLocalHome().findByPrimaryKey(new SupplierKey(supplierID));
        supplier.setName(name);
        supplier.setStreet(street);
        supplier.setCity(city);
        supplier.setUsstate(state);
        supplier.setZip(zip);
        supplier.setPhone(phone);
        supplier.setUrl(url);
        supplierInfo = new SupplierInfo(supplier);
        em.persist(supplier);
        em.flush();
      } else { // catch (FinderException e) {
        Util.debug("SuppliersBean.updateSupplier() - supplier doesn't exist.");
View Full Code Here

  public String getSupplierURL(String supplierID) {
    String url = "";
    /*
     try { */
    Util.debug("SuppliersBean.getSupplierURL() - Entered");
    Supplier supplier = null;
    // Create a new Supplier if there is NOT an existing Supplier.
    // supplier = getSupplierLocalHome().findByPrimaryKey(new SupplierKey(supplierID));
    supplier = em.find(Supplier.class, supplierID);
    if (supplier != null) url = supplier.getUrl();
    /*
     } catch (Exception e) {
     Util.debug("SuppliersBean.getSupplierURL() - Exception: " + e);
     }
     */
 
View Full Code Here

   * @return supplierItem
   */
  public SupplierInfo getSupplierInfo(String supplierID) {
    SupplierInfo supplierItem = null;
    Util.debug("SuppliersBean.getSupplierInfo() - Entered");
    Supplier supplier = null;
   
    // Return the supplier Info if the supplier exists.
    supplier = em.find(Supplier.class, supplierID);
    if (supplier != null)
      supplierItem = new SupplierInfo(supplier);
View Full Code Here

    Query q = em.createNamedQuery("findAllSuppliers");
    List l=q.getResultList();
    if (l!=null){
      Iterator i=l.iterator();
      while (i.hasNext()) {
         Supplier supplier = (Supplier) i.next();
         suppliers.add(new SupplierInfo(supplier));
      }
    }
   
    return suppliers;
View Full Code Here

TOP

Related Classes of com.emc.plants.persistence.Supplier

Copyright © 2018 www.massapicom. 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.