use of de.bps.course.nodes.VCCourseNode in project OpenOLAT by OpenOLAT.
the class AdobeConnectCleanupJob method cleanupMeetings.
/**
* @param adobe
*/
protected void cleanupMeetings(AdobeConnectProvider adobe, int daysToKeep) {
boolean success = false;
Date lowerLimit = new Date((new Date()).getTime() - (daysToKeep * 24 * 60 * 60 * 1000));
// search all virtual classrooms with the used prefix
List<String> roomIds = adobe.findClassrooms(AdobeConnectProvider.PREFIX);
for (String roomId : roomIds) {
// format is olat-courseId-nodeId, e.g. olat-82823405537032-82823405537043
// load course and node
String courseId = roomId.split("-")[1];
String nodeId = roomId.split("-")[2];
ICourse course = CourseFactory.loadCourse(Long.parseLong(courseId));
CourseNode vcNode = course.getRunStructure().getNode(nodeId);
if (!(vcNode instanceof VCCourseNode)) {
logger.warn("Tried to cleanup Adobe Connect meeting for a non Adobe Connect course node: " + roomId);
continue;
}
AdobeConnectConfiguration config = (AdobeConnectConfiguration) vcNode.getModuleConfiguration().get(VCCourseNode.CONF_VC_CONFIGURATION);
if (config == null) {
// invalid configuration, do nothing and continue
continue;
}
boolean keep = false;
for (MeetingDate date : config.getMeetingDates()) {
if (keep)
continue;
Date end = date.getEnd();
keep = lowerLimit.before(end);
}
// no planned date in the future, we can delete
// build the correct roomId
String toDelete = courseId + "-" + nodeId;
if (!keep)
success = adobe.removeClassroom(toDelete, config);
if (!success) {
logger.warn("Error when cleaning up Adobe Connect meeting \"" + roomId + "\"");
continue;
}
}
}
use of de.bps.course.nodes.VCCourseNode in project openolat by klemens.
the class AdobeConnectCleanupJob method cleanupMeetings.
/**
* @param adobe
*/
protected void cleanupMeetings(AdobeConnectProvider adobe, int daysToKeep) {
boolean success = false;
Date lowerLimit = new Date((new Date()).getTime() - (daysToKeep * 24 * 60 * 60 * 1000));
// search all virtual classrooms with the used prefix
List<String> roomIds = adobe.findClassrooms(AdobeConnectProvider.PREFIX);
for (String roomId : roomIds) {
// format is olat-courseId-nodeId, e.g. olat-82823405537032-82823405537043
// load course and node
String courseId = roomId.split("-")[1];
String nodeId = roomId.split("-")[2];
ICourse course = CourseFactory.loadCourse(Long.parseLong(courseId));
CourseNode vcNode = course.getRunStructure().getNode(nodeId);
if (!(vcNode instanceof VCCourseNode)) {
logger.warn("Tried to cleanup Adobe Connect meeting for a non Adobe Connect course node: " + roomId);
continue;
}
AdobeConnectConfiguration config = (AdobeConnectConfiguration) vcNode.getModuleConfiguration().get(VCCourseNode.CONF_VC_CONFIGURATION);
if (config == null) {
// invalid configuration, do nothing and continue
continue;
}
boolean keep = false;
for (MeetingDate date : config.getMeetingDates()) {
if (keep)
continue;
Date end = date.getEnd();
keep = lowerLimit.before(end);
}
// no planned date in the future, we can delete
// build the correct roomId
String toDelete = courseId + "-" + nodeId;
if (!keep)
success = adobe.removeClassroom(toDelete, config);
if (!success) {
logger.warn("Error when cleaning up Adobe Connect meeting \"" + roomId + "\"");
continue;
}
}
}
Aggregations