Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ARSnova Backend
Manage
Activity
Members
Labels
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Privacy
Imprint
Contact
Snippets
Groups
Projects
Show more breadcrumbs
Paul-Christian Volkmer
ARSnova Backend
Commits
2c2e7a91
Commit
2c2e7a91
authored
12 years ago
by
Paul-Christian Volkmer
Browse files
Options
Downloads
Patches
Plain Diff
Task #3842: Check if session key is allready present in CouchDB
This method uses transaction level READ_COMMITTED.
parent
a887d311
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/de/thm/arsnova/services/ISessionService.java
+1
-0
1 addition, 0 deletions
src/main/java/de/thm/arsnova/services/ISessionService.java
src/main/java/de/thm/arsnova/services/SessionService.java
+11
-0
11 additions, 0 deletions
src/main/java/de/thm/arsnova/services/SessionService.java
with
12 additions
and
0 deletions
src/main/java/de/thm/arsnova/services/ISessionService.java
+
1
−
0
View file @
2c2e7a91
...
...
@@ -27,5 +27,6 @@ public interface ISessionService {
public
Session
getSession
(
String
keyword
);
public
Feedback
getFeedback
(
String
keyword
);
public
boolean
postFeedback
(
String
keyword
,
int
value
);
public
boolean
sessionKeyAvailable
(
String
keyword
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/java/de/thm/arsnova/services/SessionService.java
+
11
−
0
View file @
2c2e7a91
...
...
@@ -31,6 +31,8 @@ import org.springframework.security.core.Authentication;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.security.core.userdetails.User
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Isolation
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.fourspaces.couchdb.Database
;
import
com.fourspaces.couchdb.Document
;
...
...
@@ -160,6 +162,15 @@ public class SessionService implements ISessionService {
return
true
;
}
@Override
@Transactional
(
isolation
=
Isolation
.
READ_COMMITTED
)
public
boolean
sessionKeyAvailable
(
String
keyword
)
{
View
view
=
new
View
(
"session/by_keyword"
);
ViewResults
results
=
database
.
view
(
view
);
return
!
results
.
containsKey
(
keyword
);
}
private
String
getSessionId
(
String
keyword
)
{
View
view
=
new
View
(
"session/by_keyword"
);
view
.
setKey
(
URLEncoder
.
encode
(
"\""
+
keyword
+
"\""
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment