Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vospace-rest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VOSpace INAF
vospace-rest
Commits
93dd552b
Commit
93dd552b
authored
2 years ago
by
Nicola Fulvio Calabria
Browse files
Options
Downloads
Patches
Plain Diff
Added busy and immutable management to delete
parent
f919f87c
No related branches found
No related tags found
1 merge request
!1
Immutable
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/it/inaf/oats/vospace/DeleteNodeService.java
+34
-21
34 additions, 21 deletions
src/main/java/it/inaf/oats/vospace/DeleteNodeService.java
with
34 additions
and
21 deletions
src/main/java/it/inaf/oats/vospace/DeleteNodeService.java
+
34
−
21
View file @
93dd552b
...
...
@@ -20,13 +20,14 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.springframework.transaction.annotation.Isolation
;
import
it.inaf.ia2.aa.data.User
;
import
it.inaf.oats.vospace.exception.InternalFaultException
;
import
it.inaf.oats.vospace.exception.NodeBusyException
;
import
org.springframework.transaction.annotation.Transactional
;
/**
*
* @author Nicola Fulvio Calabria <nicola.calabria at inaf.it>
*/
@Service
@EnableTransactionManagement
public
class
DeleteNodeService
{
...
...
@@ -48,6 +49,16 @@ public class DeleteNodeService {
throw
PermissionDeniedException
.
forPath
(
path
);
}
Long
nodeId
=
nodeDao
.
getNodeId
(
path
).
get
();
if
(
nodeDao
.
isBranchBusy
(
nodeId
))
{
throw
new
NodeBusyException
(
path
);
}
if
(
nodeDao
.
isBranchImmutable
(
nodeId
))
{
throw
new
InternalFaultException
(
"Target branch contains immutable nodes"
);
}
nodeDao
.
deleteNode
(
path
);
}
...
...
@@ -79,7 +90,9 @@ public class DeleteNodeService {
Node
mynode
=
nodeDao
.
listNode
(
tmpPath
)
.
orElseThrow
(()
->
new
NodeNotFoundException
(
tmpPath
));
if
(
mynode
.
getType
().
equals
(
"vos:LinkNode"
)
&&
i
<
pathComponents
.
size
()
-
1
)
// a LinkNode leaf can be deleted
{
throw
new
LinkFoundException
(
tmpPath
);
}
}
...
...
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