Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
7a76e4c8
Commit
7a76e4c8
authored
Aug 13, 2019
by
Piotr Gawron
Browse files
Merge remote-tracking branch 'origin/master' into 880-minervanet-error-report-90
parents
24a924ce
8d03dcb7
Pipeline
#12715
passed with stage
in 11 minutes and 43 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
7a76e4c8
...
...
@@ -3,6 +3,8 @@ minerva (14.0.0~alpha.1) unstable; urgency=low
*
Small
improvement
:
debian
package
can
be
installed
on
debian
:
buster
(#
879
)
*
Bug
fix
:
REST
API
bioEntities
:
search
method
didn
't limit results to the
submodel id (#860)
* Bug fix: Empty Overlay colours were not preserved during export to
CellDesigner (#714)
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 12 Aug 2019 10:00:00 +0200
...
...
rest-api/src/main/java/lcsb/mapviewer/api/projects/models/ModelController.java
View file @
7a76e4c8
...
...
@@ -94,6 +94,7 @@ public class ModelController extends BaseController {
@PathVariable
(
value
=
"modelId"
)
String
modelId
,
@RequestParam
(
value
=
"handlerClass"
)
String
handlerClass
,
@RequestParam
(
value
=
"overlayIds"
,
defaultValue
=
""
)
String
overlayIds
,
@RequestParam
(
value
=
"backgroundOverlayId"
,
defaultValue
=
""
)
String
backgroundOverlayId
,
@RequestParam
(
value
=
"polygonString"
,
defaultValue
=
""
)
String
polygonString
,
@RequestParam
(
value
=
"elementIds"
,
defaultValue
=
""
)
String
elementIds
,
@RequestParam
(
value
=
"reactionIds"
,
defaultValue
=
""
)
String
reactionIds
)
...
...
@@ -101,7 +102,7 @@ public class ModelController extends BaseController {
ConverterException
,
InconsistentModelException
{
User
user
=
userService
.
getUserByLogin
(
authentication
.
getName
());
FileEntry
file
=
modelController
.
getModelAsModelFile
(
projectId
,
modelId
,
handlerClass
,
overlayIds
,
polygonString
,
elementIds
,
reactionIds
,
user
);
projectId
,
modelId
,
handlerClass
,
overlayIds
,
polygonString
,
elementIds
,
reactionIds
,
user
,
backgroundOverlayId
);
return
ResponseEntity
.
ok
().
contentLength
(
file
.
getFileContent
().
length
)
.
contentType
(
MediaType
.
APPLICATION_OCTET_STREAM
)
.
header
(
"Content-Disposition"
,
"attachment; filename="
+
file
.
getOriginalFileName
())
...
...
rest-api/src/main/java/lcsb/mapviewer/api/projects/models/ModelRestImpl.java
View file @
7a76e4c8
...
...
@@ -170,9 +170,12 @@ public class ModelRestImpl extends BaseRestImpl {
public
FileEntry
getModelAsModelFile
(
String
projectId
,
String
modelId
,
String
handlerClass
,
String
overlayIds
,
String
polygonString
,
String
elementIds
,
String
reactionIds
,
User
user
)
String
reactionIds
,
User
user
,
String
backgroundOverlayId
)
throws
QueryException
,
IOException
,
InvalidColorSchemaException
,
CommandExecutionException
,
ConverterException
,
InconsistentModelException
{
Project
project
=
getProjectService
().
getProjectByProjectId
(
projectId
);
Model
originalModel
=
getModelByModelId
(
projectId
,
modelId
);
Path2D
polygon
=
stringToPolygon
(
polygonString
,
originalModel
);
...
...
@@ -188,10 +191,24 @@ public class ModelRestImpl extends BaseRestImpl {
String
[]
overlayIdsList
=
stringListToArray
(
overlayIds
);
// Remove all colors
if
(
overlayIdsList
.
length
>
0
)
{
for
(
Element
element
:
part
.
getElements
())
{
element
.
setColor
(
Color
.
WHITE
);
new
ClearColorModelCommand
(
part
).
execute
();
}
if
(!
backgroundOverlayId
.
equals
(
""
))
{
Layout
overlay
=
project
.
getLayoutByIdentifier
(
Integer
.
valueOf
(
backgroundOverlayId
));
if
(
overlay
==
null
)
{
throw
new
ObjectNotFoundException
(
"Unknown overlay in model. Layout.id="
+
backgroundOverlayId
);
}
if
(
overlay
.
getTitle
().
equals
(
BuildInLayout
.
CLEAN
.
getTitle
()))
{
// this might not return true if we change CLEAN.title in future...
// if it's clean then remove coloring
new
ClearColorModelCommand
(
part
).
execute
();
}
}
// Color with overlays
for
(
String
overlayId
:
overlayIdsList
)
{
Layout
overlay
=
layoutService
.
getLayoutById
(
Integer
.
parseInt
(
overlayId
.
trim
()));
...
...
rest-api/src/test/java/lcsb/mapviewer/api/projects/models/ModelRestImplTest.java
View file @
7a76e4c8
...
...
@@ -108,20 +108,20 @@ public class ModelRestImplTest extends RestTestFunctions {
@Test
(
expected
=
QueryException
.
class
)
public
void
testGetModelAsFileModel
()
throws
Exception
{
ModelRestImpl
modelRest
=
createMockProjectRest
(
"testFiles/model/sample.xml"
);
modelRest
.
getModelAsModelFile
(
"sample"
,
"0"
,
""
,
""
,
""
,
null
,
null
,
null
);
modelRest
.
getModelAsModelFile
(
"sample"
,
"0"
,
""
,
""
,
""
,
null
,
null
,
null
,
""
);
}
@Test
public
void
testGetModelAsFileModel2
()
throws
Exception
{
ModelRestImpl
modelRest
=
createMockProjectRest
(
"testFiles/model/sample.xml"
);
modelRest
.
getModelAsModelFile
(
"sample"
,
"0"
,
CellDesignerXmlParser
.
class
.
getCanonicalName
(),
""
,
"0,0;90,0;90,90;90,0"
,
null
,
null
,
null
);
"0,0;90,0;90,90;90,0"
,
null
,
null
,
null
,
""
);
}
@Test
(
expected
=
QueryException
.
class
)
public
void
testGetModelAsFileModel3
()
throws
Exception
{
ModelRestImpl
modelRest
=
createMockProjectRest
(
"testFiles/model/sample.xml"
);
modelRest
.
getModelAsModelFile
(
"sample"
,
"0"
,
""
,
""
,
"0,0;90,0;90,90;90,0"
,
null
,
null
,
null
);
modelRest
.
getModelAsModelFile
(
"sample"
,
"0"
,
""
,
""
,
"0,0;90,0;90,90;90,0"
,
null
,
null
,
null
,
""
);
}
@Test
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment