-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1303 from Ariho-Seth/develop
Refactored the getSysUserId Method into a Single Class
- Loading branch information
Showing
8 changed files
with
34 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 3 additions & 14 deletions
17
src/main/java/org/openelisglobal/common/rest/BaseRestController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,10 @@ | ||
package org.openelisglobal.common.rest; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
import org.openelisglobal.common.action.IActionConstants; | ||
import org.openelisglobal.login.valueholder.UserSessionData; | ||
import org.openelisglobal.common.util.ControllerUtills; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class BaseRestController implements IActionConstants { | ||
public class BaseRestController extends ControllerUtills implements IActionConstants { | ||
|
||
protected String getSysUserId(HttpServletRequest request) { | ||
UserSessionData usd = (UserSessionData) request.getSession().getAttribute(USER_SESSION_DATA); | ||
if (usd == null) { | ||
usd = (UserSessionData) request.getAttribute(USER_SESSION_DATA); | ||
if (usd == null) { | ||
return null; | ||
} | ||
} | ||
return String.valueOf(usd.getSystemUserId()); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/org/openelisglobal/common/util/ControllerUtills.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.openelisglobal.common.util; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
import org.openelisglobal.common.action.IActionConstants; | ||
import org.openelisglobal.login.valueholder.UserSessionData; | ||
|
||
public class ControllerUtills { | ||
|
||
protected String getSysUserId(HttpServletRequest request) { | ||
UserSessionData usd = (UserSessionData) request.getSession().getAttribute(IActionConstants.USER_SESSION_DATA); | ||
if (usd == null) { | ||
usd = (UserSessionData) request.getAttribute(IActionConstants.USER_SESSION_DATA); | ||
if (usd == null) { | ||
return null; | ||
} | ||
} | ||
return String.valueOf(usd.getSystemUserId()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters