| 3 |
# $Id$ |
# $Id$ |
| 4 |
# |
# |
| 5 |
# $Log$ |
# $Log$ |
| 6 |
|
# Revision 1.23 2002/12/19 16:31:53 joko |
| 7 |
|
# +- renamed sub to 'rebuildDb' |
| 8 |
|
# |
| 9 |
|
# Revision 1.22 2002/12/18 22:28:16 jonen |
| 10 |
|
# + added extended logging at 'getObjectByGuid()' |
| 11 |
|
# |
| 12 |
|
# Revision 1.21 2002/12/16 22:20:49 jonen |
| 13 |
|
# + fixed bug at 'getObjectByGuid()' |
| 14 |
|
# |
| 15 |
# Revision 1.20 2002/12/16 20:49:17 jonen |
# Revision 1.20 2002/12/16 20:49:17 jonen |
| 16 |
# + added sub 'getObjectByGuid()' |
# + added sub 'getObjectByGuid()' |
| 17 |
# + added functionality to use 'getObjectByGuid' at 'getObjectAsHash()' |
# + added functionality to use 'getObjectByGuid' at 'getObjectAsHash()' |
| 368 |
return $ok; |
return $ok; |
| 369 |
} |
} |
| 370 |
|
|
| 371 |
sub rebuildDbAndSchema { |
sub rebuildDb { |
| 372 |
my $self = shift; |
my $self = shift; |
| 373 |
$logger->info( __PACKAGE__ . "->rebuildDbAndSchema()" ); |
$logger->info( __PACKAGE__ . "->rebuildDb()" ); |
| 374 |
my @results; |
my @results; |
| 375 |
|
|
| 376 |
# sum up results (bool (0/1)) in array |
# sum up results (bool (0/1)) in array |
| 569 |
|
|
| 570 |
# Guid and Classname is needed |
# Guid and Classname is needed |
| 571 |
if(!$guid || !$options->{classname}) { |
if(!$guid || !$options->{classname}) { |
| 572 |
|
$logger->error( __PACKAGE__ . "->getObjectByGuid: No 'guid' OR no Classname in options hash was given but needed!" ); |
| 573 |
return; |
return; |
| 574 |
} |
} |
| 575 |
|
|
| 578 |
$self->{_COREHANDLE}->unload() if ($options->{destroy}); |
$self->{_COREHANDLE}->unload() if ($options->{destroy}); |
| 579 |
|
|
| 580 |
# search for object with given Classname and Guid |
# search for object with given Classname and Guid |
| 581 |
my $obj_tmp = $self->{_COREHANDLE}->remote($classname); |
my $obj_tmp = $self->{_COREHANDLE}->remote($options->{classname}); |
| 582 |
my @result = $self->{_COREHANDLE}->select($obj_tmp, $obj_tmp->{guid} eq $guid); |
my @result = $self->{_COREHANDLE}->select($obj_tmp, $obj_tmp->{guid} eq $guid); |
| 583 |
|
|
| 584 |
# we searched for global unique identifer of some object, |
# we searched for global unique identifer of some object, |
| 585 |
# so it think we can trust there would be only one result |
# so I think we can trust there would be only one result |
| 586 |
if($result[0]) { |
if($result[0]) { |
| 587 |
return $result[0]; |
return $result[0]; |
| 588 |
} else { |
} else { |
| 589 |
return "No Object with Classname $classname and GUID $options->{guid} found!"; |
$logger->error( __PACKAGE__ . "->getObjectByGuid: No Object with Classname $options->{classname} and GUID $guid found!" ); |
| 590 |
|
return; |
| 591 |
} |
} |
| 592 |
|
|
| 593 |
} |
} |