View Javadoc

1   package se.citerus.dddsample.domain.model.handling;
2   
3   import se.citerus.dddsample.domain.model.cargo.TrackingId;
4   
5   /**
6    * Thrown when trying to register an event with an unknown tracking id.
7    */
8   public final class UnknownCargoException extends CannotCreateHandlingEventException {
9   
10    private final TrackingId trackingId;
11  
12    /**
13     * @param trackingId cargo tracking id
14     */
15    public UnknownCargoException(final TrackingId trackingId) {
16      this.trackingId = trackingId;
17    }
18  
19    /**
20     * {@inheritDoc}
21     */            
22    @Override
23    public String getMessage() {
24      return "No cargo with tracking id " + trackingId.idString() + " exists in the system";
25    }
26  }