use of org.olat.modules.vitero.manager.VmsNotAvailableException in project OpenOLAT by OpenOLAT.
the class ViteroBookingWebService method getRooms.
/**
* returns the list of booking of the resource.
*
* @response.representation.200.qname {http://www.example.com}viteroBookingVO
* @response.representation.200.mediaType application/xml, application/json
* @response.representation.200.doc This is the list of all bookings of a resource
* @response.representation.200.example {@link org.olat.modules.vitero.restapi.Examples#SAMPLE_ViteroBookingVO}
* @return The list of vitero booking
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response getRooms() {
try {
List<ViteroBooking> bookings = viteroManager.getBookings(null, ores, subIdentifier);
ViteroBookingVO[] bookingVos = new ViteroBookingVO[bookings.size()];
int count = 0;
for (ViteroBooking booking : bookings) {
bookingVos[count++] = new ViteroBookingVO(booking);
}
return Response.ok(bookingVos).build();
} catch (VmsNotAvailableException e) {
log.error("", e);
return handleNotAvailableException();
}
}
use of org.olat.modules.vitero.manager.VmsNotAvailableException in project openolat by klemens.
the class ViteroBookingEditController method formOK.
@Override
protected void formOK(UserRequest ureq) {
String name = groupName.getValue();
booking.setGroupName(name);
Date begin = beginChooser.getDate();
booking.setStart(begin);
int beginBuffer = 0;
if (beginBufferEl.isOneSelected()) {
beginBuffer = Integer.parseInt(beginBufferEl.getSelectedKey());
}
booking.setStartBuffer(beginBuffer);
Date end = endChooser.getDate();
booking.setEnd(end);
int endBuffer = 0;
if (endBufferEl.isOneSelected()) {
endBuffer = Integer.parseInt(endBufferEl.getSelectedKey());
}
booking.setEndBuffer(endBuffer);
int roomSize = -1;
if (roomSizeEl.isOneSelected()) {
roomSize = Integer.parseInt(roomSizeEl.getSelectedKey());
}
booking.setRoomSize(roomSize);
boolean auto = autoSignIn.isMultiselect() && autoSignIn.isSelected(0);
booking.setAutoSignIn(auto);
try {
if (booking.getBookingId() >= 0) {
ViteroBooking updatedBooking = viteroManager.updateBooking(group, ores, subIdentifier, booking);
if (updatedBooking != null) {
showInfo("booking.ok");
fireEvent(ureq, Event.DONE_EVENT);
} else {
showError("error.unkown");
}
} else {
ViteroStatus status = viteroManager.createBooking(group, ores, subIdentifier, booking);
if (status.isOk()) {
showInfo("booking.ok");
fireEvent(ureq, Event.DONE_EVENT);
} else {
showError(status.getError().i18nKey());
}
}
} catch (VmsNotAvailableException e) {
showError(VmsNotAvailableException.I18N_KEY);
}
}
use of org.olat.modules.vitero.manager.VmsNotAvailableException in project openolat by klemens.
the class ViteroBookingsController method openVitero.
protected void openVitero(UserRequest ureq, ViteroBooking booking) {
try {
String url = viteroManager.getURLToBooking(ureq.getIdentity(), booking);
RedirectMediaResource redirect = new RedirectMediaResource(url);
ureq.getDispatchResult().setResultingMediaResource(redirect);
} catch (VmsNotAvailableException e) {
showError(VmsNotAvailableException.I18N_KEY);
}
}
use of org.olat.modules.vitero.manager.VmsNotAvailableException in project openolat by klemens.
the class ViteroBookingsController method signInVitero.
protected void signInVitero(UserRequest ureq, ViteroBooking booking) {
try {
ViteroStatus status = viteroManager.addToRoom(booking, ureq.getIdentity(), null);
if (status.isOk()) {
showInfo("signin.ok");
} else {
showError("signin.nok");
}
loadModel();
} catch (VmsNotAvailableException e) {
showError(VmsNotAvailableException.I18N_KEY);
}
}
use of org.olat.modules.vitero.manager.VmsNotAvailableException in project openolat by klemens.
the class ViteroBookingsController method openGroup.
protected void openGroup(UserRequest ureq, ViteroBooking booking) {
try {
String url = viteroManager.getURLToGroup(ureq.getIdentity(), booking);
viteroGroupVC = createVelocityContainer("opengroup");
viteroGroupVC.contextPut("groupUrl", url);
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), translate("close"), viteroGroupVC);
listenTo(cmc);
cmc.activate();
} catch (VmsNotAvailableException e) {
showError(VmsNotAvailableException.I18N_KEY);
}
}
Aggregations