1 12 package org.openbravo.base.secureApp; 13 14 import org.openbravo.base.VariablesBase; 15 import javax.servlet.http.*; 16 import org.openbravo.erpCommon.utility.OBError; 17 import org.openbravo.data.FieldProvider; 18 19 public class VariablesSecureApp extends VariablesBase { 20 private String user; 21 private String role; 22 private String language; 23 private String theme; 24 private String client; 25 private String organization; 26 private String warehouse; 27 private String command; 28 private String userClient; 29 private String userOrganization; 30 private String dbSessionID; 31 private String javaDateFormat; 32 private String jsDateFormat; 33 private String sqlDateFormat; 34 35 public VariablesSecureApp(String strUser, String strClient, String strOrganization) { 36 this.user = strUser; 37 this.role = ""; 38 this.language = System.getProperty("user.language") + "_" + System.getProperty("user.country"); 39 this.theme = ""; 40 this.client = strClient; 41 this.organization = strOrganization; 42 this.userClient = ""; 43 this.userOrganization = ""; 44 this.warehouse = ""; 45 this.dbSessionID = ""; 46 this.command = "DEFAULT"; 47 this.javaDateFormat = ""; 48 this.jsDateFormat = ""; 49 this.sqlDateFormat = ""; 50 } 51 52 public VariablesSecureApp(HttpServletRequest request) { 53 super(request); 54 this.user = getSessionValue("#AD_User_ID"); 55 this.role = getSessionValue("#AD_Role_ID"); 56 this.language = getSessionValue("#AD_Language"); 57 this.theme = getSessionValue("#Theme"); 58 this.client = getSessionValue("#AD_Client_ID"); 59 this.organization = getSessionValue("#AD_Org_ID"); 60 this.userClient = getSessionValue("#User_Client"); 61 this.userOrganization = getSessionValue("#User_Org"); 62 this.warehouse = getSessionValue("#M_Warehouse_ID"); 63 this.dbSessionID = getSessionValue("#AD_Session_ID"); 64 this.command = getStringParameter("Command", "DEFAULT"); 65 this.javaDateFormat = getSessionValue("#AD_JavaDateFormat"); 66 this.jsDateFormat = getSessionValue("#AD_JsDateFormat"); 67 this.sqlDateFormat = getSessionValue("#AD_SqlDateFormat"); 68 } 69 70 public String getUser() { 71 return user; 72 } 73 74 public String getRole() { 75 return role; 76 } 77 78 public String getLanguage() { 79 return language; 80 } 81 82 public String getTheme() { 83 return theme; 84 } 85 86 public String getClient() { 87 return client; 88 } 89 90 public String getOrg() { 91 return organization; 92 } 93 94 public String getUserClient() { 95 return userClient; 96 } 97 98 public String getUserOrg() { 99 return userOrganization; 100 } 101 102 public String getWarehouse() { 103 return warehouse; 104 } 105 106 public String getDBSession() { 107 return dbSessionID; 108 } 109 110 public String getCommand() { 111 return command; 112 } 113 114 public boolean commandIn(String inKey1) { 115 if (command.equals(inKey1)) 116 return true; 117 else 118 return false; 119 } 120 121 public boolean commandIn(String inKey1, String inKey2) { 122 if (command.equals(inKey1) || command.equals(inKey2)) 123 return true; 124 else 125 return false; 126 } 127 128 public boolean commandIn(String inKey1, String inKey2, String inKey3) { 129 if (command.equals(inKey1) || command.equals(inKey2) || command.equals(inKey3)) 130 return true; 131 else 132 return false; 133 } 134 135 public boolean commandIn(String inKey1, String inKey2, String inKey3, String inKey4) { 136 if (command.equals(inKey1) || command.equals(inKey2) || command.equals(inKey3) || command.equals(inKey4)) 137 return true; 138 else 139 return false; 140 } 141 142 public boolean commandIn(String inKey1, String inKey2, String inKey3, String inKey4, String inKey5) { 143 if (command.equals(inKey1) || command.equals(inKey2) || command.equals(inKey3) || command.equals(inKey4) || command.equals(inKey5)) 144 return true; 145 else 146 return false; 147 } 148 149 public String getJavaDateFormat() { 150 return javaDateFormat; 151 } 152 public String getJsDateFormat() { 153 return jsDateFormat; 154 } 155 public String getSqlDateFormat() { 156 return sqlDateFormat; 157 } 158 159 public OBError getMessage(String AD_Tab_ID) { 160 return ((OBError)getSessionObject(AD_Tab_ID + "|message")); 161 } 162 163 public void setMessage(String AD_Tab_ID, OBError error) { 164 setSessionObject(AD_Tab_ID + "|message", error); 165 } 166 167 public void removeMessage(String AD_Tab_ID) { 168 removeSessionValue(AD_Tab_ID + "|message"); 169 } 170 171 public FieldProvider getEditionData(String AD_Tab_ID) { 172 return ((FieldProvider)getSessionObject(AD_Tab_ID + "|editionData")); 173 } 174 175 public void setEditionData(String AD_Tab_ID, FieldProvider data) { 176 setSessionObject(AD_Tab_ID + "|editionData", data); 177 } 178 179 public void removeEditionData(String AD_Tab_ID) { 180 removeSessionValue(AD_Tab_ID + "|editionData"); 181 } 182 } 183 | Popular Tags |