Revision 4578
Added by walbridge about 16 years ago
register-dataset.cgi | ||
---|---|---|
436 | 436 |
debug("Registry: B3"); |
437 | 437 |
} else { |
438 | 438 |
# document is being modified |
439 |
$docid = $FORM::docid;
|
|
439 |
$docid = incrementRevision($FORM::docid);
|
|
440 | 440 |
|
441 |
my $x; |
|
442 |
my $y; |
|
443 |
my $z; |
|
444 |
|
|
445 |
($x, $y, $z) = split(/\./, $docid); |
|
446 |
$z++; |
|
447 |
$docid = "$x.$y.$z"; |
|
448 |
|
|
449 | 441 |
$xmldoc =~ s/docid/$docid/; |
450 | 442 |
debugDoc($xmldoc);$ |
451 | 443 |
|
... | ... | |
564 | 556 |
return $docid; |
565 | 557 |
} |
566 | 558 |
|
559 |
sub incrementRevision { |
|
560 |
my $initDocid = shift; |
|
561 |
my $docid = ''; |
|
562 |
if (!$initDocid) { |
|
563 |
debug("Registry: No docid entered."); |
|
564 |
} else { |
|
565 |
my ($scope, $id, $rev) = split(/\./, $initDocid); |
|
566 |
$rev++; |
|
567 |
$docid = "$scope.$id.$rev"; |
|
568 |
} |
|
569 |
return $docid; |
|
570 |
} |
|
571 |
|
|
567 | 572 |
################################################################################ |
568 | 573 |
# |
569 | 574 |
# Validate the parameters to make sure that required params are provided |
... | ... | |
2919 | 2924 |
|
2920 | 2925 |
#debug("Document created by handleModAccept is " . $emldoc); |
2921 | 2926 |
# update the document |
2922 |
my $docid = $FORM::docid;
|
|
2927 |
my $newDocid = incrementRevision($docid);
|
|
2923 | 2928 |
|
2924 |
my $x; |
|
2925 |
my $y; |
|
2926 |
my $z; |
|
2927 |
|
|
2928 |
($x, $y, $z) = split(/\./, $docid); |
|
2929 |
$z++; |
|
2930 |
my $newDocid = "$x.$y.$z"; |
|
2931 |
|
|
2932 | 2929 |
$emldoc =~ s/packageId=\"$docid\"/packageId=\"$newDocid\"/; |
2933 | 2930 |
$response = $metacat->update($newDocid, $emldoc); |
2934 | 2931 |
|
... | ... | |
3221 | 3218 |
#debug("Document created by handleModAccept is " . $emldoc); |
3222 | 3219 |
# update the document |
3223 | 3220 |
my $docid = $FORM::docid; |
3221 |
my $newDocid = incrementRevision($docid); |
|
3224 | 3222 |
|
3225 |
my $x; |
|
3226 |
my $y; |
|
3227 |
my $z; |
|
3228 |
|
|
3229 |
($x, $y, $z) = split(/\./, $docid); |
|
3230 |
$z++; |
|
3231 |
my $newDocid = "$x.$y.$z"; |
|
3232 |
|
|
3233 | 3223 |
$emldoc =~ s/packageId=\"$docid\"/packageId=\"$newDocid\"/; |
3234 | 3224 |
$response = $metacat->update($newDocid, $emldoc); |
3235 | 3225 |
|
3236 | 3226 |
if (!$response) { |
3237 | 3227 |
debug("Error while updating in handleModAccept.".$metacat->getMessage()); |
3238 |
#push(@errorMessages, $metacat->getMessage()); |
|
3239 | 3228 |
$errorMessage = $errorMessage." Failed while updating the document with additional Metadata."; |
3240 | 3229 |
} |
3241 | 3230 |
|
... | ... | |
3305 | 3294 |
} else { |
3306 | 3295 |
my ($reviewdoc, $temp) = split('</reviewHistory>', $doc); |
3307 | 3296 |
$reviewdoc .= $review."\n</reviewHistory>\n"; |
3308 |
($x, $y, $z) = split(/\./, $reviewDocumentId); |
|
3309 |
$z++; |
|
3310 |
$reviewDocumentId = "$x.$y.$z"; |
|
3297 |
$reviewDocumentId = incrementRevision($reviewDocumentId); |
|
3311 | 3298 |
$response = $metacat->update($reviewDocumentId, $reviewdoc); |
3312 | 3299 |
if ($response != '1') { |
3313 | 3300 |
return " Unable to update the review on Metacat for the docid:".$docid; |
Also available in: Unified diff
Add incrementRevision function to replace duplicated code