EPrints::DataObj::EPrint - Class representing an actual EPrint
- 1 DESCRIPTION
- 2 SYSTEM METADATA
- 3 METHODS
- 3.1 get_system_field_info
- 3.2 get_dataset_id
- 3.3 get_dataset
- 3.4 get_defaults
- 3.5 clone
- 3.6 log_mail_owner
- 3.7 get_editorial_contact
- 3.8 remove
- 3.9 commit
- 3.10 write_revision
- 3.11 validate
- 3.12 get_warnings
- 3.13 skip_validation
- 3.14 prune_documents
- 3.15 get_all_documents
- 3.16 required_formats
- 3.17 move_to_deletion
- 3.18 move_to_inbox
- 3.19 move_to_buffer
- 3.20 move_to_archive
- 3.21 local_path
- 3.22 url_stem
- 3.23 generate_static
- 3.24 generate_static_all_related
- 3.25 remove_static
- 3.26 render
- 3.27 render_history
- 3.28 get_control_url
- 3.29 get_url
- 3.30 get_user
- 3.31 eprintid_to_path
- 3.32 get_all_related
- 3.33 in_thread
- 3.34 first_in_thread
- 3.35 later_in_thread
- 3.36 all_in_thread
- 3.37 last_in_thread
- 3.38 remove_from_threads
- 3.39 render_version_thread
- 3.40 loop_error
- 3.41 get_type
- 3.42 render_export_links
- 3.43 user_roles
- 3.44 datestamp
- 3.45 in_editorial_scope_of
- 3.46 has_owner
- 3.47 obtain_lock
- 3.48 could_obtain_lock
- 3.49 is_locked
- 3.50 render_edit_lock
- 4 CALLBACKS
- 5 UNDOCUMENTED METHODS
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 followingmetadata fields (plus those defined in ArchiveMetadataFieldsConfig):
The unique numerical ID of this eprint.
The number of the current revision of this record.
The id of the user who deposited this eprint (if any). Scripted importingcould cause this not to be set.
The directory, relative to the documents directory for this repository, whichthis eprints data is stored in. Eg. disk0/00/00/03/34 for record 334.
The date this record first appeared live in the repository.
The date this record was last modified.
The date/time this record was moved between inbox, buffer, archive, etc.
The type of this record, one of the types of the "eprint" dataset.
The ID of the eprint (if any) which this succeeds. This field should havebeen an int and may be changed in a later upgrade.
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.
The ID of the eprint (if any) which has replaced this eprint. This is only seton records in the "deletion" dataset. This field should havebeen an int and may be changed in a later upgrade.
$metadata = EPrints::DataObj::EPrint->get_system_field_info
Return an array describing the system metadata of the EPrint dataset.
$dataset = EPrints::DataObj::EPrint->get_dataset_id
Returns the id of the EPrints::DataSet object to which this record belongs.
$dataset = $eprint->get_dataset
Return the dataset to which this object belongs. This will returnone of the virtual datasets: inbox, buffer, archive or deletion.
$defaults = EPrints::DataObj::EPrint->get_defaults( $session, $data )
Return default values for this object based on the starting data.
$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 theold one.
$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 = $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
$success = $eprint->remove
Erase this eprint and any associated records from the database andfilesystem. This should only be called on eprints in "inbox" or "buffer".
$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 L!/set_eprint_automatic_fields! just before the $eprint is committed.
Write out a snapshot of the XML describing the current state of theeprint.
$problems = $eprint->validate( [$for_archive], $workflow_id )
Return a reference to an array of XHTML DOM objects describingvalidation 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 L!/validate_eprint! for the $eprint.
$warnings = $eprint->get_warnings
Return a reference to an array of XHTML DOM objects describingwarnings about this eprint - that is things that are not quite validation errors, but it'd be nice if they were fixed. Calls L!/eprint_warnings! for the $eprint.
$boolean = $eprint->skip_validation
Returns true if this eprint should pass validation without beingproperly validated. This is to allow the use of dodgey data importedfrom legacy systems.
Remove any documents associated with this eprint which don't actuallyhave any files.
@documents = $eprint->get_all_documents
Return an array of all EPrint::Document objects associated with thiseprint.
@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.
$success = $eprint->move_to_deletion
Transfer the EPrint into the "deletion" dataset. Should only becalled in eprints in the "archive" dataset.
$success = $eprint->move_to_inbox
Transfer the EPrint into the "inbox" dataset. Should only becalled in eprints in the "buffer" dataset.
$success = $eprint->move_to_buffer
Transfer the EPrint into the "buffer" dataset. Should only becalled in eprints in the "inbox" or "archive" dataset.
$success = $eprint->move_to_archive
Move this eprint into the main "archive" dataset. Normally only calledon eprints in "deletion" or "buffer" datasets.
$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 thetrailing slash, unlike the local_path method.
Generate the static version of the abstract web page. In a multi-languagerepository this will generate one version per language. If called on inbox or buffer, remove the abstract page.
Generate the static pages for this eprint plus any it's related to,by succession or commentary.
Remove the static web page or pages.
( $description, $title, $links ) = $eprint->render
Render the eprint. The 3 returned values are references to XHTML DOMobjects. $description is the public viewable description of this eprintthat appears as the body of the abstract page. $title is the title ofthe abstract page for this eprint. $links is any elements which shouldgo in the <head> of this page. Calls L!/eprint_render! to actually render the $eprint, if it isn't deleted.
( $html ) = $eprint->render_history
Render the history of this eprint as XHTML DOM.
$url = $eprint->get_control_url
Return the URL of the control page for this eprint.
$url = $eprint->get_url
Return the public URL of this eprints abstract page.
$user = $eprint->get_user
Return the EPrints::User to whom this eprint belongs (if any).
$path = EPrints::DataObj::EPrint::eprintid_to_path( $eprintid )
Return this eprints id converted into directories. Thousands of files in one directory cause problems. For example, the eprint with the id 50344 would have the path 00/05/03/44.
@eprints = $eprint->get_all_related
Return the eprints that are related in some way to this in a successionor commentary thread. The returned list does NOT include this EPrint.
$boolean = $eprint->in_thread( $field )
Return true if this eprint is part of a thread of $field. $fieldshould be an EPrint::MetaField representing either "commentary" or"succeeds".
$eprint = $eprint->first_in_thread( $field )
Return the first (earliest) version or first paper in the threadof commentaries of this paper in the repository.
@eprints = $eprint->later_in_thread( $field )
Return a list of the immediately later items in the thread.
@eprints = $eprint->all_in_thread( $field )
Return all of the EPrints in the given thread.
$eprint = $eprint->last_in_thread( $field )
Return the last item in the specified thread.
Extract the eprint from any threads it's in. i.e., if any otherpaper is a later version of or commentary on this paper, the linkfrom that paper to this will be removed. Abstract pages are updated if needed.
$xhtml = $eprint->render_version_thread( $field )
Render XHTML DOM describing the entire thread as nested unordered lists.
$eprint->loop_error( $field, @looped_ids )
This eprint is part of a threading loop which is not allowed. Log awarning.
$type = $eprint->get_type
Return the type of this eprint.
$xhtml_ul_list = $eprint->render_export_links( [$staff] )
Return a <ul> list containing links to all the formats this eprintis available in. If $staff is true then show all formats available to staff, and linkto the staff export URL.
@roles = $eprint->user_roles( $user )
Return the @roles $user has on $eprint.
$boolean = $eprint->in_editorial_scope_of( $possible_editor )
Returns true if $possible_editor can edit this eprint. This isaccording to the user editperms. This does not mean the user has the editor priv., just that if theydo then they may edit the given item.
$boolean = $eprint->has_owner( $possible_owner )
Returns true if $possible_owner can edit this eprint. This isaccording to the user editperms. This does not mean the user has the editor priv., just that if theydo then they may edit the given item. Uses the callback "does_user_own_eprint" if available.
$boolean = $eprint->obtain_lock( $user )
$boolean = $eprint->could_obtain_lock( $user )
$boolean = $eprint->is_locked()
$xhtml = render_edit_lock( $session, $value )
Callbacks may optionally be defined in the ArchiveConfig.
validate_field( $field, $value, $session, [$for_archive] )
validate_eprint( $eprint, $session, [$for_archive] )
set_eprint_defaults( $data, $session )
set_eprint_automatic_fields( $eprint )
eprint_render( $eprint, $session )