View Javadoc

1   package se.citerus.dddsample.interfaces.handling;
2   
3   import org.apache.commons.lang.builder.ToStringBuilder;
4   import org.apache.commons.lang.builder.ToStringStyle;
5   import se.citerus.dddsample.domain.model.cargo.TrackingId;
6   import se.citerus.dddsample.domain.model.handling.HandlingEvent;
7   import se.citerus.dddsample.domain.model.location.UnLocode;
8   import se.citerus.dddsample.domain.model.voyage.VoyageNumber;
9   
10  import java.io.Serializable;
11  import java.util.Date;
12  
13  /**
14   * This is a simple transfer object for passing incoming handling event
15   * registration attempts to proper the registration procedure.
16   *
17   * It is used as a message queue element. 
18   *
19   */
20  public final class HandlingEventRegistrationAttempt implements Serializable {
21  
22    private final Date registrationTime;
23    private final Date completionTime;
24    private final TrackingId trackingId;
25    private final VoyageNumber voyageNumber;
26    private final HandlingEvent.Type type;
27    private final UnLocode unLocode;
28  
29    public HandlingEventRegistrationAttempt(final Date registrationDate,
30                                            final Date completionDate,
31                                            final TrackingId trackingId,
32                                            final VoyageNumber voyageNumber,
33                                            final HandlingEvent.Type type,
34                                            final UnLocode unLocode) {
35      this.registrationTime = registrationDate;
36      this.completionTime = completionDate;
37      this.trackingId = trackingId;
38      this.voyageNumber = voyageNumber;
39      this.type = type;
40      this.unLocode = unLocode;
41    }
42  
43    public Date getCompletionTime() {
44      return new Date(completionTime.getTime());
45    }
46  
47    public TrackingId getTrackingId() {
48      return trackingId;
49    }
50  
51    public VoyageNumber getVoyageNumber() {
52      return voyageNumber;
53    }
54  
55    public HandlingEvent.Type getType() {
56      return type;
57    }
58  
59    public UnLocode getUnLocode() {
60      return unLocode;
61    }
62  
63    public Date getRegistrationTime() {
64      return registrationTime;
65    }
66  
67    @Override
68    public String toString() {
69      return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
70    }
71    
72  }