Open Journal Systems  3.3.0
SubmissionFileDAO Class Reference
Inheritance diagram for SubmissionFileDAO:
DAO PKPPubIdPluginDAO

Public Member Functions

 assignRevisionToReviewRound ($fileId, $revision, $reviewRound)
 
 baseQueryForFileSelection ()
 
 changePubId ($pubObjectId, $pubIdType, $pubId)
 
 copyFile ($context, $submissionFile, $fileStage)
 
 deleteAllPubIds ($contextId, $pubIdType)
 
 deleteAllRevisionsByAssocId ($assocType, $assocId, $fileStage=null)
 
 deleteAllRevisionsById ($fileId, $fileStage=null, $submissionId=null)
 
 deleteAllRevisionsByReviewRound ($reviewRoundId)
 
 deleteAllRevisionsBySubmissionId ($submissionId, $fileStage=null)
 
 deleteLatestRevisionById ($fileId, $fileStage=null, $submissionId=null)
 
 deletePubId ($pubObjectId, $pubIdType)
 
 deleteReviewRoundAssignment ($submissionId, $stageId, $fileId, $revision)
 
 deleteRevision ($submissionFile)
 
 deleteRevisionById ($fileId, $revision, $fileStage=null, $submissionId=null)
 
 fromRow ($row, $fileImplementation=null)
 
 getAllFileStages ()
 
 getAllRevisions ($fileId, $fileStage=null, $submissionId=null, $rangeInfo=null)
 
 getAllRevisionsByAssocId ($assocType, $assocId, $fileStage=null, $rangeInfo=null)
 
 getByBestId ($fileId, $submissionId)
 
 getByPubId ($pubIdType, $pubId, $submissionId=null, $contextId=null)
 
 getBySubmissionId ($submissionId, $rangeInfo=null)
 
 getDelegateClassNames ()
 
 getFileIdsBySetting ($settingName, $settingValue, $submissionId=null, $contextId=null)
 
 getGenreCategoryMapping ()
 
 getLatestRevision ($fileId, $fileStage=null, $submissionId=null)
 
 getLatestRevisionNumber ($fileId)
 
 getLatestRevisions ($submissionId, $fileStage=null, $rangeInfo=null)
 
 getLatestRevisionsByAssocId ($assocType, $assocId, $submissionId=null, $fileStage=null, $rangeInfo=null)
 
 getLatestRevisionsByReviewRound ($reviewRound, $fileStage=null)
 
 getRevision ($fileId, $revision, $fileStage=null, $submissionId=null)
 
 getRevisionsByReviewRound ($reviewRound, $fileStage=null, $uploaderUserId=null)
 
 getWorkflowStageId ($submissionFile)
 
 insertObject ($submissionFile, $sourceFile, $isUpload=false)
 
 newDataObjectByGenreId ($genreId)
 
 pubIdExists ($pubIdType, $pubId, $excludePubObjectId, $contextId)
 
 setAsLatestRevision ($revisedFileId, $newFileId, $submissionId, $fileStage)
 
 transferOwnership ($oldUserId, $newUserId)
 
 updateObject ($updatedFile, $previousFileId=null, $previousRevision=null)
 
- Public Member Functions inherited from DAO
 __construct ($dataSource=null, $callHooks=true)
 
 concat ()
 
 convertFromDB ($value, $type)
 
 convertToDB ($value, &$type)
 
 dateFromDB ($d)
 
 datetimeFromDB ($dt)
 
 datetimeToDB ($dt)
 
 dateToDB ($d)
 
 flushCache ()
 
 formatDateToDB ($date, $defaultNumWeeks=null, $acceptPastDate=true)
 
 getAdditionalFieldNames ()
 
 getAffectedRows ()
 
 getDataObjectSettings ($tableName, $idFieldName, $idFieldValue, $dataObject)
 
 getDataSource ()
 
 getDirectionMapping ($direction)
 
 getDriver ()
 
 getLocaleFieldNames ()
 
 getType ($value)
 
 handleError ($dataSource, $sql)
 
 nullOrInt ($value)
 
 replace ($table, $arrFields, $keyCols)
 
