[otrs-cvs] otrs/Kernel/Modules AdminProcessManagement.pm, 1.45, 1.46 AdminGenericInterfaceWebserviceHistory.pm, 1.12, 1.13 AdminGenericInterfaceWebservice.pm, 1.40, 1.41
"CVS commits notifications of OTRS.org" <[email protected]>
| Newsgroups | gmane.comp.otrs.cvs |
|---|---|
| Message-ID | <[email protected]> |
Comments:
Update of /home/cvs/otrs/Kernel/Modules
In directory lancelot:/tmp/cvs-serv9398/Kernel/Modules
Modified Files:
AdminProcessManagement.pm
AdminGenericInterfaceWebserviceHistory.pm
AdminGenericInterfaceWebservice.pm
Log Message:
Re-implemented Kernel::System::YAML as OOP.
Author: cr
Index: AdminProcessManagement.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/Modules/AdminProcessManagement.pm,v
retrieving revision 1.45
retrieving revision 1.46
diff -2 -u -d -r1.45 -r1.46
--- AdminProcessManagement.pm 15 Jan 2013 17:43:26 -0000 1.45
+++ AdminProcessManagement.pm 17 Jan 2013 03:39:20 -0000 1.46
@@ -52,4 +52,5 @@
$Self->{JSONObject} = Kernel::System::JSON->new( %{$Self} );
$Self->{DynamicFieldObject} = Kernel::System::DynamicField->new( %{$Self} );
+ $Self->{YAMLObject} = Kernel::System::YAML->new( %{$Self} );
$Self->{ProcessObject} = Kernel::System::ProcessManagement::DB::Process->new( %{$Self} );
$Self->{EntityObject} = Kernel::System::ProcessManagement::DB::Entity->new( %{$Self} );
@@ -110,5 +111,5 @@
);
- my $ProcessData = Kernel::System::YAML::Load( $UploadStuff{Content} );
+ my $ProcessData = $Self->{YAMLObject}->Load( Data => $UploadStuff{Content} );
if ( ref $ProcessData ne 'HASH' ) {
return $Self->{LayoutObject}->ErrorScreen(
@@ -295,9 +296,9 @@
# search and replace ocurrences of old ActivityDialog ids by the new ones
- my $Config = Kernel::System::YAML::Dump(
- $ProcessData->{Activities}->{$ActivityEntityID}->{Config}
+ my $Config = $Self->{YAMLObject}->Dump(
+ Data => $ProcessData->{Activities}->{$ActivityEntityID}->{Config}
);
$Config =~ s{(AD\d+)}{$ActivityDialogMapping{$1}}xmsg;
- $Config = Kernel::System::YAML::Load($Config);
+ $Config = $Self->{YAMLObject}->Load( Data => $Config );
my $ID = $Self->{ActivityObject}->ActivityAdd(
@@ -327,15 +328,15 @@
# layout: search and replace ocurrences of old Activity ids by the new ones
- my $Layout = Kernel::System::YAML::Dump( $ProcessData->{Process}->{Layout} );
+ my $Layout = $Self->{YAMLObject}->Dump( Data => $ProcessData->{Process}->{Layout} );
$Layout =~ s{(\s+)(A\d+)}{$1$ActivityMapping{$2}}xmsg;
- $Layout = Kernel::System::YAML::Load($Layout);
+ $Layout = $Self->{YAMLObject}->Load( Data => $Layout );
# config: search and replace ocurrences of old object ids by the new ones
- my $Config = Kernel::System::YAML::Dump( $ProcessData->{Process}->{Config} );
+ my $Config = $Self->{YAMLObject}->Dump( Data => $ProcessData->{Process}->{Config} );
$Config =~ s{(\s+)(A\d+)}{$1$ActivityMapping{$2}}xmsg;
$Config =~ s{(\s+)(AD\d+)}{$1$ActivityDialogMapping{$2}}xmsg;
$Config =~ s{(\s+)(T\d+)}{$1$TransitionMapping{$2}}xmsg;
$Config =~ s{(\s+)(TA\d+)}{$1$TransitionActionMapping{$2}}xmsg;
- $Config = Kernel::System::YAML::Load($Config);
+ $Config = $Self->{YAMLObject}->Load( Data => $Config );
# now add the process
@@ -519,5 +520,5 @@
# convert the processdata hash to string
- my $ProcessData = Kernel::System::YAML::Dump( \%ProcessData );
+ my $ProcessData = $Self->{YAMLObject}->Dump( Data => \%ProcessData );
# send the result to the browser
Author: cr
Index: AdminGenericInterfaceWebserviceHistory.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/Modules/AdminGenericInterfaceWebserviceHistory.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -2 -u -d -r1.12 -r1.13
--- AdminGenericInterfaceWebserviceHistory.pm 15 Jan 2013 17:43:26 -0000 1.12
+++ AdminGenericInterfaceWebserviceHistory.pm 17 Jan 2013 03:39:20 -0000 1.13
@@ -37,4 +37,7 @@
}
+ # create additional objects
+ $Self->{YAMLObject} = Kernel::System::YAML->new( %{$Self} );
+
$Self->{WebserviceObject} = Kernel::System::GenericInterface::Webservice->new( %{$Self} );
$Self->{WebserviceHistoryObject}
@@ -196,5 +199,5 @@
# dump config
- $LogData->{Config} = Kernel::System::YAML::Dump( $LogData->{Config} );
+ $LogData->{Config} = $Self->{YAMLObject}->Dump( Data => $LogData->{Config} );
# build JSON output
@@ -235,5 +238,5 @@
# dump configuration into a YAML structure
- my $YAMLContent = Kernel::System::YAML::Dump( $WebserviceHistoryData->{Config} );
+ my $YAMLContent = $Self->{YAMLObject}->Dump( Data => $WebserviceHistoryData->{Config} );
# return yaml to download
Author: cr
Index: AdminGenericInterfaceWebservice.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/Modules/AdminGenericInterfaceWebservice.pm,v
retrieving revision 1.40
retrieving revision 1.41
diff -2 -u -d -r1.40 -r1.41
--- AdminGenericInterfaceWebservice.pm 15 Jan 2013 17:43:26 -0000 1.40
+++ AdminGenericInterfaceWebservice.pm 17 Jan 2013 03:39:20 -0000 1.41
@@ -38,4 +38,5 @@
$Self->{ValidObject} = Kernel::System::Valid->new( %{$Self} );
$Self->{WebserviceObject} = Kernel::System::GenericInterface::Webservice->new( %{$Self} );
+ $Self->{YAMLObject} = Kernel::System::YAML->new( %{$Self} );
# get configurations
@@ -355,5 +356,5 @@
# dump configuration into a YAML structure
- my $YAMLContent = Kernel::System::YAML::Dump( $WebserviceData->{Config} );
+ my $YAMLContent = $Self->{YAMLObject}->Dump( Data => $WebserviceData->{Config} );
# return yaml to download
@@ -496,13 +497,11 @@
# read configuration from a YAML structure
- # if there is an error in YAML it returns a had error eval is needed to handle the error
- eval {
- $ImportedConfig = Kernel::System::YAML::Load( $ConfigFile{Content} );
- };
+ $ImportedConfig = $Self->{YAMLObject}->Load( Data => $ConfigFile{Content} );
# display any YAML error message as a normal otrs error message
- if ($@) {
+ if ( !IsHashRefWithData($ImportedConfig) ) {
return $Self->{LayoutObject}->ErrorScreen(
- Message => $@,
+ Message => 'The imported file has not valid YAML content!'
+ . ' Please check OTRS log for details',
);
}
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log