001 package videoautomat;
002 import java.io.Serializable;
003
004 import log.LogEntry;
005 import log.Loggable;
006 /**
007 * This class implements <code>Loggable</code> to achieve the logging of {@link LogEntryVideo}.
008 */
009 public class LoggableImpl implements Loggable, Serializable {
010
011 /*
012 * The name of the user relevant to the log.
013 */
014 private String user_ID;
015
016 /*
017 * The name of the relevant video.
018 */
019 private String video_name;
020
021 /*
022 * True if this Loggable logs a rent event, otherwise null.
023 */
024 private boolean rented;
025
026 /**
027 * Constructs a new <code>LoggableImpl</code>, that will log {@link LogEntryVideo}s.
028 *
029 * @param user_ID
030 * the ID of the relevant user
031 * @param video
032 * the name of the relevant video
033 * @param rented
034 * true if this <code>Loggable</code> should log a rent event, otherwise false
035 */
036 public LoggableImpl(String user_ID, String video, boolean rented) {
037 this.user_ID = user_ID;
038 this.video_name = video;
039 this.rented = rented;
040 }
041
042 /**
043 * @return a {@link LogEntryVideo} describing the event.
044 *
045 * @see log.Loggable#getLogData()
046 */
047 public LogEntry getLogData() {
048 return new LogEntryVideo(user_ID, video_name, rented);
049 }
050 }