Package com.apress.prospring.ch9.domain

Examples of com.apress.prospring.ch9.domain.Customer


        return LOGGER;
    }
    // }}

    public void install() {
        Customer richard = getCustomerRepository().findByName("Pawson");
        Product foldingTable = getProductRepository().findByCode("820-72721");
        Product foldingChair = getProductRepository().findByCode("820-72725");
        Product waspCatcher = getProductRepository().findByCode("850-18003");
        Product coolbox = getProductRepository().findByCode("845-01020");
       
        setDate(2007, 4, 11); setTime(10, 15);
        richard.placeOrder(foldingTable, 1);
        setDate(2007, 4, 12); setTime(9, 35);
        richard.placeOrder(foldingChair, 6);
        setDate(2007, 4, 13); setTime(14, 20);
        richard.placeOrder(waspCatcher, 1);
        setDate(2007, 4, 14); setTime(11, 10);
        richard.placeOrder(coolbox, 1);
    }
View Full Code Here


    proxyCustomerDH = getProxyFactory().proxy(customerDH);
    product355 = getProductRepository().findByCode("355-40311");
  }
 
  public void testCannotPlaceOrderForStillTransientCustomer() {
    Customer newCustomer =
      getProxyFactory().proxy(getCustomerRepository().newCustomer());
    try {
      newCustomer.placeOrder(product355, 1);
      fail("Exception should have been thrown");
    } catch(DisabledImperativelyException ex) {
      assertEquals("Save object first", ex.getMessage());
    }
  }
View Full Code Here

     * Creates a new (still-transient) customer.
     *
     * @return
     */
    public Customer newCustomer() {
        Customer customer = (Customer)newTransientInstance(Customer.class);
        return customer;
    }
View Full Code Here

    public Customer newCustomer(
            String firstName,
            String lastName,
            int customerNumber) {
       
        Customer customer = newCustomer();
        customer.setFirstName(firstName);
        customer.setLastName(lastName);
        customer.setCustomerNumber(customerNumber);
       
        getContainer().makePersistent(customer);
        return customer;
    }
View Full Code Here

                String name) {
            this.name = name;
        }

        public boolean accept(Object obj) {
            Customer pojo = (Customer)obj;
            return pojo.getLastName().toLowerCase().contains(name.toLowerCase());
        }
View Full Code Here

  }
 
  private void customer() {
    CustomerDao customerDao = (CustomerDao)context.getBean("customerDao");
   
    Customer janm = customerDao.getById(1);
    Customer robh = customerDao.getById(2);
   
    System.out.println(janm);
    System.out.println(robh);
  }
View Full Code Here

    testDao.save(test1);
    testDao.save(test2);
  }
 
  public void customer() {
    CustomerDao customerDao = (CustomerDao)context.getBean("customerDao");
    List customers = customerDao.getAll();
    for (Iterator i = customers.iterator(); i.hasNext();) {
      Customer customer = (Customer)i.next();
      System.out.println(customer);
    }
   
    customers = customerDao.getAllWithOnlyOnePermission();
    for (Iterator i = customers.iterator(); i.hasNext();) {
      Customer customer = (Customer)i.next();
      System.out.println(customer);
    }   
   
View Full Code Here

public class Main {
 
  private ApplicationContext context;
   
  private void test() {
    TestDao testDao = (TestDao)context.getBean("testDao");
    List tests = testDao.getAll();
    for (Iterator i = tests.iterator(); i.hasNext();) {
      Test test = (Test)i.next();
      System.out.println(test);
    }
   
    Test test1, test2;
    test1 = testDao.getById(1);
    test2 = testDao.getById(1);
    test1.setName("new Name");
    test2.setName("other name");
    testDao.save(test1);
    testDao.save(test2);
  }
View Full Code Here

 
  public void customer() {
    CustomerDao customerDao = (CustomerDao)context.getBean("customerDao");
    List customers = customerDao.getAll();
    for (Iterator i = customers.iterator(); i.hasNext();) {
      Customer customer = (Customer)i.next();
      System.out.println(customer);
    }
   
    customers = customerDao.getAllWithOnlyOnePermission();
    for (Iterator i = customers.iterator(); i.hasNext();) {
      Customer customer = (Customer)i.next();
      System.out.println(customer);
    }   
   
    Customer customer = new Customer();
    customer.setFirstName("Jack");
    customer.setLastName("Schitt");
    customer.setPermissions(new HashSet());
    customer.setAddresses(new HashSet());
   
    CustomerAddress ca = new CustomerAddress();
    ca.setLine1("1");
    ca.setLine2("2");
    ca.setCity("Manchester");
    ca.setPostCode("M1 xx");
   
    customer.getAddresses().add(ca);
   
    Permission p = new Permission();
    p.setPermissionId(1);
   
    customer.getPermissions().add(p);
   
    //customerDao.save(customer);
  }
View Full Code Here

    customer.setFirstName("Jack");
    customer.setLastName("Schitt");
    customer.setPermissions(new HashSet());
    customer.setAddresses(new HashSet());
   
    CustomerAddress ca = new CustomerAddress();
    ca.setLine1("1");
    ca.setLine2("2");
    ca.setCity("Manchester");
    ca.setPostCode("M1 xx");
   
    customer.getAddresses().add(ca);
   
    Permission p = new Permission();
    p.setPermissionId(1);
View Full Code Here

TOP

Related Classes of com.apress.prospring.ch9.domain.Customer

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.