1 2package OpenXPKI::Server::Workflow::Activity::Tools::StringToArray; 3 4use strict; 5use base qw( OpenXPKI::Server::Workflow::Activity ); 6 7use OpenXPKI::Server::Context qw( CTX ); 8use OpenXPKI::Exception; 9use OpenXPKI::Debug; 10use Workflow::Exception qw(configuration_error); 11use OpenXPKI::Serialization::Simple; 12use Data::Dumper; 13 14sub execute { 15 ##! 1: 'start' 16 my $self = shift; 17 my $workflow = shift; 18 19 my $context = $workflow->context(); 20 my $params = $self->param(); 21 22 my $target_key = $self->param('target_key'); 23 if (!$target_key) { 24 configuration_error('No target_key set in StringToArray'); 25 } 26 27 my $ser = OpenXPKI::Serialization::Simple->new(); 28 29 # we read the string from the parameter "value" 30 my $val = $self->param('value'); 31 32 ##! 16: 'Value ' . $value 33 34 return unless ($val); 35 36 37 my $regex = $self->param('regex'); 38 $regex = '\s+' unless (defined $regex); 39 40 my $modifier = $self->param('modifier') || ''; 41 $modifier =~ s/\s//g; 42 if ($modifier =~ /[^alupimsx]/ ) { 43 OpenXPKI::Exception->throw( 44 message => "I18N_OPENXPKI_VALIDATOR_REGEX_INVALID_MODIFIER", 45 params => { 46 MODIFIER => $modifier, 47 }, 48 ); 49 } 50 $modifier = "(?$modifier)" if ($modifier); 51 $regex = qr/$modifier$regex/; 52 53 ##! 16 : 'Seperator ' . $sep 54 my @t = split($regex, $val); 55 56 ##! 32: 'Split result ' . Dumper \@t 57 $context->param( $target_key => $ser->serialize(\@t) ); 58 59 return 1; 60} 61 621; 63 64 65__END__ 66 67=head1 Name 68 69OpenXPKI::Server::Workflow::Activity::Tools::StringToArray 70 71=head1 Description 72 73Trigger notifications using the configured notifcation backends. 74 75=head2 Message 76 77Specifiy the name of the message template to send using the I<message> parameter. 78 79=head2 Additional parameters 80 81To make arbitrary value available for the templates, you can specify additional 82parameters to be mapped into the notififer. Example: 83 84 <action name="I18N_OPENXPKI_WF_ACTION_TEST_NOTIFY1" 85 class="OpenXPKI::Server::Workflow::Activity::Tools::Notify" 86 message="csr_created" 87 _map_fixed_value="a fixed value" 88 _map_from_context="$my_context_key"> 89 </action> 90 91The I<_map_> prefix is stripped, the remainder is used as key. 92Values starting with a $ sign are interpreted as context keys. 93