CollectionHandler.pm

Document to be completed !
(method descriptions partially missing)

Contents


1. Description
2. Usage
3. Method Index

1. Description

The perl module CollectionHandler.pm provides several methods to manipulate document collections, such as creation and deletion of documents.

The CollectionHandler.pm supports 3 different collection strucutres:

2. Usage

The following examples show the basic usage of the CollectionHandler module.

Creating a new document in a collection
use CollectionHandler;   # CollectionHandler has to be in @INC
  #
$collection = new CollectionHandler;   # creating a new instance
$collection -> setCollectionName('CERN/Test');   # setting the name of the collection
$collection -> setDirectoryBase('/path/to/the/base/directory');   # setting the directory base
$collection -> setCollectionStructure('yyyy-nnn');   # setting the basic structure of the collection
$collection -> verifyCollection();   # verifying if collection exists to
$collection -> setYear('2000');   # setting the year to add to
$new_doc = $collection -> addEntry();   # creating/adding a new document


3. Method Index

new (['collection_name',['base_directory']])
getCollectionName ()
setCollectionName ('collection_name')
verifyCollection ()
createCollection ()
getCollectionStructure ()
setCollectionStructure ( 'yyyy-nnn' | 'yyyy-mm-dd' | 'flat' )
addEntry ()
removeEntry ()
getListOfEntries ()
getListOfYears ()
getListInYear ('yyyy')
_getListInMonth ('yyyy','mm')
getDirectoryBase ()
setDirectoryBase ('base_directory')
getYear () 
setYear ('yyyy')
getMonth ()
setMonth ('mm');
getDay ()
setDay ('dd')
getDaySuffixPattern ()
setDaySuffixPattern ('pattern')
verifyDate ()
getEntryNumber ()
setEntryNumber ('nnn')
getEntryName ()
setEntryName ('entry_name')
entryExists ()
isValidEntryName ('entry_name')
getEntryNamePattern ()
setEntryNamePattern ('pattern')
getDisallowedEntryNames ()
setDisallowedEntryNames ('name1 name2 ...')
getEntryId ()

new (['collection_name',['base_directory']])

Creates a new instance of CollectionHandler. Method takes as 1 or 2 optional arguments the name of the collection (see setCollectionName) and the base directory of the document collections (see setDirectoryBase).

Example: $collection = new CollectionHandler();


setCollectionName

Sets the name of the collection.

Example: $collection->setCollectionName('CERN/IT/US');


getCollectionName

Returns the collection name.

Example: $collection_name = $collection->getCollectionName();


verifyCollection (['silent'])

Tests if Collection exists. Unless silent is specified it exits when Collection doesn't exist. N.B. Naturally the collection name and the base directory have to be specified before using this method.

Example: $collection->verifyCollection();


createCollection

Example:


getCollectionStructure

Example:


setCollectionStructure

Example:


addEntry

Example:


removeEntry

Example:

Example:


getListOfEntries

Example:


getListOfYears

Example:


getListInYear

Example:


_getListInMonth

Example:


getDirectoryBase

Example:


setDirectoryBase

Example:


getYear

Example:


setYear

Example:


getMonth

Example:


setMonth

Example:


getDay

Example:


setDay

Example:


getDaySuffixPattern

Example:


setDaySuffixPattern

Example:


verifyDate

Example:


getEntryNumber

Example:


setEntryNumber

Example:


getEntryName

Example:


entryExists

Example:


isValidEntryName

Example:


setEntryName

Example:


getEntryNamePattern

Example:


setEntryNamePattern

Example: $collection ->


setDisallowedEntryNames

 only for CollectionStrucutre: flat

Sets the list of directory names to be excluded from the index creation.

Example: $collection->setDisallowedEntryNames('ssi bin cfg');


getDisallowedEntryNames

Returns the list of directory names to be excluded from the index creation.

Example: $disabled_names = $collection->getDisallowedEntryNames();


getEntryId