Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VIPSLogic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
VIPS
VIPSLogic
Commits
4b209182
Commit
4b209182
authored
1 month ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Patches
Plain Diff
Feat: Fetch weather stations available to a user VIPSUTV-1035
parent
87632ce7
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/no/nibio/vips/logic/service/POIService.java
+28
-0
28 additions, 0 deletions
src/main/java/no/nibio/vips/logic/service/POIService.java
with
28 additions
and
0 deletions
src/main/java/no/nibio/vips/logic/service/POIService.java
+
28
−
0
View file @
4b209182
...
...
@@ -244,6 +244,34 @@ public class POIService {
List
<
PointOfInterest
>
retVal
=
pointOfInterestBean
.
getRelevantPointOfInterestsForUser
(
user
);
return
Response
.
ok
().
entity
(
retVal
).
build
();
}
/**
* If used outside of VIPSLogic: Requires a valid UUID to be provided in the
* Authorization header
*
* @return a list of weather stations, including the ones belonging to the user's organization and any private stations belonging to the user
*/
@GET
@Path
(
"weatherstation/user"
)
@Produces
(
"application/json;charset=UTF-8"
)
@Facet
(
"restricted"
)
@TypeHint
(
PointOfInterest
[].
class
)
public
Response
getWeatherStationsForCurrentUser
()
{
VipsLogicUser
user
=
(
VipsLogicUser
)
httpServletRequest
.
getSession
().
getAttribute
(
"user"
);
// Could be the VIPS obs app or some other client using UUID
if
(
user
==
null
)
{
String
uuidStr
=
httpServletRequest
.
getHeader
(
HttpHeaders
.
AUTHORIZATION
);
UUID
uuid
=
UUID
.
fromString
(
uuidStr
);
user
=
userBean
.
findVipsLogicUser
(
uuid
);
if
(
user
==
null
)
{
return
Response
.
status
(
Status
.
UNAUTHORIZED
).
build
();
}
}
List
<
PointOfInterestWeatherStation
>
retVal
=
pointOfInterestBean
.
getRelevantPointOfInterestsForUser
(
user
).
stream
()
.
filter
(
poi
->
poi
instanceof
PointOfInterestWeatherStation
)
.
map
(
poi
->(
PointOfInterestWeatherStation
)
poi
).
collect
(
Collectors
.
toList
());
return
Response
.
ok
().
entity
(
retVal
).
build
();
}
/**
* This service is used by the VIPS Field observation app to sync data stored locally on the smartphone with the
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment