use of org.olat.modules.vitero.model.ErrorCode in project OpenOLAT by OpenOLAT.
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;
}
use of org.olat.modules.vitero.model.ErrorCode in project OpenOLAT by OpenOLAT.
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 OpenOLAT.
the class ViteroManager method checkConnection.
public boolean checkConnection(final String url, final String login, final String password, final int customerId) throws VmsNotAvailableException {
try {
LicenceService ss = new LicenceService();
ss.setHandlerResolver(new HandlerResolver() {
@SuppressWarnings("rawtypes")
@Override
public List<Handler> getHandlerChain(PortInfo portInfo) {
List<Handler> handlerList = new ArrayList<Handler>();
handlerList.add(new ViteroSecurityHandler(login, password));
return handlerList;
}
});
Licence port = ss.getLicenceSoap11();
String endPoint = UriBuilder.fromUri(url).path("services").path("LicenseService").build().toString();
((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endPoint);
GetModulesForCustomerRequest request = new GetModulesForCustomerRequest();
request.setCustomerid(customerId);
Modulestype modulesType = port.getModulesForCustomer(request);
return modulesType != null;
} catch (SOAPFaultException f) {
ErrorCode code = handleAxisFault(f);
switch(code) {
case unsufficientRights:
log.error("Unsufficient rights", f);
break;
default:
logAxisError("Cannot check connection", f);
}
return false;
} catch (WebServiceException e) {
if (e.getCause() instanceof ConnectException) {
throw new VmsNotAvailableException();
}
log.warn("Error checking connection", e);
return false;
}
}
use of org.olat.modules.vitero.model.ErrorCode in project OpenOLAT by OpenOLAT.
the class ViteroManager method deleteVmsUser.
protected void deleteVmsUser(int userId) throws VmsNotAvailableException {
try {
Userid userIdType = new Userid();
userIdType.setUserid(userId);
getUserWebService().deleteUser(userIdType);
} catch (SOAPFaultException f) {
ErrorCode code = handleAxisFault(f);
switch(code) {
default:
logAxisError("Cannot delete vms user: " + userId, f);
}
} catch (WebServiceException e) {
if (e.getCause() instanceof ConnectException) {
throw new VmsNotAvailableException();
}
log.error("Cannot delete vms user: " + userId, e);
}
}
use of org.olat.modules.vitero.model.ErrorCode in project OpenOLAT by OpenOLAT.
the class ViteroManager method createGroup.
public int createGroup(String groupName) throws VmsNotAvailableException {
try {
CreateGroupRequest createRequest = new CreateGroupRequest();
Groupnamecustomerid groupInfos = new Groupnamecustomerid();
groupInfos.setGroupname(groupName + "_OLAT_" + UUID.randomUUID().toString().replace("-", ""));
groupInfos.setCustomerid(viteroModule.getCustomerId());
createRequest.setGroup(groupInfos);
Groupid groupId = getGroupWebService().createGroup(createRequest);
return groupId.getGroupid();
} catch (SOAPFaultException f) {
ErrorCode code = handleAxisFault(f);
switch(code) {
default:
logAxisError("Cannot create a group", f);
}
return -1;
} catch (WebServiceException e) {
if (e.getCause() instanceof ConnectException) {
throw new VmsNotAvailableException();
}
log.error("Cannot create a group.", e);
return -1;
}
}
Aggregations