Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
FDO Manager Service
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
fdo
FDO Manager Service
Commits
9912b0a9
Commit
9912b0a9
authored
7 months ago
by
I. Nüske
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Add delete method and rename base deletion
parent
427748b4
No related branches found
No related tags found
1 merge request
!7
Draft: Add tombstone delete
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/src/main/resources/api.yaml
+1
-1
1 addition, 1 deletion
api/src/main/resources/api.yaml
application/src/main/java/com/indiscale/fdo/manager/service/fdo/FDOApiImpl.java
+29
-2
29 additions, 2 deletions
...ava/com/indiscale/fdo/manager/service/fdo/FDOApiImpl.java
with
30 additions
and
3 deletions
api/src/main/resources/api.yaml
+
1
−
1
View file @
9912b0a9
...
...
@@ -248,7 +248,7 @@ paths:
tags
:
-
FDOs
description
:
"
Delete
an
FDO."
operationId
:
baseD
elete
operationId
:
d
elete
parameters
:
-
$ref
:
'
#/components/parameters/Prefix'
-
$ref
:
'
#/components/parameters/Suffix'
...
...
This diff is collapsed.
Click to expand it.
application/src/main/java/com/indiscale/fdo/manager/service/fdo/FDOApiImpl.java
+
29
−
2
View file @
9912b0a9
...
...
@@ -108,12 +108,39 @@ public class FDOApiImpl extends BaseController implements FdoApi {
}
@Override
public
ResponseEntity
<
Void
>
baseD
elete
(
public
ResponseEntity
<
Void
>
d
elete
(
String
prefix
,
String
suffix
,
Boolean
purge
,
Boolean
deleteMD
)
{
if
(
purge
)
{
return
purgeFDO
(
prefix
,
suffix
);
}
throw
new
ResponseStatusException
(
HttpStatus
.
NOT_IMPLEMENTED
);
return
deleteFDO
(
prefix
,
suffix
,
deleteMD
);
}
public
ResponseEntity
<
Void
>
deleteFDO
(
String
prefix
,
String
suffix
,
boolean
deleteMD
)
{
try
(
Manager
manager
=
getManager
())
{
String
pid
=
prefix
+
"/"
+
suffix
;
DigitalObject
fdo
=
manager
.
resolvePID
(
pid
);
String
repoId
=
manager
.
deleteFDO
(
pid
,
deleteMD
);
if
(
repoId
!=
null
&&
!
repoId
.
isEmpty
())
{
RepositoryConnection
repository
=
manager
.
getRepositoryRegistry
().
createRepositoryConnection
(
repoId
);
getLogger
().
deleteFDO
(
fdo
,
repository
);
return
ResponseEntity
.
noContent
().
build
();
}
else
{
throw
new
ResponseStatusException
(
HttpStatus
.
INTERNAL_SERVER_ERROR
,
"Could not delete PID "
+
pid
+
" due to inability to connect to repository."
);
}
}
catch
(
PidUnresolvableException
e
)
{
throw
new
ResponseStatusException
(
HttpStatus
.
NOT_FOUND
,
"Not found. Could not resolve PID "
+
e
.
getPid
());
}
catch
(
UnknownRepositoryException
e
)
{
e
.
printStackTrace
();
throw
new
ResponseStatusException
(
HttpStatus
.
NOT_FOUND
,
"Not found. Repository unknown."
);
}
catch
(
UnsuccessfulOperationException
e
)
{
e
.
printStackTrace
();
throw
new
ResponseStatusException
(
HttpStatus
.
INTERNAL_SERVER_ERROR
,
"Deletion unsuccessful: "
+
e
.
getMessage
());
}
}
public
ResponseEntity
<
Void
>
purgeFDO
(
String
prefix
,
String
suffix
)
{
...
...
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