[otrs-cvs] CVS: Incident/Kernel/System/Stats/Dynamic Incident.pm,
NONE, 1.1
cvs-log at otrs.org
cvs-log at otrs.org
Tue Jan 2 08:59:50 CET 2007
Update of /home/cvs/Incident/Kernel/System/Stats/Dynamic
In directory lancelot:/tmp/cvs-serv27339/Kernel/System/Stats/Dynamic
Added Files:
Incident.pm
Log Message:
initial insert
--- NEW FILE ---
# --
# Kernel/System/Stats/Dynamic/Incident.pm - all advice functions
# Copyright (C) 2003-2007 OTRS GmbH, http://otrs.com/
# --
# $Id: Incident.pm,v 1.1 2007/01/02 07:59:48 tr Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see http://www.gnu.org/licenses/gpl.txt.
# --
package Kernel::System::Stats::Dynamic::Incident;
use strict;
use Kernel::System::State;
use Kernel::System::Priority;
use Kernel::System::Queue;
use Kernel::System::Ticket;
use Kernel::System::Incident;
use vars qw(@ISA $VERSION);
$VERSION = '$Revision: 1.1 $';
$VERSION =~ s/^\$.*:\W(.*)\W.+?$/$1/;
sub new {
my $Type = shift;
my %Param = @_;
# allocate new hash for object
my $Self = {};
bless ($Self, $Type);
# get common opjects
foreach (keys %Param) {
$Self->{$_} = $Param{$_};
}
# check all needed objects
foreach (qw(DBObject ConfigObject LogObject UserObject)) {
die "Got no $_" if (!$Self->{$_});
}
$Self->{QueueObject} = Kernel::System::Queue ->new(%{$Self});
$Self->{TicketObject} = Kernel::System::Ticket ->new(%{$Self});
$Self->{StateObject} = Kernel::System::State ->new(%{$Self});
$Self->{PriorityObject} = Kernel::System::Priority ->new(%{$Self});
$Self->{IncidentObject} = Kernel::System::Incident ->new(%{$Self});
return $Self;
}
sub GetObjectName {
my $Self = shift;
my %Param = @_;
my $Name = 'Incident';
return $Name;
}
sub GetObjectAttributes {
my $Self = shift;
my %Param = @_;
my %Classification = $Self->{IncidentObject}->OptionListGet(OptionList => 'FinalClassificationList');
my %Priority = $Self->{PriorityObject}->PriorityList (UserID => 1);
my %State = $Self->{StateObject} ->StateList (UserID => 1);
my %AddressCategory = $Self->{IncidentObject}->OptionListGet(OptionList => 'SystemNodeAddressCategoryList');
delete($Classification{''});
my @ObjectAttributes = (
{Name => 'Classification',
UseAsXvalue => 1,
UseAsValueSeries => 1,
UseAsRestriction => 1,
Element => 'FinalClassificationID',
Block => 'SelectField',
Values => \%Classification,
},
{Name => 'Priority',
UseAsXvalue => 1,
UseAsValueSeries => 1,
UseAsRestriction => 1,
Element => 'PriorityID',
Block => 'SelectField',
Values => \%Priority,
},
{Name => 'State',
UseAsXvalue => 1,
UseAsValueSeries => 1,
UseAsRestriction => 1,
Element => 'StateID',
Block => 'SelectField',
Values => \%State,
},
{Name => 'Title',
UseAsXvalue => 0,
UseAsValueSeries => 0,
UseAsRestriction => 1,
Element => 'Title',
Block => 'InputField',
},
{Name => 'Fulltext Search',
UseAsXvalue => 0,
UseAsValueSeries => 0,
UseAsRestriction => 1,
Element => 'Text',
Block => 'InputField',
},
{Name => 'Reporter',
UseAsXvalue => 0,
UseAsValueSeries => 0,
UseAsRestriction => 1,
Element => 'Reporter',
Block => 'InputField',
},
{Name => 'Victim',
UseAsXvalue => 0,
UseAsValueSeries => 0,
UseAsRestriction => 1,
Element => 'Victim',
Block => 'InputField',
},
{Name => 'Officer',
UseAsXvalue => 0,
UseAsValueSeries => 0,
UseAsRestriction => 1,
Element => 'Officer',
Block => 'InputField',
},
{Name => 'Node-Name',
UseAsXvalue => 0,
UseAsValueSeries => 0,
UseAsRestriction => 1,
Element => 'NodeName',
Block => 'InputField',
},
{Name => 'Node-Address',
UseAsXvalue => 0,
UseAsValueSeries => 0,
UseAsRestriction => 1,
Element => 'NodeAddress',
Block => 'InputField',
},
{Name => 'Node-Addresscategory',
UseAsXvalue => 1,
UseAsValueSeries => 1,
UseAsRestriction => 1,
Element => 'NodeAddressCategoryID',
Block => 'SelectField',
Values => \%AddressCategory,
},
{Name => 'Service-Name',
UseAsXvalue => 0,
UseAsValueSeries => 0,
UseAsRestriction => 1,
Element => 'ServiceName',
Block => 'InputField',
},
{Name => 'Service-Port',
UseAsXvalue => 0,
UseAsValueSeries => 0,
UseAsRestriction => 1,
Element => 'ServicePort',
Block => 'InputField',
},
{Name => 'Service->PortList',
UseAsXvalue => 0,
UseAsValueSeries => 0,
UseAsRestriction => 1,
Element => 'ServicePortList',
Block => 'InputField',
},
{Name => 'Service-Protocol',
UseAsXvalue => 0,
UseAsValueSeries => 0,
UseAsRestriction => 1,
Element => 'ServiceProtocol',
Block => 'InputField',
},
{Name => 'User-Name',
UseAsXvalue => 0,
UseAsValueSeries => 0,
UseAsRestriction => 1,
Element => 'UserName',
Block => 'InputField',
},
{Name => 'User-Number',
UseAsXvalue => 0,
UseAsValueSeries => 0,
UseAsRestriction => 1,
Element => 'UserNumber',
Block => 'InputField',
},
{Name => 'File-Name',
UseAsXvalue => 0,
UseAsValueSeries => 0,
UseAsRestriction => 1,
Element => 'FileName',
Block => 'InputField',
},
{Name => 'File-Path',
UseAsXvalue => 0,
UseAsValueSeries => 0,
UseAsRestriction => 1,
Element => 'FilePath',
Block => 'InputField',
},
{Name => 'Process-Name',
UseAsXvalue => 0,
UseAsValueSeries => 0,
UseAsRestriction => 1,
Element => 'ProcessName',
Block => 'InputField',
},
{Name => 'Process-Path',
UseAsXvalue => 0,
UseAsValueSeries => 0,
UseAsRestriction => 1,
Element => 'ProcessPath',
Block => 'InputField',
},
{Name => 'Incident reported',
UseAsXvalue => 1,
UseAsValueSeries => 1,
UseAsRestriction => 1,
Element => 'ReportTime',
TimePeriodFormat => 'DateInputFormat',
Block => 'Time',
Values => {
TimeStart => 'ReportTimeMin',
TimeStop => 'ReportTimeMax',
},
},
{Name => 'Incident started',
UseAsXvalue => 1,
UseAsValueSeries => 1,
UseAsRestriction => 1,
Element => 'StartTime',
TimePeriodFormat => 'DateInputFormat',
Block => 'Time',
Values => {
TimeStart => 'StartTimeMin',
TimeStop => 'StartTimeMax',
},
},
{Name => 'Incident ended',
UseAsXvalue => 1,
UseAsValueSeries => 1,
UseAsRestriction => 1,
Element => 'EndTime',
TimePeriodFormat => 'DateInputFormat',
Block => 'Time',
Values => {
TimeStart => 'EndTimeMin',
TimeStop => 'EndTimeMax',
},
},
{Name => 'Incident detected',
UseAsXvalue => 1,
UseAsValueSeries => 1,
UseAsRestriction => 1,
Element => 'DetectTime',
TimePeriodFormat => 'DateInputFormat',
Block => 'Time',
Values => {
TimeStart => 'DetectTimeMin',
TimeStop => 'DetectTimeMax',
},
},
);
# actually no user element available
#if ($Self->{ConfigObject}->Get('Stats::UseAgentElementInStats')) {
# my %ObjectAttribute = (
# Name => 'Imported by',
# UseAsXvalue => 1,
# UseAsValueSeries => 1,
# UseAsRestriction => 1,
# Element => 'UserID',
# Block => 'SelectField',
# Values => \%User,
# );
# push(@ObjectAttributes, \%ObjectAttribute);
#}
return @ObjectAttributes;
}
sub GetStatElement {
my $Self = shift;
my %Param = @_;
$Param{UserID} = 1;
my %Result = $Self->{IncidentObject}->IncidentSearch(
%Param,
);
return ($Result{Counter});
}
1;
More information about the cvs-log
mailing list