Search in sources :

Example 21 with ViteroBooking

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();
    }
}
Also used : ViteroBooking(org.olat.modules.vitero.model.ViteroBooking) VmsNotAvailableException(org.olat.modules.vitero.manager.VmsNotAvailableException) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 22 with ViteroBooking

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()));
        }
    }
}
Also used : ViteroBooking(org.olat.modules.vitero.model.ViteroBooking)

Example 23 with ViteroBooking

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;
}
Also used : ViteroBooking(org.olat.modules.vitero.model.ViteroBooking)

Example 24 with ViteroBooking

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);
    }
}
Also used : ViteroBooking(org.olat.modules.vitero.model.ViteroBooking) Property(org.olat.properties.Property)

Example 25 with ViteroBooking

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();
    }
}
Also used : ViteroBooking(org.olat.modules.vitero.model.ViteroBooking) TableEvent(org.olat.core.gui.components.table.TableEvent)

Aggregations

ViteroBooking (org.olat.modules.vitero.model.ViteroBooking)44 VmsNotAvailableException (org.olat.modules.vitero.manager.VmsNotAvailableException)16 ViteroStatus (org.olat.modules.vitero.model.ViteroStatus)8 Property (org.olat.properties.Property)8 Booking_Type (de.vitero.schema.booking.Booking_Type)6 Bookingtype (de.vitero.schema.booking.Bookingtype)6 ConnectException (java.net.ConnectException)6 ArrayList (java.util.ArrayList)6 Produces (javax.ws.rs.Produces)6 WebServiceException (javax.xml.ws.WebServiceException)6 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)6 Booking (de.vitero.schema.booking.Booking)4 Date (java.util.Date)4 GET (javax.ws.rs.GET)4 Path (javax.ws.rs.Path)4 SearchIdentityParams (org.olat.basesecurity.SearchIdentityParams)4 TableEvent (org.olat.core.gui.components.table.TableEvent)4 Identity (org.olat.core.id.Identity)4 ErrorCode (org.olat.modules.vitero.model.ErrorCode)4 GroupRole (org.olat.modules.vitero.model.GroupRole)4