use of de.vitero.schema.sessioncode.Codetype in project OpenOLAT by OpenOLAT.
the class ViteroManager method createPersonalBookingSessionCode.
/**
* Create a session code with a one hour expiration date
* @param identity
* @param booking
* @return
*/
protected String createPersonalBookingSessionCode(Identity identity, ViteroBooking booking) throws VmsNotAvailableException {
try {
GetUserInfo userInfo = getVmsUserId(identity, true);
int userId = userInfo.getUserId();
// update user information
if (!userInfo.isCreated()) {
try {
updateVmsUser(identity, userId);
storePortrait(identity, userId);
} catch (Exception e) {
log.error("Cannot update user on vitero system:" + identity.getName(), e);
}
}
CreatePersonalBookingSessionCodeRequest.Sessioncode code = new CreatePersonalBookingSessionCodeRequest.Sessioncode();
code.setBookingid(booking.getBookingId());
code.setUserid(userId);
code.setTimezone(viteroModule.getTimeZoneId());
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.HOUR, 1);
code.setExpirationdate(format(cal.getTime()));
CreatePersonalBookingSessionCodeRequest codeRequest = new CreatePersonalBookingSessionCodeRequest();
codeRequest.setSessioncode(code);
Codetype myCode = getSessionCodeWebService().createPersonalBookingSessionCode(codeRequest);
return myCode.getCode();
} catch (SOAPFaultException f) {
ErrorCode code = handleAxisFault(f);
switch(code) {
case userDoesntExist:
log.error("User does not exist.", f);
break;
case userNotAssignedToGroup:
log.error("User not assigned to group.", f);
break;
case invalidAttribut:
log.error("Invalid attribute.", f);
break;
case invalidTimezone:
log.error("Invalid time zone.", f);
break;
case bookingDoesntExist:
case bookingDoesntExistPrime:
log.error("Booking does not exist.", f);
break;
default:
logAxisError("Cannot create session code.", f);
}
return null;
} catch (WebServiceException e) {
if (e.getCause() instanceof ConnectException) {
throw new VmsNotAvailableException();
}
log.error("Cannot create session code.", e);
return null;
}
}
use of de.vitero.schema.sessioncode.Codetype in project OpenOLAT by OpenOLAT.
the class ViteroManager method createVMSSessionCode.
/**
* Create a session code with a one hour expiration date
* @param identity
* @param booking
* @return
*/
protected String createVMSSessionCode(Identity identity) throws VmsNotAvailableException {
try {
GetUserInfo userInfo = getVmsUserId(identity, true);
int userId = userInfo.getUserId();
// update user information
if (!userInfo.isCreated()) {
try {
updateVmsUser(identity, userId);
storePortrait(identity, userId);
} catch (Exception e) {
log.error("Cannot update user on vitero system:" + identity.getName(), e);
}
}
CreateVmsSessionCodeRequest.Sessioncode code = new CreateVmsSessionCodeRequest.Sessioncode();
code.setUserid(userId);
code.setTimezone(viteroModule.getTimeZoneId());
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.HOUR, 1);
code.setExpirationdate(format(cal.getTime()));
CreateVmsSessionCodeRequest codeRequest = new CreateVmsSessionCodeRequest();
codeRequest.setSessioncode(code);
Codetype myCode = getSessionCodeWebService().createVmsSessionCode(codeRequest);
return myCode.getCode();
} catch (SOAPFaultException f) {
ErrorCode code = handleAxisFault(f);
switch(code) {
case userDoesntExist:
log.error("User does not exist.", f);
break;
case userNotAssignedToGroup:
log.error("User not assigned to group.", f);
break;
case invalidAttribut:
log.error("Invalid attribute.", f);
break;
case invalidTimezone:
log.error("Invalid time zone.", f);
break;
case bookingDoesntExist:
case bookingDoesntExistPrime:
log.error("Booking does not exist.", f);
break;
default:
logAxisError("Cannot create session code.", f);
}
return null;
} catch (WebServiceException e) {
if (e.getCause() instanceof ConnectException) {
throw new VmsNotAvailableException();
}
log.error("Cannot create session code.", e);
return null;
}
}
use of de.vitero.schema.sessioncode.Codetype in project openolat by klemens.
the class ViteroManager method createVMSSessionCode.
/**
* Create a session code with a one hour expiration date
* @param identity
* @param booking
* @return
*/
protected String createVMSSessionCode(Identity identity) throws VmsNotAvailableException {
try {
GetUserInfo userInfo = getVmsUserId(identity, true);
int userId = userInfo.getUserId();
// update user information
if (!userInfo.isCreated()) {
try {
updateVmsUser(identity, userId);
storePortrait(identity, userId);
} catch (Exception e) {
log.error("Cannot update user on vitero system:" + identity.getName(), e);
}
}
CreateVmsSessionCodeRequest.Sessioncode code = new CreateVmsSessionCodeRequest.Sessioncode();
code.setUserid(userId);
code.setTimezone(viteroModule.getTimeZoneId());
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.HOUR, 1);
code.setExpirationdate(format(cal.getTime()));
CreateVmsSessionCodeRequest codeRequest = new CreateVmsSessionCodeRequest();
codeRequest.setSessioncode(code);
Codetype myCode = getSessionCodeWebService().createVmsSessionCode(codeRequest);
return myCode.getCode();
} catch (SOAPFaultException f) {
ErrorCode code = handleAxisFault(f);
switch(code) {
case userDoesntExist:
log.error("User does not exist.", f);
break;
case userNotAssignedToGroup:
log.error("User not assigned to group.", f);
break;
case invalidAttribut:
log.error("Invalid attribute.", f);
break;
case invalidTimezone:
log.error("Invalid time zone.", f);
break;
case bookingDoesntExist:
case bookingDoesntExistPrime:
log.error("Booking does not exist.", f);
break;
default:
logAxisError("Cannot create session code.", f);
}
return null;
} catch (WebServiceException e) {
if (e.getCause() instanceof ConnectException) {
throw new VmsNotAvailableException();
}
log.error("Cannot create session code.", e);
return null;
}
}
use of de.vitero.schema.sessioncode.Codetype in project openolat by klemens.
the class ViteroManager method createPersonalBookingSessionCode.
/**
* Create a session code with a one hour expiration date
* @param identity
* @param booking
* @return
*/
protected String createPersonalBookingSessionCode(Identity identity, ViteroBooking booking) throws VmsNotAvailableException {
try {
GetUserInfo userInfo = getVmsUserId(identity, true);
int userId = userInfo.getUserId();
// update user information
if (!userInfo.isCreated()) {
try {
updateVmsUser(identity, userId);
storePortrait(identity, userId);
} catch (Exception e) {
log.error("Cannot update user on vitero system:" + identity.getName(), e);
}
}
CreatePersonalBookingSessionCodeRequest.Sessioncode code = new CreatePersonalBookingSessionCodeRequest.Sessioncode();
code.setBookingid(booking.getBookingId());
code.setUserid(userId);
code.setTimezone(viteroModule.getTimeZoneId());
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.HOUR, 1);
code.setExpirationdate(format(cal.getTime()));
CreatePersonalBookingSessionCodeRequest codeRequest = new CreatePersonalBookingSessionCodeRequest();
codeRequest.setSessioncode(code);
Codetype myCode = getSessionCodeWebService().createPersonalBookingSessionCode(codeRequest);
return myCode.getCode();
} catch (SOAPFaultException f) {
ErrorCode code = handleAxisFault(f);
switch(code) {
case userDoesntExist:
log.error("User does not exist.", f);
break;
case userNotAssignedToGroup:
log.error("User not assigned to group.", f);
break;
case invalidAttribut:
log.error("Invalid attribute.", f);
break;
case invalidTimezone:
log.error("Invalid time zone.", f);
break;
case bookingDoesntExist:
case bookingDoesntExistPrime:
log.error("Booking does not exist.", f);
break;
default:
logAxisError("Cannot create session code.", f);
}
return null;
} catch (WebServiceException e) {
if (e.getCause() instanceof ConnectException) {
throw new VmsNotAvailableException();
}
log.error("Cannot create session code.", e);
return null;
}
}
Aggregations