01: /*
02: * User: Michael Rettig
03: * Date: Aug 11, 2002
04: * Time: 8:39:09 PM
05: */
06: package net.sourceforge.jaxor.example.domain;
07:
08: import net.sourceforge.jaxor.example.Money;
09: import net.sourceforge.jaxor.example.MoneyWithCurrency;
10: import net.sourceforge.jaxor.example.simple.CricketerEntity;
11: import net.sourceforge.jaxor.example.simple.CricketerFinder;
12:
13: public class ObjectFactory {
14: public static AddressEntity createAddress(Long id) {
15: AddressEntity addressEntity = AddressFinder.newInstance(id);
16: setDefaultFields(addressEntity);
17: return addressEntity;
18: }
19:
20: public static void setDefaultFields(AddressEntity addressEntity) {
21: addressEntity.setCity("Chicago");
22: addressEntity.setStreet("934 W Madison");
23: addressEntity.setState("IL");
24: addressEntity.setZipCode("60607");
25: }
26:
27: public static AddressEntity createAddress() {
28: return createAddress(new Long(123));
29: }
30:
31: public static OrdersEntity createOrder(Long orderId, Long custId) {
32: OrdersEntity ent = OrdersFinder.newInstance(orderId, custId);
33: ent.setDescription("desc");
34: ent.setEquipmentCost(new MoneyWithCurrency("5.00", "US"));
35: ent.setOrderNo(new Integer(34));
36: ent.setSalesTax(new Money("5.00"));
37: ent.setShippingCharge(new Money("5.00"));
38: ent.setOrderDate(new java.sql.Date(System.currentTimeMillis()));
39: return ent;
40: }
41:
42: public static CricketerEntity createCricketer(Long id) {
43: CricketerEntity ent = CricketerFinder.newInstance(id);
44: ent.setBattingAverage(".310");
45: ent.setName("name");
46: return ent;
47: }
48:
49: public static CustomerEntity create(Long id) {
50: CustomerEntity ent = createCustomer(id);
51: ent.setAddressEntity(createAddress(new Long(432)));
52: return ent;
53: }
54:
55: public static CustomerEntity createCustomer(Long id) {
56: CustomerEntity ent = CustomerFinder.newInstance(id);
57: ent.setEmail("email@address.com");
58: ent.setNameFirst("jim");
59: ent.setNameLast("jackson");
60: return ent;
61: }
62:
63: }
|