Search in sources :

Example 31 with Property

use of org.olat.properties.Property in project OpenOLAT by OpenOLAT.

the class ViteroManager method getBookingById.

public ViteroBooking getBookingById(BusinessGroup group, OLATResourceable ores, String subIdentifier, int bookingId) throws VmsNotAvailableException {
    ViteroBooking booking = null;
    List<Property> properties = propertyManager.listProperties(null, group, ores, VMS_CATEGORY, Integer.toString(bookingId));
    if (properties.size() > 0) {
        Property property = properties.get(0);
        String propIdentifier = property.getStringValue();
        if ((propIdentifier == null || subIdentifier == null) || (subIdentifier != null && (propIdentifier == null || subIdentifier.equals(propIdentifier)))) {
            String bookingStr = property.getTextValue();
            booking = deserializeViteroBooking(bookingStr);
            Bookingtype bookingType = getVmsBookingById(booking.getBookingId());
            if (bookingType != null) {
                Booking_Type vmsBooking = bookingType.getBooking();
                booking.setProperty(property);
                update(booking, vmsBooking);
            }
        }
    }
    return booking;
}
Also used : ViteroBooking(org.olat.modules.vitero.model.ViteroBooking) Booking_Type(de.vitero.schema.booking.Booking_Type) Property(org.olat.properties.Property) Bookingtype(de.vitero.schema.booking.Bookingtype)

Example 32 with Property

use of org.olat.properties.Property in project OpenOLAT by OpenOLAT.

the class ViteroManager method slayZombies.

public void slayZombies() {
    List<Property> properties = propertyManager.listProperties(null, null, null, VMS_CATEGORY_ZOMBIE, null);
    for (Property property : properties) {
        try {
            String bookingStr = property.getTextValue();
            ViteroBooking booking = deserializeViteroBooking(bookingStr);
            deleteBooking(booking);
        } catch (VmsNotAvailableException e) {
            // try later
            log.debug("Cannot clean-up vitero room, vms not available");
        } catch (Exception e) {
            log.error("", e);
        }
    }
}
Also used : ViteroBooking(org.olat.modules.vitero.model.ViteroBooking) Property(org.olat.properties.Property) ConnectException(java.net.ConnectException) WebServiceException(javax.xml.ws.WebServiceException) ConnectTimeoutException(org.apache.commons.httpclient.ConnectTimeoutException) ParseException(java.text.ParseException) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException)

Example 33 with Property

use of org.olat.properties.Property in project OpenOLAT by OpenOLAT.

the class ViteroManager method updateProperty.

private final Property updateProperty(BusinessGroup group, OLATResourceable courseResource, String subIdentifier, ViteroBooking booking) {
    Property property = getProperty(group, courseResource, booking);
    if (property == null) {
        property = createProperty(group, courseResource, subIdentifier, booking);
        propertyManager.saveProperty(property);
    } else {
        String serialized = serializeViteroBooking(booking);
        property.setTextValue(serialized);
        propertyManager.updateProperty(property);
    }
    return property;
}
Also used : Property(org.olat.properties.Property)

Example 34 with Property

use of org.olat.properties.Property in project OpenOLAT by OpenOLAT.

the class ViteroManager method markAsZombie.

private final void markAsZombie(BusinessGroup group, OLATResourceable ores, String subIdentifier) {
    List<Property> properties = propertyManager.listProperties(null, group, ores, VMS_CATEGORY, null);
    for (Property property : properties) {
        String propIdentifier = property.getStringValue();
        if ((subIdentifier == null && propIdentifier == null) || (subIdentifier != null && subIdentifier.equals(propIdentifier))) {
            property.setName(VMS_CATEGORY_ZOMBIE);
            propertyManager.updateProperty(property);
        }
    }
}
Also used : Property(org.olat.properties.Property)

Example 35 with Property

use of org.olat.properties.Property in project OpenOLAT by OpenOLAT.

the class OLATUpgrade_10_4_0 method migrateImportedCalendars.

private boolean migrateImportedCalendars(UpgradeManager upgradeManager, UpgradeHistoryData uhd) {
    if (!uhd.getBooleanDataValue(IMPORTED_CALENDARS)) {
        int counter = 0;
        List<Property> properties;
        do {
            properties = getImportCalendarProperties(counter, BATCH_SIZE);
            for (Property property : properties) {
                processImportedCalendars(property);
                if (counter % 20 == 0) {
                    dbInstance.commit();
                }
            }
            dbInstance.commitAndCloseSession();
            counter += properties.size();
        } while (properties.size() == BATCH_SIZE);
        uhd.setBooleanDataValue(IMPORTED_CALENDARS, true);
        upgradeManager.setUpgradesHistory(uhd, VERSION);
    }
    return true;
}
Also used : Property(org.olat.properties.Property)

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