Class BaseContentReviewService
- java.lang.Object
-
- org.sakaiproject.contentreview.service.BaseContentReviewService
-
- All Implemented Interfaces:
ContentReviewService
- Direct Known Subclasses:
ContentReviewFederatedServiceImpl,NoOpContentReviewService
public abstract class BaseContentReviewService extends Object implements 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 AssignmentServiceassignmentServiceprotected ContentReviewQueueServicecrqsprotected EntityManagerentityManagerprotected PreferencesServicepreferencesServiceprotected 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(ContentReviewItem item)protected 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(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(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(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 AssignmentService assignmentService
-
crqs
protected ContentReviewQueueService crqs
-
entityManager
protected EntityManager entityManager
-
preferencesService
protected PreferencesService preferencesService
-
serverConfigurationService
protected ServerConfigurationService serverConfigurationService
-
-
Method Detail
-
getUserEULATimestamp
public Instant getUserEULATimestamp(String userId)
- Specified by:
getUserEULATimestampin interfaceContentReviewService
-
getUserEULAVersion
public String getUserEULAVersion(String userId)
- Specified by:
getUserEULAVersionin interfaceContentReviewService
-
updateUserEULATimestamp
public void updateUserEULATimestamp(String userId)
- Specified by:
updateUserEULATimestampin interfaceContentReviewService
-
createAssignment
public void createAssignment(String contextId, String taskId, Map opts) throws SubmissionException, TransientSubmissionException
- Specified by:
createAssignmentin interfaceContentReviewService- Throws:
SubmissionExceptionTransientSubmissionException
-
queueAllSubmissionsForAssignment
protected void queueAllSubmissionsForAssignment(String taskId)
-
deleteAssignment
public void deleteAssignment(String siteId, String taskId)
- Specified by:
deleteAssignmentin interfaceContentReviewService
-
deleteAllSubmissionsForAssignment
protected void deleteAllSubmissionsForAssignment(String siteId, String taskId)
-
getReviewReport
public String getReviewReport(String contentId, String assignmentRef, String userId) throws QueueException, ReportException
- Specified by:
getReviewReportin interfaceContentReviewService- Throws:
QueueExceptionReportException
-
getReviewReportInstructor
public String getReviewReportInstructor(String contentId, String assignmentRef, String userId) throws QueueException, ReportException
- Specified by:
getReviewReportInstructorin interfaceContentReviewService- Throws:
QueueExceptionReportException
-
getReviewReportStudent
public String getReviewReportStudent(String contentId, String assignmentRef, String userId) throws QueueException, ReportException
- Specified by:
getReviewReportStudentin interfaceContentReviewService- Throws:
QueueExceptionReportException
-
getReviewReportRedirectUrl
public String getReviewReportRedirectUrl(String contentId, String assignmentRef, String userId, String contextId, boolean isInstructor)
- Specified by:
getReviewReportRedirectUrlin interfaceContentReviewService
-
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(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(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(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(ContentReviewItem item)
- Specified by:
getLocalizedLastErrorin interfaceContentReviewService
-
getResourceLoader
protected 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 interfaceContentReviewService
-
-