View Javadoc

1   /*
2    * Copyright (c) 2001 - 2004 ivata limited.
3    * All rights reserved.
4    * -----------------------------------------------------------------------------
5    * ivata masks may be redistributed under the GNU General Public
6    * License as published by the Free Software Foundation;
7    * version 2 of the License.
8    *
9    * These programs are free software; you can redistribute them and/or
10   * modify them under the terms of the GNU General Public License
11   * as published by the Free Software Foundation; version 2 of the License.
12   *
13   * These programs are distributed in the hope that they will be useful,
14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16   *
17   * See the GNU General Public License in the file LICENSE.txt for more
18   * details.
19   *
20   * If you would like a copy of the GNU General Public License write to
21   *
22   * Free Software Foundation, Inc.
23   * 59 Temple Place - Suite 330
24   * Boston, MA 02111-1307, USA.
25   *
26   *
27   * To arrange commercial support and licensing, contact ivata at
28   *                  http://www.ivata.com/contact.jsp
29   * -----------------------------------------------------------------------------
30   * $Log: OrderDO.java,v $
31   * Revision 1.4  2005/04/09 18:04:13  colinmacleod
32   * Changed copyright text to GPL v2 explicitly.
33   *
34   * Revision 1.3  2005/01/07 09:13:04  colinmacleod
35   * Added newline to end of file.
36   *
37   * Revision 1.2  2005/01/07 08:08:18  colinmacleod
38   * Moved up a version number.
39   * Changed copyright notices to 2005.
40   * Updated the documentation:
41   *   - started working on multiproject:site docu.
42   *   - changed the logo.
43   * Added checkstyle and fixed LOADS of style issues.
44   * Added separate thirdparty subproject.
45   * Added struts (in web), util and webgui (in webtheme) from ivata op.
46   *
47   * Revision 1.1  2004/11/10 17:18:20  colinmacleod
48   * New value object classes - first version in CVS.
49   * -----------------------------------------------------------------------------
50   */
51  package com.ivata.mask.web.demo.order;
52  import java.util.List;
53  import java.util.Vector;
54  import com.ivata.mask.web.demo.customer.CustomerDO;
55  import com.ivata.mask.web.demo.valueobject.DemoValueObject;
56  /***
57   * <p>
58   * Represents a single order of this imaginary system.
59   * </p>
60   *
61   * @author Colin MacLeod
62   * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
63   * @since ivata masks 0.2 (2004-05-20)
64   * @version $Revision: 1.4 $
65   */
66  public final class OrderDO extends DemoValueObject {
67      /***
68       * <p>
69       * List of order items being ordered.
70       * </p>
71       */
72      private List items = new Vector();
73      /***
74       * <p>
75       * Customer associated with this order.
76       * </p>
77       */
78      private CustomerDO customer;
79      /***
80       * <p>
81       * Construct a new order instance with no id.
82       * </p>
83       */
84      public OrderDO() {
85          super();
86      }
87      /***
88       * <p>
89       * Construct a new order instance with the given unique identifier.
90       * </p>
91       *
92       * @param idParam unique identifier of this product.
93       */
94      public OrderDO(final int idParam) {
95          super(idParam);
96      }
97      /***
98       * Each order had to be ordered by someone! This is the customer who placed
99       * the order.
100      * @return the customer who placed this order.
101      */
102     public CustomerDO getCustomer() {
103         return customer;
104     }
105     /***
106      * An order ain't nothing without some items being purchased. This
107      * <code>List</code> contains instances of <code>OrderItemDO</code>.
108      *
109      * @return <code>List</code> containing instances of
110      * <code>OrderItemDO</code>.
111      */
112     public List getItems() {
113         return items;
114     }
115     /***
116      * Sets the customer who made this order.
117      *
118      * @param customerDO customer who made this order.
119      */
120     public void setCustomer(final CustomerDO customerDO) {
121         customer = customerDO;
122     }
123     /***
124      * Set all of the items in the order as a list.
125      *
126      * @param list a <code>List</code> of {@link OrderItemDO} instances.
127      */
128     public void setItems(final List list) {
129         items = list;
130     }
131     /***
132      * For an order, this just returns {@link java.lang.Object#toString
133      * toString()}.
134      *
135      * @see com.ivata.mask.valueobject.ValueObject#getStringValue()
136      */
137     public String getDisplayValue() {
138         return toString();
139     }
140 }
141