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
103e0713
Commit
103e0713
authored
14 years ago
by
buczekp
Browse files
Options
Downloads
Patches
Plain Diff
[LMS-1676] fix sample batch update and improved sample update
SVN: 17435
parent
5a3eaaf1
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleBusinessObject.java
+23
-31
23 additions, 31 deletions
...eric/server/business/bo/AbstractSampleBusinessObject.java
with
23 additions
and
31 deletions
openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleBusinessObject.java
+
23
−
31
View file @
103e0713
...
...
@@ -201,19 +201,17 @@ abstract class AbstractSampleBusinessObject extends AbstractSampleIdentifierBusi
protected
void
setGeneratedFrom
(
final
SampleIdentifier
sampleIdentifier
,
final
SamplePE
samplePE
,
String
parentIdentifier
)
{
removeParents
(
s
amplePE
);
final
SamplePE
parent
PE
=
tryGetValidSample
(
parentIdentifier
,
sampleIdentifier
);
if
(
parent
PE
!=
null
)
final
Set
<
SamplePE
>
newParents
=
new
HashSet
<
S
amplePE
>(
);
final
SamplePE
parent
OrNull
=
tryGetValidSample
(
parentIdentifier
,
sampleIdentifier
);
if
(
parent
OrNull
!=
null
)
{
RelationshipTypePE
relationship
=
tryFindParentChildRelationshipType
();
samplePE
.
addParentRelationship
(
new
SampleRelationshipPE
(
parentPE
,
samplePE
,
relationship
));
newParents
.
add
(
parentOrNull
);
}
replaceParents
(
samplePE
,
newParents
);
}
protected
void
setParents
(
final
SamplePE
childPE
,
final
String
[]
parents
)
{
removeParents
(
childPE
);
final
List
<
SampleIdentifier
>
parentIdentifiers
=
IdentifierHelper
.
extractSampleIdentifiers
(
parents
);
final
SampleIdentifier
childIdentifier
=
childPE
.
getSampleIdentifier
();
...
...
@@ -225,49 +223,43 @@ abstract class AbstractSampleBusinessObject extends AbstractSampleIdentifierBusi
IdentifierHelper
.
fillGroupIfNotSpecified
(
si
,
spaceCode
);
}
}
final
Lis
t
<
SamplePE
>
parentPEs
=
new
ArrayLis
t
<
SamplePE
>();
final
Se
t
<
SamplePE
>
parentPEs
=
new
HashSe
t
<
SamplePE
>();
for
(
SampleIdentifier
si
:
parentIdentifiers
)
{
SamplePE
parent
=
getSampleByIdentifier
(
si
);
parentPEs
.
add
(
parent
);
}
add
Parents
(
childPE
,
parentPEs
);
replace
Parents
(
childPE
,
parentPEs
);
}
private
void
add
Parents
(
SamplePE
child
PE
,
Lis
t
<
SamplePE
>
p
arent
PE
s
)
private
void
replace
Parents
(
SamplePE
child
,
Se
t
<
SamplePE
>
newP
arents
)
{
RelationshipTypePE
relationshipType
=
tryFindParentChildRelationshipType
();
for
(
SamplePE
parentPE
:
parentPEs
)
{
addParentRelationship
(
childPE
,
parentPE
,
relationshipType
);
}
}
private
void
removeParents
(
SamplePE
child
)
{
List
<
SampleRelationshipPE
>
parents
=
new
ArrayList
<
SampleRelationshipPE
>();
List
<
SampleRelationshipPE
>
oldParents
=
new
ArrayList
<
SampleRelationshipPE
>();
for
(
SampleRelationshipPE
r
:
child
.
getParentRelationships
())
{
if
(
r
.
getRelationship
().
getCode
().
equals
(
BasicConstant
.
PARENT_CHILD_INTERNAL_RELATIONSHIP
))
{
parents
.
add
(
r
);
oldParents
.
add
(
r
);
}
}
for
(
SampleRelationshipPE
r
:
oldParents
)
{
if
(
newParents
.
contains
(
r
.
getParentSample
()))
{
newParents
.
remove
(
r
.
getParentSample
());
}
else
{
child
.
removeParentRelationship
(
r
);
}
}
for
(
SampleRelationshipPE
r
:
parents
)
RelationshipTypePE
relationship
=
tryFindParentChildRelationshipType
();
for
(
SamplePE
newParent
:
newParents
)
{
child
.
removeParentR
elationship
(
r
);
child
.
addParentRelationship
(
new
SampleRelationshipPE
(
newParent
,
child
,
r
elationship
)
);
}
}
private
void
addParentRelationship
(
SamplePE
child
,
SamplePE
parent
,
RelationshipTypePE
relationshipType
)
{
final
SampleRelationshipPE
relationship
=
new
SampleRelationshipPE
(
parent
,
child
,
relationshipType
);
child
.
addParentRelationship
(
relationship
);
}
protected
RelationshipTypePE
tryFindParentChildRelationshipType
()
{
return
tryFindRelationshipTypeByCode
(
BasicConstant
.
PARENT_CHILD_INTERNAL_RELATIONSHIP
);
...
...
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