Skip to content
Snippets Groups Projects
Commit 7964ce90 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Added language support for observation list items

parent 2ce1a635
Branches
Tags
No related merge requests found
...@@ -639,9 +639,9 @@ public class Observation implements Serializable, no.nibio.vips.observation.Obse ...@@ -639,9 +639,9 @@ public class Observation implements Serializable, no.nibio.vips.observation.Obse
this.getObservationId(), this.getObservationId(),
this.getTimeOfObservation(), this.getTimeOfObservation(),
this.getOrganismId(), this.getOrganismId(),
this.getOrganism().getLocalName(locale), this.getOrganism().getLocalName(locale).trim() != "" ? this.getOrganism().getLocalName(locale) : this.getOrganism().getLatinName(),
this.getCropOrganismId(), this.getCropOrganismId(),
this.getCropOrganism().getLocalName(locale), this.getCropOrganism().getLocalName(locale).trim() != "" ? this.getCropOrganism().getLocalName(locale) : this.getCropOrganism().getLatinName(),
// Specific geoInfo trumps location. This is to be interpreted // Specific geoInfo trumps location. This is to be interpreted
// as that the observation has been geographically masked by // as that the observation has been geographically masked by
// choice of the observer // choice of the observer
......
...@@ -142,16 +142,19 @@ public class ObservationService { ...@@ -142,16 +142,19 @@ public class ObservationService {
@QueryParam("cropCategoryId") List<Integer> cropCategoryId, @QueryParam("cropCategoryId") List<Integer> cropCategoryId,
@QueryParam("from") String fromStr, @QueryParam("from") String fromStr,
@QueryParam("to") String toStr, @QueryParam("to") String toStr,
@QueryParam("userUUID") String userUUID @QueryParam("userUUID") String userUUID,
@QueryParam("locale") String localeStr
) )
{ {
VipsLogicUser user = (VipsLogicUser) httpServletRequest.getSession().getAttribute("user"); VipsLogicUser user = (VipsLogicUser) httpServletRequest.getSession().getAttribute("user");
if(user == null && userUUID != null) if(user == null && userUUID != null)
{ {
user = SessionControllerGetter.getUserBean().findVipsLogicUser(UUID.fromString(userUUID)); user = SessionControllerGetter.getUserBean().findVipsLogicUser(UUID.fromString(userUUID));
} }
//System.out.println("getFilteredObservationListItems"); String locale = localeStr != null ? localeStr :
user != null ? user.getOrganizationId().getDefaultLocale() :
SessionControllerGetter.getUserBean().getOrganization(organizationId).getDefaultLocale();
return Response.ok().entity( return Response.ok().entity(
getFilteredObservationsFromBackend( getFilteredObservationsFromBackend(
organizationId, organizationId,
...@@ -161,7 +164,7 @@ public class ObservationService { ...@@ -161,7 +164,7 @@ public class ObservationService {
fromStr, fromStr,
toStr, toStr,
user user
).stream().map(obs -> obs.getListItem("nb")).collect(Collectors.toList()) ).stream().map(obs -> obs.getListItem(locale)).collect(Collectors.toList())
).build(); ).build();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment