Object/PivotTable.pm untested

filter: Statementstmt 0.0% 0 / 102 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 21 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 138 CC 6 SCAR 15.3
CC
6
Cov
0%
from_hash
12.0
_deserialize
12.0
TO_JSON
6.0
CRAP 4.6
1 =begin comment
2
3 Copyright (c) 2026 Aspose.Cells Cloud
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21
22 =end comment
23
24 =cut
25
26 package AsposeCellsCloud::Object::PivotTable;
27
28 require 5.6.0;
29 use strict;
30 use warnings;
31 use utf8;
32 use JSON qw(decode_json);
33 use Data::Dumper;
34 use Module::Runtime qw(use_module);
35 use Log::Any qw($log);
36 use Date::Parse;
37 use DateTime;
38 use AsposeCellsCloud::Object::CellArea;
39 use AsposeCellsCloud::Object::Link;
40 use AsposeCellsCloud::Object::LinkElement;
41 use AsposeCellsCloud::Object::PivotField;
42 use AsposeCellsCloud::Object::PivotFilter;
43
44
45 use base ("Class::Accessor", "Class::Data::Inheritable");
46
47
48
49 __PACKAGE__->mk_classdata('attribute_map' => {});
50 __PACKAGE__->mk_classdata('swagger_types' => {});
51 __PACKAGE__->mk_classdata('method_documentation' => {});
52 __PACKAGE__->mk_classdata('class_documentation' => {});
53
54 # new object
55 sub new {
56 my ($class, %args) = @_;
57
58 my $self = bless {}, $class;
59
60 foreach my $attribute (keys %{$class->attribute_map}) {
61 my $args_key = $class->attribute_map->{$attribute};
62 $self->$attribute( $args{ $args_key } );
63 }
64
65 return $self;
66 }
67
68 # return perl hash
69 sub to_hash {
70 return decode_json(JSON->new->convert_blessed->encode( shift ));
71 }
72
73 # used by JSON for serialization
74 sub TO_JSON {
75 my $self = shift;
76 my $_data = {};
77 foreach my $_key (keys %{$self->attribute_map}) {
78 if (defined $self->{$_key}) {
79 $_data->{$self->attribute_map->{$_key}} = $self->{$_key};
80 }
81 }
82 return $_data;
83 }
84
85 # from Perl hashref
86 sub from_hash {
87 my ($self, $hash) = @_;
88
89 # loop through attributes and use swagger_types to deserialize the data
90 while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
91 my $_json_attribute = $self->attribute_map->{$_key};
92 if ($_type =~ /^array\[/i) { # array
93 my $_subclass = substr($_type, 6, -1);
94 my @_array = ();
95 foreach my $_element (@{$hash->{$_json_attribute}}) {
96 push @_array, $self->_deserialize($_subclass, $_element);
97 }
98 $self->{$_key} = \@_array;
99 } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
100 $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
101 } else {
102 $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
103 }
104 }
105
106 return $self;
107 }
108
109 # deserialize non-array data
110 sub _deserialize {
111 my ($self, $type, $data) = @_;
112 $log->debugf("deserializing %s with %s",Dumper($data), $type);
113
114 if ($type eq 'DateTime') {
115 return DateTime->from_epoch(epoch => str2time($data));
116 } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
117 return $data;
118 } else { # hash(model)
119 my $_instance = eval "AsposeCellsCloud::Object::$type->new()";
120 return $_instance->from_hash($data);
121 }
122 }
123
124
125 __PACKAGE__->class_documentation({description => 'Summary description for PivotTable.',
126 class => 'PivotTable',
127 required => [], # TODO
128 } );
129
130
131 __PACKAGE__->method_documentation({
132 'alt_text_description' => {
133 datatype => 'string',
134 base_name => 'AltTextDescription',
135 description => 'Gets the description of the alt text',
136 format => '',
137 read_only => '',
138 },
139 'alt_text_title' => {
140 datatype => 'string',
141 base_name => 'AltTextTitle',
142 description => '',
143 format => '',
144 read_only => '',
145 },
146 'auto_format_type' => {
147 datatype => 'string',
148 base_name => 'AutoFormatType',
149 description => '',
150 format => '',
151 read_only => '',
152 },
153 'base_fields' => {
154 datatype => 'ARRAY[PivotField]',
155 base_name => 'BaseFields',
156 description => '',
157 format => '',
158 read_only => '',
159 },
160 'column_fields' => {
161 datatype => 'ARRAY[PivotField]',
162 base_name => 'ColumnFields',
163 description => '',
164 format => '',
165 read_only => '',
166 },
167 'column_grand' => {
168 datatype => 'boolean',
169 base_name => 'ColumnGrand',
170 description => '',
171 format => '',
172 read_only => '',
173 },
174 'column_header_caption' => {
175 datatype => 'string',
176 base_name => 'ColumnHeaderCaption',
177 description => '',
178 format => '',
179 read_only => '',
180 },
181 'column_range' => {
182 datatype => 'CellArea',
183 base_name => 'ColumnRange',
184 description => '',
185 format => '',
186 read_only => '',
187 },
188 'custom_list_sort' => {
189 datatype => 'boolean',
190 base_name => 'CustomListSort',
191 description => '',
192 format => '',
193 read_only => '',
194 },
195 'data_body_range' => {
196 datatype => 'CellArea',
197 base_name => 'DataBodyRange',
198 description => '',
199 format => '',
200 read_only => '',
201 },
202 'data_field' => {
203 datatype => 'PivotField',
204 base_name => 'DataField',
205 description => '',
206 format => '',
207 read_only => '',
208 },
209 'data_fields' => {
210 datatype => 'ARRAY[PivotField]',
211 base_name => 'DataFields',
212 description => '',
213 format => '',
214 read_only => '',
215 },
216 'data_source' => {
217 datatype => 'ARRAY[string]',
218 base_name => 'DataSource',
219 description => '',
220 format => '',
221 read_only => '',
222 },
223 'display_error_string' => {
224 datatype => 'boolean',
225 base_name => 'DisplayErrorString',
226 description => '',
227 format => '',
228 read_only => '',
229 },
230 'display_immediate_items' => {
231 datatype => 'boolean',
232 base_name => 'DisplayImmediateItems',
233 description => '',
234 format => '',
235 read_only => '',
236 },
237 'display_null_string' => {
238 datatype => 'boolean',
239 base_name => 'DisplayNullString',
240 description => '',
241 format => '',
242 read_only => '',
243 },
244 'enable_data_value_editing' => {
245 datatype => 'boolean',
246 base_name => 'EnableDataValueEditing',
247 description => '',
248 format => '',
249 read_only => '',
250 },
251 'enable_drilldown' => {
252 datatype => 'boolean',
253 base_name => 'EnableDrilldown',
254 description => '',
255 format => '',
256 read_only => '',
257 },
258 'enable_field_dialog' => {
259 datatype => 'boolean',
260 base_name => 'EnableFieldDialog',
261 description => '',
262 format => '',
263 read_only => '',
264 },
265 'enable_field_list' => {
266 datatype => 'boolean',
267 base_name => 'EnableFieldList',
268 description => '',
269 format => '',
270 read_only => '',
271 },
272 'enable_wizard' => {
273 datatype => 'boolean',
274 base_name => 'EnableWizard',
275 description => '',
276 format => '',
277 read_only => '',
278 },
279 'error_string' => {
280 datatype => 'string',
281 base_name => 'ErrorString',
282 description => '',
283 format => '',
284 read_only => '',
285 },
286 'field_list_sort_ascending' => {
287 datatype => 'boolean',
288 base_name => 'FieldListSortAscending',
289 description => '',
290 format => '',
291 read_only => '',
292 },
293 'grand_total_name' => {
294 datatype => 'string',
295 base_name => 'GrandTotalName',
296 description => '',
297 format => '',
298 read_only => '',
299 },
300 'has_blank_rows' => {
301 datatype => 'boolean',
302 base_name => 'HasBlankRows',
303 description => '',
304 format => '',
305 read_only => '',
306 },
307 'indent' => {
308 datatype => 'int',
309 base_name => 'Indent',
310 description => '',
311 format => '',
312 read_only => '',
313 },
314 'is_auto_format' => {
315 datatype => 'boolean',
316 base_name => 'IsAutoFormat',
317 description => '',
318 format => '',
319 read_only => '',
320 },
321 'is_grid_drop_zones' => {
322 datatype => 'boolean',
323 base_name => 'IsGridDropZones',
324 description => '',
325 format => '',
326 read_only => '',
327 },
328 'is_multiple_field_filters' => {
329 datatype => 'boolean',
330 base_name => 'IsMultipleFieldFilters',
331 description => '',
332 format => '',
333 read_only => '',
334 },
335 'is_selected' => {
336 datatype => 'boolean',
337 base_name => 'IsSelected',
338 description => '',
339 format => '',
340 read_only => '',
341 },
342 'item_print_titles' => {
343 datatype => 'boolean',
344 base_name => 'ItemPrintTitles',
345 description => '',
346 format => '',
347 read_only => '',
348 },
349 'manual_update' => {
350 datatype => 'boolean',
351 base_name => 'ManualUpdate',
352 description => '',
353 format => '',
354 read_only => '',
355 },
356 'merge_labels' => {
357 datatype => 'boolean',
358 base_name => 'MergeLabels',
359 description => '',
360 format => '',
361 read_only => '',
362 },
363 'missing_items_limit' => {
364 datatype => 'string',
365 base_name => 'MissingItemsLimit',
366 description => '',
367 format => '',
368 read_only => '',
369 },
370 'name' => {
371 datatype => 'string',
372 base_name => 'Name',
373 description => 'Represents pivot table name.',
374 format => '',
375 read_only => '',
376 },
377 'null_string' => {
378 datatype => 'string',
379 base_name => 'NullString',
380 description => '',
381 format => '',
382 read_only => '',
383 },
384 'page_field_order' => {
385 datatype => 'string',
386 base_name => 'PageFieldOrder',
387 description => '',
388 format => '',
389 read_only => '',
390 },
391 'page_fields' => {
392 datatype => 'ARRAY[PivotField]',
393 base_name => 'PageFields',
394 description => '',
395 format => '',
396 read_only => '',
397 },
398 'page_field_wrap_count' => {
399 datatype => 'int',
400 base_name => 'PageFieldWrapCount',
401 description => '',
402 format => '',
403 read_only => '',
404 },
405 'pivot_filters' => {
406 datatype => 'ARRAY[PivotFilter]',
407 base_name => 'PivotFilters',
408 description => '',
409 format => '',
410 read_only => '',
411 },
412 'pivot_table_style_name' => {
413 datatype => 'string',
414 base_name => 'PivotTableStyleName',
415 description => '',
416 format => '',
417 read_only => '',
418 },
419 'pivot_table_style_type' => {
420 datatype => 'string',
421 base_name => 'PivotTableStyleType',
422 description => '',
423 format => '',
424 read_only => '',
425 },
426 'preserve_formatting' => {
427 datatype => 'boolean',
428 base_name => 'PreserveFormatting',
429 description => '',
430 format => '',
431 read_only => '',
432 },
433 'print_drill' => {
434 datatype => 'boolean',
435 base_name => 'PrintDrill',
436 description => '',
437 format => '',
438 read_only => '',
439 },
440 'print_titles' => {
441 datatype => 'boolean',
442 base_name => 'PrintTitles',
443 description => '',
444 format => '',
445 read_only => '',
446 },
447 'refresh_data_flag' => {
448 datatype => 'boolean',
449 base_name => 'RefreshDataFlag',
450 description => '',
451 format => '',
452 read_only => '',
453 },
454 'refresh_data_on_opening_file' => {
455 datatype => 'boolean',
456 base_name => 'RefreshDataOnOpeningFile',
457 description => '',
458 format => '',
459 read_only => '',
460 },
461 'row_fields' => {
462 datatype => 'ARRAY[PivotField]',
463 base_name => 'RowFields',
464 description => '',
465 format => '',
466 read_only => '',
467 },
468 'row_grand' => {
469 datatype => 'boolean',
470 base_name => 'RowGrand',
471 description => '',
472 format => '',
473 read_only => '',
474 },
475 'row_header_caption' => {
476 datatype => 'string',
477 base_name => 'RowHeaderCaption',
478 description => '',
479 format => '',
480 read_only => '',
481 },
482 'row_range' => {
483 datatype => 'CellArea',
484 base_name => 'RowRange',
485 description => '',
486 format => '',
487 read_only => '',
488 },
489 'save_data' => {
490 datatype => 'boolean',
491 base_name => 'SaveData',
492 description => '',
493 format => '',
494 read_only => '',
495 },
496 'show_data_tips' => {
497 datatype => 'boolean',
498 base_name => 'ShowDataTips',
499 description => '',
500 format => '',
501 read_only => '',
502 },
503 'show_drill' => {
504 datatype => 'boolean',
505 base_name => 'ShowDrill',
506 description => '',
507 format => '',
508 read_only => '',
509 },
510 'show_empty_col' => {
511 datatype => 'boolean',
512 base_name => 'ShowEmptyCol',
513 description => '',
514 format => '',
515 read_only => '',
516 },
517 'show_empty_row' => {
518 datatype => 'boolean',
519 base_name => 'ShowEmptyRow',
520 description => '',
521 format => '',
522 read_only => '',
523 },
524 'show_member_property_tips' => {
525 datatype => 'boolean',
526 base_name => 'ShowMemberPropertyTips',
527 description => '',
528 format => '',
529 read_only => '',
530 },
531 'show_pivot_style_column_header' => {
532 datatype => 'boolean',
533 base_name => 'ShowPivotStyleColumnHeader',
534 description => '',
535 format => '',
536 read_only => '',
537 },
538 'show_pivot_style_column_stripes' => {
539 datatype => 'boolean',
540 base_name => 'ShowPivotStyleColumnStripes',
541 description => '',
542 format => '',
543 read_only => '',
544 },
545 'show_pivot_style_last_column' => {
546 datatype => 'boolean',
547 base_name => 'ShowPivotStyleLastColumn',
548 description => '',
549 format => '',
550 read_only => '',
551 },
552 'show_pivot_style_row_header' => {
553 datatype => 'boolean',
554 base_name => 'ShowPivotStyleRowHeader',
555 description => '',
556 format => '',
557 read_only => '',
558 },
559 'show_pivot_style_row_stripes' => {
560 datatype => 'boolean',
561 base_name => 'ShowPivotStyleRowStripes',
562 description => '',
563 format => '',
564 read_only => '',
565 },
566 'show_row_header_caption' => {
567 datatype => 'boolean',
568 base_name => 'ShowRowHeaderCaption',
569 description => '',
570 format => '',
571 read_only => '',
572 },
573 'show_values_row' => {
574 datatype => 'boolean',
575 base_name => 'ShowValuesRow',
576 description => '',
577 format => '',
578 read_only => '',
579 },
580 'subtotal_hidden_page_items' => {
581 datatype => 'boolean',
582 base_name => 'SubtotalHiddenPageItems',
583 description => '',
584 format => '',
585 read_only => '',
586 },
587 'table_range1' => {
588 datatype => 'CellArea',
589 base_name => 'TableRange1',
590 description => '',
591 format => '',
592 read_only => '',
593 },
594 'table_range2' => {
595 datatype => 'CellArea',
596 base_name => 'TableRange2',
597 description => '',
598 format => '',
599 read_only => '',
600 },
601 'tag' => {
602 datatype => 'string',
603 base_name => 'Tag',
604 description => '',
605 format => '',
606 read_only => '',
607 },
608 'link' => {
609 datatype => 'Link',
610 base_name => 'link',
611 description => '',
612 format => '',
613 read_only => '',
614 },
615 });
616
617 __PACKAGE__->swagger_types( {
618 'alt_text_description' => 'string',
619 'alt_text_title' => 'string',
620 'auto_format_type' => 'string',
621 'base_fields' => 'ARRAY[PivotField]',
622 'column_fields' => 'ARRAY[PivotField]',
623 'column_grand' => 'boolean',
624 'column_header_caption' => 'string',
625 'column_range' => 'CellArea',
626 'custom_list_sort' => 'boolean',
627 'data_body_range' => 'CellArea',
628 'data_field' => 'PivotField',
629 'data_fields' => 'ARRAY[PivotField]',
630 'data_source' => 'ARRAY[string]',
631 'display_error_string' => 'boolean',
632 'display_immediate_items' => 'boolean',
633 'display_null_string' => 'boolean',
634 'enable_data_value_editing' => 'boolean',
635 'enable_drilldown' => 'boolean',
636 'enable_field_dialog' => 'boolean',
637 'enable_field_list' => 'boolean',
638 'enable_wizard' => 'boolean',
639 'error_string' => 'string',
640 'field_list_sort_ascending' => 'boolean',
641 'grand_total_name' => 'string',
642 'has_blank_rows' => 'boolean',
643 'indent' => 'int',
644 'is_auto_format' => 'boolean',
645 'is_grid_drop_zones' => 'boolean',
646 'is_multiple_field_filters' => 'boolean',
647 'is_selected' => 'boolean',
648 'item_print_titles' => 'boolean',
649 'manual_update' => 'boolean',
650 'merge_labels' => 'boolean',
651 'missing_items_limit' => 'string',
652 'name' => 'string',
653 'null_string' => 'string',
654 'page_field_order' => 'string',
655 'page_fields' => 'ARRAY[PivotField]',
656 'page_field_wrap_count' => 'int',
657 'pivot_filters' => 'ARRAY[PivotFilter]',
658 'pivot_table_style_name' => 'string',
659 'pivot_table_style_type' => 'string',
660 'preserve_formatting' => 'boolean',
661 'print_drill' => 'boolean',
662 'print_titles' => 'boolean',
663 'refresh_data_flag' => 'boolean',
664 'refresh_data_on_opening_file' => 'boolean',
665 'row_fields' => 'ARRAY[PivotField]',
666 'row_grand' => 'boolean',
667 'row_header_caption' => 'string',
668 'row_range' => 'CellArea',
669 'save_data' => 'boolean',
670 'show_data_tips' => 'boolean',
671 'show_drill' => 'boolean',
672 'show_empty_col' => 'boolean',
673 'show_empty_row' => 'boolean',
674 'show_member_property_tips' => 'boolean',
675 'show_pivot_style_column_header' => 'boolean',
676 'show_pivot_style_column_stripes' => 'boolean',
677 'show_pivot_style_last_column' => 'boolean',
678 'show_pivot_style_row_header' => 'boolean',
679 'show_pivot_style_row_stripes' => 'boolean',
680 'show_row_header_caption' => 'boolean',
681 'show_values_row' => 'boolean',
682 'subtotal_hidden_page_items' => 'boolean',
683 'table_range1' => 'CellArea',
684 'table_range2' => 'CellArea',
685 'tag' => 'string',
686 'link' => 'Link'
687 } );
688
689 __PACKAGE__->attribute_map( {
690 'alt_text_description' => 'AltTextDescription',
691 'alt_text_title' => 'AltTextTitle',
692 'auto_format_type' => 'AutoFormatType',
693 'base_fields' => 'BaseFields',
694 'column_fields' => 'ColumnFields',
695 'column_grand' => 'ColumnGrand',
696 'column_header_caption' => 'ColumnHeaderCaption',
697 'column_range' => 'ColumnRange',
698 'custom_list_sort' => 'CustomListSort',
699 'data_body_range' => 'DataBodyRange',
700 'data_field' => 'DataField',
701 'data_fields' => 'DataFields',
702 'data_source' => 'DataSource',
703 'display_error_string' => 'DisplayErrorString',
704 'display_immediate_items' => 'DisplayImmediateItems',
705 'display_null_string' => 'DisplayNullString',
706 'enable_data_value_editing' => 'EnableDataValueEditing',
707 'enable_drilldown' => 'EnableDrilldown',
708 'enable_field_dialog' => 'EnableFieldDialog',
709 'enable_field_list' => 'EnableFieldList',
710 'enable_wizard' => 'EnableWizard',
711 'error_string' => 'ErrorString',
712 'field_list_sort_ascending' => 'FieldListSortAscending',
713 'grand_total_name' => 'GrandTotalName',
714 'has_blank_rows' => 'HasBlankRows',
715 'indent' => 'Indent',
716 'is_auto_format' => 'IsAutoFormat',
717 'is_grid_drop_zones' => 'IsGridDropZones',
718 'is_multiple_field_filters' => 'IsMultipleFieldFilters',
719 'is_selected' => 'IsSelected',
720 'item_print_titles' => 'ItemPrintTitles',
721 'manual_update' => 'ManualUpdate',
722 'merge_labels' => 'MergeLabels',
723 'missing_items_limit' => 'MissingItemsLimit',
724 'name' => 'Name',
725 'null_string' => 'NullString',
726 'page_field_order' => 'PageFieldOrder',
727 'page_fields' => 'PageFields',
728 'page_field_wrap_count' => 'PageFieldWrapCount',
729 'pivot_filters' => 'PivotFilters',
730 'pivot_table_style_name' => 'PivotTableStyleName',
731 'pivot_table_style_type' => 'PivotTableStyleType',
732 'preserve_formatting' => 'PreserveFormatting',
733 'print_drill' => 'PrintDrill',
734 'print_titles' => 'PrintTitles',
735 'refresh_data_flag' => 'RefreshDataFlag',
736 'refresh_data_on_opening_file' => 'RefreshDataOnOpeningFile',
737 'row_fields' => 'RowFields',
738 'row_grand' => 'RowGrand',
739 'row_header_caption' => 'RowHeaderCaption',
740 'row_range' => 'RowRange',
741 'save_data' => 'SaveData',
742 'show_data_tips' => 'ShowDataTips',
743 'show_drill' => 'ShowDrill',
744 'show_empty_col' => 'ShowEmptyCol',
745 'show_empty_row' => 'ShowEmptyRow',
746 'show_member_property_tips' => 'ShowMemberPropertyTips',
747 'show_pivot_style_column_header' => 'ShowPivotStyleColumnHeader',
748 'show_pivot_style_column_stripes' => 'ShowPivotStyleColumnStripes',
749 'show_pivot_style_last_column' => 'ShowPivotStyleLastColumn',
750 'show_pivot_style_row_header' => 'ShowPivotStyleRowHeader',
751 'show_pivot_style_row_stripes' => 'ShowPivotStyleRowStripes',
752 'show_row_header_caption' => 'ShowRowHeaderCaption',
753 'show_values_row' => 'ShowValuesRow',
754 'subtotal_hidden_page_items' => 'SubtotalHiddenPageItems',
755 'table_range1' => 'TableRange1',
756 'table_range2' => 'TableRange2',
757 'tag' => 'Tag',
758 'link' => 'link'
759 } );
760
761 __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
762
763
764 1;