use of de.vitero.schema.booking.Booking_Type 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;
}
use of de.vitero.schema.booking.Booking_Type in project OpenOLAT by OpenOLAT.
the class ViteroManager method getBookingInFutures.
public List<ViteroBooking> getBookingInFutures(Identity identity) throws VmsNotAvailableException {
GetUserInfo userInfo = getVmsUserId(identity, false);
int userId = userInfo.getUserId();
if (userId > 0) {
List<Booking_Type> bookings = getBookingInFutureByUserId(userId);
return convert(bookings);
}
return Collections.emptyList();
}
use of de.vitero.schema.booking.Booking_Type 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 de.vitero.schema.booking.Booking_Type in project OpenOLAT by OpenOLAT.
the class ViteroManager method updateBooking.
/**
* There is not update on vms. We can only update some OLAT specific options.
* @param group
* @param ores
* @param vBooking
* @return
* @throws VmsNotAvailableException
*/
public ViteroBooking updateBooking(BusinessGroup group, OLATResourceable ores, String subIdentifier, ViteroBooking vBooking) throws VmsNotAvailableException {
Bookingtype bookingType = getVmsBookingById(vBooking.getBookingId());
if (bookingType == null) {
log.info("Booking doesn't exist: " + vBooking.getBookingId());
return null;
}
Booking_Type booking = bookingType.getBooking();
// set the vms values
update(vBooking, booking);
// update the property
updateProperty(group, ores, subIdentifier, vBooking);
return vBooking;
}
use of de.vitero.schema.booking.Booking_Type in project OpenOLAT by OpenOLAT.
the class ViteroManager method getBookingByDate.
public List<ViteroBooking> getBookingByDate(Date start, Date end) throws VmsNotAvailableException {
try {
Booking bookingWs = getBookingWebService();
GetBookingListByDateRequest dateRequest = new GetBookingListByDateRequest();
dateRequest.setStart(format(start));
dateRequest.setEnd(format(end));
dateRequest.setTimezone(viteroModule.getTimeZoneId());
dateRequest.setCustomerid(viteroModule.getCustomerId());
Bookinglist bookingList = bookingWs.getBookingListByDate(dateRequest);
List<Booking_Type> bookings = bookingList.getBooking();
return convert(bookings);
} catch (SOAPFaultException f) {
ErrorCode code = handleAxisFault(f);
switch(code) {
default:
logAxisError("Cannot get the list of bookings by date.", f);
}
return Collections.emptyList();
} catch (WebServiceException e) {
if (e.getCause() instanceof ConnectException) {
throw new VmsNotAvailableException();
}
return Collections.emptyList();
}
}
Aggregations