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
8d0ca687
Commit
8d0ca687
authored
Jun 30, 2020
by
Piotr Gawron
Browse files
conversion api process model in the same way as map upload
parent
f6e6b319
Pipeline
#29168
passed with stage
in 22 minutes and 26 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
8d0ca687
...
...
@@ -11,6 +11,7 @@ minerva (15.0.2) stable; urgency=medium
*
Bug
fix
:
user
data
overlays
were
not
removed
when
user
was
deleted
(#
1301
)
*
Bug
fix
:
kinetic
parameters
exported
to
SBML
created
invalid
SBML
file
(#
1305
)
*
Bug
fix
:
text
area
were
not
converted
to
GPML
using
conversion
API
(#
1306
)
--
Piotr
Gawron
<
piotr
.
gawron
@
uni
.
lu
>
Mon
,
29
Jun
2020
11
:
00
:
00
+
0200
...
...
rest-api/src/main/java/lcsb/mapviewer/api/convert/ConvertRestImpl.java
View file @
8d0ca687
...
...
@@ -40,29 +40,26 @@ public class ConvertRestImpl extends BaseRestImpl {
QueryException
{
ConverterParams
params
=
createConvertParams
(
input
);
MinervaLoggerAppender
appender
=
MinervaLoggerAppender
.
createAppender
();
Model
mode
l
;
Model
origina
l
;
try
{
mode
l
=
getModelParserByNameOrClass
(
fromFormat
).
createModel
(
params
);
StringBuilder
notes
=
new
StringBuilder
(
mode
l
.
getNotes
());
origina
l
=
getModelParserByNameOrClass
(
fromFormat
).
createModel
(
params
);
StringBuilder
notes
=
new
StringBuilder
(
origina
l
.
getNotes
());
if
(!
appender
.
getWarnings
().
isEmpty
())
{
for
(
String
entry
:
new
LogFormatter
().
createFormattedWarnings
(
appender
.
getWarnings
()))
{
notes
.
append
(
"\n"
+
entry
);
}
}
mode
l
.
setNotes
(
notes
.
toString
());
origina
l
.
setNotes
(
notes
.
toString
());
}
finally
{
MinervaLoggerAppender
.
unregisterLogEventStorage
(
appender
);
}
Model
model
=
getModelWithPathwayAndCompartment
(
original
);
Converter
exporter
=
getModelParserByNameOrClass
(
toFormat
);
return
IOUtils
.
toString
(
exporter
.
model2InputStream
(
model
),
StandardCharsets
.
UTF_8
);
}
public
ByteArrayOutputStream
converToImage
(
String
fromFormat
,
String
toFormat
,
byte
[]
input
,
Double
targetWidth
,
Double
targetHeight
)
throws
InvalidInputDataExecption
,
SBMLException
,
IOException
,
ConverterException
,
DrawingException
,
QueryException
{
Model
original
=
getModelParserByNameOrClass
(
fromFormat
).
createModel
(
createConvertParams
(
input
));
private
Model
getModelWithPathwayAndCompartment
(
Model
original
)
{
Model
model
=
new
CopyCommand
(
original
).
execute
();
try
{
new
CreateHierarchyCommand
(
model
,
10
,
1024
).
execute
();
...
...
@@ -73,6 +70,16 @@ public class ConvertRestImpl extends BaseRestImpl {
logger
.
error
(
"Problem with creating pathways"
,
e
);
model
=
original
;
}
return
model
;
}
public
ByteArrayOutputStream
converToImage
(
String
fromFormat
,
String
toFormat
,
byte
[]
input
,
Double
targetWidth
,
Double
targetHeight
)
throws
InvalidInputDataExecption
,
SBMLException
,
IOException
,
ConverterException
,
DrawingException
,
QueryException
{
Model
original
=
getModelParserByNameOrClass
(
fromFormat
).
createModel
(
createConvertParams
(
input
));
Model
model
=
getModelWithPathwayAndCompartment
(
original
);
AbstractImageGenerator
generator
=
getImageGenerator
(
toFormat
,
createImageParams
(
model
,
targetWidth
,
targetHeight
));
ByteArrayOutputStream
os
=
new
ByteArrayOutputStream
();
...
...
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