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
d26f5bb0
Commit
d26f5bb0
authored
May 16, 2022
by
Jiri Novotny
Browse files
Add facade countryGetAll
parent
afe37773
Changes
2
Hide whitespace changes
Inline
Side-by-side
ssa-api/src/main/java/cz/muni/fi/pa165/facade/CountryFacade.java
View file @
d26f5bb0
...
...
@@ -2,8 +2,10 @@ package cz.muni.fi.pa165.facade;
import
cz.muni.fi.pa165.dto.CountryDetailDto
;
import
cz.muni.fi.pa165.dto.CountryNameDto
;
import
org.springframework.data.domain.Page
;
public
interface
CountryFacade
{
CountryNameDto
getCountryName
(
Long
missionId
);
CountryDetailDto
getCountryDetail
(
Long
missionId
);
Page
<
CountryNameDto
>
getAllCountries
(
int
page
,
int
pageSize
);
}
ssa-service/src/main/java/cz/muni/fi/pa165/facade/CountryFacadeImpl.java
View file @
d26f5bb0
...
...
@@ -5,8 +5,12 @@ import cz.muni.fi.pa165.config.CountryNameMapper;
import
cz.muni.fi.pa165.dto.CountryDetailDto
;
import
cz.muni.fi.pa165.dto.CountryNameDto
;
import
cz.muni.fi.pa165.entity.Country
;
import
cz.muni.fi.pa165.service.CountryService
;
import
cz.muni.fi.pa165.service.MissionService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.stereotype.Service
;
/**
...
...
@@ -15,13 +19,15 @@ import org.springframework.stereotype.Service;
@Service
public
class
CountryFacadeImpl
implements
CountryFacade
{
private
final
MissionService
missionService
;
private
final
CountryService
countryService
;
private
final
CountryNameMapper
countryNameMapper
;
private
final
CountryDetailMapper
countryDetailMapper
;
@Autowired
public
CountryFacadeImpl
(
MissionService
missionService
,
CountryNameMapper
countryNameMapper
,
CountryDetailMapper
countryDetailMapper
)
{
public
CountryFacadeImpl
(
MissionService
missionService
,
CountryService
countryService
,
CountryNameMapper
countryNameMapper
,
CountryDetailMapper
countryDetailMapper
)
{
this
.
missionService
=
missionService
;
this
.
countryService
=
countryService
;
this
.
countryNameMapper
=
countryNameMapper
;
this
.
countryDetailMapper
=
countryDetailMapper
;
}
...
...
@@ -39,4 +45,12 @@ public class CountryFacadeImpl implements CountryFacade {
return
countryDetailMapper
.
map
(
country
);
}
@Override
public
Page
<
CountryNameDto
>
getAllCountries
(
int
page
,
int
pageSize
)
{
Pageable
pageable
=
PageRequest
.
of
(
page
,
pageSize
);
Page
<
Country
>
countries
=
countryService
.
findAll
(
pageable
);
return
countries
.
map
(
countryNameMapper:
:
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