API:EPrints/DataObj/EPrint
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 CORE METADATA FIELDS
- 3.1 eprintid (int)
- 3.2 rev_number (int)
- 3.3 eprint_status (set)
- 3.4 source (text)
- 3.5 dir (text)
- 3.6 datestamp (time)
- 3.7 lastmod (time)
- 3.8 status_changed (time)
- 3.9 type (namedset)
- 3.10 metadata_visibility (set)
- 3.11 fileinfo (longtext)
- 3.12 item_issues (compound, multiple)
- 3.13 item_issues_count (int)
- 3.14 edit_lock (compound)
- 3.15 template (namedset)
- 4 REFERENCES AND RELATED OBJECTS
- 5 METHODS
- 5.1 get_system_field_info
- 5.2 set_item_issues
- 5.3 render_issues
- 5.4 order_issues_newest_open_timestamp
- 5.5 fileinfo
- 5.6 render_fileinfo
- 5.7 create
- 5.8 create_from_data
- 5.9 update_triggers
- 5.10 get_dataset_id
- 5.11 get_dataset
- 5.12 get_defaults
- 5.13 store_path
- 5.14 eprintid_to_path
- 5.15 clone
- 5.16 log_mail_owner
- 5.17 get_editorial_contact
- 5.18 empty
- 5.19 remove
- 5.20 commit
- 5.21 save_revision
- 5.22 validate
- 5.23 skip_validation
- 5.24 prune_documents
- 5.25 get_all_documents
- 5.26 move_to_deletion
- 5.27 move_to_inbox
- 5.28 move_to_buffer
- 5.29 move_to_archive
- 5.30 local_path
- 5.31 url_stem
- 5.32 generate_static
- 5.33 remove_static
- 5.34 render
- 5.35 render_preview
- 5.36 render_box_list
- 5.37 get_control_url
- 5.38 get_url
- 5.39 get_user
- 5.40 later_in_thread
- 5.41 in_thread
- 5.42 first_in_thread
- 5.43 last_in_thread
- 5.44 removed_from_thread
- 5.45 added_to_thread
- 5.46 map_thread
- 5.47 render_version_thread
- 5.48 loop_error
- 5.49 get_type
- 5.50 user_roles
- 5.51 datestamp
- 5.52 in_editorial_scope_of
- 5.53 has_owner
- 5.54 obtain_lock
- 5.55 remove_lock
- 5.56 could_obtain_lock
- 5.57 is_locked
- 5.58 render_edit_lock
- 6 CALLBACKS
- 7 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 core metadata fields.
CORE METADATA FIELDS
eprintid (int)
The unique numerical ID of this eprint.
rev_number (int)
The number of the current revision of this record.
eprint_status (set)
The current status of the eprint record. By default this must be one of: inbox, buffer, archive, deleted.
source (text)
Stores an identifier for the source of this record. Rarely used.
dir (text)
The directory, relative to the documents directory for this repository, which this eprints data is stored in. E.g. disk0/00/00/03/34 for record 334. This cannot be cloned or imported.
datestamp (time)
The date this record first appeared live in the repository.
lastmod (time)
The date this record was last modified. This cannot be imported.
status_changed (time)
The date/time this record was moved between statuses (see eprint_status). This cannot be imported.
type (namedset)
The type of this record, one of the types of the "eprint" dataset.
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.
fileinfo (longtext)
Stores a serialisation of the files including paths associated with the record.
item_issues (compound, multiple)
Stores any issues with the metadata for this record, which were reorted by a user of generated by running bin/issues_audit. Contains the following sub-fields:
id (id) - The unique ID of the issue. type (id) - The type of issue. (E.g. duplicate title, similar title, etc.) description (longtext) - A description of the issue that can be rendered to the user. timestamp (time) - The time the issue was detected. status (set) - The status of the issue, i.e. the progress on its resolution. reported_by (itemref) - The user who reported the issue. resolved_by (itemref) - The user who resolved the issue. comment (longtext) - Comments about the issue and/or the progress of its resolution.
item_issues_count (int)
The current number of issues with the record. This field is volatile. =back
edit_lock (compound)
Stores information about any edit lock on the record to prevent other users from editing it. Contains the following sub-fields:
user (itemref) - The user holding the edit lock since (int) - Time in seconds since the start of the last epoch when the edit lock begun. until (int) - Time in seconds since the start of the last epoch when the edit lock will be released if the user does not otherwise release it.
template (namedset)
The name of the template to use for displaying the abstract/summary page.
REFERENCES AND RELATED OBJECTS
documents (subobject, multiple)
A virtual field which represents the list of documents which are part of this record.
files (subobject, multiple)
A virtual field which represents the list of files which are part 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.
importid (itemref)
The ID of the import from which this eprint was imported. (Rarely used).
sword_depositor (itemref)
The ID of the user who deposited this eprint through EPrints SWORD API.
succeeds (itemref)
The ID of the eprint (if any) which this succeeds.
commentary (itemref)
The ID of the eprint (if any) which this eprint is a commentary on.
METHODS
get_system_field_info
$fields = 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 associated 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.
render_issues
$ol_frag = EPrints::DataObj::EPrint->render_issues( $session, $field, $value )
Returns a rendering of the list of issues from $value array reference (as a ol (ordered list) XHTML DOM fragment) for the item_issues field provided by $field.
order_issues_newest_open_timestamp
$timestamps = EPrints::DataObj::EPrint->order_issues_newest_open_timestamp( $field, $value, $session, $langid, $dataset )
Returns a string containing the timestamp for the newest issue that has status reported or discovered.
This method is called through the EPrints::MetaField make_value_orderkey attribute.
$field is the item_issues field. $value is an array reference of the issues. $session is the EPrints::Repository object, $langid is the language ID and $dataset is the eprint dataset
fileinfo
$fileinfo = $eprint->fileinfo
The special fileinfo field contains the icon and main file paths and filenames 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
render_fileinfo
$frag = EPrints::DataObj::EPrint->render_fileinfo( $session, $field, $value, $alllangs, $nolink, $eprint )
Render method for fileinfo field. Returns a XHTML DOM fragment containing the documents stored in the fileinfo field.
This method is called through the EPrints::MetaField render_value attribute.
$session is the EPrints::Repository object. $field is the fileinfo field. $value is the value for this field. $session is the EPrints::Repository object, $alllangs is a boolean to render in all languages if an EPrints::MetaField::Multilang field. $nolink is a boolean on whether to not render links. $eprint is the eprint data object that has the fileinfo field.
create
$eprint = EPrints::DataObj::EPrint->create( $session, $dataset, $data )
Create a new EPrint entry in the given $dataset..
If $data is defined, then this is used as the base for the new record. Otherwise the repository specific defaults provided by
set_eprint_defaults are used.
The fields eprintid and dir will be overridden even if they are set.
create_from_data
$dataobj = EPrints::DataObj::EPrint->create_from_data( $session, $data, $dataset )
Create a new object of this type in the database.
$dataset is the dataset it will belong to.
$data is the data structured as with new_from_data.
This will also create sub-objects also.
update_triggers
$eprint->update_triggers
Update all the stuff that needs updating before an eprint data object is written to the database.
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
Returns the dataset to which this object belongs. This will return one of the virtual datasets, by default: inbox, buffer, archive or deletion.
get_defaults
$defaults = EPrints::DataObj::EPrint->get_defaults( $class, $session, $data, $dataset )
Returns default values for this data object based on the starting $data.
store_path
$path = $eprint->store_path
Get the storage path for this eprint data object.
eprintid_to_path
$path = EPrints::DataObj::eprintid_to_path( $id )
Returns path of the storage directory based on the eprint $id provided.
clone
$eprint = $eprint->clone( $dest_dataset, $copy_documents, $link )
Create a copy of this eprint data object with a new ID in the given $dest_dataset.
Returns 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 by not setting the new eprint's succeeds field.
log_mail_owner
$eprint->log_mail_owner( $mail )
Log that the given $mail message was send to the owner of this eprint data object.
$mail is the same XHTML DOM that was sent as the email.
get_editorial_contact
$user = $eprint->get_editorial_contact
Returns the user identified as the editorial contact for this item.
By default returns undef.
N.B. This does no relate to any editors defined in the metadata for this eprint data object.
empty
$eprint->empty( [ $clear_all ] )
Remove all documents and set to empty (almost) all fields.
If $clear_all also unset rev_number, metadata_visibility, and eprint_status fields.
remove
$success = $eprint->remove
Erase this eprint data object and any associated data objects 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 dodgy data imported from legacy systems.
prune_documents
$eprint->prune_documents
Remove any documents associated with this eprint that do not 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 by eprints in the archive dataset.
move_to_inbox
$success = $eprint->move_to_inbox
Transfer the eprint into the inbox dataset. Should only be called for eprints in the buffer dataset.
move_to_buffer
$success = $eprint->move_to_buffer
Transfer the eprint into the buffer dataset. Should only be called by eprints in the inbox or archive datasets.
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
Returns the full path of the eprint data onject directory on the local filesystem with no trailing slash.
url_stem
$url = $eprint->url_stem
Returns the URL to this eprint's directory.
N.B. This includes the trailing slash, unlike the local_path method.
generate_static
$eprint->generate_static
Generate the static version of the abstract/summary web page. In a multi-language repository this will generate one version per language.
If called on eprints in the inbox or buffer, remove the abstract/summary page.
remove_static
$eprint->remove_static
Remove the static web page or pages.
render
( $description, $title, $links ) = $eprint->render( $preview )
Render the eprint. If $preview is true then render a preview of the eprint data object
The 3 returned values are references to XHTML DOM objects. $description is the public viewable description of this eprintthat 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 elemeny of this HTML page.
Calls eprint_render to actually render the $eprint, if it isn't in the deleted dataset.
render_preview
( $description, $title, $links ) = $eprint->render_preview
Render a preview version of this eprint.
See render for more details
render_box_list
$frag = EPrints::DataObj::EPrint->render_box_list( $session, $eprint, $list )
Returns a rendering of the EPrints::Plugin::Screen::Box plugins from $list against the $eprint specified
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/summary page.
get_user
$user = $eprint->get_user
Return the EPrints::DataObj::User to whom this eprint belongs (if any).
later_in_thread
$list = $eprint->later_in_thread( $field )
Return an EPrints::List of the immediately later items in the thread.
$field is typically the succeeds field that generates the thread of eprints.
in_thread
$boolean = $eprint->in_thread( $field )
Returns true if this eprint is in the $field thread.
$field is typically the succeeds field that generates the thread of eprints.
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.
$field is typically the succeeds field that generates the thread of eprints.
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.
$field is typically the succeeds field that generates the thread of eprints.
removed_from_thread
$eprint->removed_from_thread( $field, [ $parent ] )
Fix the metadata_visibility for the eprint data object after it has been removed from the $field (typically succeeds) based thread.
The change in $parent must be committed before this method is called.
N.B. $parent (i.e. the eprint this eprint succeeds) is not required for this method but included for consistency.
added_to_thread
$eprint->added_to_thread( $field, $parent )
Fix the metadata_visibility for this eprint data object now the has the $parent set in the $field (typically the succeeds field).
Does not update metadata_visibility if $parent is not in archive.
map_thread
$eprint->map_thread( $field, $f )
Apply function $f to every eprint data object in the $field based thread that includes this eprint.
render_version_thread
$xhtml = $eprint->render_version_thread( $field )
Return XHTML DOM rendering describing the entire $field based thread for this eprint data object as nested unordered lists.
loop_error
$eprint->loop_error( $field, @looped_ids )
Log repository error message because this eprint is part of a loop of eprint data objects (with IDs looped_ids) in a $field based thread.
get_type
$type = $eprint->get_type
Return the type of this eprint.
This is an alias of:
$eprint->value( "type" )
user_roles
@roles = $eprint->user_roles( $user )
Return the roles the specified $user has for this eprint.
datestamp
$eprint->datestamp
DEPRECATED
Now just generates a deprecated error message to the log.
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's editperms.
This does not mean the user has the editor privilege, just that if they do then they may edit the eprint.
has_owner
$boolean = $eprint->has_owner( $possible_owner )
Returns true if $possible_owner can edit this eprint. This is according to the user's editperms.
This does not mean the user has the editor privilege, just that if they do then they may edit the given eprint.
Uses the callback does_user_own_eprint if available.
obtain_lock
$boolean = $eprint->obtain_lock( $user )
Assign the edit lock for this eprint data object to the specified $user.
Returns a boolean depending on whether the edit lock was successfully assigned.
remove_lock
$boolean = $eprint->remove_lock( $user )
Remove the edit lock for this eprint data object to the specified $user.
Returns a boolean depending on whether the edit lock was successfully removed.
could_obtain_lock
$boolean = $eprint->could_obtain_lock( $user )
Return a boolean depending on whether the specified $user could obtain ane edit lock on this eprint.
is_locked
$boolean = $eprint->is_locked
Return a boolean depending on whether this eprint currently has an edit lock.
render_edit_lock
$xhtml = render_edit_lock( $session, $field, $value, $alllangs, $nolink, $eprint )
Returns an XHTML DOM fragment providing information about the edit lock for metadata provided by $value.
This is used by the render_value attribute of the edit_lock field, which specified, the $session, $field, $value, $alllangs, $nolink and $eprint parameters. However, only the $session, $field, $value and $eprint parameters are required.
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 )
COPYRIGHT
© Copyright 2000-2024 University of Southampton.
EPrints 3.4 is supplied by EPrints Services.
http://www.eprints.org/eprints-3.4/
LICENSE
This file is part of EPrints 3.4 http://www.eprints.org/.
EPrints 3.4 and this file are released under the terms of the GNU Lesser General Public License version 3 as published by the Free Software Foundation unless otherwise stated.
EPrints 3.4 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with EPrints 3.4. If not, see http://www.gnu.org/licenses/.