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;
}
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);
}
}
}
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;
}
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);
}
}
}
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;
}
Aggregations