Difference between revisions of "API:EPrints/DataObj/EPrint"

From EPrints Documentation
Jump to: navigation, search
Line 1: Line 1:
we
+
<!-- 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-&gt;get_dataset( "inbox" );
 +
  my $epdata = { userid =&gt; $user-&gt;get_id, title =&gt; "Default title" };
 +
  my $eprint = $inbox_ds-&gt;create_object( $handle, $epdata );
 +
 
 +
  # open the eprint with id '$eprintid':
 +
  $eprint = EPrints::DataObj::EPrint-&gt;new( $handle, $eprintid ); 
 +
 
 +
  # set some metadata:
 +
  $eprint-&gt;set_value( "title", "The title of this eprint" );
 +
 
 +
  # un-set some metadata:
 +
  $eprint-&gt;set_value( "abstract", undef );
 +
 
 +
  # retrieve some metatada:
 +
  my $title = $eprint-&gt;get_value( "title" );
 +
 
 +
  # commit values to the database:
 +
  $eprint-&gt;commit;
 +
 
 +
  # delete an eprint object *forever*:
 +
  $eprint-&gt;remove;
 +
 
 +
  # render all the documents of an eprint:
 +
  foreach my $doc ( $eprint-&gt;get_all_documents )
 +
  {
 +
    $page-&gt;appendChild( $doc-&gt;render_citation );
 +
  }
 +
 
 +
  # move an eprint back to the owner's inbox:
 +
  $eprint-&gt;move_to_inbox;
 +
 
 +
  # redirect to the eprint's abstract page:
 +
  $handle-&gt;redirect( $eprint-&gt;get_url );
 +
 
 +
  # render some of the eprint's metadata
 +
  $page-&gt;appendChild( $eprint-&gt;render_value( "title" ) );
 +
 
 +
  # render information about the owner of the eprint:
 +
  my $xhtml = $eprint-&gt;get_user-&gt;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-&gt;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-&gt;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-&gt;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-&gt;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-&gt;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-&gt;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-&gt;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-&gt;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-&gt;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.3, 3.2) | Revision Log | Before editing this page please read Pod2Wiki


NAME

EPrints::DataObj::EPrint - Class representing an actual EPrint

User Comments


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):

User Comments


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;
 

User Comments


SYSTEM METADATA

User Comments


eprintid (int)

The unique numerical ID of this eprint.

User Comments


rev_number (int)

The number of the current revision of this record.

User Comments


userid (itemref)

The id of the user who deposited this eprint (if any). Scripted importing could cause this not to be set.

User Comments


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.

User Comments


datestamp (time)

The date this record first appeared live in the repository.

User Comments


lastmod (time)

The date this record was last modified.

User Comments


status_changes (time)

The date/time this record was moved between inbox, buffer, archive, etc.

User Comments


type (namedset)

The type of this record, one of the types of the "eprint" dataset.

User Comments


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.

User Comments


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.

User Comments


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.

User Comments


SEE ALSO

User Comments


METHODS

User Comments


@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.

User Comments


$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.

User Comments


$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.

User Comments


$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".

User Comments


$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.

User Comments


$path = $eprint->local_path

Return the full path of the EPrint directory on the local filesystem. No trailing slash.

User Comments


$url = $eprint->url_stem

Return the URL to this EPrint's directory. Note, this INCLUDES the trailing slash, unlike the local_path method.

User Comments


$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 Comments


$user = $eprint->get_user

Return the EPrints::User to whom this eprint belongs (if any).

User Comments