/
Story.pm
2524 lines (1743 loc) · 64 KB
/
Story.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package Bric::Biz::Asset::Business::Story;
###############################################################################
=head1 Name
Bric::Biz::Asset::Business::Story - The interface to the Story Object
=cut
require Bric; our $VERSION = Bric->VERSION;
=head1 Synopsis
# creation of new objects
$story = Bric::Biz::Asset::Business::Story->new( $init )
$story = Bric::Biz::Asset::Business::Story->lookup( $param )
($stories || @stories) = Bric::Biz::Asset::Business::Story->list($param)
# list of object ids
($ids || @ids) = Bric::Biz::Asset::Business::Story->list_ids($param)
# Type of workflow.
my $wf_type = Bric::Biz::Asset::Business::Story->workflow_type;
# General information
$asset = $asset->get_id()
$asset = $asset->set_description($description)
$description = $asset->get_description()
# User information
$usr_id = $asset->get_user__id()
$asset = $asset->set_user__id($usr_id)
# Version information
$vers_grp_id = $asset->get_version_grp__id();
$vers_id = $asset->get_asset_version_id();
# Desk information
$desk = $asset->get_current_desk;
$asset = $asset->set_current_desk($desk);
# Workflow methods.
$id = $asset->get_workflow_id;
$obj = $asset->get_workflow_object;
$id = $asset->set_workflow_id;
# Access note information
$asset = $asset->set_note($note);
my $note = $asset->get_note;
my $notes_href = $asset->get_notes()
# Access active status
$asset = $asset->deactivate()
$asset = $asset->activate()
($asset || undef) = $asset->is_active()
# Publish info
$needs_publish = $asset->needs_publish();
## METHODS INHERITED FROM Bric::Biz::Asset::Business ##
# General info
$name = $biz->get_name()
$biz = $biz->set_name($name)
$ver = $biz->get_version()
# Element Type information
$elem_type = $biz->get_element_type;
$name = $biz->get_element_name()
$at_id = $biz->get_element_type_id()
$biz = $biz->set_element_type_id($at_id)
# Element methods
$element = $biz->get_element_type()
@elements = $biz->get_elements()
$biz = $biz->add_field($field_type_obj, $data)
$value = $biz->get_value($name, $obj_order)
$parts = $biz->get_possible_field_types()
# Container methods
$new_container = $biz->add_container($at_contaier_obj)
$container = $biz->get_container($name, $obj_order)
@containes = $biz->get_possible_containers()
# Access Categories
$cat = $biz->get_primary_category;
$biz = $biz->set_primary_category($cat);
($cats || @cats) = $biz->get_secondary_categories($sortby);
$biz = $biz->add_categories([$category, ...])
($cats || @cats) = $biz->get_categories()
$biz = $biz->delete_categories([$category, ...]);
# Access keywords
$biz = $biz->add_keywords(\@kws)
($kw_list || @kws) = $biz->get_keywords()
($self || undef) = $biz->has_keyword($keyword)
$biz = $biz->del_keywords([$kw, ...])
# Change control
$biz = $biz->cancel()
$biz = $biz->revert($version)
(undef || $biz) = $biz->checkin()
$biz = $biz->checkout($param)
## INSTANCE METHODS FOR Bric::Biz::Asset::Business::Story
# Manipulation of slug field
$slug = $story->get_slug()
$story = $story->set_slug($slug)
# Access the source ID
$src_id = $story->get_source__id()
# Change control
($story || undef) = $story->is_current()
# Ad string management
$story = $story->delete_ad_param($key)
$ad_param_hash = $story->get_ad_param()
$story = $story->set_ad_param($key ,$val);
# Publish data
$date = $story->get_expire_date()
$story = $story->set_expire_date()
$date = $story->get_publish_date()
$story = $story->set_publish_date()
# Save to the database
$story = $story->save()
=head1 Description
Story contains all of the data that will result in published page(s) It
contains the metadata and associations with story documents. It inherits from
L<Bric::Biz::Asset::Business|Bric::Biz::Asset::Business>
=cut
#==============================================================================#
# Dependencies #
#======================================#
#--------------------------------------#
# Standard Dependencies
use strict;
#--------------------------------------#
# Programatic Dependencies
use Bric::Biz::Workflow qw(STORY_WORKFLOW);
use Bric::Config qw(:uri :ui);
use Bric::Util::DBI qw(:all);
use Bric::Util::Time qw(:all);
use Bric::Util::Grp::Parts::Member::Contrib;
use Bric::Util::Grp::Story;
use Bric::Util::Fault qw(:all);
use Bric::Biz::Asset::Business;
use Bric::Biz::Keyword;
use Bric::Biz::OutputChannel qw(:case_constants);
use Bric::Biz::Site;
#==============================================================================#
# Inheritance #
#======================================#
# The parent module should have a 'use' line if you need to import from it.
# use Bric;
use base qw( Bric::Biz::Asset::Business );
#=============================================================================#
# Function Prototypes #
#======================================#
# None
#==============================================================================#
# Constants #
#======================================#
use constant DEBUG => 0;
use constant TABLE => 'story';
use constant VERSION_TABLE => 'story_instance';
use constant ID_COL => 's.id';
use constant COLS => qw( uuid
usr__id
element_type__id
first_publish_date
publish_date
current_version
published_version
workflow__id
publish_status
active
desk__id
site__id
alias_id);
use constant VERSION_COLS => qw( name
priority
description
source__id
story__id
version
usr__id
primary_oc__id
slug
cover_date
note
primary_uri
expire_date
checked_out);
use constant FIELDS => qw( uuid
user__id
element_type_id
first_publish_date
publish_date
current_version
published_version
workflow_id
publish_status
_active
desk_id
site_id
alias_id);
use constant VERSION_FIELDS => qw( name
priority
description
source__id
id
version
modifier
primary_oc_id
slug
cover_date
note
primary_uri
expire_date
checked_out);
use constant AD_PARAM => '_AD_PARAM';
use constant GROUP_PACKAGE => 'Bric::Util::Grp::Story';
use constant INSTANCE_GROUP_ID => 31;
use constant CAN_DO_LIST_IDS => 1;
use constant CAN_DO_LIST => 1;
use constant CAN_DO_LOOKUP => 1;
use constant GROUP_COLS => (
group_concat_sql('m.grp__id'),
group_concat_sql('c.asset_grp_id'),
group_concat_sql('w.asset_grp_id'),
);
# the mapping for building up the where clause based on params
use constant WHERE => 's.id = i.story__id '
. 'AND sm.object_id = s.id '
. 'AND m.id = sm.member__id '
. "AND m.active = '1' "
. 'AND sc.story_instance__id = i.id '
. 'AND c.id = sc.category__id '
. 'AND s.workflow__id = w.id';
use constant COLUMNS => join(', s.', 's.id', COLS) . ', '
. join(', i.', 'i.id', VERSION_COLS);
use constant OBJECT_SELECT_COLUMN_NUMBER => scalar COLS + 1;
# param mappings for the big select statement
use constant FROM => VERSION_TABLE . ' i';
use constant PARAM_FROM_MAP => {
keyword => 'story_keyword sk, keyword k',
output_channel_id => 'story__output_channel soc',
simple => 'story_member sm, member m, story__category sc, '
. 'category c, workflow w, ' . TABLE . ' s ',
grp_id => 'member m2, story_member sm2',
category_id => 'story__category sc2',
primary_category_id => 'story__category sc2',
category_uri => 'story__category sc2',
data_text => 'story_field sd',
contrib_id => 'story__contributor sic',
element_key_name => 'element_type e',
'story.category' => 'story__category sc2',
subelement_key_name => 'story_element sct, element_type subet',
subelement_id => 'story_element sse',
related_story_id => 'story_element sctrs',
related_media_id => 'story_element sctrm',
note => 'story_instance si2',
uri => 'story_uri uri',
site => 'site',
};
PARAM_FROM_MAP->{_not_simple} = PARAM_FROM_MAP->{simple};
use constant PARAM_WHERE_MAP => {
id => 's.id = ?',
uuid => 's.uuid = ?',
exclude_id => 's.id <> ?',
active => 's.active = ?',
inactive => 's.active = ?',
alias_id => 's.alias_id = ?',
site_id => 's.site__id = ?',
site => 's.site__id = site.id AND LOWER(site.name) LIKE LOWER(?)',
no_site_id => 's.site__id <> ?',
version_id => 'i.id = ?',
workflow__id => 's.workflow__id = ?',
workflow_id => 's.workflow__id = ?',
_null_workflow_id => 's.workflow__id IS NULL',
primary_uri => 'LOWER(i.primary_uri) LIKE LOWER(?)',
uri => 's.id = uri.story__id AND LOWER(uri.uri) LIKE LOWER(?)',
element_type_id => 's.element_type__id = ?',
element_id => 's.element_type__id = ?',
element__id => 's.element_type__id = ?',
element_key_name => 's.element_type__id = e.id AND LOWER(e.key_name) LIKE LOWER(?)',
source_id => 'i.source__id = ?',
source__id => 'i.source__id = ?',
priority => 'i.priority = ?',
publish_status => 's.publish_status = ?',
first_publish_date_start => 's.first_publish_date >= ?',
first_publish_date_end => 's.first_publish_date <= ?',
publish_date_start => 's.publish_date >= ?',
publish_date_end => 's.publish_date <= ?',
cover_date_start => 'i.cover_date >= ?',
cover_date_end => 'i.cover_date <= ?',
expire_date_start => 'i.expire_date >= ?',
expire_date_end => 'i.expire_date <= ?',
unexpired => '(i.expire_date IS NULL OR i.expire_date > CURRENT_TIMESTAMP)',
expired => '(i.expire_date IS NOT NULL AND i.expire_date <= CURRENT_TIMESTAMP)',
desk_id => 's.desk__id = ?',
name => 'LOWER(i.name) LIKE LOWER(?)',
subelement_key_name => 'i.id = sct.object_instance_id AND sct.element_type__id = subet.id AND LOWER(subet.key_name) LIKE LOWER(?)',
subelement_id => 'i.id = sse.object_instance_id AND sse.active = TRUE AND sse.element_type__id = ?',
related_story_id => 'i.id = sctrs.object_instance_id AND sctrs.related_story__id = ?',
related_media_id => 'i.id = sctrm.object_instance_id AND sctrm.related_media__id = ?',
data_text => 'sd.object_instance_id = i.id AND (LOWER(sd.short_val) LIKE LOWER(?)' . ( BLOB_SEARCH ? ' OR LOWER(sd.blob_val) LIKE LOWER(?))' : ')' ),
title => 'LOWER(i.name) LIKE LOWER(?)',
description => 'LOWER(i.description) LIKE LOWER(?)',
version => 'i.version = ?',
published_version => "s.published_version = i.version AND i.checked_out = '0'",
slug => 'LOWER(i.slug) LIKE LOWER(?)',
user__id => 'i.usr__id = ?',
user_id => 'i.usr__id = ?',
_checked_in_or_out => 'i.checked_out = '
. '( SELECT checked_out '
. 'FROM story_instance '
. 'WHERE version = i.version '
. 'AND story__id = i.story__id '
. 'ORDER BY checked_out DESC LIMIT 1 )',
checked_in => 'i.checked_out = '
. '( SELECT checked_out '
. 'FROM story_instance '
. 'WHERE version = i.version '
. 'AND story__id = i.story__id '
. 'ORDER BY checked_out ASC LIMIT 1 )',
_checked_out => 'i.checked_out = ?',
checked_out => 'i.checked_out = ?',
_not_checked_out => "i.checked_out = '0' AND s.id not in "
. '(SELECT story__id FROM story_instance '
. 'WHERE s.id = story_instance.story__id '
. "AND story_instance.checked_out = '1')",
primary_oc_id => 'i.primary_oc__id = ?',
output_channel_id => '(i.id = soc.story_instance__id AND '
. '(soc.output_channel__id = ? OR '
. 'i.primary_oc__id = ?))',
category_id => 'i.id = sc2.story_instance__id AND '
. 'sc2.category__id = ?',
primary_category_id => 'i.id = sc2.story_instance__id AND '
. "sc2.category__id = ? AND sc2.main = '1'",
category_uri => 'i.id = sc2.story_instance__id AND '
. 'sc2.category__id = c.id AND '
. 'LOWER(c.uri) LIKE LOWER(?)',
'story.category' => 's.id <> ? '
. 'AND i.id = sc2.story_instance__id AND '
. 'sc2.category__id in ('
. 'SELECT sc3.category__id '
. 'FROM story__category sc3, story s2, story_instance i2 '
. 'WHERE i2.story__id = s2.id '
. 'AND i2.version = s2.current_version '
. 'AND i2.checked_out ='
. '( SELECT checked_out '
. 'FROM story_instance '
. 'WHERE version = i2.version '
. 'AND story__id = s2.id '
. 'AND sc3.story_instance__id = i2.id '
. 'AND s2.id = ? '
. 'ORDER BY checked_out DESC LIMIT 1 ))',
keyword => 'sk.story_id = s.id AND '
. 'k.id = sk.keyword_id AND '
. 'LOWER(k.name) LIKE LOWER(?)',
_no_return_versions => 's.current_version = i.version',
grp_id => 'm2.grp__id = ? AND '
. "m2.active = '1' AND "
. 'sm2.member__id = m2.id AND '
. 's.id = sm2.object_id',
simple => 's.id IN ('
. 'SELECT ss.id FROM story ss '
. 'JOIN story_instance si2 ON (story__id = ss.id AND version = ss.current_version) '
. 'WHERE LOWER(si2.name) LIKE LOWER(?) '
. 'OR LOWER(si2.description) LIKE LOWER(?) '
. 'OR LOWER(si2.primary_uri) LIKE LOWER(?) '
. 'UNION SELECT story_id FROM story_keyword '
. 'JOIN keyword kk ON (kk.id = keyword_id) '
. 'WHERE LOWER(kk.name) LIKE LOWER(?))',
contrib_id => 'i.id = sic.story_instance__id AND sic.member__id = ?',
note => 'si2.story__id = s.id AND LOWER(si2.note) LIKE LOWER(?)',
};
use constant PARAM_ANYWHERE_MAP => {
element_key_name => [ 's.element_type__id = e.id',
'LOWER(e.key_name) LIKE LOWER(?)' ],
subelement_key_name => [ 'i.id = sct.object_instance_id AND sct.element_type__id = subet.id',
'LOWER(subet.key_name) LIKE LOWER(?)' ],
subelement_id => [ 'i.id = sse.object_instance_id AND sse.active = TRUE',
'sse.element_type__id = ?' ],
related_story_id => [ 'i.id = sctrs.object_instance_id',
'sctrs.related_story__id = ?' ],
related_media_id => [ 'i.id = sctrm.object_instance_id',
'sctrm.related_media__id = ?' ],
data_text => [ 'sd.object_instance_id = i.id',
'(LOWER(sd.short_val) LIKE LOWER(?)' . (BLOB_SEARCH ? ' OR LOWER(sd.blob_val) LIKE LOWER(?)' : ')') ],
output_channel_id => [ 'i.id = soc.story_instance__id',
'soc.output_channel__id = ?' ],
category_id => [ 'i.id = sc2.story_instance__id',
'sc2.category__id = ?' ],
primary_category_id => [ "i.id = sc2.story_instance__id AND sc2.main = '1'",
'sc2.category__id = ?' ],
uri => [ 's.id = uri.story__id',
'LOWER(uri.uri) LIKE LOWER(?)' ],
category_uri => [ 'i.id = sc2.story_instance__id AND sc2.category__id = c.id',
'LOWER(c.uri) LIKE LOWER(?)' ],
keyword => [ 'sk.story_id = s.id AND k.id = sk.keyword_id',
'LOWER(k.name) LIKE LOWER(?)' ],
grp_id => [ "m2.active = '1' AND sm2.member__id = m2.id AND s.id = sm2.object_id",
'm2.grp__id = ?' ],
contrib_id => [ 'i.id = sic.story_instance__id',
'sic.member__id = ?' ],
note => [ 'si2.story__id = s.id',
'LOWER(si2.note) LIKE LOWER(?)'],
site => [ 's.site__id = site.id',
'LOWER(site.name) LIKE LOWER(?)' ],
};
use constant PARAM_ORDER_MAP => {
uuid => 's.uuid',
active => 's.active',
inactive => 's.active',
alias_id => 's.alias_id',
site_id => 's.site__id',
workflow__id => 's.workflow__id',
workflow_id => 's.workflow__id',
primary_uri => 'LOWER(i.primary_uri)',
element_type_id => 's.element_type__id',
element_id => 's.element_type__id',
element__id => 's.element_type__id',
source_id => 'i.source__id',
source__id => 'i.source__id',
priority => 'i.priority',
publish_status => 's.publish_status',
first_publish_date => 's.first_publish_date',
publish_date => 's.publish_date',
cover_date => 'i.cover_date',
expire_date => 'i.expire_date',
name => 'LOWER(i.name)',
title => 'LOWER(i.name)',
description => 'LOWER(i.description)',
version => 'i.version',
version_id => 'i.id',
slug => 'LOWER(i.slug)',
user_id => 'i.usr__id',
user__id => 'i.usr__id',
_checked_out => 'i.checked_out',
primary_oc_id => 'i.primary_oc__id',
category_id => 'sc2.category_id',
category_uri => 'LOWER(c.uri)',
keyword => 'LOWER(k.name)',
return_versions => 'i.version',
};
use constant DEFAULT_ORDER => 'cover_date';
#==============================================================================#
# Fields #
#======================================#
#--------------------------------------#
# Public Class Fields
# NONE.
#--------------------------------------#
# Private Class Fields
my ($meths, @ord);
my $ug = Data::UUID->new;
#--------------------------------------#
# Instance Fields
# NONE.
# This method of Bricolage will call 'use fields' for you and set some permissions.
BEGIN {
Bric::register_fields
({
# Public Fields
slug => Bric::FIELD_RDWR
# Private Fields
});
}
#==============================================================================#
# Interface Methods #
#======================================#
=head1 Interface
=head2 Constructors
=over 4
=cut
#--------------------------------------#
# Constructors
#------------------------------------------------------------------------------#
=item $story = Bric::Biz::Asset::Business::Story->new( $initial_state )
This will create a new story object with an optionally defined initial state
Supported Keys:
=over 4
=item *
user__id - Required.
=item *
active
=item *
priority
=item *
title - same as name
=item *
name - Will be overridden by title
=item *
description
=item *
workflow_id
=item *
slug
=item *
element_type_id - Required unless asset type object passed
=item *
element_type - the object required unless id is passed
=item *
site_id - required
=item *
source__id - required
=item *
cover_date - will set expire date in conjunction with the source
=back
B<Throws:>
NONE
B<Side Effects:>
NONE
B<Notes:>
NONE
=cut
sub new {
my ($self, $init) = @_;
$init->{'_active'} = (exists $init->{'active'}) ? $init->{'active'} : 1;
delete $init->{'active'};
$init->{priority} ||= 3;
$init->{_queried_cats} = 1;
$init->{_categories} = {};
$init->{name} = delete $init->{title} if exists $init->{title};
push @{$init->{grp_ids}}, INSTANCE_GROUP_ID;
$self->SUPER::new($init);
}
################################################################################
=item $story = Bric::Biz::Asset::Business::Story->lookup( { id => $id })
This will return a story asset that matches the id provided
B<Throws:>
"Missing required parameter 'id'"
B<Side Effects:>
NONE
B<Notes:>
Inherited from Asset
=cut
################################################################################
=item (@stories||$stories) = Bric::Biz::Asset::Business::Story->list($params)
Returns a list or anonymous array of Bric::Biz::Asset::Business::Story objects
based on the search parameters passed via an anonymous hash. The supported
lookup keys are:
=over 4
=item title
The title of the story. May use C<ANY> for a list of possible values.
=item name
Same as C<title>.
=item description
Story description. May use C<ANY> for a list of possible values.
=item id
The story ID. May use C<ANY> for a list of possible values.
=item uuid
The story UUID. May use C<ANY> for a list of possible values.
=item exclude_id
A story ID to exclude from the list. May use C<ANY> for a list of possible
values.
=item version
The story version number. May use C<ANY> for a list of possible values.
=item version_id
The ID of a version of a story. May use C<ANY> for a list of possible values.
=item slug
The story slug. May use C<ANY> for a list of possible values.
=item user_id
Returns the versions that are checked out by the user, otherwise returns the
most recent version. May use C<ANY> for a list of possible values.
=item checked_out
A boolean value indicating whether to return only checked out or not checked
out stories.
=item checked_in
If passed a true value, this parameter causes the checked in version of the
most current version of the story to be returned. When a story is checked out,
there are two instances of the current version: the one checked in last, and
the one currently being edited. When the C<checked_in> parameter is a true
value, then the instance last checked in is returned, rather than the instance
currently checked out. This is useful for users who do not currently have a
story checked out and wish to see the story as of the last check in, rather
than as currently being worked on in the current checkout. If a story is not
currently checked out, this parameter has no effect.
=item published_version
Returns the versions of the stories as they were last published. The
C<checked_out> parameter will be ignored if this parameter is passed a true
value.
=item return_versions
Boolean indicating whether to return pass version objects for each story
listed.
=item active
Boolean indicating whether to return active or inactive stories.
=item inactive
Returns only inactive stories.
=item alias_id
Returns a list of stories aliased to the story ID passed as its value. May use
C<ANY> for a list of possible values.
=item category_id
Returns a list of stories in the category represented by a category ID. May
use C<ANY> for a list of possible values.
=item category_uri
Returns a list of stories with a given category URI. May use C<ANY> for a list
of possible values.
=item keyword
Returns stories associated with a given keyword string (not object). May use
C<ANY> for a list of possible values.
=item note
Returns stories with a note matching the value associated with any of their
versions. May use C<ANY> for a list of possible values.
=item workflow_id
Return a list of stories in the workflow represented by the workflow ID. May
use C<ANY> for a list of possible values.
=item desk_id
Returns a list of stories on a desk with the given ID. May use C<ANY> for a
list of possible values.
=item primary_uri
Returns a list of stories with a given primary URI. May use C<ANY> for a list
of possible values.
=item uri
Returns a list of stories with a given URI. May use C<ANY> for a list of
possible values.
=item story.category
Pass in a story ID, and a list of stories in the same categories as the story
with that ID will be returned, minus the story with that ID. This parameter
triggers a complex join, which can slow the query time significantly on
underpowered servers or systems with a large number of stories. Still, it can
be very useful in templates that want to create a list of stories in all of
the categories the current story is in. But be sure to use the <Limit>
parameter!
=item site_id
Returns a list of stories associated with a given site ID. May use C<ANY>
for a list of possible values.
=item site
Returns a list of stories associated with a given site name. May use C<ANY>
for a list of possible values.
=item element_type_id
Returns a list of stories associated with a given element type ID. May use C<ANY>
for a list of possible values.
=item source_id
Returns a list of stories associated with a given source ID. May use C<ANY>
for a list of possible values.
=item output_channel_id
Returns a list of stories associated with a given output channel ID. May use
C<ANY> for a list of possible values.
=item primary_oc_id
Returns a list of stories associated with a given primary output channel
ID. May use C<ANY> for a list of possible values.
=item priority
Returns a list of stories associated with a given priority value. May use
C<ANY> for a list of possible values.
=item contrib_id
Returns a list of stories associated with a given contributor ID. May use
C<ANY> for a list of possible values.
=item grp_id
Returns a list of stories that are members of the group with the specified
group ID. May use C<ANY> for a list of possible values.
=item publish_status
Boolean value indicating whether to return published or unpublished stories.
=item first_publish_date_start
Returns a list of stories first published on or after a given date/time.
=item first_publish_date_end
Returns a list of stories first published on or before a given date/time.
=item publish_date_start
Returns a list of stories last published on or after a given date/time.
=item publish_date_end
Returns a list of stories last published on or before a given date/time.
=item cover_date_start
Returns a list of stories with a cover date on or after a given date/time.
=item cover_date_end
Returns a list of stories with a cover date on or before a given date/time.
=item expire_date_start
Returns a list of stories with a expire date on or after a given date/time.
=item expire_date_end
Returns a list of stories with a expire date on or before a given date/time.
=item expired
If set, returns a list of media with an expire date set in the past.
=item unexpired
If set, returns a list of stories without an expire date, or with
an expire date set in the future.
=item element_key_name
The key name for the story type element. May use C<ANY> for a list of possible
values.
=item subelement_key_name
The key name for a container element that's a subelement of a story. May use
C<ANY> for a list of possible values.
=item subelement_id
The ID for a container element that's a subelement of a story. May use C<ANY>
for a list of possible values.
=item related_story_id
Returns a list of stories that have this story ID as a related story. May use
C<ANY> for a list of possible values.
=item related_media_id
Returns a list of stories that have this media ID as a related media document.
May use C<ANY> for a list of possible values.
=item data_text
Text stored in the fields of the story element or any of its subelements. Only
fields that use the "short" storage type will be searched unless the
C<BLOB_SEARCH> F<bricolage.conf> directive is enabled, in which case the
"blob" storage will also be searched. May use C<ANY> for a list of possible
values.
=item Order
A property name or array reference of property names to order by.
=item OrderDirection
The direction in which to order the records, either "ASC" for ascending (the
default) or "DESC" for descending. This value is applied to the property
specified by the C<Order> parameter, and may also be an array reference. If no
value is supplied for any C<Order> property name, it will default to
ascending.
=item Limit
A maximum number of objects to return. If not specified, all objects that
match the query will be returned.
=item Offset
The number of objects to skip before listing the remaining objcts or the
number of objects specified by C<Limit>.
=item simple
Triggers a single OR search that hits title, description, primary_uri and
keywords.
=back
B<Throws:>
=over 4
=item *
Unable to connect to database.
=item *
Unable to prepare SQL statement.
=item *
Unable to select column into arrayref.
=item *
Unable to execute SQL statement.
=item *
Unable to bind to columns to statement handle.
=item *
Unable to fetch row from statement handle.
=back
B<Side Effects:>
NONE
B<Notes:>
Inherited from Bric::Biz::Asset;
=cut
################################################################################
=back
=head2 Destructors
=over 4
=item $self->DESTROY
This is a dummy method to save autoload the time to find it
=back
=cut
sub DESTROY {
# This method should be here even if its empty so that we don't waste time
# making Bricolage's autoload method try to find it.
}
################################################################################