Difference between revisions of "API:EPrints/DataObj/EPrint"
Line 28: | Line 28: | ||
<!-- Pod2Wiki=head_synopsis --></div> | <!-- Pod2Wiki=head_synopsis --></div> | ||
==SYNOPSIS== | ==SYNOPSIS== | ||
− | Inherrits all methods | + | Inherrits all methods from [[API:EPrints/DataObj|EPrints::DataObj]]. |
# create a new eprint object (in the inbox): | # create a new eprint object (in the inbox): |
Revision as of 19:17, 25 August 2009
EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects
Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki
NAME
EPrints::DataObj::EPrint - Class representing an actual EPrint
DESCRIPTION
This class represents a single eprint record and the metadata associated with it. This is associated with zero, one or many EPrint::Document objects.
EPrints::DataObj::EPrint is a subclass of EPrints::DataObj with the following metadata fields (plus those defined in cfg.d/eprint_fields.pl):
SYNOPSIS
Inherrits all methods from EPrints::DataObj.
# create a new eprint object (in the inbox): my $inbox_ds = $handle->get_dataset( "inbox" ); my $epdata = { userid => $user->get_id, title => "Default title" }; my $eprint = $inbox_ds->create_object( $handle, $epdata ); # open the eprint with id '$eprint_id'. $eprint = $handle->get_eprint( $eprint_id ); # open a public eprint with id '$eprint_id': $eprint = $handle->get_live_eprint( $eprint_id ); # set some metadata: $eprint->set_value( "title", "The title of this eprint" ); # un-set some metadata: $eprint->set_value( "abstract", undef ); # retrieve some metatada: my $title = $eprint->get_value( "title" ); # commit values to the database: $eprint->commit; # delete an eprint object *forever*: $eprint->remove; # render all the documents of an eprint: foreach my $doc ( $eprint->get_all_documents ) { $page->appendChild( $doc->render_citation ); } # move an eprint back to the owner's inbox: $eprint->move_to_inbox; # redirect to the eprint's abstract page: $handle->redirect( $eprint->get_url ); # render some of the eprint's metadata $page->appendChild( $eprint->render_value( "title" ) ); # render information about the owner of the eprint: my $xhtml = $eprint->get_user->render;
SYSTEM METADATA
eprintid (int)
The unique numerical ID of this eprint.
rev_number (int)
The number of the current revision of this record.
userid (itemref)
The id of the user who deposited this eprint (if any). Scripted importing could cause this not to be set.
dir (text)
The directory, relative to the documents directory for this repository, which this eprints data is stored in. Eg. disk0/00/00/03/34 for record 334.
datestamp (time)
The date this record first appeared live in the repository.
lastmod (time)
The date this record was last modified.
status_changes (time)
The date/time this record was moved between inbox, buffer, archive, etc.
type (namedset)
The type of this record, one of the types of the "eprint" dataset.
succeeds (itemref)
The ID of the eprint (if any) which this succeeds. This field should have been an int and may be changed in a later upgrade.
commentary (itemref)
The ID of the eprint (if any) which this eprint is a commentary on. This field should have been an int and may be changed in a later upgrade.
replacedby (itemref)
The ID of the eprint (if any) which has replaced this eprint. This is only set on records in the "deletion" dataset. This field should have been an int and may be changed in a later upgrade.
SEE ALSO
METHODS
@documents = $eprint->get_all_documents
Return an array of all EPrint::Document objects associated with this eprint.
nb. This will not return associated documents such as thumbnails.
$success = $eprint->move_to_deletion
Transfer the EPrint into the "deletion" dataset. Should only be called for eprints in the "archive" dataset. This is called "retiring" in the Web interface.
nb. This does not delete the eprint.
$success = $eprint->move_to_inbox
Transfer the EPrint into the "inbox" dataset. Should only be called for eprints in the "buffer" dataset.
This means moving it back to the user workarea.
$success = $eprint->move_to_buffer
Transfer the EPrint into the "buffer" dataset. Should only be called for eprints in the "inbox" or "archive" dataset.
"buffer" is the internal code for the "review area".
$success = $eprint->move_to_archive
Move this eprint into the main "archive" dataset. Normally only called for eprints in "deletion" or "buffer" datasets.
This causes the item to appear on the website.
$path = $eprint->local_path
Return the full path of the EPrint directory on the local filesystem. No trailing slash.
$url = $eprint->url_stem
Return the URL to this EPrint's directory. Note, this INCLUDES the trailing slash, unlike the local_path method.
$eprint->generate_static
Generate the static version of the abstract web page. In a multi-language repository this will generate one version per language.
If called on inbox or buffer, remove the abstract page.
$user = $eprint->get_user
Return the EPrints::User to whom this eprint belongs (if any).