Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rosettaExitStrategy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
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
Digital Preservation
rosettaExitStrategy
Commits
139567ce
Commit
139567ce
authored
8 months ago
by
Andreas Romeyke
Browse files
Options
Downloads
Patches
Plain Diff
- refactoring, extracted _handle_deleted_or_purged_aips()
parent
ff4dea9d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
perl/exit_strategy.pl
+29
-22
29 additions, 22 deletions
perl/exit_strategy.pl
with
29 additions
and
22 deletions
perl/exit_strategy.pl
+
29
−
22
View file @
139567ce
...
...
@@ -423,6 +423,7 @@ sub check_if_db_conform ($string, $filename) {
no_network
=>
1
,
recover
=>
$recovery_flag
,
);
return
$parser
;
}
}
...
...
@@ -613,6 +614,31 @@ sub check_if_file_is_readable($filename) {
return 1;
}
sub _handle_deleted_or_purged_aips($xp, $ret) {
my $amdsec_ie = $xp->findnodes($compiled_xpath_amdSec_ie)->[0];
my $is_deleted;
foreach my $state (qw(purged deleted)) {
my $dnx_ctx;
if ($state eq
'
purged
'
) {
$dnx_ctx = $xp->findnodes($xpath_if_purged_expr, $amdsec_ie)->[0];
}
else {
$dnx_ctx = $xp->findnodes($xpath_if_deleted_expr, $amdsec_ie)->[0];
}
$is_deleted = has_purged_entries($xp, $dnx_ctx);
if ($is_deleted) {
my $purged_state = get_purged_state($xp, $dnx_ctx);
$ret->{$state}->{state} = $purged_state;
$ret->{$state}->{reason} = get_purged_reasons($xp, $dnx_ctx)->[0];
$ret->{$state}->{note} = get_purged_notes($xp, $dnx_ctx)->[0];
$ret->{$state}->{date} = get_purged_dates($xp, $dnx_ctx)->[0];
$ret->{$state}->{authorized_by} = get_purged_authorized_by($xp, $dnx_ctx)->[0];
if ($state eq "purged") {last;}
}
}
return $is_deleted;
}
sub parse_iexml($filename, $recovery_flag) {
my $retry = 3;
while ($retry > 0) {
...
...
@@ -635,7 +661,7 @@ sub parse_iexml($filename, $recovery_flag) {
$xp->setContextNode($dom);
my $dmdsec = $xp->findnodes($compiled_xpath_dmdSec)->[0];
#my $amdsec_rep = $xp->findnodes($compiled_xpath_amdSec_rep)->[0];
my $amdsec_ie = $xp->findnodes($compiled_xpath_amdSec_ie)->[0];
my $filesec = $xp->findnodes($compiled_xpath_fileSec)->[0];
my $ret;
$ret->{"filename"} = $filename;
...
...
@@ -646,27 +672,7 @@ sub parse_iexml($filename, $recovery_flag) {
# get dc-records
$ret->{"dcrecords"} = get_dcrecords_ref($xp, $dmdsec);
############################################
my $is_deleted;
foreach my $state (qw(purged deleted)) {
my $dnx_ctx;
if ($state eq
'
purged
'
) {
$dnx_ctx = $xp->findnodes($xpath_if_purged_expr, $amdsec_ie)->[0];
}
else {
$dnx_ctx = $xp->findnodes($xpath_if_deleted_expr, $amdsec_ie)->[0];
}
$is_deleted = has_purged_entries($xp, $dnx_ctx);
if ($is_deleted) {
my $purged_state = get_purged_state($xp, $dnx_ctx);
$ret->{$state}->{state} = $purged_state;
$ret->{$state}->{reason} = get_purged_reasons($xp, $dnx_ctx)->[0];
$ret->{$state}->{note} = get_purged_notes($xp, $dnx_ctx)->[0];
$ret->{$state}->{date} = get_purged_dates($xp, $dnx_ctx)->[0];
$ret->{$state}->{authorized_by} = get_purged_authorized_by($xp, $dnx_ctx)->[0];
if ($state eq "purged") {last;}
}
}
my $is_deleted = _handle_deleted_or_purged_aips($xp, $ret);
############################################
# get right representation ID (has a dnx-section with <key id=label>LOCAL</key>)
my $repid = get_repid($xp);
...
...
@@ -706,6 +712,7 @@ sub parse_iexml($filename, $recovery_flag) {
return $ret;
}
return;
}
...
...
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