use of org.olat.modules.vitero.model.ViteroBooking in project openolat by klemens.
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.model.ViteroBooking in project openolat by klemens.
the class StartColumnDescriptor method renderValue.
@Override
public void renderValue(StringOutput sb, int row, Renderer renderer) {
int sortedRow = table.getSortedRow(row);
ViteroBooking booking = (ViteroBooking) getTable().getTableDataModel().getObject(sortedRow);
if (viteroManager.canGoBooking(booking)) {
if (booking.isAutoSignIn()) {
Object state = getTable().getTableDataModel().getValueAt(sortedRow, ViteroBookingDataModel.Column.sign.ordinal());
if (Sign.signout.equals(state)) {
sb.append(translator.translate(getHeaderKey()));
}
} else {
sb.append(translator.translate(getHeaderKey()));
}
}
}
use of org.olat.modules.vitero.model.ViteroBooking in project openolat by klemens.
the class StartColumnDescriptor method getAction.
@Override
public String getAction(int row) {
int sortedRow = table.getSortedRow(row);
ViteroBooking booking = (ViteroBooking) getTable().getTableDataModel().getObject(sortedRow);
if (viteroManager.canGoBooking(booking)) {
if (booking.isAutoSignIn()) {
Object state = getTable().getTableDataModel().getValueAt(sortedRow, ViteroBookingDataModel.Column.sign.ordinal());
if (Sign.signout.equals(state)) {
return super.getAction(row);
}
} else {
return super.getAction(row);
}
}
return null;
}
use of org.olat.modules.vitero.model.ViteroBooking in project OpenOLAT by OpenOLAT.
the class ViteroManager method deleteAll.
public void deleteAll(BusinessGroup group, OLATResourceable ores, String subIdentifier) {
try {
List<Property> properties = propertyManager.listProperties(null, group, ores, VMS_CATEGORY, null);
for (Property property : properties) {
String bookingStr = property.getTextValue();
ViteroBooking booking = deserializeViteroBooking(bookingStr);
deleteBooking(booking);
}
} catch (VmsNotAvailableException e) {
log.error("", e);
markAsZombie(group, ores, subIdentifier);
}
}
use of org.olat.modules.vitero.model.ViteroBooking in project OpenOLAT by OpenOLAT.
the class ViteroBookingsAdminController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == tableCtr) {
if (event instanceof TableEvent) {
TableEvent e = (TableEvent) event;
int row = e.getRowId();
ViteroBooking booking = (ViteroBooking) tableCtr.getTableDataModel().getObject(row);
if ("delete".equals(e.getActionId())) {
confirmDeleteVitero(ureq, booking);
} else if ("infos".equals(e.getActionId())) {
openInfoBox(ureq, booking);
} else if ("resource".equals(e.getActionId())) {
openResource(ureq, booking);
}
}
} else if (source == dialogCtr) {
if (DialogBoxUIFactory.isOkEvent(event)) {
ViteroBooking booking = (ViteroBooking) dialogCtr.getUserObject();
deleteBooking(booking);
}
} else if (source == cmc) {
removeAsListenerAndDispose(infoController);
removeAsListenerAndDispose(cmc);
} else if (source == infoController) {
cmc.deactivate();
removeAsListenerAndDispose(infoController);
removeAsListenerAndDispose(cmc);
reloadModel();
}
}
Aggregations