Search in sources :

Example 26 with Property

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;
}
Also used : MailContextImpl(org.olat.core.util.mail.MailContextImpl) MailContext(org.olat.core.util.mail.MailContext) MailerResult(org.olat.core.util.mail.MailerResult) MailTemplate(org.olat.core.util.mail.MailTemplate) MailBundle(org.olat.core.util.mail.MailBundle) Property(org.olat.properties.Property)

Example 27 with Property

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");
}
Also used : PackageTranslator(org.olat.core.gui.translator.PackageTranslator) Property(org.olat.properties.Property) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager) PersistingCoursePropertyManager(org.olat.course.properties.PersistingCoursePropertyManager)

Example 28 with Property

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);
    }
}
Also used : AssessmentEvaluation(org.olat.course.run.scoring.AssessmentEvaluation) Property(org.olat.properties.Property) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager)

Example 29 with Property

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);
    }
}
Also used : Property(org.olat.properties.Property) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager)

Example 30 with Property

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;
}
Also used : ViteroBooking(org.olat.modules.vitero.model.ViteroBooking) Booking_Type(de.vitero.schema.booking.Booking_Type) ArrayList(java.util.ArrayList) Property(org.olat.properties.Property) Bookingtype(de.vitero.schema.booking.Bookingtype)

Aggregations

Property (org.olat.properties.Property)270 CoursePropertyManager (org.olat.course.properties.CoursePropertyManager)62 PropertyManager (org.olat.properties.PropertyManager)48 Identity (org.olat.core.id.Identity)36 NarrowedPropertyManager (org.olat.properties.NarrowedPropertyManager)36 ArrayList (java.util.ArrayList)24 PersistingCoursePropertyManager (org.olat.course.properties.PersistingCoursePropertyManager)22 BusinessGroup (org.olat.group.BusinessGroup)18 File (java.io.File)16 ICourse (org.olat.course.ICourse)16 Translator (org.olat.core.gui.translator.Translator)14 AssertException (org.olat.core.logging.AssertException)14 CourseNode (org.olat.course.nodes.CourseNode)14 Forum (org.olat.modules.fo.Forum)14 ForumManager (org.olat.modules.fo.manager.ForumManager)14 Test (org.junit.Test)12 SyncerExecutor (org.olat.core.util.coordinate.SyncerExecutor)12 XStream (com.thoughtworks.xstream.XStream)10 HashMap (java.util.HashMap)10 List (java.util.List)10