line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
13
|
|
|
13
|
|
13235
|
use utf8; |
|
13
|
|
|
|
|
33
|
|
|
13
|
|
|
|
|
106
|
|
2
|
|
|
|
|
|
|
package Biblio::Zotero::DB::Schema::Result::Collection; |
3
|
|
|
|
|
|
|
$Biblio::Zotero::DB::Schema::Result::Collection::VERSION = '0.003'; |
4
|
|
|
|
|
|
|
# Created by DBIx::Class::Schema::Loader |
5
|
|
|
|
|
|
|
# DO NOT MODIFY THE FIRST PART OF THIS FILE |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
13
|
|
|
13
|
|
718
|
use strict; |
|
13
|
|
|
|
|
34
|
|
|
13
|
|
|
|
|
405
|
|
9
|
13
|
|
|
13
|
|
70
|
use warnings; |
|
13
|
|
|
|
|
29
|
|
|
13
|
|
|
|
|
396
|
|
10
|
|
|
|
|
|
|
|
11
|
13
|
|
|
13
|
|
75
|
use base 'DBIx::Class::Core'; |
|
13
|
|
|
|
|
39
|
|
|
13
|
|
|
|
|
6260
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
__PACKAGE__->table("collections"); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
__PACKAGE__->add_columns( |
18
|
|
|
|
|
|
|
"collectionid", |
19
|
|
|
|
|
|
|
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, |
20
|
|
|
|
|
|
|
"collectionname", |
21
|
|
|
|
|
|
|
{ data_type => "text", is_nullable => 0 }, |
22
|
|
|
|
|
|
|
"parentcollectionid", |
23
|
|
|
|
|
|
|
{ |
24
|
|
|
|
|
|
|
data_type => "int", |
25
|
|
|
|
|
|
|
default_value => \"null", |
26
|
|
|
|
|
|
|
is_foreign_key => 1, |
27
|
|
|
|
|
|
|
is_nullable => 1, |
28
|
|
|
|
|
|
|
}, |
29
|
|
|
|
|
|
|
"dateadded", |
30
|
|
|
|
|
|
|
{ |
31
|
|
|
|
|
|
|
data_type => "timestamp", |
32
|
|
|
|
|
|
|
default_value => \"current_timestamp", |
33
|
|
|
|
|
|
|
is_nullable => 0, |
34
|
|
|
|
|
|
|
}, |
35
|
|
|
|
|
|
|
"datemodified", |
36
|
|
|
|
|
|
|
{ |
37
|
|
|
|
|
|
|
data_type => "timestamp", |
38
|
|
|
|
|
|
|
default_value => \"current_timestamp", |
39
|
|
|
|
|
|
|
is_nullable => 0, |
40
|
|
|
|
|
|
|
}, |
41
|
|
|
|
|
|
|
"clientdatemodified", |
42
|
|
|
|
|
|
|
{ |
43
|
|
|
|
|
|
|
data_type => "timestamp", |
44
|
|
|
|
|
|
|
default_value => \"current_timestamp", |
45
|
|
|
|
|
|
|
is_nullable => 0, |
46
|
|
|
|
|
|
|
}, |
47
|
|
|
|
|
|
|
"libraryid", |
48
|
|
|
|
|
|
|
{ data_type => "int", is_nullable => 1 }, |
49
|
|
|
|
|
|
|
"key", |
50
|
|
|
|
|
|
|
{ data_type => "text", is_nullable => 0 }, |
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__PACKAGE__->set_primary_key("collectionid"); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__PACKAGE__->add_unique_constraint("libraryid_key_unique", ["libraryid", "key"]); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__PACKAGE__->has_many( |
61
|
|
|
|
|
|
|
"collection_items", |
62
|
|
|
|
|
|
|
"Biblio::Zotero::DB::Schema::Result::CollectionItem", |
63
|
|
|
|
|
|
|
{ "foreign.collectionid" => "self.collectionid" }, |
64
|
|
|
|
|
|
|
{ cascade_copy => 0, cascade_delete => 0 }, |
65
|
|
|
|
|
|
|
); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__PACKAGE__->has_many( |
69
|
|
|
|
|
|
|
"collections", |
70
|
|
|
|
|
|
|
"Biblio::Zotero::DB::Schema::Result::Collection", |
71
|
|
|
|
|
|
|
{ "foreign.parentcollectionid" => "self.collectionid" }, |
72
|
|
|
|
|
|
|
{ cascade_copy => 0, cascade_delete => 0 }, |
73
|
|
|
|
|
|
|
); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__PACKAGE__->belongs_to( |
77
|
|
|
|
|
|
|
"parentcollectionid", |
78
|
|
|
|
|
|
|
"Biblio::Zotero::DB::Schema::Result::Collection", |
79
|
|
|
|
|
|
|
{ collectionid => "parentcollectionid" }, |
80
|
|
|
|
|
|
|
{ |
81
|
|
|
|
|
|
|
is_deferrable => 0, |
82
|
|
|
|
|
|
|
join_type => "LEFT", |
83
|
|
|
|
|
|
|
on_delete => "NO ACTION", |
84
|
|
|
|
|
|
|
on_update => "NO ACTION", |
85
|
|
|
|
|
|
|
}, |
86
|
|
|
|
|
|
|
); |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# Created by DBIx::Class::Schema::Loader v0.07035 @ 2013-07-02 23:02:38 |
90
|
|
|
|
|
|
|
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:yKzZ7kQPHQsrMv2FSL8wrQ |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# NOTE: extended DBIC schema below |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub name { |
97
|
3
|
|
|
3
|
1
|
15490
|
my $self = shift; |
98
|
3
|
|
|
|
|
110
|
return $self->collectionname; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub items { |
102
|
3
|
|
|
3
|
1
|
138
|
my $self = shift; |
103
|
3
|
|
|
|
|
34
|
my $schema = $self->result_source->schema; |
104
|
3
|
|
|
|
|
64
|
my $items = $self->collection_items |
105
|
|
|
|
|
|
|
->get_column('itemid')->as_query; |
106
|
3
|
|
|
|
|
10223
|
$schema->resultset('StoredItem')->search( { itemid => { -in => $items } }); |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
__PACKAGE__->load_components("Tree::AdjacencyList"); |
111
|
|
|
|
|
|
|
__PACKAGE__->parent_column('parentcollectionid'); |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
1; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
__END__ |