Hi all, I'm writing my assignment for part II. I have come across the definition of Segment. I understand that a Segment has a 1 to 1 relation to a Flight, but how do you implement it in practice ? Is it implemented by a plain JavaBean which holds information about the flight ? in other words when the client looks for a flight, system returns an Enumeration of Segment....
when the client looks for a flight, system returns an Enumeration of Segment
you have said that the relationship between fligh and segment is one to one. why does it return an enumeration of segment after searching a flight? i think you still need to make clear what the real business meaning about flight and segment. not only their relationship. the problem of flight&segment is a PO topic in ranchers forum. you can use the searching function to find them.
I think he asked if the Segment is "mapped" as Value Object, transferred from the system when the search is performed. I have implemented too as value object both from the server side (Collection of VO returned after search) and from the client side (VO chosen in the list of flights). Anybody wants to join the discussion ? bye Francesco
An Itinerary must have at least 1 segment (Min. one-way i.e. a direct flight (can have more than one segment if not a direct flight))
Itinerary: includes everything from start to end.
When the user does a search; the search result could be a Collection of Itinerary objects each associated with a segment or collection of segments;
Round Trip: Each Itinerary will have information about onward (could have > 1 segments) and return trip (could have >1 segments), [how this is generated i.e. different combinations depends on business logic] To figure out the return flight you can maybe check the Airport codes (against the user input) and also possibly the Dates.
Let me know if anyone has any other ideas... thanks sai
My class diagram and sequence diagrams are exactly the same as what sai explained.
Regarding the VO and TO, in my class diagram and sequence diagrams, Itinerary, Segment and Flight are all VO. And I am also thinking whether I shall have ItineraryUtil to contain some business logic, like 'calculation of total price'. However, another way to do something like calculation of total price is to put the calculation algorithm in ItineraryVO because ItineraryVO is the knowledge export who knows all prices. Doing this might make ItineraryVO unlike VO. I don't make my mide yet.
Sai, I've been considering same approach as you. The search API returns a collection of itineraries. Assuming it's 2 way trip, user selects 2 of these. After final confirmation, these 2 itineraries will then be assembled into an itinerary attached to customer and possibly persisted? At this phase of design I'm not involving any technical details such as TO or VO...
Also, using Itinerary as the search result has an issue, unless you change the BDM: itineraries returned by search *must* have at least 1 seat attached (acording to cardinality Equippment - Seats). I interpret the "Seats" object in the BDM as the seats booked as part of prepare itinerary use case.
Am I missing something?
ps the plural in "Seats" also doesn't make sense...
In my design, An ItineraryVO could have many segments to complete a round trip.
Segment Class has 2 special attributes for GUI layout control, groupId and sequenceId. GroupId attribute means these segments with the same groupId must be combined to become a complete short distance trip. SequenceId attribute means these segment swith the same groupId should be displayed in the order which is indicated by sequenceId. Another attribute, isReturn, indicates that this segment is for departure or for return trip.
Here is the example of segments in an Itinerary for a round trip. groupid sequenceId isReturn departure destination segment1 1 1 N Taipei Hawaii segment2 1 2 N Hawaii New York segment3 2 1 N Taipei Hong Kong segment4 2 2 N Hong Kong New York segment5 3 1 Y New York Detroit segment6 3 2 Y Detroit Taipei
[ October 23, 2006: Message edited by: Steve Taiwan ] [ October 23, 2006: Message edited by: Steve Taiwan ]
Steve, This is great. I just have a couple commebts though: 1.Segment belongs to the BDM, and hence should have no attributes/methods that are technology/GUI specific; you could wrap it though in a VO... 2. Segment mandates the existence of at least 1 seat, according to the BDM diagram. How would you handle it? There are no Seats assigned to your customer at the time the first search returns the result?
According to the BDM, Segment has Flight, Flight has Equipment, Equipment has Seat so Seat can be associated with Segment. Also Itinerary has many Segments so an Itinerary can have many Seats without doubt. My Seat has some interesting attributes, like location, customerId, status. Location, such as J22, is the exact loction in an Equipment. CustomerId is for query purpose and makes Seat associated with Customer directly. Status means whether the specific Seat is available, occupied or something else.
At the first search, no Seat will be assigned to the Customer who makes the query.
Steve, You just mentioned that initially you don't assign any seats as a result of the search. This is not possible due to cardinality (Equipment mandates it). Also, you shouldn't have to add Customer attribute to seat, as Customer will be associated with Itinerary directly, and hence you hane the relationship from there. I am considering using custom request/result objects for the search to keep the model clean.
thanks, Andrew [ October 24, 2006: Message edited by: Andrew Zilahi ]
In prepare itinerary, customer selects seats in step 7 but not in the first query.
If Seat doesn't have customerId, how do you know the relationship between Customer and Seat? The requirement said RDBMS will be used. So when you do OR mapping, you should have a attribute in Seat to indicate that the specific seat number is occupied by the specific customer. Otherwise, I don't know how to retrieve the data from DB to Seats in doing OR mapping.
Steve, In this phase, you should *not* be concerned about the technologies used for the implementation (i.e. RDBMS, J2EE, etc). You just want to create a clean domain model first. Once this is done, you can think about how to wrap and persist these objects, as well as how to render them. To answer your question, as long as Itinerary object is connected to customer, your relationship is right there.
I'm still puzzled about the best approach for returning the search results, so I am going to post a new topic for this.