/
Template.pm
2432 lines (1590 loc) · 55.4 KB
/
Template.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::Template;
###############################################################################
=head1 NAME
Bric::Biz::Asset::Template - Template assets
=head1 VERSION
$LastChangedRevision$
=cut
require Bric; our $VERSION = Bric->VERSION;
=head1 DATE
$LastChangedDate$
=head1 SYNOPSIS
# Creation of Objects
$fa = Bric::Biz::Asset::Template->new( $init )
$fa = Bric::Biz::Asset::Template->lookup( { id => $id })
($fa_list || @fas) = Bric::Biz::Asset::Template->list( $param )
($faid_list || @fa_ids) = Bric::Biz::Asset::Template->list_ids( $param )
# get / set the data that is contained with in
$fa = $fa->set_data()
$data = $fa->get_data()
# get the file name that this will be deployed to
$file_name = $fa->get_file_name()
# get / set the date that this will activate
$date = $fa->get_deploy_date()
$fa = $fa->set_deploy_date($date)
# get the output channel that this is associated with
$output_channel_id = $fa->get_output_channel__id()
# get the asset type that this is associated with
$element_type_id = $fa->get_element_type_id()
# get the category that this is associated with
$category_id = $fa->get_category_id()
# Methods Inheriated from Bric::Biz::Asset
# Class Methods
$key_name = Bric::Biz::Asset->key_name()
%priorities = Bric::Biz::Asset->list_priorities()
$data = Bric::Biz::Asset->my_meths
# looking up of objects
($asset_list || @assets) = Bric::Biz::Asset->list( $param )
# General information
$asset = $asset->get_id()
$asset = $asset->set_name($name)
$name = $asset->get_name()
$asset = $asset->set_description($description)
$description = $asset->get_description()
$priority = $asset->get_priority()
$asset = $asset->set_priority($priority)
# User information
$usr_id = $asset->get_user__id()
$modifier = $asset->get_modifier()
# Version information
$vers = $asset->get_version();
$vers_id = $asset->get_version_id();
$current = $asset->get_current_version();
$checked_out = $asset->get_checked_out()
# Expire Data Information
$asset = $asset->set_expire_date($date)
$expire_date = $asset->get_expire_date()
# 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;
$asset = $asset->set_workflow_id($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()
$asset = $asset->save()
# returns all the groups this is a member of
($grps || @grps) = $asset->get_grp_ids()
=head1 DESCRIPTION
This has changed, it will need to be updated in a bit
=cut
#==============================================================================#
# Dependencies #
#======================================#
#--------------------------------------#
# Standard Dependencies
use strict;
#--------------------------------------#
# Programatic Dependencies
use Bric::Biz::Workflow qw(TEMPLATE_WORKFLOW);
use Bric::Util::DBI qw(:all);
use Bric::Util::Grp::AssetVersion;
use Bric::Util::Time qw(:all);
use Bric::Util::Fault qw(:all);
use Bric::Util::Trans::FS;
use Bric::Util::Grp::Template;
use Bric::Biz::ElementType;
use Bric::Biz::Category;
use Bric::Biz::OutputChannel;
use List::Util qw(first);
#==============================================================================#
# Inheritance #
#======================================#
use base qw( Bric::Biz::Asset );
#=============================================================================#
# Function Prototypes #
#======================================#
# None
#==============================================================================#
# Constants #
#======================================#
use constant DEBUG => 0;
use constant ELEMENT_TEMPLATE => 1;
use constant CATEGORY_TEMPLATE => 2;
use constant UTILITY_TEMPLATE => 3;
# constants for the Database
use constant TABLE => 'template';
use constant VERSION_TABLE => 'template_instance';
use constant ID_COL => 'f.id';
use constant COLS => qw( name
priority
description
usr__id
output_channel__id
tplate_type
element_type__id
category__id
file_name
current_version
published_version
deploy_status
deploy_date
expire_date
workflow__id
desk__id
active
site__id);
use constant VERSION_COLS => qw( template__id
version
usr__id
data
file_name
note
checked_out);
use constant FIELDS => qw( name
priority
description
user__id
output_channel__id
tplate_type
element_type_id
category_id
file_name
current_version
published_version
deploy_status
deploy_date
expire_date
workflow_id
desk_id
_active
site_id);
use constant VERSION_FIELDS => qw( id
version
modifier
data
file_name
note
checked_out);
use constant GROUP_PACKAGE => 'Bric::Util::Grp::Template';
use constant INSTANCE_GROUP_ID => 33;
use constant CAN_DO_LIST_IDS => 1;
use constant CAN_DO_LIST => 1;
use constant CAN_DO_LOOKUP => 1;
use constant GROUP_COLS => ('id_list(DISTINCT m.grp__id) AS grp_id',
'id_list(DISTINCT c.asset_grp_id) AS cat_grp_id',
'id_list(DISTINCT w.asset_grp_id) AS wf_grp_id');
# the mapping for building up the where clause based on params
use constant WHERE => 'f.id = i.template__id '
. 'AND fm.object_id = f.id '
. 'AND m.id = fm.member__id '
. "AND m.active = '1' "
. 'AND c.id = f.category__id '
. 'AND f.workflow__id = w.id';
use constant COLUMNS => join(', f.', 'f.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 => {
_not_simple => 'template_member fm, member m, '
. 'category c, workflow w, ' . TABLE . ' f ',
grp_id => 'member m2, template_member fm2',
element_key_name => 'element_type e',
site_id => 'output_channel oc',
note => 'template_instance fi2',
site => 'site',
};
PARAM_FROM_MAP->{simple} = PARAM_FROM_MAP->{_not_simple};
use constant PARAM_WHERE_MAP => {
id => 'f.id = ?',
exclude_id => 'f.id <> ?',
active => 'f.active = ?',
inactive => 'f.active = ?',
site_id => 'f.output_channel__id = oc.id AND oc.site__id = ?',
no_site_id => 'f.output_channel__id = oc.id AND oc.site__id <> ?',
site => 'f.site__id = site.id AND LOWER(site.name) LIKE LOWER(?)',
workflow__id => 'f.workflow__id = ?',
workflow_id => 'f.workflow__id = ?',
version_id => 'i.id = ?',
_null_workflow_id => 'f.workflow__id IS NULL',
element__id => 'f.element_type__id = ?',
element_type_id => 'f.element_type__id = ?',
element_key_name => 'f.element_type__id = e.id AND LOWER(e.key_name) LIKE LOWER(?)',
output_channel_id => 'f.output_channel__id = ?',
output_channel__id => 'f.output_channel__id = ?',
priority => 'f.priority = ?',
deploy_status => 'f.deploy_status = ?',
deploy_date_start => 'f.deploy_date >= ?',
deploy_date_end => 'f.deploy_date <= ?',
expire_date_start => 'f.expire_date >= ?',
expire_date_end => 'f.expire_date <= ?',
desk_id => 'f.desk__id = ?',
name => 'LOWER(f.name) LIKE LOWER(?)',
file_name => 'LOWER(f.file_name) LIKE LOWER(?)',
title => 'LOWER(f.name) LIKE LOWER(?)',
description => 'LOWER(f.description) LIKE LOWER(?)',
version => 'i.version = ?',
published_version => 'f.published_version = i.version AND i.checked_out = 0',
deployed_version => 'f.published_version = i.version AND i.checked_out = 0',
user__id => 'i.usr__id = ?',
user_id => 'i.usr__id = ?',
_checked_in_or_out => 'i.checked_out = '
. '( SELECT checked_out '
. 'FROM template_instance '
. 'WHERE version = i.version '
. 'AND template__id = i.template__id '
. 'ORDER BY checked_out DESC LIMIT 1 )',
checked_in => 'i.checked_out = '
. '( SELECT checked_out '
. 'FROM template_instance '
. 'WHERE version = i.version '
. 'AND template__id = i.template__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 f.id not in "
. '(SELECT template__id FROM template_instance '
. 'WHERE f.id = template_instance.template__id '
. "AND template_instance.checked_out = '1')",
category_id => 'f.category__id = ?',
category_uri => 'f.category__id = c.id AND '
. 'LOWER(c.uri) LIKE LOWER(?))',
_no_return_versions => 'f.current_version = i.version',
grp_id => "m2.active = '1' AND "
. 'm2.grp__id = ? AND '
. 'f.id = fm2.object_id AND '
. 'fm2.member__id = m2.id',
simple => '(LOWER(f.name) LIKE LOWER(?) OR '
. 'LOWER(f.file_name) LIKE LOWER(?))',
note => 'fi2.template__id = f.id AND LOWER(fi2.note) LIKE LOWER(?)',
};
use constant PARAM_ANYWHERE_MAP => {
element_key_name => [ 'f.element_type__id = e.id',
'LOWER(e.key_name) LIKE LOWER(?)' ],
category_uri => [ 'f.category__id = c.id',
'LOWER(c.uri) LIKE LOWER(?))' ],
grp_id => [ "m2.active = '1' AND fm2.member__id = m2.id AND f.id = fm2.object_id",
'm2.grp__id = ?' ],
site_id => [ 'f.output_channel__id = oc.id',
'oc.site__id = ?' ],
no_site_id => [ 'f.output_channel__id = oc.id',
'oc.site__id <> ?' ],
note => [ 'fi2.template__id = f.id',
'LOWER(fi2.note) LIKE LOWER(?)'],
site => [ 'f.site__id = site.id',
'LOWER(site.name) LIKE LOWER(?)' ],
};
use constant PARAM_ORDER_MAP => {
active => 'f.active',
inactive => 'f.active',
site_id => 'oc.site__id',
workflow_id => 'f.workflow__id',
workflow__id => 'f.workflow__id',
element_id => 'f.element_type__id',
element__id => 'f.element_type__id',
element_type_id => 'f.element_type__id',
output_channel_id => 'f.output_channel__id',
output_channel__id => 'f.output_channel__id',
priority => 'f.priority',
deploy_status => 'f.deploy_status',
deploy_date => 'f.deploy_date',
expire_date => 'f.expire_date',
name => 'LOWER(f.name)',
title => 'LOWER(f.name)',
file_name => 'LOWER(i.file_name)',
category_uri => 'LOWER(i.file_name)',
description => 'LOWER(f.description)',
version => 'i.version',
version_id => 'i.id',
user_id => 'i.usr__id',
user__id => 'i.usr__id',
_checked_out => 'i.checked_out',
category_id => 'f.category__id',
return_versions => 'i.version',
};
use constant DEFAULT_ORDER => 'deploy_date';
#==============================================================================#
# Fields #
#======================================#
#--------------------------------------#
# Public Class Fields
# None
#--------------------------------------#
# Private Class Fields
my ($meths, @ord, $set_elem, $set_util);
my %tplate_type_strings = ( &ELEMENT_TEMPLATE => 'Element Template',
&CATEGORY_TEMPLATE => 'Category Template',
&UTILITY_TEMPLATE => 'Utility Template'
);
my %string_tplate_types = map { $tplate_type_strings{$_} => $_ }
keys %tplate_type_strings;
#--------------------------------------#
# Instance Fields
BEGIN {
Bric::register_fields
({
# Public Fields
# the output channel that this is associated with
output_channel__id => Bric::FIELD_READ,
# The type of template it is.
tplate_type => Bric::FIELD_READ,
# the asset type that this formats
element_type_id => Bric::FIELD_READ,
# the category that this is associated with
category_id => Bric::FIELD_READ,
# the file name as set by the burn system when deployed
file_name => Bric::FIELD_READ,
# Users will insert data into this field and then save will
# populate the _data_oid field for DB insertion.
data => Bric::FIELD_RDWR,
deploy_status => Bric::FIELD_RDWR,
deploy_date => Bric::FIELD_RDWR,
# Private Fields
_active => Bric::FIELD_NONE,
_output_channel_obj => Bric::FIELD_NONE,
_element_type_obj => Bric::FIELD_NONE,
_category_obj => Bric::FIELD_NONE,
_revert_obj => Bric::FIELD_NONE
});
}
#==============================================================================#
=head1 INTERFACE
=head2 Constructors
=over 4
=cut
#--------------------------------------#
# Constructors
#------------------------------------------------------------------------------#
=item $fa = Bric::Biz::Asset::Template->new( $initial_state )
Constructs a new template.
Supported Keys:
=over 4
=item *
description
=item *
data
=item *
deploy_date
=item *
expire_date
=item *
workflow_id
=item *
output_channel - Required unless output channel id passed
=item *
output_channel__id - Required unless output channel object passed
=item *
tplate_type - The type of template it is.
=item *
name - The name of the template. Only used if tplate_type is set to
UTILITY_TEMPLATE.
=item *
element_type - the at object
=item *
element_type_id - the id of the asset type
=item *
category - the category object
=item *
category__id - the category id
=item *
file_type - the type of the template file - this will be used as the extension
for the file_name derived from the element name. Supported file_type values
are those returned as the first value in each array reference in the array
reference returned by C<< Bric::Util::Burner->list_file_types >>.
=back
B<Throws:>
=over 4
=item *
Missing required output channel parameter.
=item *
Missing required parameter 'element_type' or 'element_type_id'.
=item *
Invalid file_type parameter.
=item *
Missing required parameter 'name'
=item *
Invalid tplate_type parameter.
=item *
Missing required parameter 'category' or 'category_id'.
=item *
The template already exists in the output channel.
=back
B<Side Effects:> NONE.
B<Notes:> NONE.
=cut
sub new {
my ($class, $init) = @_;
my $self = bless {}, $class;
my @grp_ids = ($class->INSTANCE_GROUP_ID);
# set active unless we we passed another value
$init->{_active} = exists $init->{active} ?
delete $init->{active} ? 1 : 0 : 1;
$init->{modifier} = $init->{user__id};
$init->{checked_out} = 1;
$init->{deploy_status} = 0;
$init->{priority} ||= 3;
throw_dp "Cannot create an asset without a site" unless $init->{site_id};
$init->{grp_ids} = [$init->{site_id}, $self->INSTANCE_GROUP_ID];
# Check for required output_channel__id.
throw_dp(error => 'Missing required output channel parameter')
unless defined $init->{'output_channel'}
|| defined $init->{'output_channel__id'};
# Lookup the output channel object.
my $oc;
if ($oc = $init->{output_channel}) {
$init->{output_channel__id} = $oc->get_id;
} else {
$oc = $init->{output_channel} = Bric::Biz::OutputChannel->lookup({
id => $init->{output_channel__id},
}) or throw_dp 'There is no output channel with the ID '
. $init->{output_channel__id};
}
# Get the file type and allowed file types.
my $file_type = $init->{file_type};
my $file_types = Bric::Util::Burner->list_file_types($oc->get_burner);
# Verify or assign the file type.
if ($file_type) {
# Make sure that it's legit.
unless (first { $_->[0] eq $file_type } @$file_types) {
throw_dp qq{"$file_type" is not a valid file type in the "}
. $oc->get_name . '" output channel';
}
} else {
# Assign the first file extension we can find.
$init->{file_type} = $file_types->[0][0];
}
# Set the site ID and the group IDs.
my $name;
if (my $t = $init->{tplate_type}) {
# The tplate_type parameter has been passed. Check it out.
if ($t == ELEMENT_TEMPLATE) {
# It's an element template. Get the name from the element object.
$name = $set_elem->($init);
} elsif ($t == CATEGORY_TEMPLATE) {
# It's a category template. Set the name based on the file type.
$name = Bric::Util::Burner->cat_fn_for_ext($init->{file_type})
or throw_dp "Invalid file_type parameter '$init->{file_type}'";
} elsif ($t == UTILITY_TEMPLATE) {
$name = $set_util->($init);
} else {
throw_dp(error => "Invalid tplate_type parameter '$t'");
}
} else {
# No tplate_type name argument. So figure it out based on context.
if ($init->{element_type} or defined $init->{element_type_id}
or $init->{element} or $init->{element__id}
) {
# It's an element template. Get the element info.
$init->{tplate_type} = ELEMENT_TEMPLATE;
$name = $set_elem->($init);
} elsif ($init->{name}) {
# It's a utility template. Set up the name from the name parameter.
$init->{tplate_type} = UTILITY_TEMPLATE;
$name = $set_util->($init);
} else {
# It's a category template. Get set up the file name.
$init->{tplate_type} = CATEGORY_TEMPLATE;
$name = Bric::Util::Burner->cat_fn_for_ext($init->{file_type})
or throw_dp "Invalid file_type parameter '$init->{file_type}'";
}
}
if ($init->{category}) {
$init->{category_id} = $init->{category}->get_id;
push @grp_ids, $init->{category}->get_asset_grp_id();
} elsif (defined $init->{category_id}) {
$init->{category} =
Bric::Biz::Category->lookup({ id => $init->{category_id} });
push @grp_ids, $init->{category}->get_asset_grp_id();
} else {
throw_dp(error => "Missing required parameter 'category' or 'category_id'");
}
my $cat = $init->{category};
@{$init}{qw(version current_version name)} = (0, 0, $name);
$self->SUPER::new($init);
# construct the file name now that the object is in place
$self->_set(['file_name'],
[ $self->_build_file_name( $init->{file_type}, $name, $cat,
$init->{output_channel__id},
$init->{tplate_type} ) ]);
# set the starter grp_ids
$self->_set({ grp_ids => \@grp_ids });
return $self;
}
################################################################################
=item $template = Bric::Biz::Template->lookup( $param )
Returns an object that matches the parameters
Supported Keys
=over 4
=item id
A template asset ID.
=item version
Pass to request a specific version otherwise the most current will be
returned.
=back
B<Throws:>
NONE
B<Side Effects:>
NONE
B<Notes:>
Inherited from Bric::Biz::Asset.
=cut
################################################################################
=item ($fa_list || @fas) = Bric::Biz::Asset::Template->list( $criteria )
Returns a list or anonymous array of Bric::Biz::Asset::Template objects
based on the search parameters passed via an anonymous hash. The supported
lookup keys are:
=over 4
=item name
The name of a template. May use C<ANY> for a list of possible values.
=item title
Same as C<name>.
=item file_name
The file name of a template. May use C<ANY> for a list of possible values.
=item description
Template description. May use C<ANY> for a list of possible values.
=item id
The template ID. May use C<ANY> for a list of possible values.
=item exclude_id
A template ID to exclude from the list. May use C<ANY> for a list of possible
values.
=item version
The template version number. May use C<ANY> for a list of possible values.
=item version_id
The ID of a version of a template. May use C<ANY> for a list of possible
values.
=item active
Defaults to true
=item user_id
If defined will return the versions checked out to the user with this
id. Otherwise , unless C<checked_out> is passed, it will return the most
current non-checked out versions.
=item site_id
Returns a list of templates associated with a given site ID. May use C<ANY>
for a list of possible values.
=item site
Returns a list of templates associated with a given site name. May use C<ANY>
for a list of possible values.
=item category_id
Returns a list of templates in the category represented by a category ID. May
use C<ANY> for a list of possible values.
=item deployed_version
Returns the versions of the templates as they were last deployed. The
C<checked_out> parameter will be ignored if this parameter is passed a true
value.
=item published_version
An alias for C<deployed_version>.
=item category_uri
Returns a list of templates with a given category URI. May use C<ANY> for a
list of possible values.
=item checked_out
Indicates whether to list templates that are checked out or not. If "0", then
only non-checked out templates will be returned. If "1", then only checked-out
templates will be returned. If "all", then the checked_out attributed will be
ignored (unless the C<user__id> parameter is passed).
=item checked_in
If passed a true value, this parameter causes the checked in version of the
most current version of the template to be returned. When a template 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 template checked out and wish to see the template as of the
last check in, rather than as currently being worked on in the current
checkout. If a template is not currently checked out, this parameter has no
effect.
=item return_versions
Will return all the versions of the given templates
=item element_type_id
Returns a list of templates associated with a given element type ID. May use
C<ANY> for a list of possible values.
=item element_key_name
Returns a list of templates associated with an element with the given key
name. May use C<ANY> for a list of possible values.
=item note
Returns templates 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 templates 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 templates on a desk with the given ID. May use C<ANY> for a
list of possible values.
=item output_channel_id
Returns a list of templates associated with a given output channel ID. May use
C<ANY> for a list of possible values.
=item priority
Returns a list of templates associated with a given priority value. May use
C<ANY> for a list of possible values.
=item deploy_status
Boolean value indicating whether to return deployed or undeployed templates.
=item deploy_date_start
Returns a list of templates last deployed on or after a given date/time.
=item deploy_date_end
Returns a list of templates last deployed on or before a given date/time.
=item expire_date_start
Returns a list of templates with a expire date on or after a given date/time.
=item expire_date_end
Returns a list of templates with a expire date on or before a given date/time.
=item grp_id
Returns a list of templates that are members of the group with the specified
group ID. May use C<ANY> for a list of possible values.
=item active
Boolean indicating whether to return active or inactive templates.
=item simple
Triggers a single OR search that hits name and file name.
=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>.
=back
B<Throws:> NONE.
B<Side Effects:> NONE.
B<Notes:>
Inherited from Bric::Biz::Asset.
=cut
#--------------------------------------#
=back
=head2 Destructors
=over 4
=item $template->DESTROY
Dummy method to prevent wasting time trying to AUTOLOAD DESTROY.
=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.
}
#--------------------------------------#
=head2 Public Class Methods
=over 4
=item ($ids || @ids) = Bric::Biz::Asset::Template->list_ids($param)
Returns an unordered list or array reference of template object IDs that match
the criteria defined. The criteria are the same as those for the C<list()>
method except for C<Order> and C<OrderDirection>, which C<list_ids()> ignore.
B<Throws:>
NONE
B<Side Effects:>
NONE
B<Notes:>
Inherited from Bric::Biz::Asset.
=cut
################################################################################
=item my $key_name = Bric::Biz::Asset::Template->key_name()
Returns the key name of this class.
B<Throws:>
NONE
B<Side Effects:>
NONE
B<Notes:>
NONE
=cut
sub key_name { 'template' }
################################################################################
=item $meths = Bric::Biz::Asset::Template->my_meths
=item (@meths || $meths_aref) = Bric::Biz::Asset::Formattiong->my_meths(TRUE)
=item my (@meths || $meths_aref) = Bric::Biz:::Asset::Template->my_meths(0, TRUE)
Returns an anonymous hash of introspection data for this object. If called
with a true argument, it will return an ordered list or anonymous array of
introspection data. If a second true argument is passed instead of a first,
then a list or anonymous array of introspection data will be returned for
properties that uniquely identify an object (excluding C<id>, which is
assumed).
Each hash key is the name of a property or attribute of the object. The value
for a hash key is another anonymous hash containing the following keys:
=over 4
=item name
The name of the property or attribute. Is the same as the hash key when an
anonymous hash is returned.