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
39053c44
Commit
39053c44
authored
10 years ago
by
felmer
Browse files
Options
Downloads
Patches
Plain Diff
SSDM-1621: refactoring and bug in checkExperimentBusinessRules() fixed
SVN: 33709
parent
2079bff6
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
openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleBusinessObject.java
+8
-32
8 additions, 32 deletions
...eric/server/business/bo/AbstractSampleBusinessObject.java
with
8 additions
and
32 deletions
openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleBusinessObject.java
+
8
−
32
View file @
39053c44
...
@@ -61,6 +61,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifierFa
...
@@ -61,6 +61,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifierFa
import
ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleOwnerIdentifier
;
import
ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleOwnerIdentifier
;
import
ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind
;
import
ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind
;
import
ch.systemsx.cisd.openbis.generic.shared.managed_property.IManagedPropertyEvaluatorFactory
;
import
ch.systemsx.cisd.openbis.generic.shared.managed_property.IManagedPropertyEvaluatorFactory
;
import
ch.systemsx.cisd.openbis.generic.shared.util.EntityHelper
;
import
ch.systemsx.cisd.openbis.generic.shared.util.RelationshipUtils
;
import
ch.systemsx.cisd.openbis.generic.shared.util.RelationshipUtils
;
/**
/**
...
@@ -461,7 +462,9 @@ abstract class AbstractSampleBusinessObject extends AbstractSampleIdentifierBusi
...
@@ -461,7 +462,9 @@ abstract class AbstractSampleBusinessObject extends AbstractSampleIdentifierBusi
ExperimentPE
experiment
=
sample
.
getExperiment
();
ExperimentPE
experiment
=
sample
.
getExperiment
();
if
(
experiment
==
null
)
if
(
experiment
==
null
)
{
{
checkSampleWithoutDatasets
(
sample
);
String
sampleIdentifier
=
sample
.
getIdentifier
();
ArrayList
<
DataPE
>
dataSets
=
new
ArrayList
<
DataPE
>(
sample
.
getDatasets
());
checkDataSetsDoNotNeedAnExperiment
(
sampleIdentifier
,
dataSets
);
}
}
if
(
hasDatasets
(
sample
)
&&
sample
.
getSpace
()
==
null
)
if
(
hasDatasets
(
sample
)
&&
sample
.
getSpace
()
==
null
)
{
{
...
@@ -535,33 +538,13 @@ abstract class AbstractSampleBusinessObject extends AbstractSampleIdentifierBusi
...
@@ -535,33 +538,13 @@ abstract class AbstractSampleBusinessObject extends AbstractSampleIdentifierBusi
{
{
return
;
return
;
}
}
ExperimentPE
newExperiment
=
expIdentifierOrNull
==
null
?
null
:
changeExperiment
(
sample
,
expIdentifierOrNull
,
experimentCacheOrNull
);
tryFindExperiment
(
experimentCacheOrNull
,
expIdentifierOrNull
.
toString
(),
null
);
}
if
(
EntityHelper
.
equalEntities
(
newExperiment
,
sample
.
getExperiment
()))
private
void
removeFromExperiment
(
SamplePE
sample
)
{
if
(
hasDatasets
(
sample
))
{
throw
UserFailureException
.
fromTemplate
(
"Cannot detach the sample '%s' from the experiment "
+
"because there are already datasets attached to the sample."
,
sample
.
getIdentifier
());
}
relationshipService
.
unassignSampleFromExperiment
(
session
,
sample
);
}
private
void
changeExperiment
(
SamplePE
sample
,
ExperimentIdentifier
identifierOrNull
,
Map
<
String
,
ExperimentPE
>
experimentCacheOrNull
)
{
ExperimentPE
newExperiment
=
identifierOrNull
==
null
?
null
:
tryFindExperiment
(
experimentCacheOrNull
,
identifierOrNull
.
toString
(),
null
);
if
(
isExperimentUnchanged
(
newExperiment
,
sample
.
getExperiment
()))
{
{
return
;
return
;
}
}
ensureExperimentIsValid
(
i
dentifierOrNull
,
newExperiment
,
sample
);
ensureExperimentIsValid
(
expI
dentifierOrNull
,
newExperiment
,
sample
);
ensureSampleAttachableToExperiment
(
sample
,
newExperiment
);
ensureSampleAttachableToExperiment
(
sample
,
newExperiment
);
assignSampleAndRelatedDataSetsToExperiment
(
sample
,
newExperiment
);
assignSampleAndRelatedDataSetsToExperiment
(
sample
,
newExperiment
);
...
@@ -589,13 +572,6 @@ abstract class AbstractSampleBusinessObject extends AbstractSampleIdentifierBusi
...
@@ -589,13 +572,6 @@ abstract class AbstractSampleBusinessObject extends AbstractSampleIdentifierBusi
}
}
}
}
private
boolean
isExperimentUnchanged
(
ExperimentPE
newExperimentOrNull
,
ExperimentPE
experimentOrNull
)
{
return
experimentOrNull
==
null
?
newExperimentOrNull
==
null
:
experimentOrNull
.
equals
(
newExperimentOrNull
);
}
/**
/**
* Throws {@link UserFailureException} if adding specified parents to this data set will create a cycle in data set relationships.
* Throws {@link UserFailureException} if adding specified parents to this data set will create a cycle in data set relationships.
*/
*/
...
...
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