001: /*
002: * Copyright (c) 2001 - 2004 ivata limited.
003: * All rights reserved.
004: * -----------------------------------------------------------------------------
005: * ivata masks may be redistributed under the GNU General Public
006: * License as published by the Free Software Foundation;
007: * version 2 of the License.
008: *
009: * These programs are free software; you can redistribute them and/or
010: * modify them under the terms of the GNU General Public License
011: * as published by the Free Software Foundation; version 2 of the License.
012: *
013: * These programs are distributed in the hope that they will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016: *
017: * See the GNU General Public License in the file LICENSE.txt for more
018: * details.
019: *
020: * If you would like a copy of the GNU General Public License write to
021: *
022: * Free Software Foundation, Inc.
023: * 59 Temple Place - Suite 330
024: * Boston, MA 02111-1307, USA.
025: *
026: *
027: * To arrange commercial support and licensing, contact ivata at
028: * http://www.ivata.com/contact.jsp
029: * -----------------------------------------------------------------------------
030: * $Log: OrderDO.java,v $
031: * Revision 1.5 2005/09/14 12:41:33 colinmacleod
032: * Added serialVersionUID.
033: *
034: * Revision 1.4 2005/04/09 18:04:13 colinmacleod
035: * Changed copyright text to GPL v2 explicitly.
036: *
037: * Revision 1.3 2005/01/07 09:13:04 colinmacleod
038: * Added newline to end of file.
039: *
040: * Revision 1.2 2005/01/07 08:08:18 colinmacleod
041: * Moved up a version number.
042: * Changed copyright notices to 2005.
043: * Updated the documentation:
044: * - started working on multiproject:site docu.
045: * - changed the logo.
046: * Added checkstyle and fixed LOADS of style issues.
047: * Added separate thirdparty subproject.
048: * Added struts (in web), util and webgui (in webtheme) from ivata op.
049: *
050: * Revision 1.1 2004/11/10 17:18:20 colinmacleod
051: * New value object classes - first version in CVS.
052: * -----------------------------------------------------------------------------
053: */
054: package com.ivata.mask.web.demo.order;
055:
056: import java.util.List;
057: import java.util.Vector;
058: import com.ivata.mask.web.demo.customer.CustomerDO;
059: import com.ivata.mask.web.demo.valueobject.DemoValueObject;
060:
061: /**
062: * <p>
063: * Represents a single order of this imaginary system.
064: * </p>
065: *
066: * @author Colin MacLeod
067: * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
068: * @since ivata masks 0.2 (2004-05-20)
069: * @version $Revision: 1.5 $
070: */
071: public final class OrderDO extends DemoValueObject {
072: /**
073: * Serialization version (for <code>Serializable</code> interface).
074: */
075: private static final long serialVersionUID = 1L;
076: /**
077: * <p>
078: * List of order items being ordered.
079: * </p>
080: */
081: private List items = new Vector();
082: /**
083: * <p>
084: * Customer associated with this order.
085: * </p>
086: */
087: private CustomerDO customer;
088:
089: /**
090: * <p>
091: * Construct a new order instance with no id.
092: * </p>
093: */
094: public OrderDO() {
095: super ();
096: }
097:
098: /**
099: * <p>
100: * Construct a new order instance with the given unique identifier.
101: * </p>
102: *
103: * @param idParam unique identifier of this product.
104: */
105: public OrderDO(final int idParam) {
106: super (idParam);
107: }
108:
109: /**
110: * Each order had to be ordered by someone! This is the customer who placed
111: * the order.
112: * @return the customer who placed this order.
113: */
114: public CustomerDO getCustomer() {
115: return customer;
116: }
117:
118: /**
119: * An order ain't nothing without some items being purchased. This
120: * <code>List</code> contains instances of <code>OrderItemDO</code>.
121: *
122: * @return <code>List</code> containing instances of
123: * <code>OrderItemDO</code>.
124: */
125: public List getItems() {
126: return items;
127: }
128:
129: /**
130: * Sets the customer who made this order.
131: *
132: * @param customerDO customer who made this order.
133: */
134: public void setCustomer(final CustomerDO customerDO) {
135: customer = customerDO;
136: }
137:
138: /**
139: * Set all of the items in the order as a list.
140: *
141: * @param list a <code>List</code> of {@link OrderItemDO} instances.
142: */
143: public void setItems(final List list) {
144: items = list;
145: }
146:
147: /**
148: * For an order, this just returns {@link java.lang.Object#toString
149: * toString()}.
150: *
151: * @see com.ivata.mask.valueobject.ValueObject#getStringValue()
152: */
153: public String getDisplayValue() {
154: return toString();
155: }
156: }
|