use of org.olat.properties.Property in project OpenOLAT by OpenOLAT.
the class EnrollmentManager method addUserToWaitingList.
private boolean addUserToWaitingList(Identity identity, BusinessGroup group, ENCourseNode enNode, CoursePropertyManager coursePropertyManager, WindowControl wControl, Translator trans) {
// <- moved to bgs 1. Add user to group, fire events, do loggin etc.
// 2. Set first waiting-list date
String nowString = Long.toString(System.currentTimeMillis());
Property firstTime = coursePropertyManager.findCourseNodeProperty(enNode, identity, null, ENCourseNode.PROPERTY_INITIAL_WAITINGLIST_DATE);
if (firstTime == null) {
// create firsttime
firstTime = coursePropertyManager.createCourseNodePropertyInstance(enNode, identity, null, ENCourseNode.PROPERTY_INITIAL_WAITINGLIST_DATE, null, null, nowString, null);
coursePropertyManager.saveProperty(firstTime);
}
// 3. Set waiting-list date property
Property thisTime = coursePropertyManager.findCourseNodeProperty(enNode, identity, null, ENCourseNode.PROPERTY_RECENT_WAITINGLIST_DATE);
if (thisTime == null) {
// create firsttime
thisTime = coursePropertyManager.createCourseNodePropertyInstance(enNode, identity, null, ENCourseNode.PROPERTY_RECENT_WAITINGLIST_DATE, null, null, nowString, null);
coursePropertyManager.saveProperty(thisTime);
} else {
thisTime.setStringValue(nowString);
coursePropertyManager.updateProperty(thisTime);
}
// 4. Send notification mail
MailTemplate mailTemplate = BGMailHelper.createAddWaitinglistMailTemplate(group, identity);
// fxdiff VCRP-16: intern mail system
MailContext context = new MailContextImpl(wControl.getBusinessControl().getAsString());
MailerResult result = new MailerResult();
MailBundle bundle = mailManager.makeMailBundle(context, identity, mailTemplate, null, null, result);
if (bundle != null) {
mailManager.sendMessage(bundle);
}
MailHelper.printErrorsAndWarnings(result, wControl, false, trans.getLocale());
return true;
}
use of org.olat.properties.Property in project OpenOLAT by OpenOLAT.
the class ForumNodeForumCallback method informOnDelete.
/**
* @see org.olat.course.nodes.CourseNode#informOnDelete(org.olat.core.gui.UserRequest,
* org.olat.course.ICourse)
*/
@Override
public String informOnDelete(Locale locale, ICourse course) {
CoursePropertyManager cpm = PersistingCoursePropertyManager.getInstance(course);
Property forumKeyProperty = cpm.findCourseNodeProperty(this, null, null, FORUM_KEY);
// no forum created yet
if (forumKeyProperty == null)
return null;
return new PackageTranslator(PACKAGE_FO, locale).translate("warn.forumdelete");
}
use of org.olat.properties.Property in project OpenOLAT by OpenOLAT.
the class TaskController method setAssignedTask.
private void setAssignedTask(Identity identity, String task) {
CoursePropertyManager cpm = courseEnv.getCoursePropertyManager();
Property p = cpm.createCourseNodePropertyInstance(node, identity, null, PROP_ASSIGNED, null, null, task, null);
cpm.saveProperty(p);
AssessmentEvaluation eval = node.getUserScoreEvaluation(userCourseEnv);
if (eval.getAssessmentStatus() == null || eval.getAssessmentStatus() == AssessmentEntryStatus.notStarted) {
eval = new AssessmentEvaluation(eval, AssessmentEntryStatus.inProgress);
node.updateUserScoreEvaluation(eval, userCourseEnv, getIdentity(), false, Role.user);
}
}
use of org.olat.properties.Property in project OpenOLAT by OpenOLAT.
the class TaskController method removeAssignedTask.
/**
* Cancel the task assignment.
* @param identity
* @param task
*/
private void removeAssignedTask(Identity identity) {
CoursePropertyManager cpm = courseEnv.getCoursePropertyManager();
// remove assigned
List<Property> properties = cpm.findCourseNodeProperties(node, identity, null, PROP_ASSIGNED);
if (properties != null && properties.size() > 0) {
Property propety = properties.get(0);
cpm.deleteProperty(propety);
assignedTask = null;
}
// removed sampled
properties = courseEnv.getCoursePropertyManager().findCourseNodeProperties(node, null, null, PROP_SAMPLED);
if (properties != null && properties.size() > 0) {
Property propety = properties.get(0);
cpm.deleteProperty(propety);
}
}
use of org.olat.properties.Property in project OpenOLAT by OpenOLAT.
the class ViteroManager method getBookings.
/**
* Return the
* @param group The group (optional)
* @param ores The OLAT resourceable (of the course) (optional)
* @return
*/
public List<ViteroBooking> getBookings(BusinessGroup group, OLATResourceable ores, String subIdentifier) throws VmsNotAvailableException {
List<Property> properties = propertyManager.listProperties(null, group, ores, VMS_CATEGORY, null);
List<ViteroBooking> bookings = new ArrayList<ViteroBooking>();
for (Property property : properties) {
String propIdentifier = property.getStringValue();
if ((propIdentifier == null || subIdentifier == null) || (subIdentifier != null && (propIdentifier == null || subIdentifier.equals(propIdentifier)))) {
String bookingStr = property.getTextValue();
ViteroBooking booking = deserializeViteroBooking(bookingStr);
Bookingtype bookingType = getVmsBookingById(booking.getBookingId());
if (bookingType != null) {
Booking_Type vmsBooking = bookingType.getBooking();
booking.setProperty(property);
update(booking, vmsBooking);
bookings.add(booking);
}
}
}
return bookings;
}
Aggregations