use of org.olat.modules.vitero.model.ErrorCode in project openolat by klemens.
the class ViteroManager method deleteBooking.
public boolean deleteBooking(ViteroBooking vBooking) throws VmsNotAvailableException {
try {
DeleteBookingRequest deleteRequest = new DeleteBookingRequest();
deleteRequest.setBookingid(vBooking.getBookingId());
DeleteBookingResponse response = getBookingWebService().deleteBooking(deleteRequest);
BigInteger state = response.getDeletestate();
deleteGroup(vBooking);
deleteProperty(vBooking);
return state != null;
} catch (SOAPFaultException f) {
ErrorCode code = handleAxisFault(f);
switch(code) {
case bookingDoesntExist:
case bookingDoesntExistPrime:
{
deleteGroup(vBooking);
deleteProperty(vBooking);
// ok, vms deleted, group deleted...
return true;
}
default:
{
logAxisError("Cannot delete a booking.", f);
}
}
return false;
} catch (WebServiceException e) {
if (e.getCause() instanceof ConnectException) {
throw new VmsNotAvailableException();
}
log.error("Cannot delete a booking.", e);
return false;
}
}
use of org.olat.modules.vitero.model.ErrorCode in project openolat by klemens.
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();
}
}
use of org.olat.modules.vitero.model.ErrorCode in project openolat by klemens.
the class ViteroManager method deleteGroup.
public boolean deleteGroup(ViteroBooking vBooking) throws VmsNotAvailableException {
try {
Groupid groupId = new Groupid();
groupId.setGroupid(vBooking.getGroupId());
getGroupWebService().deleteGroup(groupId);
return true;
} catch (SOAPFaultException f) {
ErrorCode code = handleAxisFault(f);
switch(code) {
case groupDoesntExist:
log.error("Group doesn't exist!", f);
break;
case invalidAttribut:
log.error("Group id <= 0!", f);
default:
logAxisError("Cannot delete group: " + vBooking.getGroupId(), f);
}
return false;
} catch (WebServiceException e) {
if (e.getCause() instanceof ConnectException) {
throw new VmsNotAvailableException();
}
log.error("Cannot delete group: " + vBooking.getGroupId(), e);
return false;
}
}
use of org.olat.modules.vitero.model.ErrorCode in project openolat by klemens.
the class ViteroManager method removeFromRoom.
public ViteroStatus removeFromRoom(ViteroBooking booking, int userId) throws VmsNotAvailableException {
try {
Groupiduserid groupuserId = new Groupiduserid();
groupuserId.setGroupid(booking.getGroupId());
groupuserId.setUserid(userId);
getGroupWebService().removeUserFromGroup(groupuserId);
return new ViteroStatus();
} catch (SOAPFaultException f) {
ErrorCode code = handleAxisFault(f);
switch(code) {
case userDoesntExist:
log.error("The user doesn ́t exist!", f);
break;
case groupDoesntExist:
log.error("The group doesn ́t exist", f);
break;
case invalidAttribut:
log.error("An id <= 0", f);
break;
default:
logAxisError("Cannot remove an user from a group", f);
}
return new ViteroStatus(code);
} catch (WebServiceException e) {
if (e.getCause() instanceof ConnectException) {
throw new VmsNotAvailableException();
}
log.error("Cannot remove an user from a group", e);
return new ViteroStatus(ErrorCode.unkown);
}
}
use of org.olat.modules.vitero.model.ErrorCode in project openolat by klemens.
the class ViteroManager method getLicenceForAvailableRooms.
public List<Integer> getLicenceForAvailableRooms(Date begin, Date end) throws VmsNotAvailableException {
List<Integer> roomSizes = new ArrayList<Integer>();
try {
Grouprequesttype groupRequest = new Grouprequesttype();
groupRequest.setStart(format(begin));
groupRequest.setEnd(format(end));
GetBookableRoomsForGroupResponse response = getLicenceWebService().getBookableRoomsForGroup(groupRequest);
Rooms rooms = response.getRooms();
for (Integer roomSize : rooms.getRoomsize()) {
if (!roomSizes.contains(roomSize)) {
roomSizes.add(roomSize);
}
}
} catch (SOAPFaultException f) {
ErrorCode code = handleAxisFault(f);
switch(code) {
default:
logAxisError("Cannot get licence for available room by dates.", f);
}
} catch (WebServiceException e) {
if (e.getCause() instanceof ConnectException) {
throw new VmsNotAvailableException();
}
log.error("Cannot get licence for available room by dates.", e);
}
return roomSizes;
}
Aggregations