diff --git a/edu-services/cm-service/cm-api/api/src/java/org/sakaiproject/coursemanagement/api/CourseManagementAdministration.java b/edu-services/cm-service/cm-api/api/src/java/org/sakaiproject/coursemanagement/api/CourseManagementAdministration.java
index fcfceb2654f7..81c7469a21b8 100644
--- a/edu-services/cm-service/cm-api/api/src/java/org/sakaiproject/coursemanagement/api/CourseManagementAdministration.java
+++ b/edu-services/cm-service/cm-api/api/src/java/org/sakaiproject/coursemanagement/api/CourseManagementAdministration.java
@@ -261,6 +261,20 @@ public EnrollmentSet createEnrollmentSet(String eid, String title, String descri
public Enrollment addOrUpdateEnrollment(String userId, String enrollmentSetEid,
String enrollmentStatus, String credits, String gradingScheme);
+ /**
+ * Adds an Enrollment to an EnrollmentSet. If the user is already enrolled in the
+ * EnrollmentSet, the Enrollment record is updated for the user.
+ *
+ * @param userId
+ * @param enrollmentSetEid
+ * @param enrollmentStatus
+ * @param credits
+ * @param gradingScheme
+ * @param dropDate
+ */
+ public Enrollment addOrUpdateEnrollment(String userId, String enrollmentSetEid,
+ String enrollmentStatus, String credits, String gradingScheme, Date dropDate);
+
/**
* Removes an Enrollment from an EnrollmentSet by setting the Enrollment to
* dropped=true.
diff --git a/edu-services/cm-service/cm-api/api/src/java/org/sakaiproject/coursemanagement/api/Enrollment.java b/edu-services/cm-service/cm-api/api/src/java/org/sakaiproject/coursemanagement/api/Enrollment.java
index 9efdc58a3e37..866d24e82407 100644
--- a/edu-services/cm-service/cm-api/api/src/java/org/sakaiproject/coursemanagement/api/Enrollment.java
+++ b/edu-services/cm-service/cm-api/api/src/java/org/sakaiproject/coursemanagement/api/Enrollment.java
@@ -21,6 +21,8 @@
package org.sakaiproject.coursemanagement.api;
+import java.util.Date;
+
/**
* The official relationship of a student to something that gets a final grade
* (or equivalent).
@@ -46,4 +48,6 @@ public interface Enrollment {
public boolean isDropped();
public void setDropped(boolean dropped);
+ public Date getDropDate();
+ public void setDropDate(Date dropDate);
}
diff --git a/edu-services/cm-service/cm-impl/hibernate-impl/hibernate/src/hibernate/org/sakaiproject/coursemanagement/impl/EnrollmentCmImpl.hbm.xml b/edu-services/cm-service/cm-impl/hibernate-impl/hibernate/src/hibernate/org/sakaiproject/coursemanagement/impl/EnrollmentCmImpl.hbm.xml
index 1dd061236ae5..712f20838164 100644
--- a/edu-services/cm-service/cm-impl/hibernate-impl/hibernate/src/hibernate/org/sakaiproject/coursemanagement/impl/EnrollmentCmImpl.hbm.xml
+++ b/edu-services/cm-service/cm-impl/hibernate-impl/hibernate/src/hibernate/org/sakaiproject/coursemanagement/impl/EnrollmentCmImpl.hbm.xml
@@ -25,6 +25,7 @@
+
diff --git a/edu-services/cm-service/cm-impl/hibernate-impl/hibernate/src/java/org/sakaiproject/coursemanagement/impl/EnrollmentCmImpl.java b/edu-services/cm-service/cm-impl/hibernate-impl/hibernate/src/java/org/sakaiproject/coursemanagement/impl/EnrollmentCmImpl.java
index bd85fb5cf013..7a29f8052b12 100644
--- a/edu-services/cm-service/cm-impl/hibernate-impl/hibernate/src/java/org/sakaiproject/coursemanagement/impl/EnrollmentCmImpl.java
+++ b/edu-services/cm-service/cm-impl/hibernate-impl/hibernate/src/java/org/sakaiproject/coursemanagement/impl/EnrollmentCmImpl.java
@@ -21,6 +21,7 @@
package org.sakaiproject.coursemanagement.impl;
import java.io.Serializable;
+import java.util.Date;
import org.sakaiproject.coursemanagement.api.Enrollment;
import org.sakaiproject.coursemanagement.api.EnrollmentSet;
@@ -36,15 +37,21 @@ public class EnrollmentCmImpl extends AbstractPersistentCourseManagementObjectCm
private String credits;
private String gradingScheme;
private boolean dropped;
+ private Date dropDate;
public EnrollmentCmImpl() {}
public EnrollmentCmImpl(String userId, EnrollmentSet enrollmentSet, String enrollmentStatus, String credits, String gradingScheme) {
+ this(userId, enrollmentSet, enrollmentStatus, credits, gradingScheme, null);
+ }
+
+ public EnrollmentCmImpl(String userId, EnrollmentSet enrollmentSet, String enrollmentStatus, String credits, String gradingScheme, Date dropDate) {
this.userId = userId;
this.enrollmentSet = enrollmentSet;
this.enrollmentStatus = enrollmentStatus;
this.credits = credits;
this.gradingScheme = gradingScheme;
+ this.dropDate = dropDate;
}
public String getUserId() {
@@ -88,4 +95,12 @@ public boolean isDropped() {
public void setDropped(boolean dropped) {
this.dropped = dropped;
}
+
+ public Date getDropDate() {
+ return dropDate;
+ }
+
+ public void setDropDate(Date dropDate) {
+ this.dropDate = dropDate;
+ }
}
diff --git a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseManagementAdministrationHibernateImpl.java b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseManagementAdministrationHibernateImpl.java
index de0ed7d4f335..70a7dd5744e8 100644
--- a/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseManagementAdministrationHibernateImpl.java
+++ b/edu-services/cm-service/cm-impl/hibernate-impl/impl/src/java/org/sakaiproject/coursemanagement/impl/CourseManagementAdministrationHibernateImpl.java
@@ -300,6 +300,10 @@ public void updateEnrollmentSet(EnrollmentSet enrollmentSet) {
}
public Enrollment addOrUpdateEnrollment(String userId, String enrollmentSetEid, String enrollmentStatus, String credits, String gradingScheme) {
+ return addOrUpdateEnrollment(userId, enrollmentSetEid, enrollmentStatus, credits, gradingScheme, null);
+ }
+
+ public Enrollment addOrUpdateEnrollment(String userId, String enrollmentSetEid, String enrollmentStatus, String credits, String gradingScheme, Date dropDate) {
EnrollmentCmImpl enrollment = null;
List enrollments = getHibernateTemplate().findByNamedQueryAndNamedParam("findEnrollment",
@@ -307,7 +311,7 @@ public Enrollment addOrUpdateEnrollment(String userId, String enrollmentSetEid,
new Object[] {enrollmentSetEid, userId});
if(enrollments.isEmpty()) {
EnrollmentSet enrollmentSet = (EnrollmentSet)getObjectByEid(enrollmentSetEid, EnrollmentSetCmImpl.class.getName());
- enrollment = new EnrollmentCmImpl(userId, enrollmentSet, enrollmentStatus, credits, gradingScheme);
+ enrollment = new EnrollmentCmImpl(userId, enrollmentSet, enrollmentStatus, credits, gradingScheme, dropDate);
enrollment.setCreatedBy(authn.getUserEid());
enrollment.setCreatedDate(new Date());
getHibernateTemplate().save(enrollment);
@@ -317,6 +321,7 @@ public Enrollment addOrUpdateEnrollment(String userId, String enrollmentSetEid,
enrollment.setCredits(credits);
enrollment.setGradingScheme(gradingScheme);
enrollment.setDropped(false);
+ enrollment.setDropDate(dropDate);
enrollment.setLastModifiedBy(authn.getUserEid());
enrollment.setLastModifiedDate(new Date());
diff --git a/reference/docs/conversion/sakai_11_mysql_conversion.sql b/reference/docs/conversion/sakai_11_mysql_conversion.sql
index a33932372dce..050624eaf2cc 100644
--- a/reference/docs/conversion/sakai_11_mysql_conversion.sql
+++ b/reference/docs/conversion/sakai_11_mysql_conversion.sql
@@ -301,3 +301,6 @@ INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where RE
INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '!site.roles'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = '.auth'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'mail.read'));
INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '!site.roles'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = '.auth'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'rwiki.read'));
INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '!site.roles'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = '.auth'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'site.visit'));
+
+-- SAK-29432 Add dropDate field to Enrollment
+ALTER TABLE CM_ENROLLMENT_T ADD COLUMN DROP_DATE DATE;
diff --git a/reference/docs/conversion/sakai_11_oracle_conversion.sql b/reference/docs/conversion/sakai_11_oracle_conversion.sql
index 53d096d41f53..c8838cd794c9 100644
--- a/reference/docs/conversion/sakai_11_oracle_conversion.sql
+++ b/reference/docs/conversion/sakai_11_oracle_conversion.sql
@@ -305,3 +305,6 @@ INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where RE
INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '!site.roles'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = '.auth'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'mail.read'));
INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '!site.roles'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = '.auth'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'rwiki.read'));
INSERT INTO SAKAI_REALM_RL_FN VALUES((select REALM_KEY from SAKAI_REALM where REALM_ID = '!site.roles'), (select ROLE_KEY from SAKAI_REALM_ROLE where ROLE_NAME = '.auth'), (select FUNCTION_KEY from SAKAI_REALM_FUNCTION where FUNCTION_NAME = 'site.visit'));
+
+-- SAK-29432 Add dropDate field to Enrollment
+ALTER TABLE CM_ENROLLMENT_T ADD COLUMN DROP_DATE DATE;