Changeset 26221


Ignore:
Timestamp:
09/20/12 09:34:45 (8 years ago)
Author:
kjdon
Message:

new OIDtype, filename, will use the file name without any folders or file extension. Must be unique filenames in the collection. BasePlugin add_OID method returns if an id has already been set

Location:
main/trunk/greenstone2/perllib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/doc.pm

    r25557 r26221  
    204204    my ($type, $metadata) = @_;
    205205
    206     if (defined $type && $type =~ /^(hash|hash_on_file|hash_on_ga_xml|incremental|dirname|assigned)$/) {
     206    if (defined $type && $type =~ /^(hash|hash_on_file|hash_on_ga_xml|incremental|filename|dirname|assigned)$/) {
    207207    $self->{'OIDtype'} = $type;
    208208    } else {
     
    401401        $OID = "D" . $OIDcount;
    402402        $OIDcount ++;
    403      
     403    } elsif ($self->{'OIDtype'} eq "filename") {
     404        my $filename = $self->get_source_filename();
     405        $OID = &File::Basename::fileparse($filename, qr/\.[^.]*/);
     406        $OID = &util::tidy_up_oid($OID);
    404407    } elsif ($self->{'OIDtype'} eq "dirname") {
    405408        $OID = 'J';
  • main/trunk/greenstone2/perllib/plugins/BasePlugin.pm

    r25743 r26221  
    101101      { 'name' => "incremental",
    102102        'desc' => "{import.OIDtype.incremental}" },
     103      { 'name' => "filename",
     104        'desc' => "{import.OIDtype.filename}" },
    103105      { 'name' => "dirname",
    104106        'desc' => "{import.OIDtype.dirname}" } ];
     
    10161018    my ($doc_obj) = @_;
    10171019
     1020    # don't add one if there is one already set
     1021    return unless $doc_obj->get_OID() =~ /^NULL$/;
    10181022    $doc_obj->set_OIDtype($self->{'OIDtype'}, $self->{'OIDmetadata'});
    10191023
Note: See TracChangeset for help on using the changeset viewer.