To Modify an existing entry...
sub updateClass {
my($classAPI, $className, %files)=@_;
print "updateClass:\n";
my @members=();
foreach $filename (keys %files) {
my $encode64=$files{$filename}->{BASE64};
print "updateClass: pushing [$encode64]\n";
push(@members, $encode64);
}
my $stringInfo = {name => $className, members => [@members]};
$soapResponse=$classAPI->modify_string_class(SOAP::Data->name(classes => [$stringInfo]));
my($status,$text)=&checkResponse($soapResponse);
if(($status!=1)||($text ne "OK")) {
print "updateClass: status $status error [$text] from modify_string_class()\n";
exit(-1);
}
print "updateClass: status $status success [$text] from modify_string_class()\n";
}
To add a completely new entry
sub addClassEntry {
my($classAPI, $className, $classMembers, $classValues)=@_;
print "addClassEntry: ($className) ($classMembers) ($classValues)\n";
my $class_members = {name => $className, members => [$classMembers]};
print "addClassEntry: calling class->set_string_class_member_data_value()\n";
$soapResponse=$classAPI->add_string_class_member(SOAP::Data->name(class_members => [$class_members]));
$soapResponse=$classAPI->set_string_class_member_data_value(SOAP::Data->name(class_members => [$class_members]), SOAP::Data->name(values => [[$classValues]]));
my($status,$text)=&checkResponse($soapResponse);
print "addClassEntry: status[$status] text [$text]\n";
if(($status!=1)||($text ne "OK")) {
print "addClassEntry: status $status error [$text] from add_string_class_member()\n";
exit(-1);
}
print "addClassEntry: status $status success [$text] from add_string_class_member()\n";
}
To remove an entry
sub removeClassEntry {
my($classAPI, $className, $classEntry)=@_;
my @stringInfoList=();
print "removeClassEntry:\n";
my $stringInfo = {name => $className, members => [$classEntry]};
push(@stringInfoList, $stringInfo);
print "removeClassEntry: calling class->delete_string_class_member()\n";
$soapResponse=$classAPI->delete_string_class_member(SOAP::Data->name(class_members => [$stringInfo]));
my($status,$text)=&checkResponse($soapResponse);
if(($status!=1)||($text ne "OK")) {
print "removeClassEntry: status $status error [$text] from delete_string_class_member()\n";
return;
}
print "removeClassEntry: status $status success [$text] from delete_string_class_member()\n";
}
To iterate over a class and remove all entries (Using the remove funtion above)
----------------------------------------------------------------------------
sub removeEntries
----------------------------------------------------------------------------
sub removeEntries {
my ($classAPI, $className) = @_;
my $soapResponse = $classAPI->get_string_class(SOAP::Data->name(class_names => [$className]));
&checkResponse($soapResponse);
@StringClassList = @{$soapResponse->result};
foreach $StringClass (@StringClassList) {
$name = $StringClass->{"name"};
print "removeEntries($className): Name : $name\n";
@members = @{$StringClass->{"members"}};
foreach $member (@members) {
print "removeEntries($className): : $member\n";
print "removeEntries: Removing entry\n";
removeClassEntry($classAPI, $className, $member);
}
}
print "removeEntries($className):\n";
}
H