Skip to content

Commit

Permalink
more work, it builds now! (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
plukasew authored and bjones86 committed Oct 11, 2017
1 parent db65159 commit e398edd
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;

public class ContentReviewItemDao<T extends ContentReviewItem> extends HibernateCommonDao<ContentReviewItem> {
public class ContentReviewItemDao extends HibernateCommonDao<ContentReviewItem> {

protected static final String PROVIDER_ID_COL = "providerId";
protected static final String CONTENT_ID_COL = "contentId";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1679,7 +1679,7 @@ protected Map getInstructorInfo(String siteId)
return togo;
}

private Set<String> getActiveInstructorIds(String INST_ROLE, Site site)
protected Set<String> getActiveInstructorIds(String INST_ROLE, Site site)
{
log.debug("Getting active instructor IDs for permission " + INST_ROLE + " in site " + site.getId());

Expand Down Expand Up @@ -1800,7 +1800,7 @@ private boolean isValidEmail(String email) {
* @param user a sakai user
* @return the first name or at least an initial if possible, "X" if no fn can be made
*/
private String getUserFirstName(User user) {
protected String getUserFirstName(User user) {
String ufn = user.getFirstName().trim();
if (ufn == null || ufn.equals("")) {
boolean genFN = (boolean) serverConfigurationService.getBoolean("turnitin.generate.first.name", true);
Expand All @@ -1823,7 +1823,7 @@ private String getUserFirstName(User user) {
* @param user
* @return
*/
private String getUserLastName(User user){
protected String getUserLastName(User user){
String uln = user.getLastName().trim();
if (uln == null || uln.equals("")) {
boolean genLN = serverConfigurationService.getBoolean("turnitin.generate.last.name", false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,11 @@ public boolean deleteLTITool(String taskId, String contentId) {
public boolean updateExternalId(String contentId, String externalId)
{
dao.findByProviderAndContentId(getProviderId(), contentId)
.ifPresent(item -> { item.setExternalId(externalId); crqServ.update(item);});
.ifPresent(item ->
{
item.setExternalId(externalId);
crqServ.update(item);
});
// TIITODO: this is supposed to return success/failure depending on if the external id was updated or not
return true;
}
Expand Down Expand Up @@ -658,13 +662,14 @@ public Map getInstructorInfo(String siteId, boolean ignoreUseSource) {
return togo;
}

public String getLegacyReviewReportStudent(String contentId) throws QueueException, ReportException{
// TIITODO: can we remove these?
/*public String getLegacyReviewReportStudent(String contentId) throws QueueException, ReportException{
return getReviewReportStudent(contentId);
}
public String getLegacyReviewReportInstructor(String contentId) throws QueueException, ReportException{
return getReviewReportStudent(contentId);
}
}*/

// TIITODO: this method should probably just be removed at this point
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
*
* @author plukasew
*/
public class ExtendedContentReviewItemDao<T extends ContentReviewItem> extends ContentReviewItemDao<ContentReviewItem>
public class ExtendedContentReviewItemDao extends ContentReviewItemDao
{
public Optional<T> findSingleItemToSubmitMissingExternalId(Integer providerId)
public Optional<ContentReviewItem> findSingleItemToSubmitMissingExternalId(Integer providerId)
{
Calendar calendar = Calendar.getInstance();

Expand All @@ -27,6 +27,6 @@ public Optional<T> findSingleItemToSubmitMissingExternalId(Integer providerId)
.add(Restrictions.lt(NEXT_RETRY_TIME_COL, calendar.getTime()))
.setMaxResults(1);

return Optional.ofNullable((T) c.uniqueResult());
return Optional.ofNullable((ContentReviewItem) c.uniqueResult());
}
}
8 changes: 1 addition & 7 deletions content-review/impl/turnitin/tool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,7 @@
<dependencies>
<dependency>
<groupId>org.sakaiproject.contentreview</groupId>
<artifactId>contentreview-model-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.sakaiproject.contentreview</groupId>
<artifactId>contentreview-service-api</artifactId>
<version>${project.version}</version>
<artifactId>content-review-api</artifactId>
</dependency>
<dependency>
<groupId>org.sakaiproject.contentreview.turnitin</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,10 @@ protected void doPostXml(HttpServletRequest request, HttpServletResponse respons

M_log.debug("cri " + cri.getId() + " - " + cri.getContentId());

// TIITODO: implement below, currently grades will not be saved
boolean itemUpdated = contentReviewService.updateExternalGrade(cri.getContentId(), convertedScoreString);

// TIITODO: implement below once we figure out where updateExternalGrade should live, currently grades will not be saved
//boolean itemUpdated = contentReviewService.updateExternalGrade(cri.getContentId(), convertedScoreString);
boolean itemUpdated = true;

if(!itemUpdated){
M_log.error("Could not update cr item external grade for content " + cri.getContentId());
return;
Expand All @@ -209,7 +210,9 @@ protected void doPostXml(HttpServletRequest request, HttpServletResponse respons
if(a.getTypeOfSubmission() != SubmissionType.SINGLE_ATTACHMENT_SUBMISSION && a.getTypeOfSubmission() != SubmissionType.TEXT_ONLY_ASSIGNMENT_SUBMISSION){
M_log.debug(a.getTypeOfSubmission() + " is the type setting for task " + cri.getTaskId());
} else {
AssignmentSubmission as = assignService.getSubmission(cri.getSubmissionId());
// TIITODO: enable this when we figure out external grades
// check the legacy Grademark support to see if they do it differently
/*AssignmentSubmission as = assignService.getSubmission(cri.getSubmissionId());
if(as != null){
String assignmentGrade = as.getGrade();
if(StringUtils.isEmpty(assignmentGrade)){
Expand All @@ -221,15 +224,15 @@ protected void doPostXml(HttpServletRequest request, HttpServletResponse respons
as.setExternalGradeDifferent(Boolean.TRUE);
}
assignService.updateSubmission(as);
}
}*/
}
}
}
} catch(ParserConfigurationException pce){
M_log.error("Could not parse TII response (ParserConfigurationException): " + pce.getMessage());
} catch(SAXException se){
M_log.error("Could not parse TII response (SAXException): " + se.getMessage());
} catch(IOException | DOMException | IdUnusedException | PermissionException | NumberFormatException | InUseException e){
} catch(IOException | DOMException | IdUnusedException | PermissionException | NumberFormatException e){
M_log.error("Could not update the content review item " + sourcedId, e);
}
finally
Expand Down

0 comments on commit e398edd

Please sign in to comment.