Skip to content

Commit da21cd7

Browse files
Ported AdminGenericInterfaceDebugger.pm, AdminGenericInterfaceOperationDefault.pm, AdminGenericInterfaceWebservice.pm and AdminGenericInterfaceWebserviceHistory.pm to ObjectManager.
1 parent ef81d34 commit da21cd7

File tree

4 files changed

+468
-407
lines changed

4 files changed

+468
-407
lines changed

Kernel/Modules/AdminGenericInterfaceDebugger.pm

Lines changed: 59 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# --
2-
# Kernel/Modules/AdminGenericInterfaceDebugger.pm - provides a log view for admins
2+
# Kernel/Modules/AdminGenericInterfaceDebugger.pm - provides a log view for administrators
33
# Copyright (C) 2001-2015 OTRS AG, http://otrs.com/
44
# --
55
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
@@ -12,43 +12,39 @@ package Kernel::Modules::AdminGenericInterfaceDebugger;
1212
use strict;
1313
use warnings;
1414

15-
use Kernel::System::GenericInterface::Webservice;
16-
use Kernel::System::GenericInterface::DebugLog;
17-
1815
use Kernel::System::VariableCheck qw(:all);
1916

17+
our $ObjectManagerDisabled = 1;
18+
2019
sub new {
2120
my ( $Type, %Param ) = @_;
2221

2322
my $Self = {%Param};
2423
bless( $Self, $Type );
2524

26-
for (qw(ParamObject LayoutObject LogObject ConfigObject)) {
27-
if ( !$Self->{$_} ) {
28-
$Self->{LayoutObject}->FatalError( Message => "Got no $_!" );
29-
}
30-
}
31-
32-
$Self->{WebserviceObject} = Kernel::System::GenericInterface::Webservice->new( %{$Self} );
33-
$Self->{DebugLogObject} = Kernel::System::GenericInterface::DebugLog->new( %{$Self} );
34-
3525
return $Self;
3626
}
3727

