Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Genesys Backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
44
Issues
44
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Genesys PGR
Genesys Backend
Commits
a085ff49
Commit
a085ff49
authored
Nov 01, 2018
by
Matija Obreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: prevent updates to published subsets and datasets
- API reset state to draft when adding accessions
parent
1778b014
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
src/main/java/org/genesys/catalog/service/impl/DatasetServiceImpl.java
.../org/genesys/catalog/service/impl/DatasetServiceImpl.java
+2
-2
src/main/java/org/genesys2/server/service/impl/SubsetServiceImpl.java
...a/org/genesys2/server/service/impl/SubsetServiceImpl.java
+4
-2
No files found.
src/main/java/org/genesys/catalog/service/impl/DatasetServiceImpl.java
View file @
a085ff49
...
...
@@ -526,8 +526,8 @@ public class DatasetServiceImpl implements DatasetService {
if
(
loadedDataset
==
null
)
{
throw
new
NotFoundElement
(
"Dataset doesn't exist"
);
}
if
(
loadedDataset
.
getState
()
!=
PublishState
.
DRAFT
)
{
throw
new
InvalidApiUsageException
(
"Dataset
should in draft state
"
);
if
(
loadedDataset
.
isPublished
()
)
{
throw
new
InvalidApiUsageException
(
"Dataset
is published, no edits allowed.
"
);
}
loadedDataset
.
setAccessionRefs
(
lookupMatchingAccessions
(
accessionRefs
));
...
...
src/main/java/org/genesys2/server/service/impl/SubsetServiceImpl.java
View file @
a085ff49
...
...
@@ -313,6 +313,9 @@ public class SubsetServiceImpl implements SubsetService {
public
Subset
addAccessions
(
final
Subset
input
,
final
Set
<
UUID
>
accessionsUuids
)
{
LOG
.
info
(
"Add accessions to Subset. Input accessions {}"
,
input
);
final
Subset
subset
=
loadSubset
(
input
);
if
(
subset
.
isPublished
())
{
throw
new
InvalidApiUsageException
(
"Subset is published, no edits allowed."
);
}
final
List
<
Accession
>
accessions
=
accessionRepository
.
find
(
accessionsUuids
);
...
...
@@ -320,13 +323,12 @@ public class SubsetServiceImpl implements SubsetService {
for
(
Accession
accession
:
accessions
)
{
if
(
currentAccessions
.
contains
(
accession
.
getUuid
()))
{
LOG
.
warn
(
"Current Subset already contains accession, ignoring"
);
LOG
.
debug
(
"Current Subset already contains accession, ignoring"
);
}
else
{
subset
.
getAccessionRefs
().
add
(
new
AccessionRef
(
accession
));
currentAccessions
.
add
(
accession
.
getUuid
());
}
}
subset
.
setState
(
PublishState
.
DRAFT
);
return
deepLoad
(
subsetRepository
.
save
(
subset
));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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