Difference between revisions of "API:EPrints/DataObj/EPrint"
Line 1: | Line 1: | ||
− | + | <!-- Pod2Wiki=_preamble_ | |
+ | This page has been automatically generated from the EPrints 3.2 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment' comments will be lost. | ||
+ | --> | ||
+ | __NOTOC__ | ||
+ | {{Pod2Wiki}}{{API:Source|file=EPrints/DataObj/EPrint.pm|package_name=EPrints::DataObj::EPrint}}[[Category:API|EPrint]]<div><!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=head_name --></div> | ||
+ | ==NAME== | ||
+ | '''EPrints::DataObj::EPrint''' - Class representing an actual EPrint | ||
+ | |||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=head_description --></div> | ||
+ | ==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): | ||
+ | |||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=head_synopsis_inherrits_all_methods_from_eprints_dataobj --></div> | ||
+ | ==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 '$eprintid': | ||
+ | $eprint = EPrints::DataObj::EPrint->new( $handle, $eprintid ); | ||
+ | |||
+ | # 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; | ||
+ | |||
+ | |||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=head_system_metadata --></div> | ||
+ | ==SYSTEM METADATA== | ||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_eprintid --></div> | ||
+ | ===eprintid (int)=== | ||
+ | |||
+ | The unique numerical ID of this eprint. | ||
+ | |||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_rev_number --></div> | ||
+ | ===rev_number (int)=== | ||
+ | |||
+ | The number of the current revision of this record. | ||
+ | |||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_userid --></div> | ||
+ | ===userid (itemref)=== | ||
+ | |||
+ | The id of the user who deposited this eprint (if any). Scripted importing could cause this not to be set. | ||
+ | |||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_dir --></div> | ||
+ | ===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. | ||
+ | |||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_datestamp --></div> | ||
+ | ===datestamp (time)=== | ||
+ | |||
+ | The date this record first appeared live in the repository. | ||
+ | |||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_lastmod --></div> | ||
+ | ===lastmod (time)=== | ||
+ | |||
+ | The date this record was last modified. | ||
+ | |||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_status_changes --></div> | ||
+ | ===status_changes (time)=== | ||
+ | |||
+ | The date/time this record was moved between inbox, buffer, archive, etc. | ||
+ | |||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_type --></div> | ||
+ | ===type (namedset)=== | ||
+ | |||
+ | The type of this record, one of the types of the "eprint" dataset. | ||
+ | |||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_succeeds --></div> | ||
+ | ===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. | ||
+ | |||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_commentary --></div> | ||
+ | ===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. | ||
+ | |||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_replacedby --></div> | ||
+ | ===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. | ||
+ | |||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=head_see_also --></div> | ||
+ | ==SEE ALSO== | ||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=head_methods --></div> | ||
+ | ==METHODS== | ||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_get_all_documents --></div> | ||
+ | ===@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. | ||
+ | |||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_move_to_deletion --></div> | ||
+ | ===$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. | ||
+ | |||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_move_to_inbox --></div> | ||
+ | ===$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. | ||
+ | |||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_move_to_buffer --></div> | ||
+ | ===$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". | ||
+ | |||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_move_to_archive --></div> | ||
+ | ===$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. | ||
+ | |||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_local_path --></div> | ||
+ | ===$path = $eprint->local_path=== | ||
+ | |||
+ | Return the full path of the EPrint directory on the local filesystem. No trailing slash. | ||
+ | |||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_url_stem --></div> | ||
+ | ===$url = $eprint->url_stem=== | ||
+ | |||
+ | Return the URL to this EPrint's directory. Note, this INCLUDES the trailing slash, unlike the local_path method. | ||
+ | |||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_generate_static --></div> | ||
+ | ===$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. | ||
+ | |||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=item_get_user --></div> | ||
+ | ===$user = $eprint->get_user=== | ||
+ | |||
+ | Return the EPrints::User to whom this eprint belongs (if any). | ||
+ | |||
+ | <div style='background-color: #eef; margin: 0.5em 0em 1em 0em; border: solid 1px #cce; padding: 0em 1em 0em 1em; font-size: 80%; '> | ||
+ | <h4><span style='display:none'>User Comments</span></h4> | ||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki=_postamble_ --><!-- Edit below this comment --> |
Revision as of 16:00, 19 August 2009
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 '$eprintid': $eprint = EPrints::DataObj::EPrint->new( $handle, $eprintid ); # 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).