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
717f7248
Commit
717f7248
authored
4 months ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup: Remove duplicate endpoints
parent
eb28aad4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/no/nibio/vips/logic/service/LogicService.java
+0
-73
0 additions, 73 deletions
src/main/java/no/nibio/vips/logic/service/LogicService.java
src/main/java/no/nibio/vips/logic/service/POIService.java
+6
-2
6 additions, 2 deletions
src/main/java/no/nibio/vips/logic/service/POIService.java
with
6 additions
and
75 deletions
src/main/java/no/nibio/vips/logic/service/LogicService.java
+
0
−
73
View file @
717f7248
...
@@ -54,7 +54,6 @@ import jakarta.ws.rs.PathParam;
...
@@ -54,7 +54,6 @@ import jakarta.ws.rs.PathParam;
import
jakarta.ws.rs.Produces
;
import
jakarta.ws.rs.Produces
;
import
jakarta.ws.rs.QueryParam
;
import
jakarta.ws.rs.QueryParam
;
import
jakarta.ws.rs.core.Context
;
import
jakarta.ws.rs.core.Context
;
import
jakarta.ws.rs.core.HttpHeaders
;
import
jakarta.ws.rs.core.Response
;
import
jakarta.ws.rs.core.Response
;
import
jakarta.ws.rs.core.Response.Status
;
import
jakarta.ws.rs.core.Response.Status
;
import
no.nibio.vips.entity.WeatherObservation
;
import
no.nibio.vips.entity.WeatherObservation
;
...
@@ -75,9 +74,7 @@ import no.nibio.vips.logic.entity.MessageTag;
...
@@ -75,9 +74,7 @@ import no.nibio.vips.logic.entity.MessageTag;
import
no.nibio.vips.logic.entity.ModelInformation
;
import
no.nibio.vips.logic.entity.ModelInformation
;
import
no.nibio.vips.logic.entity.Organism
;
import
no.nibio.vips.logic.entity.Organism
;
import
no.nibio.vips.logic.entity.Organization
;
import
no.nibio.vips.logic.entity.Organization
;
import
no.nibio.vips.logic.entity.PointOfInterest
;
import
no.nibio.vips.logic.entity.PointOfInterestType
;
import
no.nibio.vips.logic.entity.PointOfInterestType
;
import
no.nibio.vips.logic.entity.PointOfInterestWeatherStation
;
import
no.nibio.vips.logic.entity.UserAuthentication
;
import
no.nibio.vips.logic.entity.UserAuthentication
;
import
no.nibio.vips.logic.entity.UserAuthenticationType
;
import
no.nibio.vips.logic.entity.UserAuthenticationType
;
import
no.nibio.vips.logic.entity.VipsLogicRole
;
import
no.nibio.vips.logic.entity.VipsLogicRole
;
...
@@ -796,76 +793,6 @@ public class LogicService {
...
@@ -796,76 +793,6 @@ public class LogicService {
return
Response
.
ok
().
entity
(
retVal
).
build
();
return
Response
.
ok
().
entity
(
retVal
).
build
();
}
}
/**
* Get a list of locations (pois) for a given organization
* @param organizationId
* @return
*/
@GET
@Path
(
"poi/organization/{organizationId}"
)
@Produces
(
"application/json;charset=UTF-8"
)
@TypeHint
(
PointOfInterestWeatherStation
[].
class
)
public
Response
getPoisForOrganization
(
@PathParam
(
"organizationId"
)
Integer
organizationId
)
{
Organization
organization
=
userBean
.
getOrganization
(
organizationId
);
List
<
PointOfInterestWeatherStation
>
retVal
=
pointOfInterestBean
.
getWeatherstationsForOrganization
(
organization
,
Boolean
.
TRUE
,
Boolean
.
FALSE
);
return
Response
.
ok
().
entity
(
retVal
).
build
();
}
/**
*
* @param pointOfInterestId
* @return a particular POI (Point of interest)
*/
@GET
@Path
(
"poi/{pointOfInterestId}"
)
@Produces
(
"application/json;charset=UTF-8"
)
@TypeHint
(
PointOfInterest
.
class
)
public
Response
getPoi
(
@PathParam
(
"pointOfInterestId"
)
Integer
pointOfInterestId
)
{
PointOfInterest
retVal
=
pointOfInterestBean
.
getPointOfInterest
(
pointOfInterestId
);
return
Response
.
ok
().
entity
(
retVal
).
build
();
}
/**
* Find a POI (Point of interest) by name
* @param poiName
* @return
*/
@GET
@Path
(
"poi/name/{poiName}"
)
@Produces
(
"application/json;charset=UTF-8"
)
@TypeHint
(
PointOfInterest
.
class
)
public
Response
getPoiByName
(
@PathParam
(
"poiName"
)
String
poiName
)
{
PointOfInterest
retVal
=
pointOfInterestBean
.
getPointOfInterest
(
poiName
);
return
retVal
!=
null
?
Response
.
ok
().
entity
(
retVal
).
build
()
:
Response
.
noContent
().
build
();
}
/**
* If used outside of VIPSLogic: Requires a valid UUID to be provided in the Authorization header
* @return a list of POIs for the user logged in in this session
*/
@GET
@Path
(
"poi/user"
)
@Produces
(
"application/json;charset=UTF-8"
)
@Facet
(
"restricted"
)
@TypeHint
(
PointOfInterest
[].
class
)
public
Response
getPoisForCurrentUser
()
{
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
);
}
List
<
PointOfInterest
>
retVal
=
pointOfInterestBean
.
getRelevantPointOfInterestsForUser
(
user
);
return
Response
.
ok
().
entity
(
retVal
).
build
();
}
/**
/**
*
*
...
...
This diff is collapsed.
Click to expand it.
src/main/java/no/nibio/vips/logic/service/POIService.java
+
6
−
2
View file @
717f7248
...
@@ -36,6 +36,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
...
@@ -36,6 +36,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.webcohesion.enunciate.metadata.Facet
;
import
com.webcohesion.enunciate.metadata.Facet
;
import
com.webcohesion.enunciate.metadata.rs.TypeHint
;
import
com.webcohesion.enunciate.metadata.rs.TypeHint
;
import
jakarta.ejb.EJB
;
import
jakarta.servlet.http.HttpServletRequest
;
import
jakarta.servlet.http.HttpServletRequest
;
import
jakarta.ws.rs.Consumes
;
import
jakarta.ws.rs.Consumes
;
import
jakarta.ws.rs.GET
;
import
jakarta.ws.rs.GET
;
...
@@ -72,8 +73,11 @@ public class POIService {
...
@@ -72,8 +73,11 @@ public class POIService {
@Context
@Context
private
HttpServletRequest
httpServletRequest
;
private
HttpServletRequest
httpServletRequest
;
@EJB
PointOfInterestBean
pointOfInterestBean
;
/**
/**
* Get a list of
locations (pois)
for a given organization
* Get a list of
weather stations
for a given organization
*
*
* @param organizationId Database id for the organization
* @param organizationId Database id for the organization
* @return List of weather stations for the organization
* @return List of weather stations for the organization
...
@@ -82,7 +86,7 @@ public class POIService {
...
@@ -82,7 +86,7 @@ public class POIService {
@Path
(
"organization/{organizationId}"
)
@Path
(
"organization/{organizationId}"
)
@Produces
(
"application/json;charset=UTF-8"
)
@Produces
(
"application/json;charset=UTF-8"
)
@TypeHint
(
PointOfInterestWeatherStation
[].
class
)
@TypeHint
(
PointOfInterestWeatherStation
[].
class
)
public
Response
get
Poi
sForOrganization
(
@PathParam
(
"organizationId"
)
Integer
organizationId
)
{
public
Response
get
Weatherstation
sForOrganization
(
@PathParam
(
"organizationId"
)
Integer
organizationId
)
{
Organization
organization
=
SessionControllerGetter
.
getUserBean
().
getOrganization
(
organizationId
);
Organization
organization
=
SessionControllerGetter
.
getUserBean
().
getOrganization
(
organizationId
);
List
<
PointOfInterestWeatherStation
>
retVal
=
SessionControllerGetter
.
getPointOfInterestBean
().
getWeatherstationsForOrganization
(
organization
,
Boolean
.
TRUE
,
Boolean
.
FALSE
);
List
<
PointOfInterestWeatherStation
>
retVal
=
SessionControllerGetter
.
getPointOfInterestBean
().
getWeatherstationsForOrganization
(
organization
,
Boolean
.
TRUE
,
Boolean
.
FALSE
);
return
Response
.
ok
().
entity
(
retVal
).
build
();
return
Response
.
ok
().
entity
(
retVal
).
build
();
...
...
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