Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
b8ea5f6a
Commit
b8ea5f6a
authored
15 years ago
by
tpylak
Browse files
Options
Downloads
Patches
Plain Diff
SE-149 yeastx: problem with concurent threads uploading *ML files
SVN: 12966
parent
63d9ffbc
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/db/DBUtils.java
+49
-22
49 additions, 22 deletions
...eastx/source/java/ch/systemsx/cisd/yeastx/db/DBUtils.java
with
49 additions
and
22 deletions
rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/db/DBUtils.java
+
49
−
22
View file @
b8ea5f6a
...
...
@@ -92,35 +92,62 @@ public class DBUtils
*/
public
static
void
createDataSet
(
IGenericDAO
dao
,
DMDataSetDTO
dataSet
)
{
DMExperimentDTO
experiment
=
dao
.
getExperimentByPermId
(
dataSet
.
getExperiment
().
getPermId
());
if
(
experiment
==
null
)
{
experiment
=
dataSet
.
getExperiment
();
final
long
experimentId
=
dao
.
addExperiment
(
experiment
);
experiment
.
setId
(
experimentId
);
dataSet
.
setExperimentId
(
experimentId
);
// make sure all the ids are set correctly.
}
else
{
dataSet
.
setExperimentId
(
experiment
.
getId
());
// make sure all the ids are set correctly.
}
DMExperimentDTO
experiment
=
getOrCreateExperiment
(
dao
,
dataSet
);
dataSet
.
setExperimentId
(
experiment
.
getId
());
// make sure all the ids are set correctly.
if
(
dataSet
.
getSample
()
!=
null
)
{
DMSampleDTO
sample
=
dao
.
getSampleByPermId
(
dataSet
.
getSample
().
getPermId
());
if
(
sample
==
null
)
String
permId
=
dataSet
.
getSample
().
getPermId
();
DMSampleDTO
sample
;
// it may have happened that the sample has been created by another thread after
// we checked that it does not exist
synchronized
(
IGenericDAO
.
class
)
{
sample
=
dataSet
.
getSample
();
sample
.
setExperiment
(
experiment
);
final
long
sampleId
=
dao
.
addSample
(
sample
);
sample
.
setId
(
sampleId
);
dataSet
.
setSample
(
sample
);
// make sure all the ids are set correctly.
}
else
{
dataSet
.
setSample
(
sample
);
sample
.
setExperiment
(
experiment
);
sample
=
dao
.
getSampleByPermId
(
permId
);
if
(
sample
==
null
)
{
sample
=
dataSet
.
getSample
();
sample
.
setExperiment
(
experiment
);
sample
=
createSample
(
dao
,
sample
,
permId
);
}
}
sample
.
setExperiment
(
experiment
);
dataSet
.
setSample
(
sample
);
// make sure all the ids are set correctly.
}
long
dataSetId
=
dao
.
addDataSet
(
dataSet
);
dataSet
.
setId
(
dataSetId
);
}
private
static
DMSampleDTO
createSample
(
IGenericDAO
dao
,
DMSampleDTO
sample
,
String
samplePermId
)
{
final
long
sampleId
=
dao
.
addSample
(
sample
);
sample
.
setId
(
sampleId
);
return
sample
;
}
private
static
DMExperimentDTO
getOrCreateExperiment
(
IGenericDAO
dao
,
DMDataSetDTO
dataSet
)
{
String
permId
=
dataSet
.
getExperiment
().
getPermId
();
// it may have happened that the experiment has been created by another thread after
// we checked that it does not exist
synchronized
(
IGenericDAO
.
class
)
{
DMExperimentDTO
experiment
=
dao
.
getExperimentByPermId
(
permId
);
if
(
experiment
==
null
)
{
experiment
=
createExperiment
(
dao
,
dataSet
,
permId
);
}
return
experiment
;
}
}
private
static
DMExperimentDTO
createExperiment
(
IGenericDAO
dao
,
DMDataSetDTO
dataSet
,
String
permId
)
{
DMExperimentDTO
experiment
;
experiment
=
dataSet
.
getExperiment
();
long
experimentId
=
dao
.
addExperiment
(
experiment
);
experiment
.
setId
(
experimentId
);
return
experiment
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment