Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Genesys Backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
15
Issues
15
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Genesys PGR
Genesys Backend
Commits
05dd1a0d
Commit
05dd1a0d
authored
Sep 02, 2014
by
Matija Obreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return AccessionDetails in webapi
parent
ac01b7e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
16 deletions
+7
-16
src/main/java/org/genesys2/server/servlet/controller/webapi/WebApiController.java
...s2/server/servlet/controller/webapi/WebApiController.java
+7
-16
No files found.
src/main/java/org/genesys2/server/servlet/controller/webapi/WebApiController.java
View file @
05dd1a0d
...
...
@@ -17,20 +17,16 @@
package
org.genesys2.server.servlet.controller.webapi
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.genesys2.server.model.genesys.Accession
;
import
org.genesys2.server.model.json.AccessionJson
;
import
org.genesys2.server.model.json.GenesysJsonFactory
;
import
org.genesys2.server.service.GenesysFilterService
;
import
org.genesys2.server.model.elastic.AccessionDetails
;
import
org.genesys2.server.service.ElasticService
;
import
org.genesys2.server.service.GenesysService
;
import
org.genesys2.server.service.impl.FilterHandler.AppliedFilters
;
import
org.genesys2.server.service.impl.SearchException
;
import
org.genesys2.server.servlet.controller.rest.RestController
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Sort
;
...
...
@@ -58,7 +54,7 @@ public class WebApiController extends RestController {
GenesysService
genesysService
;
@Autowired
private
GenesysFilterService
filter
Service
;
private
ElasticService
elastic
Service
;
@RequestMapping
(
value
=
"/genesys-webapi.js"
,
method
=
RequestMethod
.
GET
)
public
String
getScript
(
ModelMap
model
,
@RequestParam
(
"client_id"
)
String
clientId
,
...
...
@@ -71,20 +67,15 @@ public class WebApiController extends RestController {
@RequestMapping
(
value
=
"/v0/acn/filter"
,
method
=
RequestMethod
.
POST
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
@ResponseBody
public
Page
<
Accession
Json
>
filterAccessions
(
@RequestBody
JsonData
jsonData
)
throws
IO
Exception
{
public
Page
<
Accession
Details
>
filterAccessions
(
@RequestBody
JsonData
jsonData
)
throws
IOException
,
Search
Exception
{
AppliedFilters
appliedFilters
=
mapper
.
readValue
(
jsonData
.
filter
,
AppliedFilters
.
class
);
LOG
.
info
(
"filteringAccessions: "
+
appliedFilters
.
toString
());
Pageable
pageable
=
new
PageRequest
(
jsonData
.
startAt
-
1
,
Math
.
min
(
50
,
jsonData
.
maxRecords
),
new
Sort
(
"acceNumb"
));
Page
<
Accession
>
accessions
=
filterService
.
listAccessions
(
appliedFilters
,
pageable
);
List
<
AccessionJson
>
list
=
new
ArrayList
<
AccessionJson
>(
accessions
.
getNumber
());
for
(
Accession
a
:
accessions
.
getContent
())
{
list
.
add
(
GenesysJsonFactory
.
from
(
a
));
}
Page
<
AccessionJson
>
acnJ
=
new
PageImpl
<
AccessionJson
>(
list
,
pageable
,
accessions
.
getTotalElements
());
return
acnJ
;
Page
<
AccessionDetails
>
accessions
=
elasticService
.
filter
(
appliedFilters
,
pageable
);
return
accessions
;
}
public
static
class
JsonData
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment