001: package org.concern.controller;
002:
003: import java.util.*;
004: import java.sql.Timestamp;
005:
006: /**
007: * @author hengels
008: * @version $Revision: 666 $
009: */
010: class Logs {
011: static void logCreated(Subject subject) {
012: Log log = new Log("CREATED", (String) null);
013: log.setSuccess(true);
014: log.setSubject(subject);
015: subject.getLogs().add(log);
016: }
017:
018: static void logDestroyed(Subject subject) {
019: Log log = new Log("DESTROYED", (String) null);
020: log.setSuccess(true);
021: log.setSubject(subject);
022: subject.getLogs().add(log);
023: }
024:
025: static void logRevived(Subject subject) {
026: Log log = new Log("REVIVED", (String) null);
027: log.setSuccess(true);
028: log.setSubject(subject);
029: subject.getLogs().add(log);
030: }
031:
032: static void logSuspended(Subject subject) {
033: Log log = new Log("SUSPENDED", (String) null);
034: log.setSuccess(true);
035: log.setSubject(subject);
036: subject.getLogs().add(log);
037: }
038:
039: static void logResumed(Subject subject) {
040: Log log = new Log("RESUMED", (String) null);
041: log.setSuccess(true);
042: log.setSubject(subject);
043: subject.getLogs().add(log);
044: }
045:
046: static void logStalled(Subject subject, String details) {
047: Log log = new Log("STALLED", null, details);
048: log.setSubject(subject);
049: subject.getLogs().add(log);
050: }
051:
052: static void logSuccess(Subject subject, String name,
053: Map /* <String, String> */logAnnotations) {
054: Log log = new Log(name, "EXECUTED");
055: log.setSuccess(true);
056: log.setAnnotations(logAnnotations);
057: log.setSubject(subject);
058: subject.getLogs().add(log);
059: }
060:
061: static void logForwarded(Subject subject, String name,
062: Map /* <String, String> */logAnnotations) {
063: Log log = new Log(name, "FORWARDED");
064: log.setSubject(subject);
065: log.setAnnotations(logAnnotations);
066: subject.getLogs().add(log);
067: }
068:
069: static void logBackwarded(Subject subject, String name,
070: Map /* <String, String> */logAnnotations) {
071: Log log = new Log(name, "BACKWARDED");
072: log.setSubject(subject);
073: log.setAnnotations(logAnnotations);
074: subject.getLogs().add(log);
075: }
076:
077: static void logReset(Subject subject, String name) {
078: Log log = new Log(name, "RESET");
079: log.setSubject(subject);
080: subject.getLogs().add(log);
081: }
082:
083: static void logEscalation(Subject subject, String name) {
084: Log log = new Log(name, "ESCALATED");
085: log.setSubject(subject);
086: subject.getLogs().add(log);
087: }
088:
089: public static void logFailure(Subject subject, String name,
090: String details) {
091: Log log = new Log(name, "FAILED", details);
092: log.setSubject(subject);
093: subject.getLogs().add(log);
094: }
095:
096: public static void log(Subject subject, org.concern.Log blub) {
097: Log log = new Log();
098: log.setActivity(blub.getActivity());
099: log.setAnnotations(blub.getAnnotations());
100: log.setDetails(blub.getDetails());
101: log.setMessage(blub.getMessage());
102: log.setSubject(subject);
103: log.setSuccess(blub.isSuccess());
104: log.setTimestamp(new Timestamp(System.currentTimeMillis()));
105: subject.getLogs().add(log);
106: }
107: }
|