1 64 65 package com.jcorporate.expresso.ext.dbobj; 66 67 import com.jcorporate.expresso.core.controller.ControllerRequest; 68 import com.jcorporate.expresso.core.db.DBException; 69 import com.jcorporate.expresso.core.dbobj.SecuredDBObject; 70 import com.jcorporate.expresso.core.misc.DateTime; 71 72 73 79 public class DownloadLog 80 extends SecuredDBObject { 81 82 83 86 public static final String FLD_LOG_ENTRY = "LogEntry"; 87 88 91 public static final String FLD_FILE_NUMBER = "FileNumber"; 92 93 94 97 public static final String FLD_EXP_UID = "ExpUid"; 98 99 102 public static final String FLD_DOWNLOADED = "Downloaded"; 103 104 107 public static final String FLD_FILEPATHNAME = "FilePathName"; 108 109 112 public static final String FLD_IP = "IPNumber"; 113 114 117 public DownloadLog() 118 throws DBException { 119 super(); 120 } 121 122 129 public DownloadLog(int uid) 130 throws DBException { 131 super(uid); 132 } 133 134 141 public DownloadLog(ControllerRequest request) 142 throws DBException { 143 super(request); 144 } 145 146 151 public void setupFields() 152 throws DBException { 153 setTargetTable("DOWNLOADLOG"); 154 setDescription("DBdownloadLog"); 155 setCharset("ISO-8859-1"); 156 addField("LogEntry", "auto-inc", 0, false, "logEntryNum"); 157 addField("FileNumber", "int", 0, false, "fileNumber"); 158 addField("ExpUid", "int", 0, false, "userId"); 159 addField("Downloaded", "datetime", 0, true, "dateTimeDownloaded"); 160 addField("FilePathName", "varchar", 128, false, "filePath"); 161 addField("IPNumber", "char", 20, false, "ipAddress"); 162 setStringFilter("FilePathName", "stripFilter"); 163 setLookupObject("ExpUid", "com.jcorporate.expresso.core.security.User"); 164 addKey("LogEntry"); 165 } 166 167 168 171 public synchronized void add() throws com.jcorporate.expresso.core.db.DBException { 172 if (this.getDataField("Downloaded").isNull() || this.getDataField("Downloaded").asString().length() == 0) { 173 this.set("Downloaded", DateTime.getDateTimeForDB(new java.util.Date (), this.getDataContext())); 174 } 175 176 super.add(); 177 } 178 } 179 180 | Popular Tags |