Skip to content
Snippets Groups Projects
Commit 98b26de0 authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- minor to make script runnable

parent fe354882
Branches
Tags
No related merge requests found
...@@ -3,8 +3,8 @@ use SLUB::LZA::TA -command; ...@@ -3,8 +3,8 @@ use SLUB::LZA::TA -command;
use strict; use strict;
use warnings; use warnings;
use feature qw(say); use feature qw(say);
use SLUB::LZA::TA::common_sru; use SLUB::LZA::TA::Rosetta::common_sru;
use SLUB::LZA::TA::SRU; use SLUB::LZA::TA::Rosetta::SRU;
# VERSION # VERSION
...@@ -73,8 +73,8 @@ sub execute { ...@@ -73,8 +73,8 @@ sub execute {
my ($self, $opt, $args) = @_; my ($self, $opt, $args) = @_;
my $maxrecords="0"; my $maxrecords="0";
my $startrecord=1; my $startrecord=1;
my $query = SLUB::LZA::TA::common_sru::prepare_query($opt); my $query = SLUB::LZA::TA::Rosetta::common_sru::prepare_query($opt);
my $response = SLUB::LZA::TA::SRU::sru_search('ie', $query, $startrecord, $maxrecords, $opt->{verbose}, $opt->{debug}); my $response = SLUB::LZA::TA::Rosetta::SRU::sru_search('ie', $query, $startrecord, $maxrecords, $opt->{verbose}, $opt->{debug});
$response=~s|.*?<numberOfRecords>(\d+)</numberOfRecords.*|$1|s; $response=~s|.*?<numberOfRecords>(\d+)</numberOfRecords.*|$1|s;
say $response; say $response;
} }
......
...@@ -3,8 +3,9 @@ use SLUB::LZA::TA -command; ...@@ -3,8 +3,9 @@ use SLUB::LZA::TA -command;
use strict; use strict;
use warnings; use warnings;
use feature qw(say); use feature qw(say);
use SLUB::LZA::TA::common_sru; #use SLUB::LZA::TA::common_sru;
use SLUB::LZA::TA::SRU; #use SLUB::LZA::TA::SRU;
use SLUB::LZA::TA::Archivematica::Elasticsearch;
...@@ -12,28 +13,28 @@ use SLUB::LZA::TA::SRU; ...@@ -12,28 +13,28 @@ use SLUB::LZA::TA::SRU;
# ABSTRACT: search IEs module for ta-tool # ABSTRACT: search IEs module for ta-tool
sub abstract {"searches Rosetta based Archival Information System";} sub abstract {"searches Archival Information System (AIS)";}
my $description=<<"DESCR"; my $description=<<"DESCR";
Searches a Rosetta-based AIS for descriptive oder source metadata on behalf of the Technical Analyst. Searches an AIS for descriptive oder source metadata on behalf of the Technical Analyst.
Returns SRU-response including dc-records. Only the first 10 matches will be presented by default. Returns SRU-response including dc-records. Only the first 10 matches will be presented by default.
Examples: Examples:
* Is this dc identifier in Archiv? * Is this dc identifier in archive?
$0 count -d SLUB:LZA:Kitodo:kitodo:422766 $0 count -d SLUB:LZA:Kitodo:kitodo:422766
* Which IE PID has this dc identifier? * Which AIP has this dc identifier?
$0 search -d SLUB:LZA:Kitodo:kitodo:422766 $0 search -d SLUB:LZA:Kitodo:kitodo:422766
* Which IE PID are public domain? * Which AIPs are public domain?
$0 search -s publicdomain $0 search -s publicdomain
* Which IE PID are copyrighted? * Which AIPs are copyrighted?
$0 search -s copyrighted $0 search -s copyrighted
* Which IEs were modified in 2021-05-31? * Which AIPs were modified in 2021-05-31?
$0 search -m 2021-05-31 $0 search -m 2021-05-31
Which IEs have at least one invalid file? Which AIPs have at least one invalid file?
$0 search --with-invalid-files $0 search --with-invalid-files
* Which IEs with mkv-files are in archive? * Which AIPs with mkv-files are in archive?
$0 search --with-format=fmt/569 $0 search --with-format=fmt/569
* Which IEs have at least one file without virus check? * Which AIPs have at least one file without virus check?
$0 search --with-missed-viruscheck $0 search --with-missed-viruscheck
DESCR DESCR
...@@ -48,9 +49,10 @@ sub opt_spec { ...@@ -48,9 +49,10 @@ sub opt_spec {
["creationdate|c=s" => "search based on creationdate string"], ["creationdate|c=s" => "search based on creationdate string"],
["modificationdate|m=s" => "search based on modificationdate string"] ["modificationdate|m=s" => "search based on modificationdate string"]
] } ], ] } ],
[ "lzaid|l=s", "search a specific AIP by given LZA id"],
[ "descriptive|d=s", "search descriptive metadata (dc identifier)"], [ "descriptive|d=s", "search descriptive metadata (dc identifier)"],
[ "source|s=s", "search source metadata"], [ "source|s=s", "search source metadata"],
["ie|i=s" => "search a specific IE"], ["aip|a=s" => "search a specific AIP by given AIP id"],
["maxrecords=i", "set maxrecords, default is 10"], ["maxrecords=i", "set maxrecords, default is 10"],
["startrecord=i", "set startrecord, default is 1"], ["startrecord=i", "set startrecord, default is 1"],
["format" => hidden => {one_of => [ ["format" => hidden => {one_of => [
...@@ -86,9 +88,22 @@ sub execute { ...@@ -86,9 +88,22 @@ sub execute {
if (exists $opt->{startrecord}) { if (exists $opt->{startrecord}) {
$startrecord = $opt->{startrecord}; $startrecord = $opt->{startrecord};
} }
my $query = SLUB::LZA::TA::common_sru::prepare_query($opt); my $query = SLUB::LZA::TA::Archivematica::Elasticsearch::prepare_query($opt);
my $response = SLUB::LZA::TA::SRU::sru_search('ie', $query, $startrecord, $maxrecords, $opt->{verbose}, $opt->{debug}, $opt->{user}, $opt->{password}); use Data::Printer;
p(%SLUB::LZA::TA::config);
my $response = SLUB::LZA::TA::Archivematica::Elasticsearch::query_elasticsearch(
$SLUB::LZA::TA::config{elasticsearchprotocol},
$SLUB::LZA::TA::config{elasticsearchhost},
$SLUB::LZA::TA::config{elasticsearchport},
'aips', # indexname
$query, # query_hash
);
#my $query = SLUB::LZA::TA::Rosetta::common_sru::prepare_query($opt);
#my $response = SLUB::LZA::TA::Rosetta::SRU::sru_search('ie', $query, $startrecord, $maxrecords, $opt->{verbose}, $opt->{debug}, $opt->{user}, $opt->{password});
say $response; say $response;
use Data::Printer;
p($response);
} }
1; 1;
...@@ -2,7 +2,7 @@ package SLUB::LZA::TA::Log; ...@@ -2,7 +2,7 @@ package SLUB::LZA::TA::Log;
use strict; use strict;
use warnings; use warnings;
use feature qw(say); use feature qw(say);
use SLUB::LZA::TA::SOAP; #use SLUB::LZA::TA::SOAP;
use Path::Tiny; use Path::Tiny;
use namespace::autoclean; use namespace::autoclean;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment