Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VIPSCore
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
VIPSCore
Commits
d5feaa49
Commit
d5feaa49
authored
4 years ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Plain Diff
Merge branch 'ipm_decisions' into 'develop'
Ipm decisions See merge request
!6
parents
1b25e852
d9242013
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!6
Ipm decisions
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/no/nibio/vips/core/config/JacksonConfig.java
+0
-1
0 additions, 1 deletion
src/main/java/no/nibio/vips/core/config/JacksonConfig.java
src/main/java/no/nibio/vips/core/service/ModelResourceImpl.java
+21
-9
21 additions, 9 deletions
...in/java/no/nibio/vips/core/service/ModelResourceImpl.java
with
21 additions
and
10 deletions
src/main/java/no/nibio/vips/core/config/JacksonConfig.java
+
0
−
1
View file @
d5feaa49
...
...
@@ -47,7 +47,6 @@ public class JacksonConfig implements ContextResolver<ObjectMapper>{
{
objectMapper
=
new
ObjectMapper
();
objectMapper
.
configure
(
SerializationFeature
.
WRITE_DATES_AS_TIMESTAMPS
,
false
);
objectMapper
.
registerModule
(
new
JtsModule
());
objectMapper
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
);
objectMapper
.
registerModule
(
new
JtsModule
());
objectMapper
.
registerModule
(
new
JavaTimeModule
());
...
...
This diff is collapsed.
Click to expand it.
src/main/java/no/nibio/vips/core/service/ModelResourceImpl.java
+
21
−
9
View file @
d5feaa49
...
...
@@ -19,19 +19,13 @@
package
no.nibio.vips.core.service
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.ws.rs.Consumes
;
import
javax.ws.rs.GET
;
import
javax.ws.rs.POST
;
import
javax.ws.rs.Path
;
import
javax.ws.rs.PathParam
;
import
javax.ws.rs.Produces
;
...
...
@@ -320,9 +314,27 @@ public class ModelResourceImpl implements ModelResource{
@Override
public
Response
runModelForIPMDecisions
(
@PathParam
(
"modelId"
)
String
modelId
,
IPMDecisionsModelConfiguration
config
)
{
DataTransformer
dt
=
new
DataTransformer
();
config
.
setConfigParameter
(
"observations"
,
dt
.
getVIPSWeatherData
(
config
.
getWeatherData
()));
return
this
.
runModel
(
modelId
,
config
);
try
{
DataTransformer
dt
=
new
DataTransformer
();
config
.
setConfigParameter
(
"observations"
,
dt
.
getVIPSWeatherData
(
config
.
getWeatherData
()));
Model
calledModel
=
ModelFactory
.
getInstance
().
getModelInstance
(
modelId
);
calledModel
.
setConfiguration
(
config
);
List
<
Result
>
results
=
calledModel
.
getResult
();
return
Response
.
ok
().
entity
(
dt
.
getIPMDecisionsModelOutput
(
results
)).
build
();
}
catch
(
Exception
ex
)
{
Logger
.
getLogger
(
ModelResourceImpl
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
if
(
ex
instanceof
ConfigValidationException
){
throw
new
WebApplicationException
(
Response
.
status
(
Response
.
Status
.
BAD_REQUEST
).
entity
(
ex
).
build
());
}
else
{
throw
new
WebApplicationException
(
Response
.
status
(
Response
.
Status
.
INTERNAL_SERVER_ERROR
).
entity
(
ex
).
build
());
}
}
}
@Override
...
...
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