use of de.vitero.schema.group.Groupiduserid in project OpenOLAT by OpenOLAT.
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 de.vitero.schema.group.Groupiduserid 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 de.vitero.schema.group.Groupiduserid in project OpenOLAT by OpenOLAT.
the class ViteroManager method addToRoom.
public ViteroStatus addToRoom(ViteroBooking booking, Identity identity, GroupRole role) throws VmsNotAvailableException {
try {
GetUserInfo userInfo = getVmsUserId(identity, true);
int userId = userInfo.getUserId();
if (userId < 0) {
return new ViteroStatus(ErrorCode.userDoesntExist);
}
if (!userInfo.isCreated()) {
// update user information
try {
updateVmsUser(identity, userId);
// storePortrait(identity, userId);
} catch (Exception e) {
log.error("Cannot update user on vitero system:" + identity.getName(), e);
}
}
Group groupWs = getGroupWebService();
Groupiduserid groupuserId = new Groupiduserid();
groupuserId.setGroupid(booking.getGroupId());
groupuserId.setUserid(userId);
groupWs.addUserToGroup(groupuserId);
if (role != null) {
groupWs = getGroupWebService();
ChangeGroupRoleRequest roleRequest = new ChangeGroupRoleRequest();
roleRequest.setGroupid(booking.getGroupId());
roleRequest.setUserid(userId);
roleRequest.setRole(role.getVmsValue());
groupWs.changeGroupRole(roleRequest);
}
return new ViteroStatus();
} catch (SOAPFaultException f) {
ErrorCode code = handleAxisFault(f);
switch(code) {
case userDoesntExist:
log.error("The user doesn ́t exist!", f);
break;
case userNotAttachedToCustomer:
log.error("The user is not attached to the customer (to which this group belongs)", 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 add an user to a group", f);
}
return new ViteroStatus(code);
} catch (WebServiceException e) {
if (e.getCause() instanceof ConnectException) {
throw new VmsNotAvailableException();
}
log.error("Cannot add an user to a group", e);
return new ViteroStatus(ErrorCode.unkown);
}
}
use of de.vitero.schema.group.Groupiduserid in project openolat by klemens.
the class ViteroManager method addToRoom.
public ViteroStatus addToRoom(ViteroBooking booking, Identity identity, GroupRole role) throws VmsNotAvailableException {
try {
GetUserInfo userInfo = getVmsUserId(identity, true);
int userId = userInfo.getUserId();
if (userId < 0) {
return new ViteroStatus(ErrorCode.userDoesntExist);
}
if (!userInfo.isCreated()) {
// update user information
try {
updateVmsUser(identity, userId);
// storePortrait(identity, userId);
} catch (Exception e) {
log.error("Cannot update user on vitero system:" + identity.getName(), e);
}
}
Group groupWs = getGroupWebService();
Groupiduserid groupuserId = new Groupiduserid();
groupuserId.setGroupid(booking.getGroupId());
groupuserId.setUserid(userId);
groupWs.addUserToGroup(groupuserId);
if (role != null) {
groupWs = getGroupWebService();
ChangeGroupRoleRequest roleRequest = new ChangeGroupRoleRequest();
roleRequest.setGroupid(booking.getGroupId());
roleRequest.setUserid(userId);
roleRequest.setRole(role.getVmsValue());
groupWs.changeGroupRole(roleRequest);
}
return new ViteroStatus();
} catch (SOAPFaultException f) {
ErrorCode code = handleAxisFault(f);
switch(code) {
case userDoesntExist:
log.error("The user doesn ́t exist!", f);
break;
case userNotAttachedToCustomer:
log.error("The user is not attached to the customer (to which this group belongs)", 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 add an user to a group", f);
}
return new ViteroStatus(code);
} catch (WebServiceException e) {
if (e.getCause() instanceof ConnectException) {
throw new VmsNotAvailableException();
}
log.error("Cannot add an user to a group", e);
return new ViteroStatus(ErrorCode.unkown);
}
}
Aggregations