Changeset 17025


Ignore:
Timestamp:
08/27/08 20:32:27 (12 years ago)
Author:
kjdon
Message:

modified set_OID to take hash_on_file and hash_on_gs_xml as oid types.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/doc.pm

    r16950 r17025  
    127127    my ($type, $metadata) = @_;
    128128
    129     if (defined $type && $type =~ /^(hash|incremental|dirname|assigned)$/) {
     129    if (defined $type && $type =~ /^(hash|hash_on_file|hash_on_ga_xml|incremental|dirname|assigned)$/) {
    130130    $self->{'OIDtype'} = $type;
    131131    } else {
     
    286286    if (!defined $OID) {
    287287    $OID = "NULL";
    288     if ($self->{'OIDtype'} eq "hash") {
     288    if ($self->{'OIDtype'} =~ /^hash/) {
    289289        $use_hash_oid = 1;
    290290    } elsif ($self->{'OIDtype'} eq "incremental") {
     
    312312        my $identifier = $self->get_metadata_element ($self->get_top_section(), $self->{'OIDmetadata'});
    313313        if (defined $identifier && $identifier ne "") {
    314         $OID = "D" . $identifier;
     314        $OID = $identifier;
    315315        $OID =~ s/\.//; #remove any periods
     316        if ($OID =~ /^[\d]*$/) {
     317            $OID = "D" . $OID;
     318            print STDERR "OID only contains numbers, adding a D\n";
     319        }
     320       
    316321        } else {
    317322        # need a hash id
     
    325330
    326331    if ($use_hash_oid) {
    327        
    328         # "hash" OID - feed file to hashfile.exe
    329         #my $filename = $self->get_source_filename();
    330         # we want to use the converted file for hashing if available
    331         # cos its quicker
    332         my $filename = $self->get_filename_for_hashing();
    333         # -z: don't want to hash on the file if it is zero size
    334         if (defined($filename) && -e $filename && !-z $filename) {
    335         $OID = $self->_calc_OID ($filename);
    336         } else {
    337         $filename = &util::get_tmp_filename();
     332        my $hash_on_file = 1;
     333        if ($self->{'OIDtype'} eq "hash_on_ga_xml") {
     334        $hash_on_file = 0;
     335        }
     336        if ($hash_on_file) {
     337        # "hash" OID - feed file to hashfile.exe
     338        my $filename = $self->get_filename_for_hashing();
     339        # -z: don't want to hash on the file if it is zero size
     340        if (defined($filename) && -e $filename && !-z $filename) {
     341            $OID = $self->_calc_OID ($filename);
     342        } else {
     343            $hash_on_file = 0;
     344        }
     345        }
     346        if (!$hash_on_file) {
     347        my $filename = &util::get_tmp_filename();
    338348        if (!open (OUTFILE, ">$filename")) {
    339349            print STDERR "doc::set_OID could not write to $filename\n";
Note: See TracChangeset for help on using the changeset viewer.