|
Author: adrianc
Date: Sat Jan 9 22:46:03 2010 New Revision: 897573 URL: http://svn.apache.org/viewvc?rev=897573&view=rev Log: Minor code cleanup, no functional change. Modified: ofbiz/branches/executioncontext20091231/framework/context/src/org/ofbiz/context/ExecutionContextImpl.java Modified: ofbiz/branches/executioncontext20091231/framework/context/src/org/ofbiz/context/ExecutionContextImpl.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20091231/framework/context/src/org/ofbiz/context/ExecutionContextImpl.java?rev=897573&r1=897572&r2=897573&view=diff ============================================================================== --- ofbiz/branches/executioncontext20091231/framework/context/src/org/ofbiz/context/ExecutionContextImpl.java (original) +++ ofbiz/branches/executioncontext20091231/framework/context/src/org/ofbiz/context/ExecutionContextImpl.java Sat Jan 9 22:46:03 2010 @@ -51,43 +51,61 @@ protected AuthorizationManager security = null; protected GenericValue userLogin = null; - public AccessController getAccessController() { - return (AccessController) this.getSecurity().getAccessController(); - } - - public Delegator getDelegator() { - if (this.delegator == null) { - this.delegator = DelegatorFactory.getDelegator("default"); - } - return this.delegator; - } - - public LocalDispatcher getDispatcher() { - if (this.dispatcher == null) { - this.dispatcher = GenericDispatcher.getLocalDispatcher("ExecutionContext", this.getDelegator()); - } - return this.dispatcher; - } + @Override + public void clearUserData() { + this.userLogin = null; + this.resetUserPreferences(); + } + + @Override + public void endRunUnprotected() { + if (!this.managerList.isEmpty()) { + this.setSecurity(this.managerList.removeLast()); + } + } + + @Override + public AccessController getAccessController() { + return this.getSecurity().getAccessController(); + } + + @Override + public Delegator getDelegator() { + if (this.delegator == null) { + this.delegator = DelegatorFactory.getDelegator("default"); + } + return this.delegator; + } + + @Override + public LocalDispatcher getDispatcher() { + if (this.dispatcher == null) { + this.dispatcher = GenericDispatcher.getLocalDispatcher("ExecutionContext", this.getDelegator()); + } + return this.dispatcher; + } - public AuthorizationManager getSecurity() { - if (this.security == null) { + @Override + public AuthorizationManager getSecurity() { + if (this.security == null) { ClassLoader loader = Thread.currentThread().getContextClassLoader(); String className = UtilProperties.getPropertyValue("api.properties", "authorizationManager.class"); - if (this.verbose) { - Debug.logInfo("Loading Authorization Manager " + className, module); - } + if (this.verbose) { + Debug.logInfo("Loading Authorization Manager " + className, module); + } try { this.security = (AuthorizationManager) loader.loadClass(className).newInstance(); } catch (Exception e) { Debug.logError(e, module); } - } - return this.security; - } - - public GenericValue getUserLogin() { - if (this.userLogin == null) { - Delegator localDelegator = this.getDelegator(); + } + return this.security; + } + + @Override + public GenericValue getUserLogin() { + if (this.userLogin == null) { + Delegator localDelegator = this.getDelegator(); try { this.userLogin = localDelegator.findOne("UserLogin", false, "userLoginId", "NOT_LOGGED_IN"); } catch (GenericEntityException e) { @@ -97,18 +115,19 @@ this.userLogin = localDelegator.makeValue("UserLogin"); this.userLogin.set("userLoginId", "NOT_LOGGED_IN"); } - } - return this.userLogin; - } - - public void initializeContext(Map<String, ? extends Object> params) { - this.setDelegator((Delegator) params.get("delegator")); - this.setDispatcher((LocalDispatcher) params.get("dispatcher")); - this.setSecurity((AuthorizationManager) params.get("security")); - this.setUserLogin((GenericValue) params.get("userLogin")); - this.setLocale((Locale) params.get("locale")); + } + return this.userLogin; + } + + @Override + public void initializeContext(Map<String, ? extends Object> params) { + this.setDelegator((Delegator) params.get("delegator")); + this.setDispatcher((LocalDispatcher) params.get("dispatcher")); + this.setSecurity((AuthorizationManager) params.get("security")); + this.setUserLogin((GenericValue) params.get("userLogin")); + this.setLocale((Locale) params.get("locale")); this.setTimeZone((TimeZone) params.get("timeZone")); - } + } @Override public void reset() { @@ -130,46 +149,38 @@ } } + @Override + public void runUnprotected() { + this.managerList.addLast(getSecurity()); + this.setSecurity(nullAuthorizationManager); + } + + @Override public void setDelegator(Delegator delegator) { - if (delegator != null) { - this.delegator = delegator; - } - } - - public void setDispatcher(LocalDispatcher dispatcher) { - if (dispatcher != null) { - this.dispatcher = dispatcher; - } - } - - public void setSecurity(AuthorizationManager security) { - if (security != null) { - this.security = security; - } - } - - public void setUserLogin(GenericValue userLogin) { - if (userLogin != null) { - this.userLogin = userLogin; - this.resetUserPreferences(); - } - } + if (delegator != null) { + this.delegator = delegator; + } + } - public void clearUserData() { - this.userLogin = null; - this.resetUserPreferences(); + @Override + public void setDispatcher(LocalDispatcher dispatcher) { + if (dispatcher != null) { + this.dispatcher = dispatcher; + } } @Override - public void endRunUnprotected() { - if (!this.managerList.isEmpty()) { - this.setSecurity(this.managerList.removeLast()); + public void setSecurity(AuthorizationManager security) { + if (security != null) { + this.security = security; } } @Override - public void runUnprotected() { - this.managerList.addLast(getSecurity()); - this.setSecurity(nullAuthorizationManager); + public void setUserLogin(GenericValue userLogin) { + if (userLogin != null) { + this.userLogin = userLogin; + this.resetUserPreferences(); + } } } |
| Free forum by Nabble | Edit this page |
