Skip to content

Commit

Permalink
SAK-33548 Assignment TimeZone persistence update and localization (sa…
Browse files Browse the repository at this point in the history
  • Loading branch information
ern authored Nov 6, 2017
1 parent e1da779 commit c151ca1
Show file tree
Hide file tree
Showing 37 changed files with 328 additions and 290 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
package org.sakaiproject.assignment.api;

import java.io.OutputStream;
import java.time.Instant;
import java.util.*;

import org.sakaiproject.assignment.api.model.Assignment;
Expand Down Expand Up @@ -726,4 +727,6 @@ public String getDeepLinkWithPermissions(String context, String assignmentId, bo
* This is used when creating a new gradebook item.
*/
public String getToolTitle();

String getUsersLocalDateTimeString(Instant date);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,35 @@

package org.sakaiproject.assignment.api.model;

import java.util.*;
import javax.persistence.*;
import java.time.Instant;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.MapKeyColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;

/**
* Assignment represents a specific assignment for a specific section or class.
Expand Down Expand Up @@ -93,33 +114,33 @@ public class Assignment {
@Column(name = "SECTION")
private String section;

@Type(type = "org.sakaiproject.springframework.orm.hibernate.type.InstantType")
@Column(name = "CREATED_DATE", nullable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date dateCreated;
private Instant dateCreated;

@Type(type = "org.sakaiproject.springframework.orm.hibernate.type.InstantType")
@Column(name = "MODIFIED_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date dateModified;
private Instant dateModified;

@Type(type = "org.sakaiproject.springframework.orm.hibernate.type.InstantType")
@Column(name = "VISIBLE_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date visibleDate;
private Instant visibleDate;

@Type(type = "org.sakaiproject.springframework.orm.hibernate.type.InstantType")
@Column(name = "OPEN_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date openDate;
private Instant openDate;

@Type(type = "org.sakaiproject.springframework.orm.hibernate.type.InstantType")
@Column(name = "DUE_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date dueDate;
private Instant dueDate;

@Type(type = "org.sakaiproject.springframework.orm.hibernate.type.InstantType")
@Column(name = "CLOSE_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date closeDate;
private Instant closeDate;

@Type(type = "org.sakaiproject.springframework.orm.hibernate.type.InstantType")
@Column(name = "DROP_DEAD_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date dropDeadDate;
private Instant dropDeadDate;

@Column(name = "MODIFIER")
private String modifier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

package org.sakaiproject.assignment.api.model;

import java.time.Instant;
import java.util.*;
import javax.persistence.*;

Expand All @@ -29,6 +30,7 @@
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;

/**
* AssignmentSubmission represents a student submission for an assignment.
Expand Down Expand Up @@ -57,21 +59,21 @@ public class AssignmentSubmission {

//private List submissionLog;

@Type(type = "org.sakaiproject.springframework.orm.hibernate.type.InstantType")
@Column(name = "SUBMITTED_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date dateSubmitted;
private Instant dateSubmitted;

@Type(type = "org.sakaiproject.springframework.orm.hibernate.type.InstantType")
@Column(name = "RETURNED_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date dateReturned;
private Instant dateReturned;

@Type(type = "org.sakaiproject.springframework.orm.hibernate.type.InstantType")
@Column(name = "CREATED_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date dateCreated;
private Instant dateCreated;

@Type(type = "org.sakaiproject.springframework.orm.hibernate.type.InstantType")
@Column(name = "MODIFIED_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date dateModified;
private Instant dateModified;

@ElementCollection
@Column(name = "ATTACHMENT")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.sakaiproject.assignment.impl;

import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -68,15 +69,14 @@ public void schedulePeerReview(String assignmentId) {
try {
assignment = assignmentService.getAssignment(assignmentId);
if (!assignment.getDraft() && assignment.getAllowPeerAssessment()) {
Date assignmentCloseTime = assignment.getCloseDate();
Date openTime = null;
Instant assignmentCloseTime = assignment.getCloseDate();
Instant openTime = null;
if (assignmentCloseTime != null) {
openTime = new Date(assignmentCloseTime.getTime());
openTime = assignmentCloseTime;
}
// Schedule the new notification
if (openTime != null) {
scheduledInvocationManager.createDelayedInvocation(openTime.toInstant(),
"org.sakaiproject.assignment.api.AssignmentPeerAssessmentService", assignmentId);
scheduledInvocationManager.createDelayedInvocation(openTime, "org.sakaiproject.assignment.api.AssignmentPeerAssessmentService", assignmentId);
}
}
} catch (Exception e) {
Expand Down
Loading

0 comments on commit c151ca1

Please sign in to comment.