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
3c09221a
Commit
3c09221a
authored
Jan 08, 2021
by
Piotr Gawron
Browse files
copy of the map is synchronized due to untracked side effects happening during copy process
parent
d232fd34
Pipeline
#36156
passed with stage
in 13 minutes and 47 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
3c09221a
...
...
@@ -2,6 +2,8 @@ minerva (15.1.2) stable; urgency=medium
*
Bug
fix
:
automatic
annotations
are
sometimes
missing
after
project
upload
(#
1434
)
*
Bug
fix
:
export
to
SBML
failed
if
reactant
/
product
line
had
length
=
0
*
Bug
fix
:
downloading
submap
from
big
project
as
a
map
quite
often
resulted
in
error
(#
1440
)
--
Piotr
Gawron
<
piotr
.
gawron
@
uni
.
lu
>
Thu
,
7
Jan
2021
15
:
00
:
00
+
0200
...
...
model-command/src/main/java/lcsb/mapviewer/commands/CopyCommand.java
View file @
3c09221a
...
...
@@ -47,48 +47,50 @@ public class CopyCommand extends NewModelCommand {
Model
model
=
getModel
();
if
(
model
.
getModelData
().
getParentModels
().
size
()
>
0
)
{
ModelSubmodelConnection
parent
=
null
;
for
(
SubmodelConnection
connection
:
model
.
getModelData
().
getParentModels
())
{
if
(
connection
instanceof
ModelSubmodelConnection
)
{
if
(
parent
!=
null
)
{
throw
new
InvalidArgumentException
(
"It looks like the model is a submodel, but has more than one parent..."
);
}
else
{
parent
=
(
ModelSubmodelConnection
)
connection
;
synchronized
(
model
)
{
if
(
model
.
getModelData
().
getParentModels
().
size
()
>
0
)
{
ModelSubmodelConnection
parent
=
null
;
for
(
SubmodelConnection
connection
:
model
.
getModelData
().
getParentModels
())
{
if
(
connection
instanceof
ModelSubmodelConnection
)
{
if
(
parent
!=
null
)
{
throw
new
InvalidArgumentException
(
"It looks like the model is a submodel, but has more than one parent..."
);
}
else
{
parent
=
(
ModelSubmodelConnection
)
connection
;
}
}
}
}
if
(
parent
!=
null
)
{
CopyCommand
copyParentCommand
=
new
CopyCommand
(
parent
.
getParentModel
().
getModel
()
);
Model
copy
=
copyParentCommand
.
execute
();
for
(
ModelSubmodelConnection
submodel
:
copy
.
getSubmodelConnections
(
))
{
if
(
submodel
.
get
Name
().
equals
(
parent
.
getName
()))
{
return
submodel
.
getSubmodel
().
getModel
();
if
(
parent
!=
null
)
{
CopyCommand
copyParentCommand
=
new
CopyCommand
(
parent
.
getParentModel
().
getModel
());
Model
copy
=
copyParentCommand
.
execute
(
);
for
(
ModelSubmodelConnection
submodel
:
copy
.
getSubmodelConnections
())
{
if
(
submodel
.
getName
().
equals
(
parent
.
getName
()
))
{
return
submodel
.
get
Submodel
().
getModel
();
}
}
throw
new
InvalidStateException
(
"Problem with copying submodel of a model"
);
}
throw
new
InvalidStateException
(
"Problem with copying submodel of a model"
);
}
}
Model
result
=
createNotNestedCopy
(
model
);
Model
result
=
createNotNestedCopy
(
model
);
copies
.
put
(
model
,
result
);
copies
.
put
(
model
,
result
);
for
(
ModelSubmodelConnection
submodelConnection
:
model
.
getSubmodelConnections
())
{
Model
submodel
=
submodelConnection
.
getSubmodel
().
getModel
();
Model
submodelCopy
=
createNotNestedCopy
(
submodel
);
copies
.
put
(
submodel
,
submodelCopy
);
}
for
(
Model
modelCopy
:
copies
.
values
())
{
try
{
assignModelCopies
(
modelCopy
,
copies
);
}
catch
(
InvalidModelException
e
)
{
throw
new
InvalidArgumentException
(
e
);
for
(
ModelSubmodelConnection
submodelConnection
:
model
.
getSubmodelConnections
())
{
Model
submodel
=
submodelConnection
.
getSubmodel
().
getModel
();
Model
submodelCopy
=
createNotNestedCopy
(
submodel
);
copies
.
put
(
submodel
,
submodelCopy
);
}
for
(
Model
modelCopy
:
copies
.
values
())
{
try
{
assignModelCopies
(
modelCopy
,
copies
);
}
catch
(
InvalidModelException
e
)
{
throw
new
InvalidArgumentException
(
e
);
}
}
return
result
;
}
return
result
;
}
/**
...
...
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