View Javadoc

1   /*
2    * @(#)ShipmentData.java Jul 12, 2004
3    * 
4    * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX
5    * Delft, the Netherlands. All rights reserved.
6    * 
7    * See for project information <a href="http://www.simulation.tudelft.nl/">
8    * www.simulation.tudelft.nl </a>.
9    * 
10   * The source code and binary code of this software is proprietary information
11   * of Delft University of Technology.
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.OrderStandAlone;
20  import nl.tudelft.simulation.supplychain.content.Shipment;
21  
22  /***
23   * Contains data for a shipment. This object is send to a client-side graphical
24   * user interface and is used to update information related to a shipment. <br>
25   * <br>
26   * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX
27   * Delft, the Netherlands. All rights reserved.
28   * 
29   * See for project information <a href="http://www.simulation.tudelft.nl/">
30   * www.simulation.tudelft.nl </a>.
31   * 
32   * The source code and binary code of this software is proprietary information
33   * of Delft University of Technology.
34   * 
35   * @author <a
36   *         href="http://www.tbm.tudelft.nl/webstaf/alexandv/index.htm">Alexander
37   *         Verbraeck </a>
38   * @version $Revision: 1.1 $ $Date: 2005/06/16 12:33:56 $
39   * @since 1.0.0
40   */
41  public class ShipmentData extends ContentData
42  {
43  	/*** the serial version uid */
44  	private static final long serialVersionUID = 11L;
45  
46  	/*** the order to which this shipment belongs */
47  	private OrderData orderData = null;
48  
49  	/*** in transit ? */
50  	private boolean inTransit = false;
51  
52  	/*** delivered ? */
53  	private boolean isDelivered = true;
54  
55  	/***
56  	 * @param shipment the shipment to extract data from
57  	 * @param simulator the simulator
58  	 */
59  	public ShipmentData(final Shipment shipment,
60  			final SimulatorInterface simulator)
61  	{
62  		super(shipment.getSender().getName(), shipment.getSender()
63  				.getLocationDescription(), shipment.getReceiver().getName(),
64  				shipment.getReceiver().getLocationDescription());
65  
66  		this.inTransit = shipment.isInTransit();
67  		this.isDelivered = shipment.isDelivered();
68  
69  		if (shipment.getOrder() instanceof OrderBasedOnQuote)
70  		{
71  			this.orderData = new OrderBasedOnQuoteData(
72  					(OrderBasedOnQuote) shipment.getOrder(), simulator);
73  		} else if (shipment.getOrder() instanceof OrderStandAlone)
74  		{
75  			this.orderData = new OrderStandAloneData((OrderStandAlone) shipment
76  					.getOrder(), simulator);
77  		} else
78  		{
79  			Logger.warning("ShipmentData", "<init>",
80  					"Order not OrderBasedOnQuote or OrderStandAloneData but: "
81  							+ shipment.getOrder().getClass());
82  		}
83  	}
84  
85  	/***
86  	 * @return Returns the orderData.
87  	 */
88  	public OrderData getOrderData()
89  	{
90  		return this.orderData;
91  	}
92  
93  	/***
94  	 * @return returns true if in transit
95  	 */
96  	public boolean isInTransit()
97  	{
98  		return this.inTransit;
99  	}
100 
101 	/***
102 	 * @return Returns true if delivered
103 	 */
104 	public boolean isDelivered()
105 	{
106 		return this.isDelivered;
107 	}
108 }