1 13 14 package org.ejbca.core.ejb.log; 15 16 import javax.ejb.CreateException ; 17 18 import org.ejbca.core.ejb.BaseEntityBean; 19 import org.ejbca.core.model.log.LogConfiguration; 20 import org.ejbca.core.model.log.LogEntry; 21 22 23 24 25 70 public abstract class LogConfigurationDataBean extends BaseEntityBean { 71 72 77 public abstract Integer getId(); 78 79 81 public abstract void setId(Integer id); 82 83 87 public abstract LogConfiguration getLogConfiguration(); 88 89 91 public abstract void setLogConfiguration(LogConfiguration logConfiguration); 92 93 97 public abstract int getLogEntryRowNumber(); 98 99 102 public abstract void setLogEntryRowNumber(int logEntryRowNumber); 103 104 109 public LogConfiguration loadLogConfiguration() { 110 LogConfiguration logconfiguration = getLogConfiguration(); 111 112 for (int i = 0; i < LogEntry.EVENTNAMES_INFO.length; i++) { 114 if (logconfiguration.getLogEvent(i) == null) { 115 logconfiguration.setLogEvent(i, true); 116 } 117 } 118 119 for (int i = 0; i < LogEntry.EVENTNAMES_ERROR.length; i++) { 120 int index = i + LogEntry.EVENT_ERROR_BOUNDRARY; 121 122 if (logconfiguration.getLogEvent(index) == null) { 123 logconfiguration.setLogEvent(index, true); 124 } 125 } 126 127 return logconfiguration; 128 } 129 130 135 public void saveLogConfiguration(LogConfiguration logConfiguration) { 136 setLogConfiguration(logConfiguration); 137 } 138 139 145 public Integer getAndIncrementRowCount() { 146 int returnval = getLogEntryRowNumber(); 147 setLogEntryRowNumber(returnval + 1); 148 149 return new Integer (returnval); 150 } 151 152 156 166 public Integer ejbCreate(Integer id, LogConfiguration logConfiguration) 167 throws CreateException { 168 setId(id); 169 setLogConfiguration(logConfiguration); 170 setLogEntryRowNumber(0); 171 172 return null; 173 } 174 175 181 public void ejbPostCreate(Integer id, LogConfiguration logConfiguration) { 182 } 184 } 185 | Popular Tags |