NAME

PICA::Store - CRUD interface to a PICA::Record storage

SYNOPSIS

use PICA::Store;

$server = PICA::Store->new( SOAP => $baseurl, $userkey, $password, $dbsid );
%result = $server->retrieve( $id );
%result = $server->insert( $record );
%result = $server->update( $id, $record, $version );
%result = $server->delete( $id );

DESCRIPTION

This class provided a simple retrieve-insert-update-delete - interface to a record store. Currently there is only a CBS webcat SOAP-API but you could also wrap for instance a Jangle interface with this class.

A formal description of the CBS webcat SOAP-API can be found at http://cws.gbv.de/ws/webcatws.wsdl.

METHODS

new ( $type => $url, $userkey, $password, $dbsid [, $language ] )

Create a new Server. You must specify a connection type and base URL, userkey, password, and database id. The optional language (default: "en") for error messagescan be one of "de", "en", "fr" or "ne".

Currently only the connection type "SOAP" is supported.

TODO: add SOAP error handling.

retrieve ( $id )

Retrieve a record by ID.

Returns a hash with either 'errorcode' and 'errormessage' or a hash with 'id', 'record', and 'version'. The 'record' element contains a PICA::Record object.

insert ( $record )

Insert a new record. The parameter must be a PICA::Record object.

Returns a hash with either 'errorcode' and 'errormessage' or a hash with 'id', 'record', and 'version'.

update ( $id, $record, $version )

Update a record by ID, updated record (of type PICA::Record), and version (of a previous retrieve, insert, or update command).

Returns a hash with either 'errorcode' and 'errormessage' or a hash with 'id', 'record', and 'version'.

delete ( $id )

Deletes a record by ID.

Returns a hash with either 'errorcode' and 'errormessage' or a hash with 'id'.

INTERNAL METHODS

_soap_query ( $operation, @params )

Internal method to prepare, perform and evaluate a SOAP request. Returns a hash with 'errorcode' and 'errormessage' or a hash with 'dbsid', 'id', 'record', and 'version' depending on the type of query. Do not directly call this method!