source: main/trunk/greenstone2/perllib/classify/AllList.pm@ 23116

Last change on this file since 23116 was 23116, checked in by kjdon, 14 years ago

for incremental build, classifiers are not really done incrementally. Previously, we reconstructed all the docs from the database, and classified them, then processed any new/edited/deleted docs, updating the classifier as necessary. Now, we process all new/updated docs, then reconstruct the docs from the database, but only classify those not changed/deleted. This means that we are only ever adding docs to a classifier, never updating or deleting. I have removed edit_mode and all code handling deleting stuff from the classifier.

  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 KB
RevLine 
[12744]1###########################################################################
2#
3# AllList.pm -- Creates a single list of all documents. Use by the oaiserver.
4# A component of the Greenstone digital library software
5# from the New Zealand Digital Library Project at the
6# University of Waikato, New Zealand.
7#
8# Copyright (C) 2005 New Zealand Digital Library Project
9#
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 2 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23#
24###########################################################################
25
[8221]26package AllList;
27
[17209]28use BaseClassifier;
[10253]29
30use strict;
31no strict 'refs'; # allow filehandles to be variables and viceversa
32
[8221]33sub BEGIN {
[17209]34 @AllList::ISA = ('BaseClassifier');
[8221]35}
36
37my $arguments =
38 [
39 ];
40
41my $options = { 'name' => "AllList",
[12744]42 'desc' => "{AllList.desc}",
[17209]43 'abstract' => "yes", # hide from gli
[8221]44 'inherits' => "yes" };
45
46sub new {
[10218]47 my ($class) = shift (@_);
48 my ($classifierslist,$inputargs,$hashArgOptLists) = @_;
49 push(@$classifierslist, $class);
[8221]50
[17209]51 push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});
52 push(@{$hashArgOptLists->{"OptList"}},$options);
[10218]53
[17209]54 my $self = new BaseClassifier($classifierslist, $inputargs, $hashArgOptLists);
[10253]55
56 if ($self->{'info_only'}) {
57 # don't worry about any options etc
58 return bless $self, $class;
59 }
[10218]60
61 # Manually set $self parameters.
[8221]62 $self->{'list'} = [];
[10218]63 $self->{'buttonname'} = "All Documents";
[8221]64
65 return bless $self, $class;
66}
67
68sub init {
69 my $self = shift (@_);
70}
71
72sub classify {
73 my $self = shift (@_);
[23116]74 my ($doc_obj) = @_;
[22220]75
[8221]76 my $doc_OID = $doc_obj->get_OID();
[22220]77
[23116]78 push (@{$self->{'list'}}, $doc_OID);
79
[8221]80 return;
81}
82
83sub get_classify_info {
84 my $self = shift(@_);
85 my ($no_thistype) = @_;
86
87 my %classifyinfo = ('childtype' =>'VList',
[10218]88 'Title' =>$self->{'buttonname'},
[8221]89 'contains' =>[],
90 'classifyOID' =>"oai");
91 $classifyinfo{'thistype'} = 'Invisible';
[10253]92 my @list = @{$self->{'list'}};
[8221]93
94 my $seqNo = 0;
[10253]95 foreach my $OID (@list) {
[8221]96 my $hashref={};
97 $hashref->{'OID'}=$OID;
98
99 my %tempinfo=('childtype'=>'VList',
[10218]100 'Title'=>$self->{'buttonname'},
[8221]101 'classifyOID' =>"oai.$seqNo",
102 'contains' =>[]);
103
104 push (@{$tempinfo{'contains'}}, $hashref);
105
106 push (@{$classifyinfo{'contains'}}, \%tempinfo);
107 $seqNo ++;
108 }
109
110 return \%classifyinfo;
111}
Note: See TracBrowser for help on using the repository browser.