1 package se.citerus.dddsample.domain.model.cargo; 2 3 import java.util.List; 4 5 public interface CargoRepository { 6 7 /** 8 * Finds a cargo using given id. 9 * 10 * @param trackingId Id 11 * @return Cargo if found, else {@code null} 12 */ 13 Cargo find(TrackingId trackingId); 14 15 /** 16 * Finds all cargo. 17 * 18 * @return All cargo. 19 */ 20 List<Cargo> findAll(); 21 22 /** 23 * Saves given cargo. 24 * 25 * @param cargo cargo to save 26 */ 27 void store(Cargo cargo); 28 29 /** 30 * @return A unique, generated tracking Id. 31 */ 32 TrackingId nextTrackingId(); 33 34 }