Class BaseContentReviewService
- java.lang.Object
-
- org.sakaiproject.contentreview.service.BaseContentReviewService
-
- All Implemented Interfaces:
org.sakaiproject.contentreview.service.ContentReviewService
- Direct Known Subclasses:
ContentReviewFederatedServiceImpl,NoOpContentReviewService
public abstract class BaseContentReviewService extends Object implements org.sakaiproject.contentreview.service.ContentReviewService
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceBaseContentReviewService.LastErrorUpdaterFunctional interface for updateLastError
-
Field Summary
Fields Modifier and Type Field Description protected org.sakaiproject.assignment.api.AssignmentServiceassignmentServiceprotected org.sakaiproject.contentreview.service.ContentReviewQueueServicecrqsprotected org.sakaiproject.entity.api.EntityManagerentityManagerprotected org.sakaiproject.user.api.PreferencesServicepreferencesServiceprotected org.sakaiproject.component.api.ServerConfigurationServiceserverConfigurationService
-
Constructor Summary
Constructors Constructor Description BaseContentReviewService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallowSubmissionsOnBehalf()voidcreateAssignment(String contextId, String taskId, Map opts)protected ObjectcreateFormattedMessageXML(Document document, String key, Object... args)Creates XML that represents calls to ResourceLoader.getFormattedMessage().protected StringcreateLastError(BaseContentReviewService.LastErrorUpdater leu)Create's an XML model that represents calls to ResourceLoader.getFormattedMessage(...).protected voiddeleteAllSubmissionsForAssignment(String siteId, String taskId)voiddeleteAssignment(String siteId, String taskId)StringgetLocalizedLastError(org.sakaiproject.contentreview.dao.ContentReviewItem item)protected org.sakaiproject.util.ResourceLoadergetResourceLoader()The Resource Loader specific to the content-review service implementationprotected StringgetResourceLoaderName()Gets the name of the resource loader's file.StringgetReviewReport(String contentId, String assignmentRef, String userId)StringgetReviewReportInstructor(String contentId, String assignmentRef, String userId)StringgetReviewReportRedirectUrl(String contentId, String assignmentRef, String userId, String contextId, boolean isInstructor)StringgetReviewReportStudent(String contentId, String assignmentRef, String userId)InstantgetUserEULATimestamp(String userId)StringgetUserEULAVersion(String userId)StringgetWebhookUrl(Optional<String> customParam)protected voidqueueAllSubmissionsForAssignment(String taskId)protected voidsetLastError(org.sakaiproject.contentreview.dao.ContentReviewItem item, Exception e)Convenience method: If the Exception is an instance of ContentReviewProviderException, the item's lastError is set to the exception's I18nXml; otherwise it falls back to getLocalizedMessage()protected voidsetLastError(org.sakaiproject.contentreview.dao.ContentReviewItem item, Exception e, BaseContentReviewService.LastErrorUpdater leu)If the Exception is an instance of ContentReviewProviderException, the item's lastError is set to the exception's I18nXml; otherwise it falls back to leu; if leu is null, it falls back to getLocalizedMessage()protected voidsetLastError(org.sakaiproject.contentreview.dao.ContentReviewItem item, BaseContentReviewService.LastErrorUpdater leu)Sets the ContentReviewItem's lastError property to the result of createLastError(leu).voidupdateUserEULATimestamp(String userId)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.sakaiproject.contentreview.service.ContentReviewService
allowAllContent, allowResubmission, checkForReports, getAcceptableExtensionsToMimeTypes, getAcceptableFileTypesToExtensions, getAllContentReviewItems, getAssignment, getContentReviewItemByContentId, getDateQueued, getDateSubmitted, getEndUserLicenseAgreementLink, getEndUserLicenseAgreementTimestamp, getEndUserLicenseAgreementVersion, getIconCssClassforScore, getLocalizedStatusMessage, getLocalizedStatusMessage, getLocalizedStatusMessage, getProviderId, getReportList, getReportList, getReviewError, getReviewScore, getReviewStatus, getServiceName, isAcceptableContent, isSiteAcceptable, processQueue, queueContent, removeFromQueue, resetUserDetailsLockedItems, syncRosters, webhookEvent
-
-
-
-
Field Detail
-
assignmentService
protected org.sakaiproject.assignment.api.AssignmentService assignmentService
-
crqs
protected org.sakaiproject.contentreview.service.ContentReviewQueueService crqs
-
entityManager
protected org.sakaiproject.entity.api.EntityManager entityManager
-
preferencesService
protected org.sakaiproject.user.api.PreferencesService preferencesService
-
serverConfigurationService
protected org.sakaiproject.component.api.ServerConfigurationService serverConfigurationService
-
-
Method Detail
-
getUserEULATimestamp
public Instant getUserEULATimestamp(String userId)
- Specified by:
getUserEULATimestampin interfaceorg.sakaiproject.contentreview.service.ContentReviewService
-
getUserEULAVersion
public String getUserEULAVersion(String userId)
- Specified by:
getUserEULAVersionin interfaceorg.sakaiproject.contentreview.service.ContentReviewService
-
updateUserEULATimestamp
public void updateUserEULATimestamp(String userId)
- Specified by:
updateUserEULATimestampin interfaceorg.sakaiproject.contentreview.service.ContentReviewService
-
createAssignment
public void createAssignment(String contextId, String taskId, Map opts) throws org.sakaiproject.contentreview.exception.SubmissionException, org.sakaiproject.contentreview.exception.TransientSubmissionException
- Specified by:
createAssignmentin interfaceorg.sakaiproject.contentreview.service.ContentReviewService- Throws:
org.sakaiproject.contentreview.exception.SubmissionExceptionorg.sakaiproject.contentreview.exception.TransientSubmissionException
-
queueAllSubmissionsForAssignment
protected void queueAllSubmissionsForAssignment(String taskId)
-
deleteAssignment
public void deleteAssignment(String siteId, String taskId)
- Specified by:
deleteAssignmentin interfaceorg.sakaiproject.contentreview.service.ContentReviewService
-
deleteAllSubmissionsForAssignment
protected void deleteAllSubmissionsForAssignment(String siteId, String taskId)
-
getReviewReport
public String getReviewReport(String contentId, String assignmentRef, String userId) throws org.sakaiproject.contentreview.exception.QueueException, org.sakaiproject.contentreview.exception.ReportException
- Specified by:
getReviewReportin interfaceorg.sakaiproject.contentreview.service.ContentReviewService- Throws:
org.sakaiproject.contentreview.exception.QueueExceptionorg.sakaiproject.contentreview.exception.ReportException
-
getReviewReportInstructor
public String getReviewReportInstructor(String contentId, String assignmentRef, String userId) throws org.sakaiproject.contentreview.exception.QueueException, org.sakaiproject.contentreview.exception.ReportException
- Specified by:
getReviewReportInstructorin interfaceorg.sakaiproject.contentreview.service.ContentReviewService- Throws:
org.sakaiproject.contentreview.exception.QueueExceptionorg.sakaiproject.contentreview.exception.ReportException
-
getReviewReportStudent
public String getReviewReportStudent(String contentId, String assignmentRef, String userId) throws org.sakaiproject.contentreview.exception.QueueException, org.sakaiproject.contentreview.exception.ReportException
- Specified by:
getReviewReportStudentin interfaceorg.sakaiproject.contentreview.service.ContentReviewService- Throws:
org.sakaiproject.contentreview.exception.QueueExceptionorg.sakaiproject.contentreview.exception.ReportException
-
getReviewReportRedirectUrl
public String getReviewReportRedirectUrl(String contentId, String assignmentRef, String userId, String contextId, boolean isInstructor)
- Specified by:
getReviewReportRedirectUrlin interfaceorg.sakaiproject.contentreview.service.ContentReviewService
-
createFormattedMessageXML
protected Object createFormattedMessageXML(Document document, String key, Object... args)
Creates XML that represents calls to ResourceLoader.getFormattedMessage().- Returns:
- an XML element representing the i18n message key and arguments - unless document is null, in which case the formatted message is returned as a String using the current session locale
-
setLastError
protected void setLastError(org.sakaiproject.contentreview.dao.ContentReviewItem item, BaseContentReviewService.LastErrorUpdater leu)Sets the ContentReviewItem's lastError property to the result of createLastError(leu). Changes are not committed - the caller is responsible to do so. Afterward, the message can be localized to end users via getLocalizedLastError(item).
-
setLastError
protected void setLastError(org.sakaiproject.contentreview.dao.ContentReviewItem item, Exception e)Convenience method: If the Exception is an instance of ContentReviewProviderException, the item's lastError is set to the exception's I18nXml; otherwise it falls back to getLocalizedMessage()
-
setLastError
protected void setLastError(org.sakaiproject.contentreview.dao.ContentReviewItem item, Exception e, BaseContentReviewService.LastErrorUpdater leu)If the Exception is an instance of ContentReviewProviderException, the item's lastError is set to the exception's I18nXml; otherwise it falls back to leu; if leu is null, it falls back to getLocalizedMessage()
-
createLastError
protected String createLastError(BaseContentReviewService.LastErrorUpdater leu)
Create's an XML model that represents calls to ResourceLoader.getFormattedMessage(...). Example - represent an i18n compliant message for "An error has occurred with the service. Error code: 42; cause: A Sakaiger ate the paper" given: service.error=An error has occurred with the service. Error code: {0}; cause: {1} service.sakaiger.ate.paper=A Sakaiger ate the paper You may invoke: createLastError(doc -> createFormattedMessageXML(doc, "service.error", 42, createFormattedMessageXML(doc, "service.sakaiger.ate.paper")));
-
getLocalizedLastError
public String getLocalizedLastError(org.sakaiproject.contentreview.dao.ContentReviewItem item)
- Specified by:
getLocalizedLastErrorin interfaceorg.sakaiproject.contentreview.service.ContentReviewService
-
getResourceLoader
protected org.sakaiproject.util.ResourceLoader getResourceLoader()
The Resource Loader specific to the content-review service implementation
-
getResourceLoaderName
protected String getResourceLoaderName()
Gets the name of the resource loader's file. Default implementation is getServiceName() to lower case, and this should be overriden as necessary
-
allowSubmissionsOnBehalf
public boolean allowSubmissionsOnBehalf()
- Specified by:
allowSubmissionsOnBehalfin interfaceorg.sakaiproject.contentreview.service.ContentReviewService
-
-