Elive/View/Session.pm

filter: Statementstmt 23.1% 19 / 82 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 41.6% 5 / 12 Podpod 100% 6 / 6 totaltotal 24.3% 30 / 123 CC 12 SCAR 31.2
CC
12
Cov
19%
update
56.0
insert
20.0
__add_preloads
12.0
CRAP 22.7
« Elive/Entity/Session.pm ↑ Summary Elive/Connection.pm »
1 package Elive::View::Session;
2 5 ▶use warnings; use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 5 ▶use Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use Mouse::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 5 extends 'Elive::Entity::Session';
8 5 has 'id' => (is => 'rw', isa => 'Int', required => 1);
9 5 __PACKAGE__->primary_key('id');
10  
11 5 ▶use Elive::Entity::Preloads;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 =head1 NAME
14  
15 Elive::View::Session - Session view and insert/update via ELM 2.x
16  
17 =head1 DESCRIPTION
18  
19 A session is a consolidated view of meetings, meeting parameters, server parameters and participants.
20  
21 =cut
22  
23 =head1 METHODS
24  
25 =cut
26  
27 =head2 insert
28  
29 Creates a new session on an Elluminate server.
30  
31 use Elive::View::Session;
32  
33 my $session_start = time();
34 my $session_end = $session_start + 900;
35  
36 $session_start .= '000';
37 $session_end .= '000';
38  
39 my $preload = Elive::Entity::Preload->upload('c:\\Documents\intro.wbd');
40  
41 my %session_data = (
42 name => 'An example session',
43 facilitatorId => Elive->login->userId,
44 password => 'example', # what else?
45 start => $session_start,
46 end => $session_end,
47 privateMeeting => 1,
48 costCenter => 'example',
49 recordingStatus => 'remote',
50 raiseHandOnEnter => 1,
51 maxTalkers => 2,
52 inSessionInvitation => 1,
53 boundaryMinutes => 15,
54 fullPermissions => 1,
55 supervised => 1,
56 seats => 2,
57 participants => [
58 -moderators => [qw(alice bob)],
59 -others => '*staff_group'
60 ],
61 add_preload => $preload
62 );
63  
64 my $session = Elive::View::Session->insert( \%session_data );
65  
66 A series of sessions can be created using the C<recurrenceCount> and C<recurrenceDays> parameters.
67  
68 #
69 # create three weekly sessions
70 #
71 my @sessions = Elive::View::Session->insert({
72 ...,
73 recurrenceCount => 3,
74 recurrenceDays => 7,
75 });
76  
77 =cut
78  
79 sub insert {
80 0 ▶ my $class = shift;
Subroutine insert: not called CC=4 SCAR=30.0
Pod documented
81 0 my %data = %{ shift() };
82 0 my %opts = @_;
83  
84 0 my $preloads = delete $data{add_preload};
85 #
86 # start by inserting the meeting
87 #
88 0 my @meeting_props = $class->_data_owned_by('Elive::Entity::Meeting' => (sort keys %data));
89  
90 my %meeting_data = map {
91 0 $_ => delete $data{$_}
92 } @meeting_props;
93  
94 #
95 # recurrenceCount, and recurrenceDays may result in multiple meetings
96 #
97 0 my @meetings = Elive::Entity::Meeting->insert(\%meeting_data, %opts);
98  
99 my @objs = map {
100 0 my $meeting = $_;
101  
102 0 my $self = Elive::Entity::Session->new( {id => $meeting->meetingId,
103 meeting => $meeting} );
104 0 bless $self, $class;
105  
106 0 $self->connection( $meeting->connection );
107 #
108 # from here on in, it's just a matter of updating attributes owned by
109 # the other entities. We need to do this for each meeting instance
110 #
111 0 ▶ $self->update(\%data, %opts)
Branch: 1 branch
BranchTrueFalseTotal
if keys %data 0 0 0
112 if keys %data;
113  
114 0 ▶ $self->__add_preloads( $preloads ) if $preloads;
Branch: 1 branch
BranchTrueFalseTotal
if $preloads 0 0 0
115  
116 0 $self;
117  
118 } @meetings;
119  
120 0 ▶ return wantarray? @objs : $objs[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
121 }
122  
123 =head2 update
124  
125 Updates a previously created session.
126  
127 $session->seats(5);
128 $session->update;
129  
130 ...or equivalently...
131  
132 $session->update({seats => 5});
133  
134 =cut
135  
136 sub update {
137 0 ▶ my $self = shift;
Subroutine update: not called CC=7 SCAR=40.3
Pod documented
138 0 ▶ my %data = %{ shift() || {} };
Branch: 1 branch
BranchTrueFalseTotal
shift() or {} 0 0 0
139 0 my %opts = @_;
140  
141 0 my $preloads = delete $data{add_preload};
142 0 my $delegates = $self->_delegates;
143  
144 0 foreach my $delegate (sort keys %$delegates) {
145  
146 0 my $delegate_class = $delegates->{$delegate};
147 0 my @delegate_props = $self->_data_owned_by($delegate_class => sort keys %data);
148 next unless @delegate_props
149 0 ▶ || ($self->{$delegate} && $self->{$delegate}->is_changed);
Branch: 1 branch
BranchTrueFalseTotal
unless @delegate_props or $self->{$delegate} and $self->{$delegate}->is_changed 0 0 0
Condition0%0/6
@delegate_props or $self->{$delegate} and $self->{$delegate}->is_changed
l!l&&r!l&&!r
000
$self->{$delegate} and $self->{$delegate}->is_changed
!ll&&!rl&&r
000
MC/DC0%0/3
@delegate_props or $self->{$delegate} and $self->{$delegate}->is_changed
@delegate_props $self->{$delegate} $self->{$delegate}->is_changed
Truth table0%0/4
A or B and C
A= @delegate_propsB= $self->{$delegate}C= $self->{$delegate}->is_changed
ABCresult
1XX1
0111
00X0
0100
150  
151 0 my %delegate_data = map {$_ => delete $data{$_}} @delegate_props;
152  
153 0 $self->$delegate->update( \%delegate_data, %opts );
154 }
155  
156 0 ▶ $self->__add_preloads( $preloads ) if $preloads;
Branch: 1 branch
BranchTrueFalseTotal
if $preloads 0 0 0
157  
158 0 return $self;
159 }
160  
161 sub __add_preloads {
162 0 ▶ my $self = shift;
Subroutine __add_preloads: not called CC=3 SCAR=24.8
163 0 my $preloads = shift;
164  
165 0 ▶ if ($preloads) {
Branch: 1 branch
BranchTrueFalseTotal
if ($preloads) 0 0 0
166 0 $preloads = Elive::Entity::Preloads->_build_array( $preloads );
167  
168 0 foreach my $preload (@$preloads) {
169 0 $self->meeting->add_preload( $preload );
170 }
171 }
172 }
173  
174 =head2 list retrieve buildJNLP check_preload add_preload remove_preload is_participant is_moderator list_preloads list_recordings
175  
176 These methods are available from the base class L<Elive::Entity::Session>.
177  
178 =head2 adapter allModerators boundaryMinutes costCenter deleted enableTelephony end facilitatorId followModerator fullPermissions id inSessionInvitation maxTalkers moderatorNotes moderatorTelephonyAddress moderatorTelephonyPIN name participantTelephonyAddress participantTelephonyPIN participants password privateMeeting profile raiseHandOnEnter recordingObfuscation recordingResolution recordingStatus redirectURL restrictedMeeting seats serverTelephonyAddress serverTelephonyPIN start supervised telephonyType userNotes videoWindow
179  
180 These attributes are available from the base class L<Elive::Entity::Session>.
181  
182 =cut
183  
184 sub properties {
185 0 ▶ my $class = shift;
Subroutine properties: not called CC=1 SCAR=6.9
Pod documented
186  
187 0 my %seen = (meetingId => 1);
188 0 my $delegates = $class->_delegates;
189  
190 0 my @delegate_properties = sort grep {! $seen{$_}++} (
191 'id',
192 0 map {$_->properties} sort values %$delegates,
193 );
194  
195 0 return @delegate_properties;
196 }
197  
198 sub property_types {
199 0 ▶ my $class = shift;
Subroutine property_types: not called CC=1 SCAR=6.9
Pod documented
200  
201 0 my $id = $class->SUPER::property_types->{id};
202 0 my $delegates = $class->_delegates;
203  
204 my %property_types = (
205 id => $id,
206 0 map { %{$_->property_types} } sort values %$delegates,
207 );
208  
209 0 delete $property_types{meetingId};
210  
211 0 return \%property_types;
212 }
213  
214 sub property_doco {
215 0 ▶ my $class = shift;
Subroutine property_doco: not called CC=1 SCAR=6.9
Pod documented
216  
217 0 my $delegates = $class->_delegates;
218  
219 return {
220 0 map { %{$_->property_doco} } sort values %$delegates,
221 };
222 }
223  
224 sub derivable {
225 0 ▶ my $class = shift;
Subroutine derivable: not called CC=1 SCAR=6.9
Pod documented
226  
227 0 my $delegates = $class->_delegates;
228  
229 return (
230 0 map { $_->derivable } sort values %$delegates,
231 );
232 }
233  
234 =head1 BUGS AND LIMITATIONS
235  
236 The C<insert()> and C<update()> methods in this class rely on older ELM 2.x
237 commands. These do not support newer ELM 3.x features including
238 restricted meetings, invited guests, groups, exit URLs and a number of other
239 newer options and flags - these are listed in L<elive_raise_meeting>.
240  
241 Sites running ELM 3.0 / Elluminate Live 9.5 or newer may want to consider
242 using L<Elive::Entity::Session>, which implements the newer C<createSession>
243 and C<updateSession> commands.
244  
245 =cut
246  
247 5 1;
« Elive/Entity/Session.pm ↑ Summary Elive/Connection.pm »