Index: lams_build/lib/lams/lams-monitoring.jar
===================================================================
diff -u -rc49a3de871a3c5a9e7c98d2edd045abc556e93dd -raead34144651a924f76d7bca8645327e6820d226
Binary files differ
Index: lams_build/lib/lams/lams.jar
===================================================================
diff -u -r1ab5b0aabad85e5cee0203bd43e0da1c83f69fb9 -raead34144651a924f76d7bca8645327e6820d226
Binary files differ
Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/Activity.hbm.xml
===================================================================
diff -u -r88e98be30293b57a81d4a8a6e5cdaf5c62e97883 -raead34144651a924f76d7bca8645327e6820d226
--- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/Activity.hbm.xml (.../Activity.hbm.xml) (revision 88e98be30293b57a81d4a8a6e5cdaf5c62e97883)
+++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/Activity.hbm.xml (.../Activity.hbm.xml) (revision aead34144651a924f76d7bca8645327e6820d226)
@@ -253,16 +253,6 @@
true
-
gateStartTimeOffset
is set to null.
- *
- * - * All time value that used for persistent should be UTC time - *
- */ - private Date gateStartDateTime; - - /** - *
- * The absolute end time of the gate activity. If this is set, we are expecting gateEndTimeOffset
is
- * set to null.
- *
- * All time value that used for persistent should be UTC time - *
- */ - private Date gateEndDateTime; - private Boolean gateActivityCompletionBased; /** full constructor */ + @SuppressWarnings("rawtypes") public ScheduleGateActivity(Long activityId, Integer id, String description, String title, Integer xcoord, Integer ycoord, Integer orderId, java.util.Date createDateTime, LearningLibrary learningLibrary, Activity parentActivity, Activity libraryActivity, Integer parentUIID, LearningDesign learningDesign, @@ -108,9 +87,10 @@ transitionFrom, languageFile, stopAfterActivity, inputActivities, gateActivityLevelId, waitingLearners, sysTool, branchActivityEntries); // validate pre-condition. - if (gateStartTimeOffset != null && gateEndTimeOffset != null - && (gateStartTimeOffset.intValue() > gateEndTimeOffset.intValue())) + if ((gateStartTimeOffset != null) && (gateEndTimeOffset != null) + && (gateStartTimeOffset.intValue() > gateEndTimeOffset.intValue())) { throw new IllegalStateException("End time offset must be larger" + " than start time offset"); + } this.gateStartTimeOffset = gateStartTimeOffset; this.gateEndTimeOffset = gateEndTimeOffset; @@ -123,6 +103,7 @@ } /** minimal constructor */ + @SuppressWarnings("rawtypes") public ScheduleGateActivity(Long activityId, java.util.Date createDateTime, org.lamsfoundation.lams.learningdesign.LearningLibrary learningLibrary, org.lamsfoundation.lams.learningdesign.Activity parentActivity, @@ -132,9 +113,10 @@ Set waitingLearners) { super(activityId, createDateTime, learningLibrary, parentActivity, learningDesign, grouping, activityTypeId, transitionTo, transitionFrom, gateActivityLevelId, waitingLearners); - if (gateStartTimeOffset != null && gateEndTimeOffset != null - && (gateStartTimeOffset.intValue() > gateEndTimeOffset.intValue())) + if ((gateStartTimeOffset != null) && (gateEndTimeOffset != null) + && (gateStartTimeOffset.intValue() > gateEndTimeOffset.intValue())) { throw new IllegalStateException("End time offset must be larger" + " than start time offset"); + } this.gateStartTimeOffset = gateStartTimeOffset; this.gateEndTimeOffset = gateEndTimeOffset; @@ -146,6 +128,7 @@ * * @return ScheduleGateActivity Returns a deep-copy of the originalActivity */ + @Override public Activity createCopy(int uiidOffset) { ScheduleGateActivity newScheduleGateActivity = new ScheduleGateActivity(); copyToNewActivity(newScheduleGateActivity, uiidOffset); @@ -154,28 +137,10 @@ newScheduleGateActivity.setGateEndTimeOffset(this.getGateEndTimeOffset()); newScheduleGateActivity.setGateStartTimeOffset(this.getGateStartTimeOffset()); - newScheduleGateActivity.setGateEndDateTime(this.getGateEndDateTime()); - newScheduleGateActivity.setGateStartDateTime(this.getGateStartDateTime()); newScheduleGateActivity.setGateActivityCompletionBased(this.getGateActivityCompletionBased()); return newScheduleGateActivity; } - public Date getGateEndDateTime() { - return gateEndDateTime; - } - - public void setGateEndDateTime(Date gateEndDateTime) { - this.gateEndDateTime = gateEndDateTime; - } - - public Date getGateStartDateTime() { - return gateStartDateTime; - } - - public void setGateStartDateTime(Date gateStartDateTime) { - this.gateStartDateTime = gateStartDateTime; - } - /** * @hibernate.property column="gate_start_date_time" length="20" */ @@ -205,7 +170,7 @@ public void setGateActivityCompletionBased(Boolean gateActivityCompletionBased) { this.gateActivityCompletionBased = gateActivityCompletionBased; } - + /** *
* Returns the gate open time for a particular lesson according to the s ettings done by the author.
@@ -231,17 +196,8 @@
// compute the real opening time based on the lesson start time.
if (isScheduledByStartTimeOffset()) {
openTime.add(Calendar.MINUTE, getGateStartTimeOffset().intValue());
- if (!Boolean.TRUE.equals(gateActivityCompletionBased)) {
- this.setGateStartDateTime(openTime.getTime());
- }
- } else if (isScheduledByStartDateTime()) {
- openTime.setTime(getGateStartDateTime());
}
- /**
- * else throw new ActivityBehaviorException("No way of scheduling has " +
- * "been setup - this usually should be done at authoring " +
- * "interface. Fail to calculate gate open time for lesson.");
- */
+
return openTime.getTime();
}
@@ -267,22 +223,20 @@
// compute the real opening time based on the
if (isScheduledByEndTimeOffset()) {
closeTime.add(Calendar.MINUTE, getGateEndTimeOffset().intValue());
- } else if (isScheduledByEndDateTime())
- closeTime.setTime(getGateEndDateTime());
- /**
- * else throw new ActivityBehaviorException("No way of scheduling has " +
- * "been setup - this usually should be done at authoring " + "interface. Fail to calculate gate close time.");
- */
+ }
+
return closeTime.getTime();
}
+ @Override
public String toString() {
return new ToStringBuilder(this).append("activityId", getActivityId()).toString();
}
/**
* @see org.lamsfoundation.lams.util.Nullable#isNull()
*/
+ @Override
public boolean isNull() {
return false;
}
@@ -292,17 +246,20 @@
*
* @return error message key
*/
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
public Vector validateActivity(MessageService messageService) {
Vector listOfValidationErrors = new Vector();
if (isScheduledByTimeOffset()) {
- if (getGateStartTimeOffset().equals(getGateEndTimeOffset()))
+ if (getGateStartTimeOffset().equals(getGateEndTimeOffset())) {
listOfValidationErrors.add(new ValidationErrorDTO(ValidationErrorDTO.SCHEDULE_GATE_ERROR_CODE,
messageService.getMessage(ValidationErrorDTO.SCHEDULE_GATE_ERROR_TYPE1_KEY), this
.getActivityUIID()));
- else if (getGateStartTimeOffset().compareTo(getGateEndTimeOffset()) > 0)
+ } else if (getGateStartTimeOffset().compareTo(getGateEndTimeOffset()) > 0) {
listOfValidationErrors.add(new ValidationErrorDTO(ValidationErrorDTO.SCHEDULE_GATE_ERROR_CODE,
messageService.getMessage(ValidationErrorDTO.SCHEDULE_GATE_ERROR_TYPE2_KEY), this
.getActivityUIID()));
+ }
}
return listOfValidationErrors;
@@ -314,19 +271,10 @@
* @return is the gate scheduled by time offset
*/
private boolean isScheduledByTimeOffset() {
- return getGateStartTimeOffset() != null && getGateEndTimeOffset() != null;
+ return (getGateStartTimeOffset() != null) && (getGateEndTimeOffset() != null);
}
/**
- * Helper method that determines the way of sheduling gate.
- *
- * @return is the gate scheduled by the exact date time.
- */
- private boolean isScheduledByDateTime() {
- return getGateStartDateTime() != null && getGateEndDateTime() != null;
- }
-
- /**
* Helper method that determines way of scheduling a gate.
*
* @return is the gate scheduled by start time offset
@@ -343,31 +291,4 @@
private boolean isScheduledByEndTimeOffset() {
return getGateEndTimeOffset() != null;
}
-
- /**
- * Helper method that determines way of scheduling a gate.
- *
- * @return is the gate scheduled by start exact date time.
- */
- private boolean isScheduledByStartDateTime() {
- return getGateStartDateTime() != null;
- }
-
- /**
- * Helper method that determines way of scheduling a gate.
- *
- * @return is the gate scheduled by start exact date time.
- */
- private boolean isScheduledByEndDateTime() {
- return getGateEndDateTime() != null;
- }
-
- /**
- * Helper method that determines if a gate is not scheduled.
- *
- * @return is the gate scheduled by any time offset.
- */
- public boolean isScheduled() {
- return isScheduledByTimeOffset() || isScheduledByDateTime();
- }
}
\ No newline at end of file
Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/AuthoringActivityDTO.java
===================================================================
diff -u -r88e98be30293b57a81d4a8a6e5cdaf5c62e97883 -raead34144651a924f76d7bca8645327e6820d226
--- lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/AuthoringActivityDTO.java (.../AuthoringActivityDTO.java) (revision 88e98be30293b57a81d4a8a6e5cdaf5c62e97883)
+++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/AuthoringActivityDTO.java (.../AuthoringActivityDTO.java) (revision aead34144651a924f76d7bca8645327e6820d226)
@@ -461,9 +461,7 @@
}
private void addScheduleGateActivityAttributes(ScheduleGateActivity activity) {
- gateStartDateTime = activity.getGateStartDateTime();
gateStartTimeOffset = activity.getGateStartTimeOffset();
- gateEndDateTime = activity.getGateEndDateTime();
gateEndTimeOffset = activity.getGateEndTimeOffset();
gateActivityCompletionBased = activity.getGateActivityCompletionBased();
}
Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/LibraryActivityDTO.java
===================================================================
diff -u -r88e98be30293b57a81d4a8a6e5cdaf5c62e97883 -raead34144651a924f76d7bca8645327e6820d226
--- lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/LibraryActivityDTO.java (.../LibraryActivityDTO.java) (revision 88e98be30293b57a81d4a8a6e5cdaf5c62e97883)
+++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/LibraryActivityDTO.java (.../LibraryActivityDTO.java) (revision aead34144651a924f76d7bca8645327e6820d226)
@@ -246,9 +246,7 @@
}
private void addScheduleGateActivityAttributes(ScheduleGateActivity activity) {
- gateStartDateTime = activity.getGateStartDateTime();
gateStartTimeOffset = activity.getGateStartTimeOffset();
- gateEndDateTime = activity.getGateEndDateTime();
gateEndTimeOffset = activity.getGateEndTimeOffset();
gateActivityCompletionBased = activity.getGateActivityCompletionBased();
}
Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ExportToolContentService.java
===================================================================
diff -u -rc135649b64e98c9233da20bdcfb7689598116314 -raead34144651a924f76d7bca8645327e6820d226
--- lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ExportToolContentService.java (.../ExportToolContentService.java) (revision c135649b64e98c9233da20bdcfb7689598116314)
+++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/service/ExportToolContentService.java (.../ExportToolContentService.java) (revision aead34144651a924f76d7bca8645327e6820d226)
@@ -2510,10 +2510,9 @@
// always set false
((ScheduleGateActivity) act).setGateOpen(false);
- ((ScheduleGateActivity) act).setGateEndDateTime(actDto.getGateEndDateTime());
- ((ScheduleGateActivity) act).setGateStartDateTime(actDto.getGateStartDateTime());
((ScheduleGateActivity) act).setGateStartTimeOffset(actDto.getGateStartTimeOffset());
((ScheduleGateActivity) act).setGateEndTimeOffset(actDto.getGateEndTimeOffset());
+ ((ScheduleGateActivity) act).setGateActivityCompletionBased(actDto.getGateActivityCompletionBased());
((ScheduleGateActivity) act).setSystemTool(systemToolDAO.getSystemToolByID(SystemTool.SCHEDULE_GATE));
break;
case Activity.PERMISSION_GATE_ACTIVITY_TYPE:
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GateAction.java
===================================================================
diff -u -r88e98be30293b57a81d4a8a6e5cdaf5c62e97883 -raead34144651a924f76d7bca8645327e6820d226
--- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GateAction.java (.../GateAction.java) (revision 88e98be30293b57a81d4a8a6e5cdaf5c62e97883)
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GateAction.java (.../GateAction.java) (revision aead34144651a924f76d7bca8645327e6820d226)
@@ -208,11 +208,14 @@
gateForm.set("remainTime", remainTime);
} else {
gateForm.set("reachDate", null);
- long diff = scheduleGate.getGateStartDateTime().getTime() - new Date().getTime();
+ Calendar startingTime = new GregorianCalendar(TimeZone.getDefault());
+ startingTime.setTime(lesson.getStartDateTime());
+ startingTime.add(Calendar.MINUTE, scheduleGate.getGateStartTimeOffset().intValue());
+ gateForm.set("startingTime", startingTime.getTime());
+ long diff = startingTime.getTimeInMillis() - new Date().getTime();
long remainTime = diff / 1000;
gateForm.set("remainTime", remainTime);
- gateForm.set("startingTime", scheduleGate.getGateStartDateTime());
- gateForm.set("endingTime", scheduleGate.getGateEndDateTime());
+ gateForm.set("endingTime", null);
}
return mapping.findForward(GateAction.VIEW_SCHEDULE_GATE);
} else if (gate.isConditionGate()) {
Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java
===================================================================
diff -u -r15045d0b9b0dbb930f42a9da7757207e7a325341 -raead34144651a924f76d7bca8645327e6820d226
--- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java (.../IMonitoringService.java) (revision 15045d0b9b0dbb930f42a9da7757207e7a325341)
+++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java (.../IMonitoringService.java) (revision aead34144651a924f76d7bca8645327e6820d226)
@@ -525,17 +525,6 @@
public GroupingActivity getGroupingActivityById(Long activityID);
/**
- * Returns the status of the gate in WDDX format.
- *
- * @param activityID
- * The activity_id of the Activity whose gate must be checked
- * @param lessonID
- * The lesson_id of the Lesson
- * @return
- */
- public String checkGateStatus(Long activityID, Long lessonID) throws IOException;
-
- /**
* Returns an acknowledgement that the gate has been released. Returns true if the gate has been released and false
* otherwise. This information is packaged in WDDX format
*
Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java
===================================================================
diff -u -r88e98be30293b57a81d4a8a6e5cdaf5c62e97883 -raead34144651a924f76d7bca8645327e6820d226
--- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java (.../MonitoringService.java) (revision 88e98be30293b57a81d4a8a6e5cdaf5c62e97883)
+++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java (.../MonitoringService.java) (revision aead34144651a924f76d7bca8645327e6820d226)
@@ -2125,30 +2125,6 @@
}
/**
- * (non-Javadoc)
- *
- * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#checkGateStatus(java.lang.Long,
- * java.lang.Long)
- */
- @Override
- public String checkGateStatus(Long activityID, Long lessonID) throws IOException {
- FlashMessage flashMessage;
- GateActivity gate = (GateActivity) activityDAO.getActivityByActivityId(activityID);
- Lesson lesson = lessonDAO.getLesson(lessonID); // used to calculate the
- // total learners.
-
- if ((gate == null) || (lesson == null)) {
- flashMessage = new FlashMessage("checkGateStatus", messageService.getMessage("INVALID.ACTIVITYID.LESSONID",
- new Object[] { activityID, lessonID }), FlashMessage.ERROR);
- } else {
- Hashtable table = new Hashtable();
- table = createGateStatusInfo(activityID, gate);
- flashMessage = new FlashMessage("checkGateStatus", table);
- }
- return flashMessage.serializeMessage();
- }
-
- /**
* (non-javadoc)
*
* @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#releaseGate(java.lang.Long)
@@ -2398,28 +2374,6 @@
return (JobDetail) applicationContext.getBean("closeScheduleGateJob");
}
- private Hashtable createGateStatusInfo(Long activityID, GateActivity gate) {
- Hashtable