1
2
3
4
5
6
7
8
9
10
11
12
13
14 package org.gscg.singleuser.interactionlayer.dataobjects.content;
15
16 import nl.tudelft.simulation.dsol.simulators.SimulatorInterface;
17 import nl.tudelft.simulation.logger.Logger;
18 import nl.tudelft.simulation.supplychain.content.OrderBasedOnQuote;
19 import nl.tudelft.simulation.supplychain.content.OrderConfirmation;
20 import nl.tudelft.simulation.supplychain.content.OrderStandAlone;
21
22 import org.gscg.singleuser.interactionlayer.dataobjects.DateIntData;
23
24 /***
25 * Contains data for an order confirmation. This object is send to a client-side
26 * graphical user interface and is used to update information related an order
27 * confirmation.
28 * <p>
29 * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX
30 * Delft, the Netherlands. All rights reserved.
31 *
32 * See for project information <a href="http://www.simulation.tudelft.nl/">
33 * www.simulation.tudelft.nl </a>.
34 *
35 * The source code and binary code of this software is proprietary information
36 * of Delft University of Technology.
37 *
38 * @author <a
39 * href="http://www.tbm.tudelft.nl/webstaf/stijnh/index.htm">Stijn-Pieter
40 * van Houten </a>
41 * @version $Revision: 1.1 $ $Date: 2005/06/16 12:33:56 $
42 * @since 1.0.0
43 */
44 public class OrderConfirmationData extends ContentData
45 {
46 /*** the serial version uid */
47 private static final long serialVersionUID = 11L;
48
49 /*** the Order */
50 private OrderData orderData = null;
51
52 /*** the proposed delivery */
53 private DateIntData proposedDelivery = null;
54
55 /*** the shipment date to use */
56 private DateIntData proposedShippingDate = null;
57
58 /*** the amount */
59 private double amount = 0;
60
61 /*** the product name */
62 private String productName = null;
63
64 /*** the proposed price */
65 private double price = 0.0;
66
67 /***
68 * @param orderConfirmation the order confirmation
69 * @param simulator the simulator
70 */
71 public OrderConfirmationData(final OrderConfirmation orderConfirmation,
72 final SimulatorInterface simulator)
73 {
74 super(orderConfirmation.getSender().getName(), orderConfirmation
75 .getSender().getLocationDescription(), orderConfirmation
76 .getReceiver().getName(), orderConfirmation.getReceiver()
77 .getLocationDescription());
78 if (orderConfirmation.getOrder() instanceof OrderBasedOnQuote)
79 {
80 this.orderData = new OrderBasedOnQuoteData(
81 (OrderBasedOnQuote) orderConfirmation.getOrder(), simulator);
82 } else if (orderConfirmation.getOrder() instanceof OrderStandAlone)
83 {
84 this.orderData = new OrderStandAloneData(
85 (OrderStandAlone) orderConfirmation.getOrder(), simulator);
86 } else
87 {
88 Logger.warning("OrderConfirmationData", "<init>",
89 "Order not OrderBasedOnQuote or OrderStandAloneData but: "
90 + orderConfirmation.getOrder().getClass());
91 }
92 this.proposedDelivery = DateIntData.makeDateIntData(orderConfirmation
93 .getOrder().getDeliveryDate(), simulator);
94 this.proposedShippingDate = DateIntData.makeDateIntData(
95 ((OrderBasedOnQuote) orderConfirmation.getOrder()).getQuote()
96 .getProposedShippingDate(), simulator);
97 this.amount = orderConfirmation.getOrder().getAmount();
98 this.productName = orderConfirmation.getOrder().getProduct().getName();
99 this.price = Math.round(orderConfirmation.getOrder().getPrice());
100 }
101
102 /***
103 * @return Returns the amount.
104 */
105 public double getAmount()
106 {
107 return this.amount;
108 }
109
110 /***
111 * @return Returns the orderData.
112 */
113 public OrderData getOrderData()
114 {
115 return this.orderData;
116 }
117
118 /***
119 * @return Returns the price.
120 */
121 public double getPrice()
122 {
123 return this.price;
124 }
125
126 /***
127 * @return Returns the productName.
128 */
129 public String getProductName()
130 {
131 return this.productName;
132 }
133
134 /***
135 * @return Returns the proposedDelivery.
136 */
137 public DateIntData getProposedDelivery()
138 {
139 return this.proposedDelivery;
140 }
141
142 /***
143 * @return Returns the proposed shipping date
144 */
145 public DateIntData getProposedShippingDate()
146 {
147 return this.proposedShippingDate;
148 }
149
150 /***
151 * @param amount The amount to set.
152 */
153 public void setAmount(final double amount)
154 {
155 this.amount = amount;
156 }
157 }