Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
de4l-private-routes-backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
scads
DE4L
Privacy
de4l-private-routes-backend
Merge requests
!15
Cleanup
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Cleanup
cleanup
into
main
Overview
0
Commits
9
Pipelines
0
Changes
10
Merged
Jonathan Schneider
requested to merge
cleanup
into
main
2 years ago
Overview
0
Commits
9
Pipelines
0
Changes
10
Expand
0
0
Merge request reports
Viewing commit
fd1fee1e
Prev
Next
Show latest version
10 files
+
54
−
102
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
10
Search (e.g. *.vue) (Ctrl+P)
fd1fee1e
use modelmapper to create request body for requests to privacy-services
· fd1fee1e
Jonathan Schneider
authored
2 years ago
src/main/java/de/scads/privacy/privateroutes/point/PointController.java
+
6
−
25
Options
package
de.scads.privacy.privateroutes.point
;
import
de.scads.privacy.privateroutes.dto.DtoService
;
import
de.scads.privacy.privateroutes.dto.output.PointDto
;
import
de.scads.privacy.privateroutes.dto.output.Point
WithMeasurement
Dto
;
import
org.geolatte.geom.G2D
;
import
org.geolatte.geom.Polygon
;
import
org.geolatte.geom.crs.CoordinateReferenceSystem
;
import
org.modelmapper.ModelMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.
web.bind.annotation.CrossOrigin
;
import
org.springframework.
stereotype.Service
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
static
org
.
geolatte
.
geom
.
builder
.
DSL
.*;
import
static
org
.
geolatte
.
geom
.
builder
.
DSL
.
g
;
@Service
@RequestMapping
(
"api/point"
)
public
class
PointController
{
private
final
PointService
pointService
;
private
final
ModelMapper
modelMapper
;
@Autowired
CoordinateReferenceSystem
<
G2D
>
crs
;
@@ -33,10 +29,9 @@ public class PointController {
@Autowired
public
PointController
(
PointService
pointService
,
DtoService
dtoService
,
ModelMapper
modelMapper
)
{
public
PointController
(
PointService
pointService
,
DtoService
dtoService
)
{
this
.
pointService
=
pointService
;
this
.
dtoService
=
dtoService
;
this
.
modelMapper
=
modelMapper
;
}
@@ -46,31 +41,17 @@ public class PointController {
}
@GetMapping
(
""
)
public
List
<
PointDto
>
getAllPoints
()
{
public
List
<
Point
WithMeasurement
Dto
>
getAllPoints
()
{
return
pointService
.
getAllPoints
().
stream
()
.
map
(
dtoService:
:
convertPoint
)
.
collect
(
Collectors
.
toList
());
}
@GetMapping
(
"stops"
)
public
List
<
PointDto
>
getAllStops
()
{
return
pointService
.
getAllStops
()
.
stream
()
.
map
(
dtoService:
:
convertPoint
)
.
collect
(
Collectors
.
toList
());
}
@GetMapping
(
path
=
"{id}"
)
public
PointDto
getPointById
(
@PathVariable
(
"id"
)
Long
id
)
{
public
Point
WithMeasurement
Dto
getPointById
(
@PathVariable
(
"id"
)
Long
id
)
{
return
pointService
.
getPointById
(
id
)
.
map
(
dtoService:
:
convertPoint
)
.
orElse
(
null
);
}
@GetMapping
(
"testSpatial"
)
public
List
<
Point
>
testSpatialQuery
()
{
Polygon
<
G2D
>
polygon
=
polygon
(
crs
,
ring
(
g
(-
8.642196
,
41.160114
),
g
(-
8.61
,
41.16
),
g
(-
8.62506
,
41.144805
),
g
(-
8.642196
,
41.160114
)));
return
pointService
.
getPointsWithin
(
polygon
);
}
}
Loading