001: /*
002: * JFolder, Copyright 2001-2006 Gary Steinmetz
003: *
004: * Distributable under LGPL license.
005: * See terms of license at gnu.org.
006: */
007:
008: package org.jfolder.security.audit;
009:
010: //base classes
011: import java.math.BigDecimal;
012: import java.util.HashMap;
013:
014: //project specific classes
015: import org.jfolder.common.UnexpectedSystemException;
016: import org.jfolder.common.utils.misc.MiscHelper;
017: import org.jfolder.security.model.UserHolder;
018: import org.jfolder.security.model.UserIdentity;
019:
020: //other classes
021:
022: public class SimpleSecurityAudit extends BaseSecurityAudit {
023:
024: //
025: //private UserIdentity auditUser = null;
026: //private int auditCode = 0;
027: //private String auditComment = null;
028: //private String auditStatus = null;
029: //private long auditTimestamp = 0;
030: ////private boolean initialized = false;
031: //
032: ////private boolean auditFaultPresent = false;
033: //private String auditFaultMessage = null;
034: //private String auditFaultSource = null;
035: //private boolean auditFaultPresent = false;
036:
037: //
038: private UserIdentity auditUserIdentity = null;
039: private BigDecimal auditSequenceNumber = null;
040: private String auditMachineOfOrigin = null;
041: private String auditDateTime = null;
042: private String auditSeverityLevel = null;
043: private HashMap auditCategoryType = null;
044: private HashMap auditSourceType = null;
045: private String auditServerVersion = null;
046: //
047: private BigDecimal auditCustomCode = null;
048: private HashMap auditCustomCategoryType = null;
049: private HashMap auditCustomSourceType = null;
050: private String auditCustomMessage = null;
051: //
052: private boolean auditOpened = false;
053:
054: protected SimpleSecurityAudit() {
055: super ();
056: }
057:
058: protected SimpleSecurityAudit(UserIdentity inUi,
059: BigDecimal inSeqNum, String inMachineOfOrig,
060: String inDateTime, String inSeverityLevel,
061: HashMap inCategoryType, HashMap inSourceType,
062: String inServerVersion, BigDecimal inCustomCode,
063: HashMap inCustomCategoryType, HashMap inCustomSourceType,
064: String inCustomMessage, boolean inOpened) {
065:
066: //
067: //if (!inUser.isValid()) {
068: // throw new UnexpectedSystemException("Invalid user - " + inUser);
069: //}
070:
071: //
072: setAuditUserIdentity(inUi);
073: setAuditSequenceNumber(inSeqNum);
074: setAuditMachineOfOrigin(inMachineOfOrig);
075: setAuditDateTime(inDateTime);
076: setAuditSeverityLevel(inSeverityLevel);
077: setAuditCategoryType(inCategoryType);
078: setAuditSourceType(inSourceType);
079: setAuditServerVersion(inServerVersion);
080: //
081: setAuditCustomCode(inCustomCode);
082: setAuditCustomCategoryType(inCustomCategoryType);
083: setAuditCustomSourceType(inCustomSourceType);
084: setAuditCustomMessage(inCustomMessage);
085: //
086: setAuditOpened(inOpened);
087: //this.auditUser = inUser;
088: //this.auditCode = inCode;
089: //this.auditComment = inComment;
090: //this.auditStatus = inStatus;
091: //this.auditTimestamp = inTimestamp;
092:
093: //
094: //this.auditFaultMessage = inFaultMessage;
095: //this.auditFaultSource = inFaultSource;
096: //this.auditFaultPresent = inFaultPresent;
097: }
098:
099: public final static SimpleSecurityAudit newInstance(
100: UserIdentity inUi, BigDecimal inSeqNum,
101: String inMachineOfOrig, String inDateTime,
102: String inSeverityLevel, HashMap inCategoryType,
103: HashMap inSourceType, String inServerVersion,
104: BigDecimal inCustomCode, HashMap inCustomCategoryType,
105: HashMap inCustomSourceType, String inCustomMessage,
106: boolean inOpened) {
107:
108: SimpleSecurityAudit outValue = null;
109:
110: outValue = new SimpleSecurityAudit(inUi, inSeqNum,
111: inMachineOfOrig, inDateTime, inSeverityLevel,
112: inCategoryType, inSourceType, inServerVersion,
113: inCustomCode, inCustomCategoryType, inCustomSourceType,
114: inCustomMessage, inOpened);
115:
116: return outValue;
117: }
118:
119: protected SimpleSecurityAudit(SecurityAudit inSa) {
120: refreshSecurityAudit(inSa);
121: }
122:
123: //
124: public boolean isAuditUserIdentityPresent() {
125: return (this .auditUserIdentity != null);
126: }
127:
128: public UserIdentity getAuditUserIdentity() {
129: return this .auditUserIdentity;
130: }
131:
132: public BigDecimal getAuditSequenceNumber() {
133: return this .auditSequenceNumber;
134: }
135:
136: public String getAuditMachineOfOrigin() {
137: return this .auditMachineOfOrigin;
138: }
139:
140: public String getAuditDateTime() {
141: return this .auditDateTime;
142: }
143:
144: public String getAuditSeverityLevel() {
145: return this .auditSeverityLevel;
146: }
147:
148: public HashMap getAuditCategoryType() {
149: return this .auditCategoryType;
150: }
151:
152: public HashMap getAuditSourceType() {
153: return this .auditSourceType;
154: }
155:
156: public String getAuditServerVersion() {
157: return this .auditServerVersion;
158: }
159:
160: //
161: public BigDecimal getAuditCustomCode() {
162: return this .auditCustomCode;
163: }
164:
165: public HashMap getAuditCustomCategoryType() {
166: return this .auditCustomCategoryType;
167: }
168:
169: public HashMap getAuditCustomSourceType() {
170: return this .auditCustomSourceType;
171: }
172:
173: public String getAuditCustomMessage() {
174: return this .auditCustomMessage;
175: }
176:
177: //
178: public boolean isAuditOpened() {
179: return this .auditOpened;
180: }
181:
182: //
183: protected void setAuditUserIdentity(UserIdentity inUi) {
184: this .auditUserIdentity = inUi;
185: }
186:
187: protected void setAuditSequenceNumber(BigDecimal inSeqNum) {
188: this .auditSequenceNumber = inSeqNum;
189: }
190:
191: protected void setAuditMachineOfOrigin(String inMachineOfOrig) {
192: this .auditMachineOfOrigin = inMachineOfOrig;
193: }
194:
195: protected void setAuditDateTime(String inDateTime) {
196: this .auditDateTime = inDateTime;
197: }
198:
199: protected void setAuditSeverityLevel(String inSeverityLevel) {
200: this .auditSeverityLevel = inSeverityLevel;
201: }
202:
203: protected void setAuditCategoryType(HashMap inCategoryType) {
204: this .auditCategoryType = inCategoryType;
205: }
206:
207: protected void setAuditSourceType(HashMap inSourceType) {
208: this .auditSourceType = inSourceType;
209: }
210:
211: protected void setAuditServerVersion(String inServerVersion) {
212: this .auditServerVersion = inServerVersion;
213: }
214:
215: //
216: protected void setAuditCustomCode(BigDecimal inCustomCode) {
217: this .auditCustomCode = inCustomCode;
218: }
219:
220: protected void setAuditCustomCategoryType(HashMap inCategoryType) {
221: this .auditCustomCategoryType = inCategoryType;
222: }
223:
224: protected void setAuditCustomSourceType(HashMap inSourceType) {
225: this .auditCustomSourceType = inSourceType;
226: }
227:
228: protected void setAuditCustomMessage(String inCustomMessage) {
229: this .auditCustomMessage = inCustomMessage;
230: }
231:
232: //
233: public void setAuditOpened(boolean inOpened) {
234: this .auditOpened = inOpened;
235: }
236: //
237: //
238: //
239: //
240: //
241: //
242: //
243: //
244: //
245: //
246: //
247: //
248: //
249: //
250: //
251: //
252: //
253: //
254: //
255: //
256:
257: //
258: //public UserIdentity getAuditUser() {
259: // return this.auditUser;
260: //}
261: //public int getAuditCode() {
262: // return this.auditCode;
263: //}
264: //public String getAuditComment() {
265: // return this.auditComment;
266: //}
267: //public String getAuditStatus() {
268: // return this.auditStatus;
269: //}
270: //public long getAuditTimestamp() {
271: // return this.auditTimestamp;
272: //}
273: ////public boolean isAuditExceptionPresent() {
274: //// return this.auditExceptionPresent;
275: ////}
276: //public String getAuditFaultMessage() {
277: // return this.auditFaultMessage;
278: //}
279: //public String getAuditFaultSource() {
280: // return this.auditFaultSource;
281: //}
282: //public boolean isAuditFaultPresent() {
283: // return this.auditFaultPresent;
284: //}
285:
286: //
287: //protected void setAuditUser(UserIdentity inUser) {
288: // this.auditUser = inUser;
289: //}
290: //protected void setAuditCode(int inCode) {
291: // this.auditCode = inCode;
292: //}
293: //protected void setAuditComment(String inComment) {
294: // this.auditComment = inComment;
295: //}
296: //protected void setAuditStatus(String inStatus) {
297: // this.auditStatus = inStatus;
298: //}
299: //protected void setAuditTimestamp(long inTimestamp) {
300: // this.auditTimestamp = inTimestamp;
301: //}
302: //protected void setAuditFaultMessage(String inMessage) {
303: // this.auditFaultMessage = inMessage;
304: //}
305: //protected void setAuditFaultSource(String inSource) {
306: // this.auditFaultSource = inSource;
307: //}
308: //protected void setAuditFaultPresent(boolean inPresent) {
309: // this.auditFaultPresent = inPresent;
310: //}
311:
312: //public void setAuditException(Exception inException) {
313: // setAuditException(inException.getMessage(),
314: // MiscHelper.getStackTraceAsString(inException));
315: //}
316:
317: //public void setAuditException(String inMessage, String inSource) {
318: // this.auditExceptionPresent = true;
319: // this.auditExceptionMessage = inMessage;
320: // this.auditExceptionSource = inSource;
321: //}
322:
323: //protected void setAuditStatus(String inStatus) {
324: // this.auditStatus = inStatus;
325: //}
326: }
|