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

From EPrints Documentation
Jump to: navigation, search
Line 28: Line 28:
 
<!-- Pod2Wiki=head_synopsis --></div>
 
<!-- Pod2Wiki=head_synopsis --></div>
 
==SYNOPSIS==
 
==SYNOPSIS==
Inherrits all methods {{API:PodLink|file=from EPrints/DataObj|package_name=from EPrints::DataObj|section=|text=from EPrints::DataObj}}.
+
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


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 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 '$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;
 

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