retrieve ($sql, $params=false, $callHooks=true)
 
retrieveCached ($sql, $params=false, $secsToCache=3600, $callHooks=true)
 
retrieveLimit ($sql, $params=false, $numRows=false, $offset=false, $callHooks=true)
 
retrieveRange ($sql, $params=false, $dbResultRange=null, $callHooks=true)
 
 setCacheDir ()
 
 setDataSource ($dataSource)
 
 update ($sql, $params=false, $callHooks=true, $dieOnError=true)
 
 updateDataObjectSettings ($tableName, $dataObject, $idArray)
 

Data Fields

 $_delegates = array()
 
- Data Fields inherited from DAO
 $_dataSource
 

Additional Inherited Members

- Static Public Member Functions inherited from DAO
static getDataChangedEvent ($elementId=null, $parentElementId=null, $content='')
 
- Protected Member Functions inherited from DAO
 _getInsertId ($table='', $id='')
 

Detailed Description

Abstract base class for retrieving and modifying SubmissionFile objects and their decendents (e.g. SubmissionFile, SubmissionArtworkFile).

See also
SubmissionFile
SubmissionFileDAODelegate

This class provides access to all SubmissionFile implementations. It instantiates and uses delegates internally to provide the right database access behaviour depending on the type of the accessed file.

The state classes are named after the data object plus the "DAODelegate" extension, e.g. SubmissionArtworkFileDAODelegate. An internal factory method will provide the correct implementation to the DAO.

This design allows clients to access all types of files without having to know about the specific file implementation unless the client really wishes to access file implementation specific data. This also enables us to let delegates inherit from each others to avoid code duplication between DAO implementations.

Definition at line 38 of file SubmissionFileDAO.inc.php.

Member Function Documentation

◆ assignRevisionToReviewRound()

SubmissionFileDAO::assignRevisionToReviewRound (   $fileId,
  $revision,
  $reviewRound 
)

Assign file to a review round.

Parameters
$fileIdint The file to be assigned.
$revisionint The revision of the file to be assigned.
$reviewRoundReviewRound

Definition at line 455 of file SubmissionFileDAO.inc.php.

References deleteReviewRoundAssignment(), fatalError(), and DAO\update().

◆ baseQueryForFileSelection()

SubmissionFileDAO::baseQueryForFileSelection ( )

Return the basic join over all file class tables.

Returns
string

Definition at line 648 of file SubmissionFileDAO.inc.php.

◆ changePubId()

SubmissionFileDAO::changePubId (   $pubObjectId,
  $pubIdType,
  $pubId 
)

Change the public ID of a submission.

