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
f20cd35d
Commit
f20cd35d
authored
9 years ago
by
juanf
Browse files
Options
Downloads
Patches
Plain Diff
Fixing Non Parents found using the default transaction API
SVN: 33782
parent
612535e5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plasmid/source/core-plugins/newbrowser/1/dss/reporting-plugins/newbrowserapi/script.py
+25
-5
25 additions, 5 deletions
...ewbrowser/1/dss/reporting-plugins/newbrowserapi/script.py
with
25 additions
and
5 deletions
plasmid/source/core-plugins/newbrowser/1/dss/reporting-plugins/newbrowserapi/script.py
+
25
−
5
View file @
f20cd35d
...
@@ -21,10 +21,30 @@ from java.io import File
...
@@ -21,10 +21,30 @@ from java.io import File
from
java.io
import
FileOutputStream
from
java.io
import
FileOutputStream
from
java.lang
import
System
from
java.lang
import
System
from
net.lingala.zip4j.core
import
ZipFile
from
net.lingala.zip4j.core
import
ZipFile
from
ch.systemsx.cisd.common.exceptions
import
UserFailureException
from
ch.systemsx.cisd.openbis.generic.shared.api.v1.dto
import
SearchCriteria
from
ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria
import
MatchClause
,
SearchOperator
,
MatchClauseAttribute
import
time
import
time
import
subprocess
import
subprocess
import
os.path
import
os.path
def
getSampleByIdentifierForUpdate
(
tr
,
identifier
):
space
=
identifier
.
split
(
"
/
"
)[
1
];
code
=
identifier
.
split
(
"
/
"
)[
2
];
criteria
=
SearchCriteria
();
criteria
.
addMatchClause
(
MatchClause
.
createAttributeMatch
(
MatchClauseAttribute
.
SPACE
,
space
));
criteria
.
addMatchClause
(
MatchClause
.
createAttributeMatch
(
MatchClauseAttribute
.
CODE
,
code
));
criteria
.
setOperator
(
SearchOperator
.
MATCH_ALL_CLAUSES
);
searchService
=
tr
.
getSearchService
();
found
=
list
(
searchService
.
searchForSamples
(
criteria
));
if
len
(
found
)
==
1
:
return
tr
.
makeSampleMutable
(
found
[
0
]);
else
:
raise
UserFailureException
(
identifier
+
"
Not found by search service.
"
);
def
process
(
tr
,
parameters
,
tableBuilder
):
def
process
(
tr
,
parameters
,
tableBuilder
):
method
=
parameters
.
get
(
"
method
"
);
method
=
parameters
.
get
(
"
method
"
);
...
@@ -178,7 +198,7 @@ def insertDataSet(tr, parameters, tableBuilder):
...
@@ -178,7 +198,7 @@ def insertDataSet(tr, parameters, tableBuilder):
metadata
=
parameters
.
get
(
"
metadata
"
);
#java.util.LinkedHashMap<String, String> where the key is the name
metadata
=
parameters
.
get
(
"
metadata
"
);
#java.util.LinkedHashMap<String, String> where the key is the name
#Create Dataset
#Create Dataset
dataSetSample
=
tr
.
getSample
(
sampleIdentifier
);
dataSetSample
=
getSample
ByIdentifierForUpdate
(
tr
,
sampleIdentifier
);
dataSet
=
tr
.
createNewDataSet
(
dataSetType
);
dataSet
=
tr
.
createNewDataSet
(
dataSetType
);
dataSet
.
setSample
(
dataSetSample
);
dataSet
.
setSample
(
dataSetSample
);
...
@@ -248,7 +268,7 @@ def copySample(tr, parameters, tableBuilder):
...
@@ -248,7 +268,7 @@ def copySample(tr, parameters, tableBuilder):
#Copy children and attach to Sample
#Copy children and attach to Sample
if
sampleChildren
!=
None
:
if
sampleChildren
!=
None
:
for
sampleChildIdentifier
in
sampleChildren
:
for
sampleChildIdentifier
in
sampleChildren
:
child
=
tr
.
getSample
(
sampleChildIdentifier
);
#Retrieve Sample child to copy
child
=
getSample
ByIdentifierForUpdate
(
tr
,
sampleChildIdentifier
);
#Retrieve Sample child to copy
copyChildCode
=
None
copyChildCode
=
None
try
:
#For autogenerated children that have the code as sufix
try
:
#For autogenerated children that have the code as sufix
...
@@ -316,7 +336,7 @@ def insertUpdateSample(tr, parameters, tableBuilder):
...
@@ -316,7 +336,7 @@ def insertUpdateSample(tr, parameters, tableBuilder):
sample
=
tr
.
createNewSample
(
sampleIdentifier
,
sampleType
);
#Create Sample given his id
sample
=
tr
.
createNewSample
(
sampleIdentifier
,
sampleType
);
#Create Sample given his id
if
method
==
"
updateSample
"
:
if
method
==
"
updateSample
"
:
sample
=
tr
.
getSampleForUpdate
(
sampleIdentifier
);
#Retrieve Sample
sample
=
getSample
ByIdentifier
ForUpdate
(
tr
,
sampleIdentifier
);
#Retrieve Sample
#Obtain space
#Obtain space
space
=
None
;
space
=
None
;
...
@@ -362,7 +382,7 @@ def insertUpdateSample(tr, parameters, tableBuilder):
...
@@ -362,7 +382,7 @@ def insertUpdateSample(tr, parameters, tableBuilder):
#Add sample children
#Add sample children
if
sampleChildren
!=
None
:
if
sampleChildren
!=
None
:
for
sampleChildIdentifier
in
sampleChildren
:
for
sampleChildIdentifier
in
sampleChildren
:
child
=
tr
.
getSampleForUpdate
(
sampleChildIdentifier
);
#Retrieve Sample
child
=
getSample
ByIdentifier
ForUpdate
(
tr
,
sampleChildIdentifier
);
#Retrieve Sample
if
child
!=
None
:
#The new created ones will not be found
if
child
!=
None
:
#The new created ones will not be found
childParents
=
child
.
getParentSampleIdentifiers
();
childParents
=
child
.
getParentSampleIdentifiers
();
childParents
.
add
(
sampleIdentifier
);
childParents
.
add
(
sampleIdentifier
);
...
@@ -371,7 +391,7 @@ def insertUpdateSample(tr, parameters, tableBuilder):
...
@@ -371,7 +391,7 @@ def insertUpdateSample(tr, parameters, tableBuilder):
#Remove sample children
#Remove sample children
if
sampleChildrenRemoved
!=
None
:
if
sampleChildrenRemoved
!=
None
:
for
sampleChildIdentifier
in
sampleChildrenRemoved
:
for
sampleChildIdentifier
in
sampleChildrenRemoved
:
child
=
tr
.
getSampleForUpdate
(
sampleChildIdentifier
);
#Retrieve Sample
child
=
getSample
ByIdentifier
ForUpdate
(
tr
,
sampleChildIdentifier
);
#Retrieve Sample
if
child
!=
None
:
#The new created ones will not be found
if
child
!=
None
:
#The new created ones will not be found
childParents
=
child
.
getParentSampleIdentifiers
();
childParents
=
child
.
getParentSampleIdentifiers
();
childParents
.
remove
(
sampleIdentifier
);
childParents
.
remove
(
sampleIdentifier
);
...
...
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