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

From EPrints Documentation
Jump to: navigation, search
Line 17: Line 17:
 
<!-- Pod2Wiki=head_description --></div>
 
<!-- Pod2Wiki=head_description --></div>
 
==DESCRIPTION==
 
==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.
+
This class represents a single eprint record and the metadata  associated with it. This is associated with one of more  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):
+
EPrints::DataObj::EPrint is a subclass of EPrints::DataObj with the following metadata fields (plus those defined in ArchiveMetadataFieldsConfig):
 
 
<div style='background-color: #e8e8f; 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 --></div>
 
==SYNOPSIS==
 
Inherrits all methods from [[API:EPrints/DataObj|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 '$eprint_id'.
 
  $eprint = $handle-&gt;get_eprint( $eprint_id );
 
 
 
  # open a public eprint with id '$eprint_id':
 
  $eprint = $handle-&gt;get_live_eprint( $eprint_id );
 
 
 
  # 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: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
Line 197: Line 143:
  
  
<!-- Pod2Wiki=head_see_also --></div>
+
<!-- Pod2Wiki=head_methods --></div>
==SEE ALSO==
+
==METHODS==
 +
<div style='background-color: #e8e8f; 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_system_field_info --></div>
 +
===$metadata = EPrints::DataObj::EPrint-&gt;get_system_field_info===
 +
 
 +
Return an array describing the system metadata of the EPrint dataset.
 +
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<div style='background-color: #e8e8f; 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>
 
<h4><span style='display:none'>User Comments</span></h4>
Line 204: Line 160:
  
  
<!-- Pod2Wiki=head_methods --></div>
+
<!-- Pod2Wiki=item_set_item_issues --></div>
==METHODS==
+
===$eprint-&gt;set_item_issues( $new_issues )===
 +
 
 +
This method updates the issues attached to this eprint based on the new issues passed.
 +
 
 +
If an existing issue is set as "discovered" and doesn't exist in $new_issues its status will be updated to "autoresolved", otherwise the old issue's status and description are updated.
 +
 
 +
Any issues in $new_issues that don't already exist will be appended.
 +
 
 +
<div style='background-color: #e8e8f; 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_dataset_id --></div>
 +
===$dataset = EPrints::DataObj::EPrint-&gt;get_dataset_id===
 +
 
 +
Returns the id of the [[API:EPrints/DataSet|EPrints::DataSet]] object to which this record belongs.
 +
 
 +
<div style='background-color: #e8e8f; 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_dataset --></div>
 +
===$dataset = $eprint-&gt;get_dataset===
 +
 
 +
Return the dataset to which this object belongs. This will return one of the virtual datasets: inbox, buffer, archive or deletion.
 +
 
 +
<div style='background-color: #e8e8f; 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_defaults --></div>
 +
===$defaults = EPrints::DataObj::EPrint-&gt;get_defaults( $session, $data )===
 +
 
 +
Return default values for this object based on the starting data.
 +
 
 +
<div style='background-color: #e8e8f; 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_clone --></div>
 +
===$eprint = $eprint-&gt;clone( $dest_dataset, $copy_documents, $link )===
 +
 
 +
Create a copy of this EPrint with a new ID in the given dataset. Return the new eprint, or undef in the case of an error.
 +
 
 +
If $copy_documents is set and true then the documents (and files) will be copied in addition to the metadata.
 +
 
 +
If $nolink is true then the new eprint is not connected to the old one.
 +
 
 +
<div style='background-color: #e8e8f; 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_log_mail_owner --></div>
 +
===$eprint-&gt;log_mail_owner( $mail )===
 +
 
 +
Log that the given mail message was send to the owner of this EPrint.
 +
 
 +
$mail is the same XHTML DOM that was sent as the email.
 +
 
 +
<div style='background-color: #e8e8f; 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_editorial_contact --></div>
 +
===$user = $eprint-&gt;get_editorial_contact===
 +
 
 +
Return the user identified as the editorial contact for this item.
 +
 
 +
By default returns undef.
 +
 
 +
nb. This has nothing to do with the editor defined in the metadata
 +
 
 +
<div style='background-color: #e8e8f; 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_remove --></div>
 +
===$success = $eprint-&gt;remove===
 +
 
 +
Erase this eprint and any associated records from the database and filesystem.
 +
 
 +
This should only be called on eprints in "inbox" or "buffer".
 +
 
 +
<div style='background-color: #e8e8f; 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_commit --></div>
 +
===$success = $eprint-&gt;commit( [$force] );===
 +
 
 +
Commit any changes that might have been made to the database.
 +
 
 +
If the item has not be changed then this function does nothing unless $force is true.
 +
 
 +
Calls {{API:PodLink|file=|package_name=|section=set_eprint_automatic_fields|text=/set_eprint_automatic_fields}} just before the <tt>$eprint</tt> is committed.
 +
 
 +
<div style='background-color: #e8e8f; 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_write_revision --></div>
 +
===$eprint-&gt;write_revision===
 +
 
 +
Write out a snapshot of the XML describing the current state of the eprint.
 +
 
 +
<div style='background-color: #e8e8f; 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_validate --></div>
 +
===$problems = $eprint-&gt;validate( [$for_archive], $workflow_id )===
 +
 
 +
Return a reference to an array of XHTML DOM objects describing validation problems with the entire eprint based on $workflow_id.
 +
 
 +
If $workflow_id is undefined defaults to "default".
 +
 
 +
A reference to an empty array indicates no problems.
 +
 
 +
Calls {{API:PodLink|file=|package_name=|section=validate_eprint|text=/validate_eprint}} for the <tt>$eprint</tt>.
 +
 
 +
<div style='background-color: #e8e8f; 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_skip_validation --></div>
 +
===$boolean = $eprint-&gt;skip_validation===
 +
 
 +
Returns true if this eprint should pass validation without being properly validated. This is to allow the use of dodgey data imported from legacy systems.
 +
 
 +
<div style='background-color: #e8e8f; 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_prune_documents --></div>
 +
===$eprint-&gt;prune_documents===
 +
 
 +
Remove any documents associated with this eprint which don't actually have any files.
 +
 
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<div style='background-color: #e8e8f; 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>
 
<h4><span style='display:none'>User Comments</span></h4>
Line 216: Line 321:
 
Return an array of all EPrint::Document objects associated with this eprint.
 
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: #e8e8f; 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_required_formats --></div>
 +
===@formats =  $eprint-&gt;required_formats===
 +
 
 +
Return a list of the required formats for this  eprint. Only one of the required formats is required, not all.
 +
 
 +
An empty list means no format is required.
  
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
Line 226: Line 341:
 
===$success = $eprint-&gt;move_to_deletion===
 
===$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.
+
Transfer the EPrint into the "deletion" dataset. Should only be called in eprints in the "archive" dataset.
 
 
nb. This does not delete the eprint.
 
  
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
Line 238: Line 351:
 
===$success = $eprint-&gt;move_to_inbox===
 
===$success = $eprint-&gt;move_to_inbox===
  
Transfer the EPrint into the "inbox" dataset. Should only be called for eprints in the "buffer" dataset.
+
Transfer the EPrint into the "inbox" dataset. Should only be called in eprints in the "buffer" dataset.
 
 
This means moving it back to the user workarea.
 
  
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
Line 250: Line 361:
 
===$success = $eprint-&gt;move_to_buffer===
 
===$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.
+
Transfer the EPrint into the "buffer" dataset. Should only be called in eprints in the "inbox" or "archive" dataset.
 
 
"buffer" is the internal code for the "review area".
 
  
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
Line 262: Line 371:
 
===$success = $eprint-&gt;move_to_archive===
 
===$success = $eprint-&gt;move_to_archive===
  
Move this eprint into the main "archive" dataset. Normally only called for eprints in "deletion" or "buffer" datasets.
+
Move this eprint into the main "archive" dataset. Normally only called on eprints in "deletion" or "buffer" datasets.
 
 
This causes the item to appear on the website.
 
  
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
Line 297: Line 404:
  
 
If called on inbox or buffer, remove the abstract page.
 
If called on inbox or buffer, remove the abstract page.
 +
 +
<div style='background-color: #e8e8f; 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_all_related --></div>
 +
===$eprint-&gt;generate_static_all_related===
 +
 +
Generate the static pages for this eprint plus any it's related to, by succession or commentary.
 +
 +
<div style='background-color: #e8e8f; 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_remove_static --></div>
 +
===$eprint-&gt;remove_static===
 +
 +
Remove the static web page or pages.
 +
 +
<div style='background-color: #e8e8f; 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_render --></div>
 +
===( $description, $title, $links ) = $eprint-&gt;render===
 +
 +
Render the eprint. The 3 returned values are references to XHTML DOM objects. $description is the public viewable description of this eprint that appears as the body of the abstract page. $title is the title of the abstract page for this eprint. $links is any elements which should go in the &lt;head&gt; of this page.
 +
 +
Calls {{API:PodLink|file=|package_name=|section=eprint_render|text=/eprint_render}} to actually render the <tt>$eprint</tt>, if it isn't deleted.
 +
 +
<div style='background-color: #e8e8f; 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_render_history --></div>
 +
===( $html ) = $eprint-&gt;render_history===
 +
 +
Render the history of this eprint as XHTML DOM.
 +
 +
<div style='background-color: #e8e8f; 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_control_url --></div>
 +
===$url = $eprint-&gt;get_control_url===
 +
 +
Return the URL of the control page for this eprint.
 +
 +
<div style='background-color: #e8e8f; 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_url --></div>
 +
===$url = $eprint-&gt;get_url===
 +
 +
Return the public URL of this eprints abstract page.
  
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
Line 307: Line 476:
  
 
Return the EPrints::User to whom this eprint belongs (if any).
 
Return the EPrints::User to whom this eprint belongs (if any).
 +
 +
<div style='background-color: #e8e8f; 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_related --></div>
 +
===@eprints = $eprint-&gt;get_all_related===
 +
 +
Return the eprints that are related in some way to this in a succession or commentary thread. The returned list does NOT include this EPrint.
 +
 +
<div style='background-color: #e8e8f; 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_in_thread --></div>
 +
===$boolean = $eprint-&gt;in_thread( $field )===
 +
 +
Return true if this eprint is part of a thread of $field. $field should be an EPrint::MetaField representing either "commentary" or "succeeds".
 +
 +
<div style='background-color: #e8e8f; 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_first_in_thread --></div>
 +
===$eprint = $eprint-&gt;first_in_thread( $field )===
 +
 +
Return the first (earliest) version or first paper in the thread of commentaries of this paper in the repository.
 +
 +
<div style='background-color: #e8e8f; 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_later_in_thread --></div>
 +
===@eprints = $eprint-&gt;later_in_thread( $field )===
 +
 +
Return a list of the immediately later items in the thread.
 +
 +
<div style='background-color: #e8e8f; 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_all_in_thread --></div>
 +
===@eprints = $eprint-&gt;all_in_thread( $field )===
 +
 +
Return all of the EPrints in the given thread.
 +
 +
<div style='background-color: #e8e8f; 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_last_in_thread --></div>
 +
===$eprint = $eprint-&gt;last_in_thread( $field )===
 +
 +
Return the last item in the specified thread.
 +
 +
<div style='background-color: #e8e8f; 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_remove_from_threads --></div>
 +
===$eprint-&gt;remove_from_threads===
 +
 +
Extract the eprint from any threads it's in. i.e., if any other paper is a later version of or commentary on this paper, the link from that paper to this will be removed.
 +
 +
Abstract pages are updated if needed.
 +
 +
<div style='background-color: #e8e8f; 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_render_version_thread --></div>
 +
===$xhtml = $eprint-&gt;render_version_thread( $field )===
 +
 +
Render XHTML DOM describing the entire thread as nested unordered lists.
 +
 +
<div style='background-color: #e8e8f; 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_loop_error --></div>
 +
===$eprint-&gt;loop_error( $field, @looped_ids )===
 +
 +
This eprint is part of a threading loop which is not allowed. Log a warning.
 +
 +
<div style='background-color: #e8e8f; 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_type --></div>
 +
===$type = $eprint-&gt;get_type===
 +
 +
Return the type of this eprint.
 +
 +
<div style='background-color: #e8e8f; 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_render_export_links --></div>
 +
===$xhtml_ul_list = $eprint-&gt;render_export_links( [$staff] )===
 +
 +
Return a &lt;ul&gt; list containing links to all the formats this eprint is available in.
 +
 +
If $staff is true then show all formats available to staff, and link to the staff export URL.
 +
 +
<div style='background-color: #e8e8f; 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_user_roles --></div>
 +
===@roles = $eprint-&gt;user_roles( $user )===
 +
 +
Return the @roles $user has on $eprint.
 +
 +
<div style='background-color: #e8e8f; 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>
 +
===$eprint-&gt;datestamp===
 +
 +
DEPRECATED.
 +
 +
<div style='background-color: #e8e8f; 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_in_editorial_scope_of --></div>
 +
===$boolean = $eprint-&gt;in_editorial_scope_of( $possible_editor )===
 +
 +
Returns true if $possible_editor can edit this eprint. This is according to the user editperms.
 +
 +
This does not mean the user has the editor priv., just that if they do then they may edit the given item.
 +
 +
<div style='background-color: #e8e8f; 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_has_owner --></div>
 +
===$boolean = $eprint-&gt;has_owner( $possible_owner )===
 +
 +
Returns true if $possible_owner can edit this eprint. This is according to the user editperms.
 +
 +
This does not mean the user has the editor priv., just that if they do then they may edit the given item.
 +
 +
Uses the callback "does_user_own_eprint" if available.
 +
 +
<div style='background-color: #e8e8f; 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_obtain_lock --></div>
 +
===$boolean = $eprint-&gt;obtain_lock( $user )===
 +
 +
<div style='background-color: #e8e8f; 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_could_obtain_lock --></div>
 +
===$boolean = $eprint-&gt;could_obtain_lock( $user )===
 +
 +
<div style='background-color: #e8e8f; 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_is_locked --></div>
 +
===$boolean = $eprint-&gt;is_locked()===
 +
 +
<div style='background-color: #e8e8f; 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_render_edit_lock --></div>
 +
===$xhtml = render_edit_lock( $session, $value )===
 +
 +
<div style='background-color: #e8e8f; 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_callbacks --></div>
 +
==CALLBACKS==
 +
Callbacks may optionally be defined in the ArchiveConfig.
 +
 +
<div style='background-color: #e8e8f; 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_validate_field --></div>
 +
===validate_field===
 +
 +
  validate_field( $field, $value, $session, [$for_archive] )
 +
 
 +
<div style='background-color: #e8e8f; 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_validate_eprint --></div>
 +
===validate_eprint===
 +
 +
  validate_eprint( $eprint, $session, [$for_archive] )
 +
 
 +
<div style='background-color: #e8e8f; 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_set_eprint_defaults --></div>
 +
===set_eprint_defaults===
 +
 +
  set_eprint_defaults( $data, $session )
 +
 
 +
<div style='background-color: #e8e8f; 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_set_eprint_automatic_fields --></div>
 +
===set_eprint_automatic_fields===
 +
 +
  set_eprint_automatic_fields( $eprint )
 +
 
 +
<div style='background-color: #e8e8f; 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_eprint_render --></div>
 +
===eprint_render===
 +
 +
  eprint_render( $eprint, $session )
 +
 
 +
See {{API:PodLink|file=ArchiveRenderConfig|package_name=ArchiveRenderConfig|section=eprint_render|text=ArchiveRenderConfig/eprint_render}}.
  
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>

Revision as of 16:34, 12 February 2010


EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


API: Core API

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

User Comments


DESCRIPTION

This class represents a single eprint record and the metadata associated with it. This is associated with one of more EPrint::Document objects.

EPrints::DataObj::EPrint is a subclass of EPrints::DataObj with the following metadata fields (plus those defined in ArchiveMetadataFieldsConfig):

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


METHODS

User Comments


$metadata = EPrints::DataObj::EPrint->get_system_field_info

Return an array describing the system metadata of the EPrint dataset.

User Comments


$eprint->set_item_issues( $new_issues )

This method updates the issues attached to this eprint based on the new issues passed.

If an existing issue is set as "discovered" and doesn't exist in $new_issues its status will be updated to "autoresolved", otherwise the old issue's status and description are updated.

Any issues in $new_issues that don't already exist will be appended.

User Comments


$dataset = EPrints::DataObj::EPrint->get_dataset_id

Returns the id of the EPrints::DataSet object to which this record belongs.

User Comments


$dataset = $eprint->get_dataset

Return the dataset to which this object belongs. This will return one of the virtual datasets: inbox, buffer, archive or deletion.

User Comments


$defaults = EPrints::DataObj::EPrint->get_defaults( $session, $data )

Return default values for this object based on the starting data.

User Comments


$eprint = $eprint->clone( $dest_dataset, $copy_documents, $link )

Create a copy of this EPrint with a new ID in the given dataset. Return the new eprint, or undef in the case of an error.

If $copy_documents is set and true then the documents (and files) will be copied in addition to the metadata.

If $nolink is true then the new eprint is not connected to the old one.

User Comments


$eprint->log_mail_owner( $mail )

Log that the given mail message was send to the owner of this EPrint.

$mail is the same XHTML DOM that was sent as the email.

User Comments


$user = $eprint->get_editorial_contact

Return the user identified as the editorial contact for this item.

By default returns undef.

nb. This has nothing to do with the editor defined in the metadata

User Comments


$success = $eprint->remove

Erase this eprint and any associated records from the database and filesystem.

This should only be called on eprints in "inbox" or "buffer".

User Comments


$success = $eprint->commit( [$force] );

Commit any changes that might have been made to the database.

If the item has not be changed then this function does nothing unless $force is true.

Calls /set_eprint_automatic_fields just before the $eprint is committed.

User Comments


$eprint->write_revision

Write out a snapshot of the XML describing the current state of the eprint.

User Comments


$problems = $eprint->validate( [$for_archive], $workflow_id )

Return a reference to an array of XHTML DOM objects describing validation problems with the entire eprint based on $workflow_id.

If $workflow_id is undefined defaults to "default".

A reference to an empty array indicates no problems.

Calls /validate_eprint for the $eprint.

User Comments


$boolean = $eprint->skip_validation

Returns true if this eprint should pass validation without being properly validated. This is to allow the use of dodgey data imported from legacy systems.

User Comments


$eprint->prune_documents

Remove any documents associated with this eprint which don't actually have any files.

User Comments


@documents = $eprint->get_all_documents

Return an array of all EPrint::Document objects associated with this eprint.

User Comments


@formats = $eprint->required_formats

Return a list of the required formats for this eprint. Only one of the required formats is required, not all.

An empty list means no format is required.

User Comments


$success = $eprint->move_to_deletion

Transfer the EPrint into the "deletion" dataset. Should only be called in eprints in the "archive" dataset.

User Comments


$success = $eprint->move_to_inbox

Transfer the EPrint into the "inbox" dataset. Should only be called in eprints in the "buffer" dataset.

User Comments


$success = $eprint->move_to_buffer

Transfer the EPrint into the "buffer" dataset. Should only be called in eprints in the "inbox" or "archive" dataset.

User Comments


$success = $eprint->move_to_archive

Move this eprint into the main "archive" dataset. Normally only called on eprints in "deletion" or "buffer" datasets.

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


$eprint->generate_static_all_related

Generate the static pages for this eprint plus any it's related to, by succession or commentary.

User Comments


$eprint->remove_static

Remove the static web page or pages.

User Comments


( $description, $title, $links ) = $eprint->render

Render the eprint. The 3 returned values are references to XHTML DOM objects. $description is the public viewable description of this eprint that appears as the body of the abstract page. $title is the title of the abstract page for this eprint. $links is any elements which should go in the <head> of this page.

Calls /eprint_render to actually render the $eprint, if it isn't deleted.

User Comments


( $html ) = $eprint->render_history

Render the history of this eprint as XHTML DOM.

User Comments


$url = $eprint->get_control_url

Return the URL of the control page for this eprint.

User Comments


$url = $eprint->get_url

Return the public URL of this eprints abstract page.

User Comments


$user = $eprint->get_user

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

User Comments


@eprints = $eprint->get_all_related

Return the eprints that are related in some way to this in a succession or commentary thread. The returned list does NOT include this EPrint.

User Comments


$boolean = $eprint->in_thread( $field )

Return true if this eprint is part of a thread of $field. $field should be an EPrint::MetaField representing either "commentary" or "succeeds".

User Comments


$eprint = $eprint->first_in_thread( $field )

Return the first (earliest) version or first paper in the thread of commentaries of this paper in the repository.

User Comments


@eprints = $eprint->later_in_thread( $field )

Return a list of the immediately later items in the thread.

User Comments


@eprints = $eprint->all_in_thread( $field )

Return all of the EPrints in the given thread.

User Comments


$eprint = $eprint->last_in_thread( $field )

Return the last item in the specified thread.

User Comments


$eprint->remove_from_threads

Extract the eprint from any threads it's in. i.e., if any other paper is a later version of or commentary on this paper, the link from that paper to this will be removed.

Abstract pages are updated if needed.

User Comments


$xhtml = $eprint->render_version_thread( $field )

Render XHTML DOM describing the entire thread as nested unordered lists.

User Comments


$eprint->loop_error( $field, @looped_ids )

This eprint is part of a threading loop which is not allowed. Log a warning.

User Comments


$type = $eprint->get_type

Return the type of this eprint.

User Comments


$xhtml_ul_list = $eprint->render_export_links( [$staff] )

Return a <ul> list containing links to all the formats this eprint is available in.

If $staff is true then show all formats available to staff, and link to the staff export URL.

User Comments


@roles = $eprint->user_roles( $user )

Return the @roles $user has on $eprint.

User Comments


$eprint->datestamp

DEPRECATED.

User Comments


$boolean = $eprint->in_editorial_scope_of( $possible_editor )

Returns true if $possible_editor can edit this eprint. This is according to the user editperms.

This does not mean the user has the editor priv., just that if they do then they may edit the given item.

User Comments


$boolean = $eprint->has_owner( $possible_owner )

Returns true if $possible_owner can edit this eprint. This is according to the user editperms.

This does not mean the user has the editor priv., just that if they do then they may edit the given item.

Uses the callback "does_user_own_eprint" if available.

User Comments


$boolean = $eprint->obtain_lock( $user )

User Comments


$boolean = $eprint->could_obtain_lock( $user )

User Comments


$boolean = $eprint->is_locked()

User Comments


$xhtml = render_edit_lock( $session, $value )

User Comments


CALLBACKS

Callbacks may optionally be defined in the ArchiveConfig.

User Comments


validate_field

 validate_field( $field, $value, $session, [$for_archive] )
 

User Comments


validate_eprint

 validate_eprint( $eprint, $session, [$for_archive] )
 

User Comments


set_eprint_defaults

 set_eprint_defaults( $data, $session )
 

User Comments


set_eprint_automatic_fields

 set_eprint_automatic_fields( $eprint )
 

User Comments


eprint_render

 eprint_render( $eprint, $session )
 

See ArchiveRenderConfig/eprint_render.

User Comments