Parameters
$pubObjectIdint ID of the pub object
$pubIdTypestring One of the NLM pub-id-type values or 'other::something' if not part of the official NLM list (see http://dtd.nlm.nih.gov/publishing/tag-library/n-4zh0.html).
$pubIdstring

Reimplemented from PKPPubIdPluginDAO.

Definition at line 728 of file SubmissionFileDAO.inc.php.

◆ copyFile()

SubmissionFileDAO::copyFile (   $context,
  $submissionFile,
  $fileStage 
)

Make a copy of the file to the specified file stage

Parameters
$contextContext
$submissionFileSubmissionFile
$fileStageint SUBMISSION_FILE_...
Returns
newFileId int

Definition at line 1112 of file SubmissionFileDAO.inc.php.

◆ deleteAllPubIds()

SubmissionFileDAO::deleteAllPubIds (   $contextId,
  $pubIdType 
)

Delete the public IDs of all submissions in this context.

Parameters
$contextIdint
$pubIdTypestring One of the NLM pub-id-type values or 'other::something' if not part of the official NLM list (see http://dtd.nlm.nih.gov/publishing/tag-library/n-4zh0.html).

Reimplemented from PKPPubIdPluginDAO.

Definition at line 744 of file SubmissionFileDAO.inc.php.

◆ deleteAllRevisionsByAssocId()

SubmissionFileDAO::deleteAllRevisionsByAssocId (   $assocType,
  $assocId,
  $fileStage = null 
)

Retrieve all files associated to a certain object.

Parameters
$assocTypeint ASSOC_TYPE_...
$assocIdint ID corresponding to specified assocType.
$fileStageint (optional) further restricts the selection to a given file stage.
Returns
integer the number of deleted file revisions.

Definition at line 545 of file SubmissionFileDAO.inc.php.

◆ deleteAllRevisionsById()

SubmissionFileDAO::deleteAllRevisionsById (   $fileId,
  $fileStage = null,
  $submissionId = null 
)

Delete all revisions of a file, optionally restricted to a given file stage.

Parameters
$fileIdint File ID.
$fileStageint (optional) further restricts the selection to a given file stage.
$submissionIdint (optional) for validation purposes only
Returns
integer the number of deleted file revisions

Definition at line 521 of file SubmissionFileDAO.inc.php.

◆ deleteAllRevisionsByReviewRound()

SubmissionFileDAO::deleteAllRevisionsByReviewRound (   $reviewRoundId)

Remove all file assignements for the given review round.

Parameters
$reviewRoundIdint The review round ID.

Definition at line 553 of file SubmissionFileDAO.inc.php.

References DAO\update().

◆ deleteAllRevisionsBySubmissionId()

SubmissionFileDAO::deleteAllRevisionsBySubmissionId (   $submissionId,
  $fileStage = null 
)

Delete all revisions of all files of a submission, optionally restricted to a given file stage.

Parameters
$submissionIdint Submission ID.
$fileStageint (optional) further restricts the selection to a given file stage.
Returns
integer the number of deleted file revisions

Definition at line 533 of file SubmissionFileDAO.inc.php.

◆ deleteLatestRevisionById()

SubmissionFileDAO::deleteLatestRevisionById (   $fileId,
  $fileStage = null,
  $submissionId = null 
)

Delete the latest revision of a submission file by id.

Parameters
$fileIdint File ID.
$fileStageint (optional) further restricts the selection to a given file stage.
$submissionIdint (optional) for validation purposes only
Returns
integer the number of deleted file revisions

Definition at line 507 of file SubmissionFileDAO.inc.php.

◆ deletePubId()

SubmissionFileDAO::deletePubId (   $pubObjectId,
  $pubIdType 
)

Delete the public ID of a submission.

Parameters
$pubObjectIdint ID of the pub object
$pubIdTypestring One of the NLM pub-id-type values or 'other::something' if not part of the official NLM list (see http://dtd.nlm.nih.gov/publishing/tag-library/n-4zh0.html).

Reimplemented from PKPPubIdPluginDAO.

Definition at line 736 of file SubmissionFileDAO.inc.php.

◆ deleteReviewRoundAssignment()

SubmissionFileDAO::deleteReviewRoundAssignment (   $submissionId,
  $stageId,
  $fileId,
  $revision 
)

Remove a specific file assignment from a review round.

Parameters
$submissionIdint The submission id of the file
$stageIdint The review round type.
$fileIdint The file id.
$revisionint The file revision.

Definition at line 565 of file SubmissionFileDAO.inc.php.

References DAO\update().

Referenced by assignRevisionToReviewRound().

◆ deleteRevision()

SubmissionFileDAO::deleteRevision (   $submissionFile)

Delete a specific revision of a submission file.

Parameters
$submissionFileSubmissionFile
Returns
integer the number of deleted file revisions

Definition at line 480 of file SubmissionFileDAO.inc.php.

References deleteRevisionById().

◆ deleteRevisionById()

SubmissionFileDAO::deleteRevisionById (   $fileId,
  $revision,
  $fileStage = null,
  $submissionId = null 
)

Delete a specific revision of a submission file by id.

Parameters
$fileIdint File ID.
$revisionint File revision number.
$fileStageint (optional) further restricts the selection to a given file stage.
$submissionIdint (optional) for validation purposes only
Returns
integer the number of deleted file revisions

Definition at line 494 of file SubmissionFileDAO.inc.php.

Referenced by deleteRevision().

◆ fromRow()

SubmissionFileDAO::fromRow (   $row,
  $fileImplementation = null 
)

Internal function to return a SubmissionFile object from a row.

Parameters
$rowarray
$fileImplementationstring
Returns
SubmissionFile

Definition at line 675 of file SubmissionFileDAO.inc.php.

◆ getAllFileStages()

SubmissionFileDAO::getAllFileStages ( )

Return all file stages.

Returns
array

Definition at line 696 of file SubmissionFileDAO.inc.php.

◆ getAllRevisions()

SubmissionFileDAO::getAllRevisions (   $fileId,
  $fileStage = null,
  $submissionId = null,
  $rangeInfo = null 
)

Retrieve all revisions of a submission file.

Parameters
$fileIdint File ID.
$fileStageint (optional) further restricts the selection to a given file stage.
$submissionIdint Optional submission ID for validation purposes only
$rangeInfoDBResultRange (optional)
Returns
array|null a list of SubmissionFile instances

Definition at line 196 of file SubmissionFileDAO.inc.php.

◆ getAllRevisionsByAssocId()

SubmissionFileDAO::getAllRevisionsByAssocId (   $assocType,
  $assocId,
  $fileStage = null,
  $rangeInfo = null 
)

Retrieve all files associated to a certain object.

Parameters
$assocTypeint ASSOC_TYPE_...
$assocIdint ID corresponding to specified assocType.
$fileStageint (optional) further restricts the selection to a given file stage.
$rangeInfoDBResultRange (optional)
Returns
array|null a list of SubmissionFile instances

Definition at line 236 of file SubmissionFileDAO.inc.php.

◆ getByBestId()

SubmissionFileDAO::getByBestId (   $fileId,
  $submissionId 
)

Retrieve file by public ID or, failing that, internal file ID and revision; public ID takes precedence.

Parameters
$fileIdstring Either public ID or fileId-revision
$submissionIdint
Returns
SubmissionFile|null

Definition at line 144 of file SubmissionFileDAO.inc.php.

References getByPubId(), and getRevision().

◆ getByPubId()

SubmissionFileDAO::getByPubId (   $pubIdType,
  $pubId,
  $submissionId = null,
  $contextId = null 
)

Retrieve file by public file ID

Parameters
$pubIdTypestring One of the NLM pub-id-type values or 'other::something' if not part of the official NLM list (see http://dtd.nlm.nih.gov/publishing/tag-library/n-4zh0.html).
$pubIdstring
$submissionIdint optional
$contextIdint optional
Returns
SubmissionFile|null

Definition at line 124 of file SubmissionFileDAO.inc.php.

References getFileIdsBySetting(), and getLatestRevision().

Referenced by getByBestId().

◆ getBySubmissionId()

SubmissionFileDAO::getBySubmissionId (   $submissionId,
  $rangeInfo = null 
)

Retrieve all submission files & revisions for a submission.

Parameters
$submissionIdint Submission ID.
$rangeInfoDBResultRange (optional)
Returns
array a list of SubmissionFile instances

Definition at line 207 of file SubmissionFileDAO.inc.php.

◆ getDelegateClassNames()

SubmissionFileDAO::getDelegateClassNames ( )

Return the available delegates mapped by lower case class names.

Returns
array a list of fully qualified class names indexed by the lower case class name of the file implementation they serve. NB: Be careful to order class names such that they can be called in the given order to delete files without offending foreign key constraints, i.e. place the sub-classes before the super-classes.

Definition at line 622 of file SubmissionFileDAO.inc.php.

◆ getFileIdsBySetting()

SubmissionFileDAO::getFileIdsBySetting (   $settingName,
  $settingValue,
  $submissionId = null,
  $contextId = null 
)

Find file IDs by querying file settings.

Parameters
$settingNamestring
$settingValuemixed
$submissionIdint optional
$contextIdint optional
Returns
array The file IDs identified by setting.

Definition at line 75 of file SubmissionFileDAO.inc.php.

References DAO\retrieve().

Referenced by getByPubId().

◆ getGenreCategoryMapping()

SubmissionFileDAO::getGenreCategoryMapping ( )

Return the mapping of genre categories to the lower case class name of file implementation.

Returns
array a list of lower case class names of file implementations.

Definition at line 636 of file SubmissionFileDAO.inc.php.

◆ getLatestRevision()

SubmissionFileDAO::getLatestRevision (   $fileId,
  $fileStage = null,
  $submissionId = null 
)

Retrieve the latest revision of a file.

Parameters
$fileIdint File ID.
$fileStageint (optional) further restricts the selection to a given file stage.
$submissionIdint (optional) for validation purposes only
Returns
SubmissionFile|null

Definition at line 166 of file SubmissionFileDAO.inc.php.

Referenced by getByPubId(), and setAsLatestRevision().

◆ getLatestRevisionNumber()

SubmissionFileDAO::getLatestRevisionNumber (   $fileId)

Retrieve the current revision number for a file.

Parameters
$fileIdint File ID.
Returns
int|null

Definition at line 277 of file SubmissionFileDAO.inc.php.

References DAO\retrieve().

◆ getLatestRevisions()

SubmissionFileDAO::getLatestRevisions (   $submissionId,
  $fileStage = null,
  $rangeInfo = null 
)

Retrieve a list of current revisions.

Parameters
$submissionIdint Submission ID.
$fileStageint (optional) further restricts the selection to a given file stage.
$rangeInfoDBResultRange (optional)
Returns
array|null a list of SubmissionFile instances

Definition at line 181 of file SubmissionFileDAO.inc.php.

◆ getLatestRevisionsByAssocId()

SubmissionFileDAO::getLatestRevisionsByAssocId (   $assocType,
  $assocId,
  $submissionId = null,
  $fileStage = null,
  $rangeInfo = null 
)

Retrieve the latest revision of all files associated to a certain object.

Parameters
$assocTypeint ASSOC_TYPE_...
$assocIdint ID corresponding to specified assocType.
$fileStageint (optional) further restricts the selection to a given file stage.
$rangeInfoDBResultRange (optional)
Returns
array|null a list of SubmissionFile instances

Definition at line 222 of file SubmissionFileDAO.inc.php.

◆ getLatestRevisionsByReviewRound()

SubmissionFileDAO::getLatestRevisionsByReviewRound (   $reviewRound,
  $fileStage = null 
)

Get the latest revisions of all files that are in the specified review round.

Parameters
$reviewRoundReviewRound
$fileStageint SUBMISSION_FILE_... (Optional)
Returns
array A list of SubmissionFiles.

Definition at line 264 of file SubmissionFileDAO.inc.php.

◆ getRevision()

SubmissionFileDAO::getRevision (   $fileId,
  $revision,
  $fileStage = null,
  $submissionId = null 
)

Retrieve a specific revision of a file.

Parameters
$fileIdint File ID.
$revisionint File revision number.
$fileStageint (optional) further restricts the selection to a given file stage.
$submissionIdint|null (optional) for validation purposes only
Returns
SubmissionFile|null

Definition at line 61 of file SubmissionFileDAO.inc.php.

Referenced by getByBestId(), and updateObject().

◆ getRevisionsByReviewRound()

SubmissionFileDAO::getRevisionsByReviewRound (   $reviewRound,
  $fileStage = null,
  $uploaderUserId = null 
)

Get all file revisions assigned to the given review round.

Parameters
$reviewRoundReviewRound
$fileStageint SUBMISSION_FILE_...
$uploaderUserIdint Uploader's user ID
Returns
array|null A list of SubmissionFiles.

Definition at line 248 of file SubmissionFileDAO.inc.php.

◆ getWorkflowStageId()

SubmissionFileDAO::getWorkflowStageId (   $submissionFile)

Get the workflow stage id associated with a submission file

Maps a file stage to a workflow stage. When a file is associated with a review round or query, it will get the stage id from the round or query.

Parameters
$submissionFileSubmissionFile
Returns
null|int One of the WORKFLOW_STAGE_... constants or null if the submission file is not attached to a particular stage

Definition at line 759 of file SubmissionFileDAO.inc.php.

References DAORegistry\getDAO().

◆ insertObject()

SubmissionFileDAO::insertObject (   $submissionFile,
  $sourceFile,
  $isUpload = false 
)

Insert a new SubmissionFile.

Parameters
$submissionFileSubmissionFile
$sourceFilestring The place where the physical file resides right now or the file name in the case of an upload. The file will be copied to its canonical target location.
$isUploadboolean set to true if the file has just been uploaded.
Returns
SubmissionFile

Definition at line 305 of file SubmissionFileDAO.inc.php.

References strtolower_codesafe().

◆ newDataObjectByGenreId()

SubmissionFileDAO::newDataObjectByGenreId (   $genreId)

Construct a new data object corresponding to this DAO.

Parameters
$genreIdinteger The genre is required to identify the right file implementation.
Returns
SubmissionFile

Definition at line 599 of file SubmissionFileDAO.inc.php.

◆ pubIdExists()

SubmissionFileDAO::pubIdExists (   $pubIdType,
  $pubId,
  $excludePubObjectId,
  $contextId 
)

Checks if public identifier exists (other than for the specified submission ID, which is treated as an exception).

Parameters
$pubIdTypestring One of the NLM pub-id-type values or 'other::something' if not part of the official NLM list (see http://dtd.nlm.nih.gov/publishing/tag-library/n-4zh0.html).
$pubIdstring
$excludePubObjectIdint ID of the pub object to be excluded from the search.
$contextIdint
Returns
boolean

Reimplemented from PKPPubIdPluginDAO.

Definition at line 720 of file SubmissionFileDAO.inc.php.

◆ setAsLatestRevision()

SubmissionFileDAO::setAsLatestRevision (   $revisedFileId,
  $newFileId,
  $submissionId,
  $fileStage 
)

Set the latest revision of a file as the latest revision of another file.

Parameters
$revisedFileIdinteger the revised file
$newFileIdinteger the file that will become the latest revision of the revised file.
$submissionIdinteger the submission id the two files must belong to.
$fileStageinteger the file stage the two files must belong to.
Returns
SubmissionFile the new revision or null if something went wrong.

Definition at line 420 of file SubmissionFileDAO.inc.php.

References getLatestRevision(), and updateObject().

◆ transferOwnership()

SubmissionFileDAO::transferOwnership (   $oldUserId,
  $newUserId 
)

Transfer the ownership of the submission files of one user to another.

Parameters
$oldUserIdint User ID of old user (to be deleted)
$newUserIdint User ID of new user (to receive assets belonging to old user)

Definition at line 584 of file SubmissionFileDAO.inc.php.

◆ updateObject()

SubmissionFileDAO::updateObject (   $updatedFile,
  $previousFileId = null,
  $previousRevision = null 
)

Update an existing submission file.

NB: We implement a delete + insert strategy to deal with various casting problems (e.g. file implementation/genre may change, file path may change, etc.).

Parameters
$updatedFileSubmissionFile
$previousFileIdinteger The file id before the file was changed. Must only be given if the file id changed so that the previous file can be identified.
$previousRevisioninteger The revision before the file was changed. Must only be given if the revision changed so that the previous file can be identified.
Returns
SubmissionFile The updated file. This file may be of a different file implementation than the file passed into the method if the genre of the file didn't fit its implementation.

Definition at line 344 of file SubmissionFileDAO.inc.php.

References getRevision(), and strtolower_codesafe().

Referenced by setAsLatestRevision().

Field Documentation

◆ $_delegates

array SubmissionFileDAO::$_delegates = array()

a private list of delegates that provide operations for different SubmissionFile implementations.

Definition at line 46 of file SubmissionFileDAO.inc.php.


The documentation for this class was generated from the following file: