line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Catmandu::FedoraCommons::Model::datastreamProfile - Perl model for the Fedora 'addDatastream', 'getDatastream', 'modifyDatastream','setDatastreamState' and 'setDatastreamVersionable' REST call |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Catmandu::FedoraCommons; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $fedora = Catmandu::FedoraCommons->new('http://localhost:8080/fedora','fedoraAdmin','fedoraAdmin'); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $obj = $fedora->getDatastream(pid => 'demo:29', dsID => 'DC')->parse_content; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
{ |
14
|
|
|
|
|
|
|
'pid' => 'demo:29' , |
15
|
|
|
|
|
|
|
'dsID' => 'DC', |
16
|
|
|
|
|
|
|
'dateTime' => '2008-07-02T05:09:43.234Z' , |
17
|
|
|
|
|
|
|
'profile' => { |
18
|
|
|
|
|
|
|
'dsLabel' => 'Dublin Core Record for this object' , |
19
|
|
|
|
|
|
|
'dsVersionID' => 'DC1.0' , |
20
|
|
|
|
|
|
|
'dsCreateDate' => '2008-07-02T05:09:43.234Z' , |
21
|
|
|
|
|
|
|
'dsState' => 'A' , |
22
|
|
|
|
|
|
|
'dsMIME' => 'text/xml' , |
23
|
|
|
|
|
|
|
'dsFormatURI' => 'http://www.openarchives.org/OAI/2.0/oai_dc/' , |
24
|
|
|
|
|
|
|
'dsControlGroup' => 'X' , |
25
|
|
|
|
|
|
|
'dsSize' => 626, |
26
|
|
|
|
|
|
|
'dsVersionable' => 'true' , |
27
|
|
|
|
|
|
|
'dsInfoType' => '' , |
28
|
|
|
|
|
|
|
'dsLocation' => 'demo:29+DC+DC1.0' , |
29
|
|
|
|
|
|
|
'dsLocationType' => '' , |
30
|
|
|
|
|
|
|
'dsChecksumType' => 'DISABLED' , |
31
|
|
|
|
|
|
|
'dsChecksum' => 'none' , |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 SEE ALSO |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
L<Catmandu::FedoraCommons> |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
package Catmandu::FedoraCommons::Model::datastreamProfile; |
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
1
|
|
48591
|
use XML::LibXML; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub parse { |
45
|
|
|
|
|
|
|
my ($class,$xml) = @_; |
46
|
|
|
|
|
|
|
my $dom = XML::LibXML->load_xml(string => $xml); |
47
|
|
|
|
|
|
|
$dom->getDocumentElement()->setNamespace('http://www.fedora.info/definitions/1/0/management/','m'); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my @nodes = $dom->findnodes("/m:datastreamProfile/*"); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my $result; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
for my $node (@nodes) { |
54
|
|
|
|
|
|
|
my $name = $node->nodeName; |
55
|
|
|
|
|
|
|
my $value = $node->textContent; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
$result->{profile}->{$name} = $value; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
my $pid = $dom->firstChild()->getAttribute('pid'); |
61
|
|
|
|
|
|
|
$result->{pid} = $pid; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my $dsID = $dom->firstChild()->getAttribute('dsID'); |
64
|
|
|
|
|
|
|
$result->{dsID} = $dsID; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my $dateTime = $dom->firstChild()->getAttribute('dateTime'); |
67
|
|
|
|
|
|
|
$result->{dateTime} = $dateTime; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
return $result; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |