Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
CTF
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grzegorz
CTF
Commits
cde37948
Commit
cde37948
authored
Mar 09, 2016
by
Grzegorz Pietrusza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove initalizing in repositories
parent
811a548a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
3 additions
and
24 deletions
+3
-24
Repository.java
service/src/main/java/repositories/Repository.java
+0
-1
SolutionsRepository.java
service/src/main/java/repositories/SolutionsRepository.java
+1
-13
TasksRepository.java
service/src/main/java/repositories/TasksRepository.java
+1
-2
TeamsRepository.java
service/src/main/java/repositories/TeamsRepository.java
+1
-2
UsersRepository.java
service/src/main/java/repositories/UsersRepository.java
+0
-6
No files found.
service/src/main/java/repositories/Repository.java
View file @
cde37948
...
...
@@ -8,7 +8,6 @@ import java.util.List;
public
interface
Repository
{
// void getByTaskName(UUID uuid);
List
getAll
();
void
initialize
();
// void add(User user); //todo: not user //todo: use generics?
}
service/src/main/java/repositories/SolutionsRepository.java
View file @
cde37948
...
...
@@ -17,26 +17,14 @@ public class SolutionsRepository implements Repository {
@Inject
public
SolutionsRepository
(
Datastore
datastore
)
{
this
.
datastore
=
datastore
;
initialize
();
}
public
List
<
Solution
>
getAll
()
{
return
datastore
.
createQuery
(
Solution
.
class
).
asList
();
}
@Override
public
void
initialize
()
{
this
.
clean
();
}
public
void
add
(
Solution
solution
)
{
//todo
datastore
.
save
(
solution
);
//todo: error handling?
//todo: do not add if already exists
}
public
void
clean
()
{
datastore
.
getCollection
(
Solution
.
class
).
drop
();
}
}
//todo: generify!
\ No newline at end of file
}
\ No newline at end of file
service/src/main/java/repositories/TasksRepository.java
View file @
cde37948
...
...
@@ -41,7 +41,6 @@ public class TasksRepository implements Repository
this
.
datastore
=
datastore
;
this
.
teamsRepository
=
teamsRepository
;
this
.
solutionsRepository
=
solutionsRepository
;
initialize
();
}
public
Task
getByLevel
(
int
level
)
...
...
@@ -73,7 +72,7 @@ public class TasksRepository implements Repository
return
datastore
.
createQuery
(
Task
.
class
).
asList
();
}
@Override
//todo: rethink, move to command?
public
void
initialize
()
{
List
<
TextTaskConfig
>
cryptoTasks
=
applicationConfiguration
.
getTextTasks
();
...
...
service/src/main/java/repositories/TeamsRepository.java
View file @
cde37948
...
...
@@ -27,7 +27,6 @@ public class TeamsRepository implements Repository {
this
.
datastore
=
datastore
;
this
.
applicationConfiguration
=
applicationConfiguration
;
this
.
usersRepository
=
usersRepository
;
initialize
();
}
public
Optional
<
Team
>
getTeamByUser
(
User
user
)
{
...
...
@@ -49,7 +48,7 @@ public class TeamsRepository implements Repository {
return
datastore
.
createQuery
(
Team
.
class
).
asList
();
}
@Override
//todo: move to command
public
void
initialize
()
{
this
.
clean
();
applicationConfiguration
.
getTeams
().
forEach
(
team
->
{
...
...
service/src/main/java/repositories/UsersRepository.java
View file @
cde37948
...
...
@@ -53,10 +53,4 @@ public class UsersRepository implements Repository
{
return
null
;
}
@Override
public
void
initialize
()
{
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment