Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
5e1475d2
Commit
5e1475d2
authored
Jul 25, 2019
by
Piotr Gawron
Browse files
overlayId is numeric
parent
97cccedb
Pipeline
#12085
failed with stage
in 10 minutes and 43 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
rest-api/src/main/java/lcsb/mapviewer/api/projects/overlays/OverlayController.java
View file @
5e1475d2
...
...
@@ -53,7 +53,7 @@ public class OverlayController extends BaseController {
@GetMapping
(
value
=
"/{overlayId}/"
)
public
Map
<
String
,
Object
>
getOverlayById
(
@PathVariable
(
value
=
"projectId"
)
String
projectId
,
@PathVariable
(
value
=
"overlayId"
)
String
overlayId
)
throws
QueryException
{
@PathVariable
(
value
=
"overlayId"
)
Integer
overlayId
)
throws
QueryException
{
return
overlayRestImp
.
getOverlayById
(
projectId
,
overlayId
);
}
...
...
@@ -64,7 +64,7 @@ public class OverlayController extends BaseController {
@GetMapping
(
value
=
"/{overlayId}/models/{modelId}/bioEntities/"
)
public
List
<
Map
<
String
,
Object
>>
getOverlayElements
(
@PathVariable
(
value
=
"projectId"
)
String
projectId
,
@PathVariable
(
value
=
"overlayId"
)
String
overlayId
,
@PathVariable
(
value
=
"overlayId"
)
Integer
overlayId
,
@RequestParam
(
value
=
"columns"
,
defaultValue
=
""
)
String
columns
)
throws
QueryException
{
return
overlayRestImp
.
getOverlayElements
(
projectId
,
Integer
.
valueOf
(
overlayId
),
columns
);
}
...
...
@@ -77,7 +77,7 @@ public class OverlayController extends BaseController {
public
Map
<
String
,
Object
>
getFullReaction
(
@PathVariable
(
value
=
"projectId"
)
String
projectId
,
@PathVariable
(
value
=
"modelId"
)
String
modelId
,
@PathVariable
(
value
=
"overlayId"
)
String
overlayId
,
@PathVariable
(
value
=
"overlayId"
)
Integer
overlayId
,
@PathVariable
(
value
=
"reactionId"
)
String
reactionId
,
@RequestParam
(
value
=
"columns"
,
defaultValue
=
""
)
String
columns
)
throws
QueryException
,
NumberFormatException
,
ObjectNotFoundException
{
...
...
@@ -93,7 +93,7 @@ public class OverlayController extends BaseController {
public
Map
<
String
,
Object
>
getFullSpecies
(
@PathVariable
(
value
=
"projectId"
)
String
projectId
,
@PathVariable
(
value
=
"modelId"
)
String
modelId
,
@PathVariable
(
value
=
"overlayId"
)
String
overlayId
,
@PathVariable
(
value
=
"overlayId"
)
Integer
overlayId
,
@PathVariable
(
value
=
"elementId"
)
String
reactionId
,
@RequestParam
(
value
=
"columns"
,
defaultValue
=
""
)
String
columns
)
throws
QueryException
,
NumberFormatException
,
ObjectNotFoundException
{
...
...
@@ -126,7 +126,7 @@ public class OverlayController extends BaseController {
@DeleteMapping
(
value
=
"/{overlayId}"
)
public
Map
<
String
,
Object
>
removeOverlay
(
@PathVariable
(
value
=
"projectId"
)
String
projectId
,
@PathVariable
(
value
=
"overlayId"
)
String
overlayId
)
throws
QueryException
,
IOException
{
@PathVariable
(
value
=
"overlayId"
)
Integer
overlayId
)
throws
QueryException
,
IOException
{
return
overlayRestImp
.
removeOverlay
(
projectId
,
overlayId
);
}
...
...
@@ -136,7 +136,7 @@ public class OverlayController extends BaseController {
@PatchMapping
(
value
=
"/{overlayId}"
)
public
Map
<
String
,
Object
>
updateOverlay
(
@RequestBody
String
body
,
@PathVariable
(
value
=
"overlayId"
)
String
overlayId
,
@PathVariable
(
value
=
"overlayId"
)
Integer
overlayId
,
@PathVariable
(
value
=
"projectId"
)
String
projectId
)
throws
QueryException
,
IOException
{
Map
<
String
,
Object
>
node
=
parseBody
(
body
);
...
...
@@ -151,7 +151,7 @@ public class OverlayController extends BaseController {
@GetMapping
(
value
=
"/{overlayId}:downloadSource"
)
public
ResponseEntity
<
byte
[]>
getOverlaySource
(
@PathVariable
(
value
=
"projectId"
)
String
projectId
,
@PathVariable
(
value
=
"overlayId"
)
String
overlayId
)
@PathVariable
(
value
=
"overlayId"
)
Integer
overlayId
)
throws
QueryException
{
FileEntry
file
=
overlayRestImp
.
getOverlaySource
(
projectId
,
overlayId
);
...
...
rest-api/src/main/java/lcsb/mapviewer/api/projects/overlays/OverlayRestImpl.java
View file @
5e1475d2
...
...
@@ -147,28 +147,27 @@ public class OverlayRestImpl extends BaseRestImpl {
return
result
;
}
public
Map
<
String
,
Object
>
getOverlayById
(
String
projectId
,
String
overlayId
)
public
Map
<
String
,
Object
>
getOverlayById
(
String
projectId
,
Integer
overlayId
)
throws
QueryException
{
Model
model
=
getModelService
().
getLastModelByProjectId
(
projectId
);
if
(
model
==
null
)
{
throw
new
QueryException
(
"Project with given id doesn't exist"
);
}
Layout
overlay
=
layoutService
.
getLayoutById
(
Integer
.
valueOf
(
overlayId
)
)
;
Layout
overlay
=
layoutService
.
getLayoutById
(
overlayId
);
if
(
overlay
==
null
)
{
throw
new
QueryException
(
"Overlay with given id doesn't exist"
);
}
return
overlayToMap
(
overlay
);
}
public
FileEntry
getOverlaySource
(
String
projectId
,
String
overlayId
)
public
FileEntry
getOverlaySource
(
String
projectId
,
Integer
overlayId
)
throws
QueryException
{
Model
model
=
getModelService
().
getLastModelByProjectId
(
projectId
);
if
(
model
==
null
)
{
throw
new
QueryException
(
"Project with given id doesn't exist"
);
}
try
{
int
id
=
Integer
.
parseInt
(
overlayId
);
Layout
layout
=
layoutService
.
getLayoutById
(
id
);
Layout
layout
=
layoutService
.
getLayoutById
(
overlayId
);
if
(
layout
==
null
)
{
throw
new
QueryException
(
"Invalid overlay id"
);
}
...
...
@@ -180,13 +179,12 @@ public class OverlayRestImpl extends BaseRestImpl {
}
}
public
Map
<
String
,
Object
>
updateOverlay
(
String
overlayId
,
Map
<
String
,
Object
>
overlayData
)
throws
QueryException
{
public
Map
<
String
,
Object
>
updateOverlay
(
Integer
overlayId
,
Map
<
String
,
Object
>
overlayData
)
throws
QueryException
{
if
(
overlayData
==
null
)
{
throw
new
QueryException
(
"overlay field cannot be undefined"
);
}
try
{
int
id
=
Integer
.
parseInt
(
overlayId
);
Layout
layout
=
layoutService
.
getLayoutById
(
id
);
Layout
layout
=
layoutService
.
getLayoutById
(
overlayId
);
if
(
layout
==
null
)
{
throw
new
ObjectNotFoundException
(
"overlay doesn't exist"
);
}
...
...
@@ -232,15 +230,14 @@ public class OverlayRestImpl extends BaseRestImpl {
}
}
public
Map
<
String
,
Object
>
removeOverlay
(
String
projectId
,
String
overlayId
)
public
Map
<
String
,
Object
>
removeOverlay
(
String
projectId
,
Integer
overlayId
)
throws
QueryException
,
IOException
{
Project
project
=
getProjectService
().
getProjectByProjectId
(
projectId
);
if
(
project
==
null
)
{
throw
new
ObjectNotFoundException
(
"Project with given id doesn't exist"
);
}
try
{
int
id
=
Integer
.
parseInt
(
overlayId
);
Layout
layout
=
layoutService
.
getLayoutById
(
id
);
Layout
layout
=
layoutService
.
getLayoutById
(
overlayId
);
if
(
layout
==
null
)
{
throw
new
ObjectNotFoundException
(
"Overlay doesn't exist"
);
}
...
...
@@ -321,7 +318,7 @@ public class OverlayRestImpl extends BaseRestImpl {
layout
.
setOrderIndex
(
count
);
layoutService
.
updateLayout
(
layout
);
return
getOverlayById
(
projectId
,
layout
.
getId
()
+
""
);
return
getOverlayById
(
projectId
,
layout
.
getId
());
}
catch
(
InvalidColorSchemaException
e
)
{
throw
new
QueryException
(
e
.
getMessage
(),
e
);
}
...
...
rest-api/src/test/java/lcsb/mapviewer/api/projects/overlays/OverlayRestImplTest.java
View file @
5e1475d2
...
...
@@ -66,7 +66,7 @@ public class OverlayRestImplTest extends RestTestFunctions {
Map
<
String
,
Object
>
result
=
overlayRest
.
addOverlay
(
projectId
,
"x"
,
"desc"
,
"s1"
,
null
,
null
,
ColorSchemaType
.
GENERIC
.
name
(),
"true"
,
null
);
String
id
=
result
.
get
(
"idObject"
).
toString
();
Integer
id
=
Integer
.
valueOf
(
result
.
get
(
"idObject"
).
toString
()
)
;
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"name"
,
"xyz"
);
result
=
overlayRest
.
updateOverlay
(
id
,
data
);
...
...
@@ -84,7 +84,7 @@ public class OverlayRestImplTest extends RestTestFunctions {
Map
<
String
,
Object
>
result
=
overlayRest
.
addOverlay
(
projectId
,
"x"
,
"desc"
,
"s1"
,
null
,
null
,
ColorSchemaType
.
GENERIC
.
name
(),
"true"
,
null
);
String
id
=
result
.
get
(
"idObject"
).
toString
();
Integer
id
=
Integer
.
valueOf
(
result
.
get
(
"idObject"
).
toString
()
)
;
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"name"
,
""
);
result
=
overlayRest
.
updateOverlay
(
id
,
data
);
...
...
service/src/main/java/lcsb/mapviewer/services/impl/LayoutService.java
View file @
5e1475d2
...
...
@@ -469,7 +469,7 @@ public class LayoutService implements ILayoutService {
}
@Override
public
Layout
getLayoutById
(
i
nt
overlayId
)
{
public
Layout
getLayoutById
(
I
nt
eger
overlayId
)
{
return
layoutDao
.
getById
(
overlayId
);
}
...
...
service/src/main/java/lcsb/mapviewer/services/interfaces/ILayoutService.java
View file @
5e1475d2
...
...
@@ -142,7 +142,7 @@ public interface ILayoutService {
*/
List
<
Layout
>
getLayoutsByProject
(
Project
project
);
Layout
getLayoutById
(
i
nt
overlayId
);
Layout
getLayoutById
(
I
nt
eger
overlayId
);
void
setLayoutDao
(
LayoutDao
layoutDao
);
...
...
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