Difference between revisions of "API:EPrints/DataObj/EPrint"
Line 1: | Line 1: | ||
<!-- Pod2Wiki=_preamble_ | <!-- 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. | 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. | ||
− | -->{{API}}{{Pod2Wiki}}{{API:Source|file=EPrints/DataObj/EPrint.pm|package_name=EPrints::DataObj::EPrint}}[[Category:API|EPRINT]][[Category:API:EPrints/DataObj|EPRINT]][[Category:API:EPrints/DataObj/EPrint|EPRINT]]<div><!-- Edit below this comment --> | + | -->{{API}}{{Pod2Wiki}}{{API:Source|file=perl_lib/EPrints/DataObj/EPrint.pm|package_name=EPrints::DataObj::EPrint}}[[Category:API|EPRINT]][[Category:API:EPrints/DataObj|EPRINT]][[Category:API:EPrints/DataObj/EPrint|EPRINT]]<div><!-- Edit below this comment --> |
Revision as of 15:26, 16 December 2011
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
Contents
- 1 NAME
- 2 DESCRIPTION
- 3 SYSTEM METADATA
- 4 METHODS
- 4.1 get_system_field_info
- 4.2 set_item_issues
- 4.3 fileinfo
- 4.4 get_dataset_id
- 4.5 get_dataset
- 4.6 get_defaults
- 4.7 clone
- 4.8 log_mail_owner
- 4.9 get_editorial_contact
- 4.10 remove
- 4.11 commit
- 4.12 save_revision
- 4.13 validate
- 4.14 skip_validation
- 4.15 prune_documents
- 4.16 get_all_documents
- 4.17 move_to_deletion
- 4.18 move_to_inbox
- 4.19 move_to_buffer
- 4.20 move_to_archive
- 4.21 local_path
- 4.22 url_stem
- 4.23 generate_static
- 4.24 remove_static
- 4.25 render
- 4.26 render_history
- 4.27 get_control_url
- 4.28 get_url
- 4.29 get_user
- 4.30 in_thread
- 4.31 first_in_thread
- 4.32 last_in_thread
- 4.33 render_version_thread
- 4.34 get_type
- 4.35 user_roles
- 4.36 in_editorial_scope_of
- 4.37 has_owner
- 4.38 obtain_lock
- 4.39 remove_lock
- 4.40 could_obtain_lock
- 4.41 is_locked
- 4.42 render_edit_lock
- 5 CALLBACKS
- 6 COPYRIGHT
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 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):
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.
metadata_visibility (set)
This field is automatically set.
show - appears normally no_search - hidden from search/views
The 'hide' option may be used to force an eprint to not appear in search/views but is not considered a stable option.
METHODS
get_system_field_info
$metadata = EPrints::DataObj::EPrint->get_system_field_info
Return an array describing the system metadata of the EPrint dataset.
set_item_issues
$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.
fileinfo
$eprint->fileinfo()
The special fileinfo field contains the icon URL and main-file URL for each non-volatile document in the eprint. This is a performance tweak to avoid having to retrieve documents when rendering eprint citations.
Example:
/style/images/fileicons/application_pdf.png;/20/1/paper.pdf|/20/4.hassmallThumbnailVersion/tdb_portrait.jpg;/20/4/tdb_portrait.jpg
These URLs are relative to the current repository base path ('http_url').
get_dataset_id
$dataset = EPrints::DataObj::EPrint->get_dataset_id
Returns the id of the EPrints::DataSet object to which this record belongs.
get_dataset
$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.
get_defaults
$defaults = EPrints::DataObj::EPrint->get_defaults( $session, $data )
Return default values for this object based on the starting data.
clone
$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.
log_mail_owner
$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.
get_editorial_contact
$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
remove
$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".
commit
$success = $eprint->commit( [$force] );
Commit any changes to the database.
Calls update_triggers just before the database is updated.
The actions this method does are dependent on some object attributes:
changed - HASH of changed fields (from EPrints::DataObj) non_volatile_change - BOOL (from EPrints::DataObj) under_construction - BOOL
If datestamp is unset and this eprint is in the archive dataset datestamp will always be set which will in turn set datestamp as changed.
If no field values were changed and $force is false returns.
If under_construction is false:
- static files updated
If non_volatile_change is true:
- lastmod field updated - triples update queued
If under_construction is false and non_volatile_change is true:
- revision generated
The goal of these controls is to only trigger expensive processes in response to user actions. Revisions need to be generated when the user changes metadata or uploads new files (see EPrints::DataObj::Document/commit).
save_revision
$eprint->save_revision( %opts )
Increase the eprint revision number and save a complete copy of the record into the history (see EPrints::DataObj::History).
Options:
user - user that caused the action to occur, defaults to current user action - see history.action, defaults to "modify" details - see history.details, defaults to a description of changed fields
validate
$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.
skip_validation
$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.
prune_documents
$eprint->prune_documents
Remove any documents associated with this eprint which don't actually have any files.
get_all_documents
@documents = $eprint->get_all_documents
Return a list of all EPrint::Document objects associated with this eprint excluding documents with a "isVolatileVersionOf" relation (e.g. thumbnails).
move_to_deletion
$success = $eprint->move_to_deletion
Transfer the EPrint into the "deletion" dataset. Should only be called in eprints in the "archive" dataset.
move_to_inbox
$success = $eprint->move_to_inbox
Transfer the EPrint into the "inbox" dataset. Should only be called in eprints in the "buffer" dataset.
move_to_buffer
$success = $eprint->move_to_buffer
Transfer the EPrint into the "buffer" dataset. Should only be called in eprints in the "inbox" or "archive" dataset.
move_to_archive
$success = $eprint->move_to_archive
Move this eprint into the main "archive" dataset. Normally only called on eprints in "deletion" or "buffer" datasets.
local_path
$path = $eprint->local_path
Return the full path of the EPrint directory on the local filesystem. No trailing slash.
url_stem
$url = $eprint->url_stem
Return the URL to this EPrint's directory. Note, this INCLUDES the trailing slash, unlike the local_path method.
generate_static
$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.
remove_static
$eprint->remove_static
Remove the static web page or pages.
render
( $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.
render_history
( $html ) = $eprint->render_history
Render the history of this eprint as XHTML DOM.
get_control_url
$url = $eprint->get_control_url
Return the URL of the control page for this eprint.
get_url
$url = $eprint->get_url
Return the public URL of this eprints abstract page.
get_user
$user = $eprint->get_user
Return the EPrints::DataObj::User to whom this eprint belongs (if any).
in_thread
$bool = $eprint->in_thread( $field )
Returns true if this eprint is in the $field thread.
first_in_thread
$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.
last_in_thread
$eprint = $eprint->last_in_thread( $field )
Returns the latest item in the $field thread on this eprint's branch of the thread tree.
render_version_thread
$xhtml = $eprint->render_version_thread( $field )
Render XHTML DOM describing the entire thread as nested unordered lists.
get_type
$type = $eprint->get_type
Return the type of this eprint.
user_roles
@roles = $eprint->user_roles( $user )
Return the @roles $user has on $eprint.
in_editorial_scope_of
$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.
has_owner
$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.
obtain_lock
$boolean = $eprint->obtain_lock( $user )
remove_lock
$boolean = $eprint->remove_lock( $user )
could_obtain_lock
$boolean = $eprint->could_obtain_lock( $user )
is_locked
$boolean = $eprint->is_locked()
render_edit_lock
$xhtml = render_edit_lock( $session, $value )
CALLBACKS
Callbacks may optionally be defined in the ArchiveConfig.
validate_field
validate_field( $field, $value, $session, [$for_archive] )
validate_eprint
validate_eprint( $eprint, $session, [$for_archive] )
set_eprint_defaults
set_eprint_defaults( $data, $session )
set_eprint_automatic_fields
set_eprint_automatic_fields( $eprint )
eprint_render
eprint_render( $eprint, $session )
See ArchiveRenderConfig/eprint_render.
COPYRIGHT