Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Max Mecklin
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0ced1669
authored
Oct 07, 2017
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused functions from BortalLocalContextHolder
1 parent
b6fad775
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
82 deletions
code/moya-beans-client/ejbModule/fi/codecrew/moya/clientutils/BortalLocalContextHolder.java
code/moya-beans-client/ejbModule/fi/codecrew/moya/clientutils/BortalLocalContextHolder.java
View file @
0ced166
...
...
@@ -29,17 +29,12 @@ import org.slf4j.LoggerFactory;
import
fi.codecrew.moya.enums.apps.IAppPermission
;
public
class
BortalLocalContextHolder
{
private
static
final
ThreadLocal
<
BortalLocalContextHolder
>
THREAD_WITH_CONTEXT
=
new
ThreadLocal
<
BortalLocalContextHolder
>();
private
String
hostname
;
private
boolean
ssl
=
false
;
private
Integer
hostnameId
;
private
LoginContext
loginContext
;
private
final
Map
<
IAppPermission
,
Boolean
>
rightcache
=
new
HashMap
<
IAppPermission
,
Boolean
>();
private
static
boolean
inDevelopmentMode
=
false
;
...
...
@@ -51,37 +46,13 @@ public class BortalLocalContextHolder {
private
BortalLocalContextHolder
(
BortalLocalContextHolder
old
)
{
super
();
this
.
hostname
=
old
.
hostname
;
this
.
ssl
=
old
.
ssl
;
this
.
loginContext
=
old
.
loginContext
;
}
public
static
void
setHostname
(
String
hostname
)
{
getThread
().
hostname
=
hostname
;
}
public
static
String
getHostname
()
{
return
getThread
().
getHolderHostname
();
}
public
static
void
cleanupThread
()
{
if
(
THREAD_WITH_CONTEXT
!=
null
)
{
THREAD_WITH_CONTEXT
.
remove
();
}
}
public
String
getHolderHostname
()
{
return
hostname
;
}
public
static
Boolean
hasPermission
(
IAppPermission
permission
)
{
return
getThread
().
hasHolderPermission
(
permission
);
}
private
static
BortalLocalContextHolder
getThread
()
{
...
...
@@ -91,14 +62,6 @@ public class BortalLocalContextHolder {
return
THREAD_WITH_CONTEXT
.
get
();
}
private
Boolean
hasHolderPermission
(
IAppPermission
target
)
{
return
rightcache
.
get
(
target
);
}
public
static
void
setPermission
(
IAppPermission
permission
,
Boolean
value
)
{
getThread
().
rightcache
.
put
(
permission
,
value
);
}
public
static
BortalLocalContextHolder
getInstance
()
{
return
getThread
();
}
...
...
@@ -111,54 +74,12 @@ public class BortalLocalContextHolder {
inDevelopmentMode
=
developmentMode
;
}
public
static
Integer
getHostnameId
()
{
return
getThread
().
hostnameId
;
}
public
static
void
setHostnameId
(
Integer
id
)
{
getThread
().
hostnameId
=
id
;
}
public
static
boolean
isSsl
()
{
return
getThread
().
ssl
;
}
public
static
void
setSsl
(
boolean
ssl
)
{
getThread
().
ssl
=
ssl
;
}
public
static
void
copy
(
BortalLocalContextHolder
contextHolder
)
{
if
(
THREAD_WITH_CONTEXT
.
get
()
!=
null
)
{
logger
.
warn
(
"Context for thread is not empty. Received hostname
{}"
,
THREAD_WITH_CONTEXT
.
get
().
hostname
);
logger
.
warn
(
"Context for thread is not empty. Received hostname
"
);
}
THREAD_WITH_CONTEXT
.
set
(
new
BortalLocalContextHolder
(
contextHolder
));
}
public
void
setLoginContext
(
LoginContext
loginContext
)
{
this
.
loginContext
=
loginContext
;
}
public
LoginContext
getLoginContext
()
{
return
loginContext
;
}
public
boolean
executeLogin
()
{
try
{
this
.
loginContext
.
login
();
System
.
err
.
println
(
"execute login"
);
return
true
;
}
catch
(
LoginException
e
)
{
return
false
;
}
}
public
void
executeLogout
()
{
try
{
this
.
loginContext
.
logout
();
System
.
err
.
println
(
"execute logout"
);
}
catch
(
Exception
e
)
{
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment