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
Merge requests
!20
Privat varsel
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Privat varsel
privat_varsel
into
develop
Overview
0
Commits
3
Pipelines
0
Changes
4
Merged
Tor-Einar Skog
requested to merge
privat_varsel
into
develop
5 years ago
Overview
0
Commits
3
Pipelines
0
Changes
4
Expand
0
0
Merge request reports
Compare
develop
develop (base)
and
latest version
latest version
201b3bed
3 commits,
5 years ago
4 files
+
57
−
14
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
src/main/java/no/nibio/vips/logic/controller/session/ForecastBean.java
+
20
−
6
Options
@@ -710,7 +710,7 @@ public class ForecastBean {
return
resource
;
}
public
Kml
getForecastsAggregateKml
(
List
<
Integer
>
organizationIds
,
List
<
Integer
>
cropOrganismIds
,
Date
theDate
,
String
serverName
)
public
Kml
getForecastsAggregateKml
(
List
<
Integer
>
organizationIds
,
List
<
Integer
>
cropOrganismIds
,
Date
theDate
,
String
serverName
,
VipsLogicUser
user
)
{
//String iconPath = Globals.PROTOCOL + "://" + serverName + "/public/images/";
String
iconPath
=
"//"
+
serverName
+
"/public/images/"
;
@@ -751,13 +751,13 @@ public class ForecastBean {
if
(
organizationIds
.
size
()
==
1
&&
organizationIds
.
get
(
0
).
equals
(-
1
))
{
em
.
createNamedQuery
(
"Organization.findAll"
,
Organization
.
class
).
getResultStream
().
forEach
(
org
->
poisWithAggregate
.
addAll
(
getPointOfInterestForecastsAggregate
(
org
.
getOrganizationId
(),
cropOrganismIds
,
theDate
))
org
->
poisWithAggregate
.
addAll
(
getPointOfInterestForecastsAggregate
(
org
.
getOrganizationId
(),
cropOrganismIds
,
theDate
,
user
))
);
}
else
{
organizationIds
.
stream
().
forEach
(
orgId
->
poisWithAggregate
.
addAll
(
getPointOfInterestForecastsAggregate
(
orgId
,
cropOrganismIds
,
theDate
))
orgId
->
poisWithAggregate
.
addAll
(
getPointOfInterestForecastsAggregate
(
orgId
,
cropOrganismIds
,
theDate
,
user
))
);
}
@@ -1015,9 +1015,15 @@ public class ForecastBean {
* @param organizationId Filter for organization
* @param cropOrganismIds Filter for crops
* @param theDate Filter for date. If theDate=systemDate, data is fetched from the caching table forecast_result_cache
* @param user if not null: Include private forecasts for this user
* @return
*/
private
List
<
PointOfInterest
>
getPointOfInterestForecastsAggregate
(
Integer
organizationId
,
List
<
Integer
>
cropOrganismIds
,
Date
theDate
)
{
private
List
<
PointOfInterest
>
getPointOfInterestForecastsAggregate
(
Integer
organizationId
,
List
<
Integer
>
cropOrganismIds
,
Date
theDate
,
VipsLogicUser
user
)
{
// TODO: More precise gathering of POIs...
List
<
PointOfInterest
>
pois
;
if
(
organizationId
!=
null
&&
organizationId
>
0
)
@@ -1050,14 +1056,22 @@ public class ForecastBean {
"WHERE forecast_configuration_id IN( \n"
+
" SELECT forecast_configuration_id \n"
+
" FROM forecast_configuration \n"
+
" WHERE is_private IS FALSE \n"
+
" AND forecast_configuration_id > 0 \n"
+
" WHERE forecast_configuration_id > 0 \n"
+
(
user
==
null
?
" AND is_private IS FALSE \n"
:
" AND (is_private IS FALSE OR (is_private IS TRUE AND vips_logic_user_id=:vipsLogicUserId))"
)
+
" AND location_point_of_interest_id=:locationPointOfInterestId \n"
+
(
cropOrganismIds
!=
null
&&
!
cropOrganismIds
.
isEmpty
()
?
" AND crop_organism_id IN ("
+
StringUtils
.
join
(
cropOrganismIds
,
","
)
+
") "
:
""
)
+
")\n"
+
"AND valid_time_start between :midnight AND :nextMidnight"
;
//System.out.println(poi.getName() + " SQL=" + sql);
Query
q
=
em
.
createNativeQuery
(
sql
);
if
(
user
!=
null
)
{
q
.
setParameter
(
"vipsLogicUserId"
,
user
);
}
q
.
setParameter
(
"locationPointOfInterestId"
,
poi
.
getPointOfInterestId
());
q
.
setParameter
(
"midnight"
,
midnight
);
q
.
setParameter
(
"nextMidnight"
,
nextMidnight
);
Loading