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
b4859414
Commit
b4859414
authored
May 16, 2022
by
Jiri Novotny
Browse files
Add facade skillGetAll
parent
d26f5bb0
Changes
2
Hide whitespace changes
Inline
Side-by-side
ssa-api/src/main/java/cz/muni/fi/pa165/facade/AgentFacade.java
View file @
b4859414
...
...
@@ -3,6 +3,7 @@ package cz.muni.fi.pa165.facade;
import
cz.muni.fi.pa165.dto.AgentCountDto
;
import
cz.muni.fi.pa165.dto.AgentDetailDto
;
import
cz.muni.fi.pa165.dto.AgentListDto
;
import
cz.muni.fi.pa165.dto.SkillDto
;
import
org.springframework.data.domain.Page
;
public
interface
AgentFacade
{
...
...
@@ -12,4 +13,5 @@ public interface AgentFacade {
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
);
Page
<
SkillDto
>
getAllSkills
(
int
page
,
int
pageSize
);
}
ssa-service/src/main/java/cz/muni/fi/pa165/facade/AgentFacadeImpl.java
View file @
b4859414
...
...
@@ -2,9 +2,11 @@ package cz.muni.fi.pa165.facade;
import
cz.muni.fi.pa165.config.AgentDetailMapper
;
import
cz.muni.fi.pa165.config.AgentListMapper
;
import
cz.muni.fi.pa165.config.SkillMapper
;
import
cz.muni.fi.pa165.dto.AgentCountDto
;
import
cz.muni.fi.pa165.dto.AgentDetailDto
;
import
cz.muni.fi.pa165.dto.AgentListDto
;
import
cz.muni.fi.pa165.dto.SkillDto
;
import
cz.muni.fi.pa165.entity.*
;
import
cz.muni.fi.pa165.service.AgentService
;
import
cz.muni.fi.pa165.service.CountryService
;
...
...
@@ -35,15 +37,17 @@ public class AgentFacadeImpl implements AgentFacade {
private
final
AgentDetailMapper
agentDetailMapper
;
private
final
AgentListMapper
agentListMapper
;
private
final
SkillMapper
skillMapper
;
@Autowired
public
AgentFacadeImpl
(
AgentService
agentService
,
MissionService
missionService
,
CountryService
countryService
,
SkillService
skillService
,
AgentDetailMapper
agentDetailMapper
,
AgentListMapper
agentListMapper
)
{
public
AgentFacadeImpl
(
AgentService
agentService
,
MissionService
missionService
,
CountryService
countryService
,
SkillService
skillService
,
AgentDetailMapper
agentDetailMapper
,
AgentListMapper
agentListMapper
,
SkillMapper
skillMapper
)
{
this
.
agentService
=
agentService
;
this
.
missionService
=
missionService
;
this
.
countryService
=
countryService
;
this
.
skillService
=
skillService
;
this
.
agentDetailMapper
=
agentDetailMapper
;
this
.
agentListMapper
=
agentListMapper
;
this
.
skillMapper
=
skillMapper
;
}
@Override
...
...
@@ -120,6 +124,14 @@ public class AgentFacadeImpl implements AgentFacade {
return
agents
.
map
(
agentListMapper:
:
map
);
}
@Override
public
Page
<
SkillDto
>
getAllSkills
(
int
page
,
int
pageSize
)
{
Pageable
pageable
=
PageRequest
.
of
(
page
,
pageSize
);
Page
<
Skill
>
skills
=
skillService
.
findAll
(
pageable
);
return
skills
.
map
(
skillMapper:
:
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
();
...
...
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