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
No related branches found
No related tags found
No related merge requests found
......@@ -639,9 +639,9 @@ public class Observation implements Serializable, no.nibio.vips.observation.Obse
this.getObservationId(),
this.getTimeOfObservation(),
this.getOrganismId(),
this.getOrganism().getLocalName(locale),
this.getOrganism().getLocalName(locale).trim() != "" ? this.getOrganism().getLocalName(locale) : this.getOrganism().getLatinName(),
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
// as that the observation has been geographically masked by
// choice of the observer
......
......@@ -142,16 +142,19 @@ public class ObservationService {
@QueryParam("cropCategoryId") List<Integer> cropCategoryId,
@QueryParam("from") String fromStr,
@QueryParam("to") String toStr,
@QueryParam("userUUID") String userUUID
@QueryParam("userUUID") String userUUID,
@QueryParam("locale") String localeStr
)
{
VipsLogicUser user = (VipsLogicUser) httpServletRequest.getSession().getAttribute("user");
if(user == null && userUUID != null)
{
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(
getFilteredObservationsFromBackend(
organizationId,
......@@ -161,7 +164,7 @@ public class ObservationService {
fromStr,
toStr,
user
).stream().map(obs -> obs.getListItem("nb")).collect(Collectors.toList())
).stream().map(obs -> obs.getListItem(locale)).collect(Collectors.toList())
).build();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment