Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Samuel Kulíšek
pa165-secret-service-archive
Commits
afe37773
Commit
afe37773
authored
May 16, 2022
by
Jiri Novotny
Browse files
Add facade missionGetAll and agentGetAll
parent
c1aab57c
Changes
4
Hide whitespace changes
Inline
Side-by-side
ssa-api/src/main/java/cz/muni/fi/pa165/facade/AgentFacade.java
View file @
afe37773
...
...
@@ -11,4 +11,5 @@ public interface AgentFacade {
AgentCountDto
getAgentCount
(
Long
missionId
);
Page
<
AgentListDto
>
getAgentWithSkill
(
String
skill
,
int
page
,
int
pageSize
);
Page
<
AgentListDto
>
getAgentWithCountryXp
(
Long
countryId
,
int
page
,
int
pageSize
);
Page
<
AgentListDto
>
getAllAgents
(
int
page
,
int
pageSize
);
}
ssa-api/src/main/java/cz/muni/fi/pa165/facade/MissionFacade.java
View file @
afe37773
...
...
@@ -7,4 +7,5 @@ import org.springframework.data.domain.Page;
public
interface
MissionFacade
{
Page
<
MissionListDto
>
getAgentMissions
(
Long
agentId
,
int
page
,
int
pageSize
);
MissionDetailDto
getMission
(
Long
missionId
);
Page
<
MissionListDto
>
getAllMissions
(
int
page
,
int
pageSize
);
}
ssa-service/src/main/java/cz/muni/fi/pa165/facade/AgentFacadeImpl.java
View file @
afe37773
...
...
@@ -112,6 +112,14 @@ public class AgentFacadeImpl implements AgentFacade {
return
createPage
(
agentsWithXpList
,
pageable
);
}
@Override
public
Page
<
AgentListDto
>
getAllAgents
(
int
page
,
int
pageSize
)
{
Pageable
pageable
=
PageRequest
.
of
(
page
,
pageSize
);
Page
<
Agent
>
agents
=
agentService
.
findAll
(
pageable
);
return
agents
.
map
(
agentListMapper:
:
map
);
}
private
Page
<
AgentListDto
>
createPage
(
List
<
Agent
>
agents
,
Pageable
pageable
)
{
List
<
AgentListDto
>
mappedAgents
=
agents
.
stream
().
map
(
agentListMapper:
:
map
).
collect
(
Collectors
.
toList
());
final
int
start
=
(
int
)
pageable
.
getOffset
();
...
...
ssa-service/src/main/java/cz/muni/fi/pa165/facade/MissionFacadeImpl.java
View file @
afe37773
...
...
@@ -2,9 +2,9 @@ package cz.muni.fi.pa165.facade;
import
cz.muni.fi.pa165.config.MissionDetailMapper
;
import
cz.muni.fi.pa165.config.MissionListMapper
;
import
cz.muni.fi.pa165.dto.AgentListDto
;
import
cz.muni.fi.pa165.dto.MissionDetailDto
;
import
cz.muni.fi.pa165.dto.MissionListDto
;
import
cz.muni.fi.pa165.entity.Agent
;
import
cz.muni.fi.pa165.entity.Mission
;
import
cz.muni.fi.pa165.service.MissionService
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -65,4 +65,12 @@ public class MissionFacadeImpl implements MissionFacade {
return
missionDetailMapper
.
map
(
mission
);
}
@Override
public
Page
<
MissionListDto
>
getAllMissions
(
int
page
,
int
pageSize
)
{
Pageable
pageable
=
PageRequest
.
of
(
page
,
pageSize
);
Page
<
Mission
>
missions
=
missionService
.
findAll
(
pageable
);
return
missions
.
map
(
missionListMapper:
:
map
);
}
}
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment