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 * ID for Serialization. 013 */ 014 private static final long serialVersionUID = 1859861011358753928L; 015 016 /* 017 * The name of the user relevant to the log. 018 */ 019 private String user_ID; 020 021 /* 022 * The name of the relevant video. 023 */ 024 private String video_name; 025 026 /* 027 * True if this Loggable logs a rent event, otherwise null. 028 */ 029 private boolean rented; 030 031 /** 032 * Constructs a new <code>LoggableImpl</code>, that will log {@link LogEntryVideo}s. 033 * 034 * @param user_ID 035 * the ID of the relevant user 036 * @param video 037 * the name of the relevant video 038 * @param rented 039 * true if this <code>Loggable</code> should log a rent event, otherwise false 040 */ 041 public LoggableImpl(String user_ID, String video, boolean rented) { 042 this.user_ID = user_ID; 043 this.video_name = video; 044 this.rented = rented; 045 } 046 047 /** 048 * @return a {@link LogEntryVideo} describing the event. 049 * 050 * @see log.Loggable#getLogData() 051 */ 052 public LogEntry getLogData() { 053 return new LogEntryVideo(user_ID, video_name, rented); 054 } 055 }