1 17 18 package org.pentaho.core.session; 19 20 import java.util.Locale ; 21 22 import org.pentaho.core.audit.AuditHelper; 23 import org.pentaho.core.audit.MessageTypes; 24 import org.pentaho.core.system.PentahoBase; 25 import org.pentaho.messages.Messages; 26 import org.pentaho.util.logging.ILogger; 27 28 public abstract class BaseSession extends PentahoBase implements IPentahoSession { 29 30 31 private String name; 32 33 private String id; 34 35 private String processId; 36 37 private String actionName; 38 39 private Locale locale; 40 41 private boolean authenticated; 42 43 private volatile boolean backgroundExecutionAlert; 44 45 public BaseSession(String name, String id, Locale locale) { 46 this.name = name; 47 this.id = id; 48 this.locale = locale; 49 actionName = ""; setLogId( Messages.getString("BaseSession.CODE_LOG_ID", id, ILogger.SESSION_LOG, name) ); AuditHelper.audit(id, name, actionName, getObjectName(), "", MessageTypes.SESSION_START, "", "", null, null); authenticated = false; 53 } 54 55 public boolean isAuthenticated() { 56 return authenticated; 57 } 58 59 public void setAuthenticated(String name) { 60 if (name != null) { 61 authenticated = true; 62 this.name = name; 63 } 64 } 65 66 public void setNotAuthenticated() { 67 name = null; 68 authenticated = false; 69 } 70 71 public Locale getLocale() { 72 return locale; 73 } 74 75 public void destroy() { 76 AuditHelper.audit(id, name, actionName, getObjectName(), "", MessageTypes.SESSION_END, "", "", null, null); } 78 79 public void setActionName(String actionName) { 80 this.actionName = actionName; 81 } 82 83 public void setProcessId(String processId) { 84 this.processId = processId; 85 } 86 87 92 public String getName() { 93 return name; 94 } 95 96 101 public String getId() { 102 return id; 103 } 104 105 110 public String getObjectName() { 111 return this.getClass().getName(); 112 } 113 114 119 public String getProcessId() { 120 return processId; 121 } 122 123 128 public String getActionName() { 129 return actionName; 130 } 131 132 public synchronized void setBackgroundExecutionAlert() { 133 this.backgroundExecutionAlert = true; 134 } 135 136 public synchronized boolean getBackgroundExecutionAlert() { 137 return this.backgroundExecutionAlert; 138 } 139 140 public synchronized void resetBackgroundExecutionAlert() { 141 this.backgroundExecutionAlert = false; 142 } 143 144 } 145 | Popular Tags |