3828
sub Run {
3929
my ( $Self, %Param ) = @_;
4030

41-
my $WebserviceID = $Self->{ParamObject}->GetParam( Param => 'WebserviceID' );
31+
my $WebserviceID = $Kernel::OM->Get('Kernel::System::Web::Request')->GetParam( Param => 'WebserviceID' );
32+
33+
# get layout object
34+
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
35+
4236
if ( !$WebserviceID ) {
43-
return $Self->{LayoutObject}->ErrorScreen(
37+
return $LayoutObject->ErrorScreen(
4438
Message => "Need WebserviceID!",
4539
);
4640
}
4741

48-
my $WebserviceData = $Self->{WebserviceObject}->WebserviceGet( ID => $WebserviceID );
42+
my $WebserviceData = $Kernel::OM->Get('Kernel::System::GenericInterface::Webservice')->WebserviceGet(
43+
ID => $WebserviceID,
44+
);
4945

5046
if ( !IsHashRefWithData($WebserviceData) ) {
51-
return $Self->{LayoutObject}->ErrorScreen(
47+
return $LayoutObject->ErrorScreen(
5248
Message => "Could not get data for WebserviceID $WebserviceID",
5349
);
5450
}
@@ -86,10 +82,13 @@ sub Run {
8682
sub _ShowScreen {
8783
my ( $Self, %Param ) = @_;
8884

89-
my $Output = $Self->{LayoutObject}->Header();
90-
$Output .= $Self->{LayoutObject}->NavigationBar();
85+
# get layout object
86+
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
9187

92-
my $FilterTypeStrg = $Self->{LayoutObject}->BuildSelection(
88+
my $Output = $LayoutObject->Header();
89+
$Output .= $LayoutObject->NavigationBar();
90+
91+
my $FilterTypeStrg = $LayoutObject->BuildSelection(
9392
Data => [
9493
'Provider',
9594
'Requester',
@@ -99,16 +98,16 @@ sub _ShowScreen {
9998
Translate => 0,
10099
);
101100

102-
my $FilterFromStrg = $Self->{LayoutObject}->BuildDateSelection(
101+
my $FilterFromStrg = $LayoutObject->BuildDateSelection(
103102
Prefix => 'FilterFrom',
104103
DiffTime => -60 * 60 * 24 * 356,
105104
);
106105

107-
my $FilterToStrg = $Self->{LayoutObject}->BuildDateSelection(
106+
my $FilterToStrg = $LayoutObject->BuildDateSelection(
108107
Prefix => 'FilterTo',
109108
);
110109

111-
$Output .= $Self->{LayoutObject}->Output(
110+
$Output .= $LayoutObject->Output(
112111
TemplateFile => 'AdminGenericInterfaceDebugger',
113112
Data => {
114113
%Param,
@@ -119,7 +118,7 @@ sub _ShowScreen {
119118
},
120119
);
121120

122-
$Output .= $Self->{LayoutObject}->Footer();
121+
$Output .= $LayoutObject->Footer();
123122
return $Output;
124123
}
125124

@@ -130,31 +129,39 @@ sub _GetRequestList {
130129
WebserviceID => $Param{WebserviceID},
131130
);
132131

133-
my $FilterType = $Self->{ParamObject}->GetParam( Param => 'FilterType' );
132+
# get param object
133+
my $ParamObject = $Kernel::OM->Get('Kernel::System::Web::Request');
134+
135+
my $FilterType = $ParamObject->GetParam( Param => 'FilterType' );
134136
$LogSearchParam{CommunicationType} = $FilterType if ($FilterType);
135137

136-
my $FilterRemoteIP = $Self->{ParamObject}->GetParam( Param => 'FilterRemoteIP' );
137-
$LogSearchParam{RemoteIP} = $FilterRemoteIP
138-
if ( $FilterRemoteIP && IsIPv4Address($FilterRemoteIP) );
138+
my $FilterRemoteIP = $ParamObject->GetParam( Param => 'FilterRemoteIP' );
139+
140+
if ( $FilterRemoteIP && IsIPv4Address($FilterRemoteIP) ) {
141+
$LogSearchParam{RemoteIP} = $FilterRemoteIP;
142+
}
139143

140-
$LogSearchParam{CreatedAtOrAfter} = $Self->{ParamObject}->GetParam( Param => 'FilterFrom' );
141-
$LogSearchParam{CreatedAtOrBefore} = $Self->{ParamObject}->GetParam( Param => 'FilterTo' );
144+
$LogSearchParam{CreatedAtOrAfter} = $ParamObject->GetParam( Param => 'FilterFrom' );
145+
$LogSearchParam{CreatedAtOrBefore} = $ParamObject->GetParam( Param => 'FilterTo' );
142146

143-
my $LogData = $Self->{DebugLogObject}->LogSearch(%LogSearchParam);
147+
my $LogData = $Kernel::OM->Get('Kernel::System::GenericInterface::DebugLog')->LogSearch(%LogSearchParam);
144148

145-
# Fail gracefully
146-
$LogData = [] if ( !$LogData );
149+
# fail gracefully
150+
$LogData ||= [];
151+
152+
# get layout object
153+
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
147154

148155
# build JSON output
149-
my $JSON = $Self->{LayoutObject}->JSONEncode(
156+
my $JSON = $LayoutObject->JSONEncode(
150157
Data => {
151158
LogData => $LogData,
152159
},
153160
);
154161

155162
# send JSON response
156-
return $Self->{LayoutObject}->Attachment(
157-
ContentType => 'application/json; charset=' . $Self->{LayoutObject}->{Charset},
163+
return $LayoutObject->Attachment(
164+
ContentType => 'application/json; charset=' . $LayoutObject->{Charset},
158165
Content => $JSON,
159166
Type => 'inline',
160167
NoCache => 1,
@@ -164,32 +171,35 @@ sub _GetRequestList {
164171
sub _GetCommunicationDetails {
165172
my ( $Self, %Param ) = @_;
166173

167-
my $CommunicationID = $Self->{ParamObject}->GetParam( Param => 'CommunicationID' );
174+
my $CommunicationID = $Kernel::OM->Get('Kernel::System::Web::Request')->GetParam( Param => 'CommunicationID' );
168175

169176
if ( !$CommunicationID ) {
170-
$Self->{LogObject}->Log(
177+
$Kernel::OM->Get('Kernel::System::Log')->Log(
171178
Priority => 'error',
172179
Message => 'Got no CommunicationID',
173180
);
174181

175182
return; # return empty response
176183
}
177184

178-
my $LogData = $Self->{DebugLogObject}->LogGetWithData(
185+
my $LogData = $Kernel::OM->Get('Kernel::System::GenericInterface::DebugLog')->LogGetWithData(
179186
WebserviceID => $Param{WebserviceID},
180187
CommunicationID => $CommunicationID,
181188
);
182189

190+
# get layout object
191+
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
192+
183193
# build JSON output
184-
my $JSON = $Self->{LayoutObject}->JSONEncode(
194+
my $JSON = $LayoutObject->JSONEncode(
185195
Data => {
186196
LogData => $LogData,
187197
},
188198
);
189199

190200
# send JSON response
191-
return $Self->{LayoutObject}->Attachment(
192-
ContentType => 'application/json; charset=' . $Self->{LayoutObject}->{Charset},
201+
return $LayoutObject->Attachment(
202+
ContentType => 'application/json; charset=' . $LayoutObject->{Charset},
193203
Content => $JSON,
194204
Type => 'inline',
195205
NoCache => 1,
@@ -199,20 +209,23 @@ sub _GetCommunicationDetails {
199209
sub _ClearDebugLog {
200210
my ( $Self, %Param ) = @_;
201211

202-
my $Success = $Self->{DebugLogObject}->LogDelete(
212+
my $Success = $Kernel::OM->Get('Kernel::System::GenericInterface::DebugLog')->LogDelete(
203213
WebserviceID => $Param{WebserviceID},
204214
);
205215

216+
# get layout object
217+
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
218+
206219
# build JSON output
207-
my $JSON = $Self->{LayoutObject}->JSONEncode(
220+
my $JSON = $LayoutObject->JSONEncode(
208221
Data => {
209222
Success => $Success,
210223
},
211224
);
212225

213226
# send JSON response
214-
return $Self->{LayoutObject}->Attachment(
215-
ContentType => 'application/json; charset=' . $Self->{LayoutObject}->{Charset},
227+
return $LayoutObject->Attachment(
228+
ContentType => 'application/json; charset=' . $LayoutObject->{Charset},
216229
Content => $JSON,
217230
Type => 'inline',
218231
NoCache => 1,

0 commit comments

Comments
 (0)